From 86c8dc781b3a5aef3126931ee43d1f190a0143a5 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 19 Apr 2010 18:27:03 +0200 Subject: CWS gnumake2: remove duplicate header in solver: vcl/imagebtn.hxx is just a copy of vcl/button.hxx --- vcl/prj/d.lst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 8345b155ce58..5d6a25d6323a 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -22,7 +22,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\bmpacc.hxx %_DEST%\inc%_EXT%\vcl\bmpacc.hxx ..\inc\vcl\btndlg.hxx %_DEST%\inc%_EXT%\vcl\btndlg.hxx ..\inc\vcl\button.hxx %_DEST%\inc%_EXT%\vcl\button.hxx -..\inc\vcl\button.hxx %_DEST%\inc%_EXT%\vcl\imagebtn.hxx ..\inc\vcl\cmdevt.h %_DEST%\inc%_EXT%\vcl\cmdevt.h ..\inc\vcl\cmdevt.hxx %_DEST%\inc%_EXT%\vcl\cmdevt.hxx ..\inc\vcl\combobox.h %_DEST%\inc%_EXT%\vcl\combobox.h @@ -153,4 +152,4 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\ppdparser.hxx %_DEST%\inc%_EXT%\vcl\ppdparser.hxx ..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx ..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx -..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx \ No newline at end of file +..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx -- cgit From 841c2c37e5186b2de0b075a03528f11d8b06c6a7 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 23 Aug 2010 19:20:31 +0200 Subject: mib19: #163018# allow to intercept the messages to the system child windows --- vcl/inc/vcl/salframe.hxx | 1 - vcl/inc/vcl/salobj.hxx | 2 ++ vcl/inc/vcl/window.h | 3 ++- vcl/inc/vcl/window.hxx | 3 +++ vcl/source/window/window.cxx | 7 ++++++ vcl/win/inc/saldata.hxx | 1 + vcl/win/inc/salobj.h | 2 ++ vcl/win/source/app/salinst.cxx | 15 ++++++++---- vcl/win/source/gdi/salprn.cxx | 15 ++++++++---- vcl/win/source/window/salobj.cxx | 50 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 89 insertions(+), 10 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 08548d7dda40..d82a2099f315 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -270,7 +270,6 @@ public: // 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 ) diff --git a/vcl/inc/vcl/salobj.hxx b/vcl/inc/vcl/salobj.hxx index e453bf5c6f87..adf0e0a3d45d 100644 --- a/vcl/inc/vcl/salobj.hxx +++ b/vcl/inc/vcl/salobj.hxx @@ -73,6 +73,8 @@ public: virtual const SystemEnvData* GetSystemData() const = 0; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ) = 0; + void SetCallback( void* pInst, SALOBJECTPROC pProc ) { m_pInst = pInst; m_pCallback = pProc; } long CallCallback( USHORT nEvent, const void* pEvent ) diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index 691c3ed18421..c12dcd618d92 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -355,7 +355,8 @@ public: mbDisableAccessibleLabelForRelation:1, mbDisableAccessibleLabeledByRelation:1, mbHelpTextDynamic:1, - mbFakeFocusSet:1; + mbFakeFocusSet:1, + mbInterceptChildWindowKeyDown:1; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; }; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 8264767e59ad..a7628da0b408 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1101,6 +1101,9 @@ public: */ void doLazyDelete(); + // let the window intercept the KeyDown messages of the system children + void InterceptChildWindowKeyDown( sal_Bool bIntercept ); + virtual XubString GetSurroundingText() const; virtual Selection GetSurroundingTextSelection() const; }; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index adedbde4c0f2..370669d6969b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4791,6 +4791,13 @@ void Window::doLazyDelete() vcl::LazyDeletor::Delete( this ); } +// ----------------------------------------------------------------------- +void Window::InterceptChildWindowKeyDown( sal_Bool bIntercept ) +{ + if( mpWindowImpl->mpSysObj ) + mpWindowImpl->mpSysObj->InterceptChildWindowKeyDown( bIntercept ); +} + // ----------------------------------------------------------------------- void Window::MouseMove( const MouseEvent& rMEvt ) diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx index ec67272ed07f..f95f1e0ca96b 100644 --- a/vcl/win/inc/saldata.hxx +++ b/vcl/win/inc/saldata.hxx @@ -213,6 +213,7 @@ void ImplSalYieldMutexAcquire(); void ImplSalYieldMutexRelease(); ULONG ImplSalReleaseYieldMutex(); void ImplSalAcquireYieldMutex( ULONG nCount ); +sal_Bool ImplInterceptChildWindowKeyDown( MSG& rMsg ); // \\WIN\SOURCE\WINDOW\SALFRAME.CXX LRESULT CALLBACK SalFrameWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ); diff --git a/vcl/win/inc/salobj.h b/vcl/win/inc/salobj.h index 11ae96931321..ae7ea5271800 100644 --- a/vcl/win/inc/salobj.h +++ b/vcl/win/inc/salobj.h @@ -46,6 +46,7 @@ public: RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data RECT* mpNextClipRect; // Naechstes ClipRegion-Rect BOOL mbFirstClipRect; // Flag for first cliprect to insert + sal_Bool mbInterceptChildWindowKeyDown; // Intercept the KeyDown event sent to system child window WinSalObject* mpNextObject; // pointer to next object @@ -64,6 +65,7 @@ public: virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 97dbb5285cca..9514bc9a2ace 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -721,8 +721,12 @@ void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) { if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplSalDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplSalDispatchMessage( &aMsg ); + } + bOneEvent = bWasMsg = true; } else @@ -733,8 +737,11 @@ void ImplSalYield( BOOL bWait, BOOL bHandleAllCurrentEvents ) { if ( ImplGetMessage( &aMsg, 0, 0, 0 ) ) { - TranslateMessage( &aMsg ); - ImplSalDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplSalDispatchMessage( &aMsg ); + } } } } diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 9d8d41723f64..702ff639ed84 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1798,8 +1798,11 @@ WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) MSG aMsg; if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplDispatchMessage( &aMsg ); + } i++; if ( i > 15 ) bWhile = FALSE; @@ -2060,8 +2063,12 @@ BOOL WinSalPrinter::StartJob( const XubString* pFileName, MSG aMsg; if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) ) { - TranslateMessage( &aMsg ); - ImplDispatchMessage( &aMsg ); + if ( !ImplInterceptChildWindowKeyDown( aMsg ) ) + { + TranslateMessage( &aMsg ); + ImplDispatchMessage( &aMsg ); + } + i++; if ( i > 15 ) bWhile = FALSE; diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index 2f657968284f..6d00242ef313 100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -39,6 +39,7 @@ #include #include #include +#include // ======================================================================= @@ -101,6 +102,46 @@ WinSalFrame* ImplFindSalObjectFrame( HWND hWnd ) return pFrame; } +// ----------------------------------------------------------------------- + +sal_Bool ImplInterceptChildWindowKeyDown( MSG& rMsg ) +{ + sal_Bool bResult = sal_False; + if ( rMsg.message == WM_KEYDOWN ) + { + wchar_t pClassName[10]; + sal_Int32 nLen = GetClassNameW( rMsg.hwnd, pClassName, 10 ); + if ( !( nLen == 9 && wcsncmp( pClassName, SAL_OBJECT_CLASSNAMEW, nLen ) == 0 ) ) + { + // look for the first SalObject in the parent hierarchy + HWND hWin = rMsg.hwnd; + HWND hLastOLEWindow = hWin; + WinSalObject* pSalObj = NULL; + do + { + hLastOLEWindow = hWin; + hWin = ::GetParent( hWin ); + if ( hWin ) + { + nLen = GetClassNameW( hWin, pClassName, 10 ); + if ( nLen == 9 && wcsncmp( pClassName, SAL_OBJECT_CLASSNAMEW, nLen ) == 0 ) + pSalObj = GetSalObjWindowPtr( hWin ); + } + } while( hWin && !pSalObj ); + + if ( pSalObj && pSalObj->mbInterceptChildWindowKeyDown && pSalObj->maSysData.hWnd ) + { + bResult = ( 1 == ImplSendMessage( pSalObj->maSysData.hWnd, rMsg.message, rMsg.wParam, rMsg.lParam ) ); + } + } + } + + return bResult; +} + +// ----------------------------------------------------------------------- + + // ----------------------------------------------------------------------- LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) @@ -623,6 +664,7 @@ WinSalObject::WinSalObject() mhLastFocusWnd = 0; maSysData.nSize = sizeof( SystemEnvData ); mpStdClipRgnData = NULL; + mbInterceptChildWindowKeyDown = sal_False; // Insert object in objectlist mpNextObject = pSalData->mpFirstObject; @@ -836,3 +878,11 @@ const SystemEnvData* WinSalObject::GetSystemData() const { return &maSysData; } + +// ----------------------------------------------------------------------- + +void WinSalObject::InterceptChildWindowKeyDown( sal_Bool bIntercept ) +{ + mbInterceptChildWindowKeyDown = bIntercept; +} + -- cgit From 123175d154c725a8238a408abce8d6491ed7df1c Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 23 Aug 2010 19:27:56 +0200 Subject: mib19: #163018# adjust other platforms --- vcl/aqua/inc/salobj.h | 1 + vcl/aqua/source/window/salobj.cxx | 6 ++++++ vcl/os2/inc/salobj.h | 1 + vcl/os2/source/window/salobj.cxx | 6 ++++++ vcl/unx/inc/salobj.h | 1 + vcl/unx/source/window/salobj.cxx | 7 +++++++ 6 files changed, 22 insertions(+) (limited to 'vcl') diff --git a/vcl/aqua/inc/salobj.h b/vcl/aqua/inc/salobj.h index 0041b22c16a0..56b07cea4262 100644 --- a/vcl/aqua/inc/salobj.h +++ b/vcl/aqua/inc/salobj.h @@ -81,6 +81,7 @@ public: virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx index 07d337dcc81a..f300929f04fe 100644 --- a/vcl/aqua/source/window/salobj.cxx +++ b/vcl/aqua/source/window/salobj.cxx @@ -237,3 +237,9 @@ const SystemEnvData* AquaSalObject::GetSystemData() const return &maSysData; } +// ----------------------------------------------------------------------- + +void AquaSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + diff --git a/vcl/os2/inc/salobj.h b/vcl/os2/inc/salobj.h index 5b4ac21ccdd6..04fdef90bf67 100644 --- a/vcl/os2/inc/salobj.h +++ b/vcl/os2/inc/salobj.h @@ -64,6 +64,7 @@ public: virtual void SetBackground(); virtual void SetBackground( SalColor nSalColor ); virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/os2/source/window/salobj.cxx b/vcl/os2/source/window/salobj.cxx index 85ed1a606d08..e55ce448f7d0 100644 --- a/vcl/os2/source/window/salobj.cxx +++ b/vcl/os2/source/window/salobj.cxx @@ -566,3 +566,9 @@ void Os2SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) } #endif +// ----------------------------------------------------------------------- + +void Os2SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + diff --git a/vcl/unx/inc/salobj.h b/vcl/unx/inc/salobj.h index fa9f1309c8ca..d7d9334f281b 100644 --- a/vcl/unx/inc/salobj.h +++ b/vcl/unx/inc/salobj.h @@ -98,6 +98,7 @@ public: virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H diff --git a/vcl/unx/source/window/salobj.cxx b/vcl/unx/source/window/salobj.cxx index 647b95ae032c..2ff6d05c35c6 100644 --- a/vcl/unx/source/window/salobj.cxx +++ b/vcl/unx/source/window/salobj.cxx @@ -559,3 +559,10 @@ long X11SalObject::Dispatch( XEvent* pEvent ) } return 0; } + +// ----------------------------------------------------------------------- + +void X11SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + -- cgit From 3036c496a1f303386d9d7eebe4317ea6c7d3cf0c Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 31 Aug 2010 11:29:02 +0200 Subject: mib19: missing implementations of abstract function --- vcl/unx/gtk/window/gtkobject.cxx | 5 +++++ vcl/unx/headless/svpdummies.cxx | 1 + vcl/unx/headless/svpdummies.hxx | 2 ++ vcl/unx/inc/plugins/gtk/gtkobject.hxx | 1 + 4 files changed, 9 insertions(+) (limited to 'vcl') diff --git a/vcl/unx/gtk/window/gtkobject.cxx b/vcl/unx/gtk/window/gtkobject.cxx index 2a2bbe78078a..c5f5a168f653 100644 --- a/vcl/unx/gtk/window/gtkobject.cxx +++ b/vcl/unx/gtk/window/gtkobject.cxx @@ -209,3 +209,8 @@ void GtkSalObject::signalDestroy( GtkObject* pObj, gpointer object ) pThis->m_pSocket = NULL; } } + +void GtkSalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) +{ +} + diff --git a/vcl/unx/headless/svpdummies.cxx b/vcl/unx/headless/svpdummies.cxx index 5983ff18c34f..0a67b147804a 100644 --- a/vcl/unx/headless/svpdummies.cxx +++ b/vcl/unx/headless/svpdummies.cxx @@ -61,6 +61,7 @@ void SvpSalObject::GrabFocus() {} void SvpSalObject::SetBackground() {} void SvpSalObject::SetBackground( SalColor ) {} const SystemEnvData* SvpSalObject::GetSystemData() const { return &m_aSystemChildData; } +void SvpSalObject::InterceptChildWindowKeyDown( sal_Bool ) {} // SalI18NImeStatus SvpImeStatus::~SvpImeStatus() {} diff --git a/vcl/unx/headless/svpdummies.hxx b/vcl/unx/headless/svpdummies.hxx index febf7eef6bbe..ea7667ce51ca 100644 --- a/vcl/unx/headless/svpdummies.hxx +++ b/vcl/unx/headless/svpdummies.hxx @@ -58,6 +58,8 @@ public: virtual void SetBackground( SalColor nSalColor ); virtual const SystemEnvData* GetSystemData() const; + + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; class SvpImeStatus : public SalI18NImeStatus diff --git a/vcl/unx/inc/plugins/gtk/gtkobject.hxx b/vcl/unx/inc/plugins/gtk/gtkobject.hxx index ea740249f1c6..9d3f235b8894 100644 --- a/vcl/unx/inc/plugins/gtk/gtkobject.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkobject.hxx @@ -64,6 +64,7 @@ public: virtual const SystemEnvData* GetSystemData() const; + virtual void InterceptChildWindowKeyDown( sal_Bool bIntercept ); }; #endif // _SV_SALOBJ_H -- cgit From 955e88c80e9abce3f15aa55d434dae6ae17d7d43 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 22 Oct 2010 10:37:46 +0200 Subject: sb131: #i115124# $(XSLTPROC) implies LIBXSLT:libxslt --- vcl/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 0a6f6a95f605..af15ad73e19d 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc SO:print_header cpputools shell svl NULL +vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools l10ntools icc SO:print_header cpputools shell svl LIBXSLT:libxslt NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL -- cgit From 91e34e4ccc6c61d0b64d250817af7f0d2263b89e Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Fri, 29 Oct 2010 15:36:30 +0200 Subject: CWS gnumake2: resolve conflicts and make sources buildable on Linux --- vcl/prj/d.lst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index ae9c0364c895..bf6b36a7eaf7 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -152,7 +152,5 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx ..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx ..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx -<<<<<<< local -======= ..\%__SRC%\misc\vcl.component %_DEST%\xml%_EXT%\vcl.component ->>>>>>> other + -- cgit From d8138bfc18fcc2732d3ea7304b24b319268995af Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 2 Nov 2010 17:03:34 +0100 Subject: vcl117: #i115056# change direct help texts to help ids to allow for proper help content --- vcl/inc/vcl/print.hxx | 20 ++++--- vcl/source/gdi/print3.cxx | 74 ++++++++++++------------ vcl/source/src/print.src | 83 ++++++++++---------------- vcl/source/window/printdlg.cxx | 128 ++++++++++------------------------------- 4 files changed, 109 insertions(+), 196 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index c389034d918f..c335e4853702 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -620,28 +620,34 @@ class VCL_DLLPUBLIC PrinterOptionsHelper , mbEnabled( i_bEnabled ) {} }; + // note: in the following helper functions HelpIds are expected as an rtl::OUString + // the normal HelpId form is rtl::OString (byte string instead of UTF16 string) + // this is because the whole interface is base on UNO properties; in fact the structures + // are passed over UNO interfaces. UNO does not know a byte string, hence the string is + // transported via UTF16 strings. + // 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 com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpId, 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 ); + static com::sun::star::uno::Any getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpId ); // 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 rtl::OUString& i_rHelpId, 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_rHelpId, const rtl::OUString& i_rProperty, sal_Bool i_bValue, const UIControlOptions& i_rControlOptions = UIControlOptions() @@ -649,7 +655,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper // 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 com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpId, const rtl::OUString& i_rProperty, const com::sun::star::uno::Sequence< rtl::OUString >& i_rChoices, sal_Int32 i_nValue, @@ -661,7 +667,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper // 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_rHelpId, const rtl::OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue = -1, @@ -672,7 +678,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper // 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_rHelpId, const rtl::OUString& i_rProperty, const rtl::OUString& i_rValue, const UIControlOptions& i_rControlOptions = UIControlOptions() diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 9d8f3bf2f9a0..e557a8427704 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1721,7 +1721,7 @@ void PrinterOptionsHelper::appendPrintUIOptions( uno::Sequence< beans::PropertyV } Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, - const Sequence< rtl::OUString >& i_rHelpTexts, + const Sequence< rtl::OUString >& i_rHelpIds, const rtl::OUString& i_rType, const PropertyValue* i_pVal, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions @@ -1730,7 +1730,7 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, sal_Int32 nElements = 1 // ControlType + (i_rTitle.getLength() ? 1 : 0) // Text - + (i_rHelpTexts.getLength() ? 1 : 0) // HelpText + + (i_rHelpIds.getLength() ? 1 : 0) // HelpId + (i_pVal ? 1 : 0) // Property + i_rControlOptions.maAddProps.getLength() // additional props + (i_rControlOptions.maGroupHint.getLength() ? 1 : 0) // grouping @@ -1753,10 +1753,10 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); aCtrl[nUsed++].Value = makeAny( i_rTitle ); } - if( i_rHelpTexts.getLength() ) + if( i_rHelpIds.getLength() ) { - aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ); - aCtrl[nUsed++].Value = makeAny( i_rHelpTexts ); + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpId" ) ); + aCtrl[nUsed++].Value = makeAny( i_rHelpIds ); } aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); aCtrl[nUsed++].Value = makeAny( i_rType ); @@ -1805,53 +1805,53 @@ Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, return makeAny( aCtrl ); } -Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText ) +Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpId ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); } Any PrinterOptionsHelper::getSubgroupControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ), + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ), NULL, i_rControlOptions ); } Any PrinterOptionsHelper::getBoolControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, sal_Bool i_bValue, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_bValue ); - return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, i_rControlOptions ); + return getUIControlOpt( i_rTitle, aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, i_rControlOptions ); } Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle, - const Sequence< rtl::OUString >& i_rHelpText, + const Sequence< rtl::OUString >& i_rHelpId, const rtl::OUString& i_rProperty, const Sequence< rtl::OUString >& i_rChoices, sal_Int32 i_nValue, @@ -1874,11 +1874,11 @@ Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle, PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_nValue ); - return getUIControlOpt( i_rTitle, i_rHelpText, i_rType, &aVal, aOpt ); + return getUIControlOpt( i_rTitle, i_rHelpId, i_rType, &aVal, aOpt ); } Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue, @@ -1897,17 +1897,17 @@ Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, aOpt.maAddProps[nUsed++].Value = makeAny( i_nMaxValue ); } - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_nValue ); return getUIControlOpt( i_rTitle, - aHelpText, + aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), &aVal, aOpt @@ -1915,23 +1915,23 @@ Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, } Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, - const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rHelpId, const rtl::OUString& i_rProperty, const rtl::OUString& i_rValue, const PrinterOptionsHelper::UIControlOptions& i_rControlOptions ) { - Sequence< rtl::OUString > aHelpText; - if( i_rHelpText.getLength() > 0 ) + Sequence< rtl::OUString > aHelpId; + if( i_rHelpId.getLength() > 0 ) { - aHelpText.realloc( 1 ); - *aHelpText.getArray() = i_rHelpText; + aHelpId.realloc( 1 ); + *aHelpId.getArray() = i_rHelpId; } PropertyValue aVal; aVal.Name = i_rProperty; aVal.Value = makeAny( i_rValue ); return getUIControlOpt( i_rTitle, - aHelpText, + aHelpId, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Edit" ) ), &aVal, i_rControlOptions diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 13ae6b0ead76..bafa13fdbeba 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -45,16 +45,19 @@ ModalDialog SV_DLG_PRINT Pos = MAP_APPFONT( 240, 195 ); Size = MAP_APPFONT( 50, 15 ); Text [en-US] = "~Print"; + HelpID = ".HelpID:vcl:PrintDialog:OK"; }; CancelButton SV_PRINT_CANCEL { Pos = MAP_APPFONT( 295, 195 ); Size = MAP_APPFONT( 50, 15 ); + HelpID = ".HelpID:vcl:PrintDialog:Cancel"; }; HelpButton SV_PRINT_HELP { Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 50, 15 ); + HelpID = ".HelpID:vcl:PrintDialog:Help"; }; Window SV_PRINT_PAGE_PREVIEW @@ -62,16 +65,16 @@ ModalDialog SV_DLG_PRINT Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 130, 130 ); Border = FALSE; + HelpID = ".HelpID:vcl:PrintDialog:Preview"; }; NumericField SV_PRINT_PAGE_EDIT { - HelpID = "vcl:NumericField:SV_DLG_PRINT:SV_PRINT_PAGE_EDIT"; Pos = MAP_APPFONT( 5, 140 ); Size = MAP_APPFONT( 30, 12 ); SVLook = TRUE; Spin = FALSE; Border = TRUE; - HelpText [en-US] = "Select page to display in preview."; + HelpID = ".HelpID:vcl:PrintDialog:PageEdit"; }; FixedText SV_PRINT_PAGE_TXT { @@ -79,26 +82,25 @@ ModalDialog SV_DLG_PRINT Size = MAP_APPFONT( 30, 12 ); Text [ en-US ] = "/ %n"; VCenter = TRUE; + HelpID = ".HelpID:vcl:PrintDialog:NumPagesText"; }; PushButton SV_PRINT_PAGE_FORWARD { - HelpID = "vcl:PushButton:SV_DLG_PRINT:SV_PRINT_PAGE_FORWARD"; Pos = MAP_APPFONT( 95, 140 ); Size = MAP_APPFONT( 15, 12 ); - HelpText [en-US] = "Scroll one page forward."; + HelpID = ".HelpID:vcl:PrintDialog:ForwardBtn"; }; PushButton SV_PRINT_PAGE_BACKWARD { - HelpID = "vcl:PushButton:SV_DLG_PRINT:SV_PRINT_PAGE_BACKWARD"; Pos = MAP_APPFONT( 80, 140 ); Size = MAP_APPFONT( 15, 12 ); - HelpText [en-US] = "Scroll one page backward."; + HelpID = ".HelpID:vcl:PrintDialog:BackwardBtn"; }; TabControl SV_PRINT_TABCTRL { - HelpID = "vcl:TabControl:SV_DLG_PRINT:SV_PRINT_TABCTRL"; Pos = MAP_APPFONT( 140, 5 ); Size = MAP_APPFONT( 205, 175 ); + HelpID = ".HelpID:vcl:PrintDialog:TabPages"; }; FixedLine SV_PRINT_BUTTONLINE { @@ -128,7 +130,7 @@ ModalDialog SV_DLG_PRINT TabPage SV_PRINT_TAB_NUP { - HelpID = "vcl:TabPage:SV_PRINT_TAB_NUP"; + HelpID = ".HelpID:vcl:PrintDialog:TabNUp"; Text [en-US] = "Page Layout"; Hide = TRUE; @@ -138,38 +140,28 @@ ModalDialog SV_DLG_PRINT Size = MAP_APPFONT( 150, 10 ); Text [en-US] = "Layout"; }; - RadioButton SV_PRINT_PRT_NUP_DEFAULT_BTN - { - HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_DEFAULT_BTN"; - Pos = MAP_APPFONT( 0, 0 ); - Size = MAP_APPFONT( 10, 10 ); - Text [en-US] = "~Default"; - HelpText [en-US] = "Print one page per sheet of paper."; - }; RadioButton SV_PRINT_PRT_NUP_BROCHURE_BTN { - HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_BROCHURE_BTN"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:Brochure"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 10 ); Text = ""; }; RadioButton SV_PRINT_PRT_NUP_PAGES_BTN { - HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_PAGES_BTN"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PagesPerSheet"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 10 ); Text [en-US] = "Pa~ges per sheet"; - HelpText [en-US] = "Print multiple pages per sheet of paper."; }; ListBox SV_PRINT_PRT_NUP_PAGES_BOX { - HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_PAGES_BOX"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PagesPerSheetBox"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 80 ); Border = TRUE; DropDown = TRUE; CurPos = 0; - HelpText [en-US] = "Select how many pages to print per sheet of paper."; StringList [en-US] = { < "1"; 1; >; @@ -190,7 +182,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_PRT_NUP_COLS_EDT { - HelpID = "vcl:NumericField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_COLS_EDT"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:ColumnsBox"; Pos = MAP_APPFONT( 55, 20 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -198,7 +190,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 32; Value = 1; - HelpText [en-US] = "Select number of columns."; }; FixedText SV_PRINT_PRT_NUP_TIMES_TXT { @@ -209,7 +200,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_PRT_NUP_ROWS_EDT { - HelpID = "vcl:NumericField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ROWS_EDT"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:RowsBox"; Pos = MAP_APPFONT( 55, 35 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -217,7 +208,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 32; Value = 1; - HelpText [en-US] = "Select number of rows."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT { @@ -227,14 +217,13 @@ ModalDialog SV_DLG_PRINT }; MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT { - HelpID = "vcl:MetricField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:PageMarginBox"; Pos = MAP_APPFONT( 55, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; Value = 0; Unit = FUNIT_MM; - HelpText [en-US] = "Select margin between individual pages on each sheet of paper."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT { @@ -250,14 +239,13 @@ ModalDialog SV_DLG_PRINT }; MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT { - HelpID = "vcl:MetricField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:SheetMarginBox"; Pos = MAP_APPFONT( 155, 95 ); Size = MAP_APPFONT( 40, 12 ); Spin = TRUE; Border = TRUE; Value = 0; Unit = FUNIT_MM; - HelpText [en-US] = "Select margin between the printed pages and paper edge."; }; FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT { @@ -273,7 +261,7 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX { - HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ORIENTATION_BOX"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:OrientationBox"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 40 ); Border = TRUE; @@ -285,7 +273,6 @@ ModalDialog SV_DLG_PRINT < "Portrait"; SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT; >; < "Landscape"; SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE; >; }; - HelpText [en-US] = "Select the orientation of the paper."; }; FixedText SV_PRINT_PRT_NUP_ORDER_TXT { @@ -295,7 +282,7 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRT_NUP_ORDER_BOX { - HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ORDER_BOX"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:OrderBox"; Pos = MAP_APPFONT( 0, 0 ); Size = MAP_APPFONT( 10, 20 ); DropDown = TRUE; @@ -306,21 +293,19 @@ ModalDialog SV_DLG_PRINT < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >; < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >; }; - HelpText [en-US] = "Select order in which pages are to be printed."; }; CheckBox SV_PRINT_PRT_NUP_BORDER_CB { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_BORDER_CB"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage:BorderBox"; Pos = MAP_APPFONT( 10, 65 ); Size = MAP_APPFONT( 150, 12 ); Text [en-US] = "Draw a border around each page"; - HelpText [en-US] = "Check to draw a border around each page."; }; }; TabPage SV_PRINT_TAB_JOB { - HelpID = "vcl:TabPage:SV_PRINT_TAB_JOB"; + HelpID = ".HelpID:vcl:PrintDialog:TabJob"; Text [en-US] = "General"; Hide = TRUE; @@ -332,20 +317,18 @@ ModalDialog SV_DLG_PRINT }; ListBox SV_PRINT_PRINTERS { - HelpID = "vcl:ListBox:SV_PRINT_TAB_JOB:SV_PRINT_PRINTERS"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage:PrinterList"; Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 100, 80 ); Border = TRUE; Sort = TRUE; - HelpText [en-US] = "Select the printer to print on."; }; CheckBox SV_PRINT_DETAILS_BTN { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_JOB:SV_PRINT_DETAILS_BTN"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage:DetailsBtn"; Pos = MAP_APPFONT( 5, 5 ); Size = MAP_APPFONT( 5, 5 ); Text [en-US] = "Details"; - HelpText [en-US] = "Show/Hide detailed information of the selected printer."; }; FixedText SV_PRINT_STATUS_TXT { @@ -367,11 +350,10 @@ ModalDialog SV_DLG_PRINT }; PushButton SV_PRINT_PRT_SETUP { - HelpID = "vcl:PushButton:SV_PRINT_TAB_JOB:SV_PRINT_PRT_SETUP"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Properties"; Pos = MAP_APPFONT( 115, 5 ); Size = MAP_APPFONT( 50, 15 ); Text [en-US] = "Properties..."; - HelpText [en-US] = "Call the setup dialog of the selected printer."; }; FixedLine SV_PRINT_COPIES { @@ -387,7 +369,7 @@ ModalDialog SV_DLG_PRINT }; NumericField SV_PRINT_COPYCOUNT_FIELD { - HelpID = "vcl:NumericField:SV_PRINT_TAB_JOB:SV_PRINT_COPYCOUNT_FIELD"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Copies"; Pos = MAP_APPFONT( 10, 56 ); Size = MAP_APPFONT( 40, 12 ); Border = TRUE; @@ -395,7 +377,6 @@ ModalDialog SV_DLG_PRINT Minimum = 1; Maximum = 16384; Value = 1; - HelpText [en-US] = "Select the number of copies to be produced."; }; FixedImage SV_PRINT_COLLATE_IMAGE { @@ -404,11 +385,10 @@ ModalDialog SV_DLG_PRINT }; CheckBox SV_PRINT_COLLATE { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_JOB:SV_PRINT_COLLATE"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage:Collate"; Pos = MAP_APPFONT( 95, 45 ); Size = MAP_APPFONT( 70, 10 ); Text [en-US] = "Collate"; - HelpText [en-US] = "Select whether copies should be collated or not."; }; Image SV_PRINT_COLLATE_IMG @@ -434,9 +414,9 @@ ModalDialog SV_DLG_PRINT TabPage SV_PRINT_TAB_OPT { - HelpID = "vcl:TabPage:SV_PRINT_TAB_OPT"; Text [en-US] = "Options"; Hide = TRUE; + HelpID = ".HelpID:vcl:PrintDialog:TabOpt"; FixedLine SV_PRINT_OPT_PRINT_FL { @@ -446,27 +426,24 @@ ModalDialog SV_DLG_PRINT }; CheckBox SV_PRINT_OPT_TOFILE { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_TOFILE"; + HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToFile"; Pos = MAP_APPFONT( 10, 20 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "Print to ~file"; - HelpText [en-US] = "Check to send output to a file instead of the actual printer."; }; CheckBox SV_PRINT_OPT_SINGLEJOBS { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_SINGLEJOBS"; + HelpID = ".HelpID:vcl:PrintDialog:OptPage:SingleJobs"; Pos = MAP_APPFONT( 10, 35 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "~Create single print jobs for collated output"; - HelpText [en-US] = "Check to not rely on the printer to create collated copies but create a print job for each copy instead."; }; CheckBox SV_PRINT_OPT_REVERSE { - HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_REVERSE"; + HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse"; Pos = MAP_APPFONT( 10, 50 ); Size = MAP_APPFONT( 200, 12 ); Text [en-US] = "Print in ~reverse page order"; - HelpText [en-US] = "Check to print pages in reverse order."; }; }; }; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index f24ed500b7df..ec80f5628635 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -60,10 +60,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::container; using namespace com::sun::star::beans; -#define HELPID_PREFIX ".HelpId:vcl:PrintDialog" -#define SMHID2( a, b ) SetHelpId( rtl::OString( HELPID_PREFIX ":" a ":" b ) ) -#define SMHID1( a ) SetHelpId( rtl::OString( HELPID_PREFIX ":" a ) ) - PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const ResId& i_rId ) : Window( i_pParent, i_rId ) , maOrigSize( 10, 10 ) @@ -429,28 +425,6 @@ PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) maPageMarginEdt.SetDecimalDigits( nDigits ); maSheetMarginEdt.SetDecimalDigits( nDigits ); - SMHID1( "NUpPage" ); - maNupLine.SMHID2("NUpPage", "Layout"); - maBrochureBtn.SMHID2("NUpPage", "Brochure" ); - maPagesBtn.SMHID2( "NUpPage", "PagesPerSheet" ); - maPagesBoxTitleTxt.SMHID2( "NUpPage", "PagesPerSheetLabel" ); - maNupPagesBox.SMHID2( "NUpPage", "PagesPerSheetBox" ); - maNupNumPagesTxt.SMHID2( "NUpPage", "Columns" ); - maNupColEdt.SMHID2( "NUpPage", "ColumnsBox" ); - maNupTimesTxt.SMHID2( "NUpPage", "Rows" ); - maNupRowsEdt.SMHID2( "NUpPage", "RowsBox" ); - maPageMarginTxt1.SMHID2( "NUpPage", "PageMargin" ); - maPageMarginEdt.SMHID2( "NUpPage", "PageMarginBox" ); - maPageMarginTxt2.SMHID2( "NUpPage", "PageMarginCont" ); - maSheetMarginTxt1.SMHID2( "NUpPage", "SheetMargin" ); - maSheetMarginEdt.SMHID2( "NUpPage", "SheetMarginBox" ); - maSheetMarginTxt2.SMHID2( "NUpPage", "SheetMarginCont" ); - maNupOrientationTxt.SMHID2( "NUpPage", "Orientation" ); - maNupOrientationBox.SMHID2( "NUpPage", "OrientationBox" ); - maNupOrderTxt.SMHID2( "NUpPage", "Order" ); - maNupOrderBox.SMHID2( "NUpPage", "OrderBox" ); - maBorderCB.SMHID2( "NUpPage", "BorderBox" ); - setupLayout(); } @@ -605,24 +579,6 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) { FreeResource(); - SMHID1( "JobPage" ); - maPrinterFL.SMHID2( "JobPage", "Printer" ); - maPrinters.SMHID2( "JobPage", "PrinterList" ); - maDetailsBtn.SMHID2( "JobPage", "DetailsBtn" ); - maStatusLabel.SMHID2( "JobPage", "StatusLabel" ); - maStatusTxt.SMHID2( "JobPage", "StatusText" ); - maLocationLabel.SMHID2( "JobPage", "LocationLabel" ); - maLocationTxt.SMHID2( "JobPage", "LocationText" ); - maCommentLabel.SMHID2( "JobPage", "CommentLabel" ); - maCommentTxt.SMHID2( "JobPage", "CommentText" ); - maSetupButton.SMHID2( "JobPage", "Properties" ); - maCopies.SMHID2( "JobPage", "CopiesLine" ); - maCopySpacer.SMHID2( "JobPage", "CopySpacer" ); - maCopyCount.SMHID2( "JobPage", "CopiesText" ); - maCopyCountField.SMHID2( "JobPage", "Copies" ); - maCollateBox.SMHID2( "JobPage", "Collate" ); - maCollateImage.SMHID2( "JobPage", "CollateImage" ); - maCopySpacer.Show(); maStatusTxt.Show(); maCommentTxt.Show(); @@ -753,11 +709,6 @@ PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rRe , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) { FreeResource(); - SMHID1( "OptPage" ); - maOptionsLine.SMHID2( "OptPage", "Options" ); - maToFileBox.SMHID2( "OptPage", "ToFile" ); - maCollateSingleJobsBox.SMHID2( "OptPage", "SingleJobs" ); - maReverseOrderBox.SMHID2( "OptPage", "Reverse" ); setupLayout(); } @@ -977,18 +928,6 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr& i_rHelpIds, sal_Int32 i_nIndex ) { - rtl::OStringBuffer aBuf( 256 ); - aBuf.append( HELPID_PREFIX ); - if( i_rPropName.getLength() ) - { - aBuf.append( ':' ); - aBuf.append( rtl::OUStringToOString( i_rPropName, RTL_TEXTENCODING_UTF8 ) ); - } - if( i_pType ) - { - aBuf.append( ':' ); - aBuf.append( i_pType ); - } - if( i_nId >= 0 ) - { - aBuf.append( ':' ); - aBuf.append( i_nId ); - } - i_pWindow->SetHelpId( aBuf.makeStringAndClear() ); + if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() ) + i_pWindow->SetHelpId( rtl::OUStringToOString( i_rHelpIds.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8 ) ); } -static void setHelpText( Window* /*i_pWindow*/, const Sequence< rtl::OUString >& /*i_rHelpTexts*/, sal_Int32 /*i_nIndex*/ ) +static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) { // without a help text set and the correct smartID, // help texts will be retrieved from the online help system - - // passed help texts for optional UI is used only for native dialogs which currently - // cannot access the same (rather implicit) mechanism - #if 0 if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() ) i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] ); - #endif } void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize ) @@ -1196,6 +1114,7 @@ void PrintDialog::setupOptionalUI() Sequence< rtl::OUString > aChoices; Sequence< sal_Bool > aChoicesDisabled; Sequence< rtl::OUString > aHelpTexts; + Sequence< rtl::OUString > aHelpIds; sal_Int64 nMinValue = 0, nMaxValue = 0; sal_Int32 nCurHelpText = 0; rtl::OUString aGroupingHint; @@ -1270,6 +1189,18 @@ void PrintDialog::setupOptionalUI() } } } + else if( rEntry.Name.equalsAscii( "HelpId" ) ) + { + if( ! (rEntry.Value >>= aHelpIds ) ) + { + rtl::OUString aHelpId; + if( (rEntry.Value >>= aHelpId) ) + { + aHelpIds.realloc( 1 ); + *aHelpIds.getArray() = aHelpId; + } + } + } else if( rEntry.Name.equalsAscii( "HintNoLayoutPage" ) ) { sal_Bool bNoLayoutPage = sal_False; @@ -1339,7 +1270,7 @@ void PrintDialog::setupOptionalUI() maTabCtrl.SetTabPage( nOptPageId, pNewGroup ); // set help id - setSmartId( pNewGroup, "TabPage", nOptPageId ); + setHelpId( pNewGroup, aHelpIds, 0 ); // set help text setHelpText( pNewGroup, aHelpTexts, 0 ); @@ -1371,7 +1302,7 @@ void PrintDialog::setupOptionalUI() pNewSub->Show(); // set help id - setSmartId( pNewSub, "FixedLine", sal_Int32( nCurSubGroup++ ) ); + setHelpId( pNewSub, aHelpIds, 0 ); // set help text setHelpText( pNewSub, aHelpTexts, 0 ); // add group to current column @@ -1451,7 +1382,7 @@ void PrintDialog::setupOptionalUI() maControlToPropertyMap[pNewBox] = aPropertyName; // set help id - setSmartId( pNewBox, "CheckBox", -1, aPropertyName ); + setHelpId( pNewBox, aHelpIds, 0 ); // set help text setHelpText( pNewBox, aHelpTexts, 0 ); @@ -1474,9 +1405,10 @@ void PrintDialog::setupOptionalUI() pHeading->Show(); // set help id - setSmartId( pHeading, "FixedText", -1, aPropertyName ); + setHelpId( pHeading, aHelpIds, nCurHelpText ); // set help text - setHelpText( pHeading, aHelpTexts, nCurHelpText++ ); + setHelpText( pHeading, aHelpTexts, nCurHelpText ); + nCurHelpText++; // add fixed text to current column pCurColumn->addWindow( pHeading ); // add an indent to the current column @@ -1512,9 +1444,10 @@ void PrintDialog::setupOptionalUI() maControlToNumValMap[pBtn] = m; // set help id - setSmartId( pBtn, "RadioButton", m, aPropertyName ); + setHelpId( pBtn, aHelpIds, nCurHelpText ); // set help text - setHelpText( pBtn, aHelpTexts, nCurHelpText++ ); + setHelpText( pBtn, aHelpTexts, nCurHelpText ); + nCurHelpText++; // add the radio button to the column pLabel->setLabel( pBtn ); } @@ -1538,9 +1471,6 @@ void PrintDialog::setupOptionalUI() pHeading->SetText( aText ); pHeading->Show(); - // set help id - setSmartId( pHeading, "FixedText", -1, aPropertyName ); - // add to row pLabel = new vcl::LabeledElement( pFieldColumn, 2 ); pFieldColumn->addChild( pLabel ); @@ -1567,7 +1497,7 @@ void PrintDialog::setupOptionalUI() pList->Show(); // set help id - setSmartId( pList, "ListBox", -1, aPropertyName ); + setHelpId( pList, aHelpIds, 0 ); // set help text setHelpText( pList, aHelpTexts, 0 ); @@ -1600,7 +1530,7 @@ void PrintDialog::setupOptionalUI() pField->Show(); // set help id - setSmartId( pField, "NumericField", -1, aPropertyName ); + setHelpId( pField, aHelpIds, 0 ); // set help text setHelpText( pField, aHelpTexts, 0 ); @@ -1627,7 +1557,7 @@ void PrintDialog::setupOptionalUI() pField->Show(); // set help id - setSmartId( pField, "Edit", -1, aPropertyName ); + setHelpId( pField, aHelpIds, 0 ); // set help text setHelpText( pField, aHelpTexts, 0 ); -- cgit From e8ffa7cfebb3dd1ad41f333901286a13eb450232 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 3 Nov 2010 17:10:14 +0100 Subject: vcl117: #i115304# read printer options from configuration --- vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 3 + vcl/inc/vcl/print.hxx | 6 ++ vcl/inc/vcl/prndlg.hxx | 4 +- vcl/source/gdi/print.cxx | 100 ++++++++++++++++++++++++++ vcl/source/gdi/print3.cxx | 8 +++ vcl/source/window/printdlg.cxx | 31 ++++++-- 6 files changed, 146 insertions(+), 6 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index d19290d8320a..93945570dc96 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -322,6 +322,9 @@ class ControllerProperties GDIMetaFile aMtf; PrinterController::PageSize aPageSize( mpController->getFilteredPageFile( i_nPage, aMtf, false ) ); VirtualDevice aDev; + if( mpController->getPrinter()->GetPrinterOptions().IsConvertToGreyscales() ) + aDev.SetDrawMode( aDev.GetDrawMode() | ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); // see salprn.cxx, currently we pretend to be a 720dpi device on printers aDev.SetReferenceDevice( 720, 720 ); aDev.EnableOutput( TRUE ); diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index c335e4853702..04f47d16bba8 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -208,6 +208,11 @@ public: BOOL IsConvertToGreyscales() const { return mbConvertToGreyscales; } void SetConvertToGreyscales( BOOL bSet ) { mbConvertToGreyscales = bSet; } + + // read printer options from configuration, parameter decides whether the set for + // print "to printer" or "to file" should be read. + // returns true if config was read, false if an error occured + bool ReadFromConfig( bool bFile ); }; // ----------- @@ -538,6 +543,7 @@ public: 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 ); + SAL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput ); }; class VCL_DLLPUBLIC PrinterOptionsHelper diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index fdaf06c9854e..7c6975eafa4f 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -59,6 +59,7 @@ namespace vcl VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; + bool mbGreyscale; bool useHCColorReplacement() const; public: @@ -71,7 +72,8 @@ namespace vcl virtual void DataChanged( const DataChangedEvent& ); void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&, - sal_Int32 i_nDPIX, sal_Int32 i_nDPIY + sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, + bool i_bGreyscale ); }; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 2ea9bfcc4c11..cafaf5cad6eb 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -57,8 +57,14 @@ #include +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" + using namespace com::sun::star::uno; using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; int nImplSysDialog = 0; @@ -130,6 +136,100 @@ PrinterOptions::~PrinterOptions() { } +#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency")) +#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode")) +#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceGradients")) +#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientMode")) +#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedGradientStepCount")) +#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceBitmaps")) +#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapMode")) +#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapResolution")) +#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency")) +#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales")) + +bool PrinterOptions::ReadFromConfig( bool i_bFile ) +{ + bool bSuccess = false; + // save old state in case something goes wrong + PrinterOptions aOldValues( *this ); + + // get the configuration service + Reference< XMultiServiceFactory > xConfigProvider; + Reference< XNameAccess > xConfigAccess; + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + xConfigProvider = Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), + UNO_QUERY ); + if( xConfigProvider.is() ) + { + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + if( i_bFile ) + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/File" ) ); + else + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/Printer" ) ); + aArgs.getArray()[0] <<= aVal; + xConfigAccess = Reference< XNameAccess >( + xConfigProvider->createInstanceWithArguments( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ), + UNO_QUERY ); + if( xConfigAccess.is() ) + { + Reference< XPropertySet > xSet( xConfigAccess, UNO_QUERY ); + if( xSet.is() ) + { + sal_Int32 nValue = 0; + sal_Bool bValue = 0; + if( xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bValue ) + SetReduceTransparency( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nValue ) + SetReducedTransparencyMode( (PrinterTransparencyMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bValue ) + SetReduceGradients( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nValue ) + SetReducedGradientMode( (PrinterGradientMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nValue ) + SetReducedGradientStepCount( (USHORT)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bValue ) + SetReduceBitmaps( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue ) + SetReducedBitmapMode( (PrinterBitmapMode)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue ) + SetReducedBitmapResolution( (USHORT)nValue ); + if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue ) + SetReducedBitmapIncludesTransparency( bValue ); + if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue ) + SetConvertToGreyscales( bValue ); + + bSuccess = true; + } + } + } + } + catch( Exception& ) + { + } + } + } + catch( WrappedTargetException& ) + { + } + + if( ! bSuccess ) + *this = aOldValues; + return bSuccess; +} + // ------------- // - QueueInfo - // ------------- diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index e557a8427704..afb510b05a17 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -553,6 +553,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrReadFromConfig( mbPrintFile ); maJobName = i_rJobName; mnCurPage = 1; @@ -733,6 +734,13 @@ void PrinterController::setPrinter( const boost::shared_ptr& i_rPrinter mpImplData->mnFixedPaperBin = -1; } +void PrinterController:: resetPrinterOptions( bool i_bFileOutput ) +{ + PrinterOptions aOpt; + aOpt.ReadFromConfig( i_bFileOutput ); + mpImplData->mpPrinter->SetPrinterOptions( aOpt ); +} + bool PrinterController::setupPrinter( Window* i_pParent ) { bool bRet = false; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index ec80f5628635..0641c49c27f0 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -65,6 +65,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re , maOrigSize( 10, 10 ) , maPageVDev( *this ) , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) ) + , mbGreyscale( false ) { SetPaintTransparent( TRUE ); SetBackground(); @@ -245,6 +246,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) maPageVDev.Erase(); maPageVDev.Push(); maPageVDev.SetMapMode( MAP_100TH_MM ); + ULONG nOldDrawMode = maPageVDev.GetDrawMode(); + if( mbGreyscale ) + maPageVDev.SetDrawMode( maPageVDev.GetDrawMode() | + ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); aMtf.WindStart(); aMtf.Scale( fScale, fScale ); aMtf.WindStart(); @@ -254,6 +260,7 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) SetMapMode( MAP_PIXEL ); maPageVDev.SetMapMode( MAP_PIXEL ); DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev ); + maPageVDev.SetDrawMode( nOldDrawMode ); DecorationView aVw( this ); Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); @@ -285,7 +292,8 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi const Size& i_rOrigSize, const rtl::OUString& i_rReplacement, sal_Int32 i_nDPIX, - sal_Int32 i_nDPIY + sal_Int32 i_nDPIY, + bool i_bGreyscale ) { rtl::OUStringBuffer aBuf( 256 ); @@ -306,6 +314,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi maOrigSize = i_rOrigSize; maReplacementString = i_rReplacement; + mbGreyscale = i_bGreyscale; maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY ); maPageVDev.EnableOutput( TRUE ); Resize(); @@ -808,9 +817,6 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrgetReversePrint() ); - // get the first page - preparePreview( true, true ); - // fill printer listbox const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() ); for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin(); @@ -841,6 +847,12 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptrsetPrinter( boost::shared_ptr( new Printer( Printer::GetDefaultPrinterName() ) ) ); } } + // not printing to file + maPController->resetPrinterOptions( false ); + + // get the first page + preparePreview( true, true ); + // update the text fields for the printer updatePrinterText(); @@ -1024,6 +1036,11 @@ void PrintDialog::readFromSettings() } } maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); + if( maOptionsPage.maToFileBox.IsChecked() ) + { + maPController->resetPrinterOptions( true ); + preparePreview( true, true ); + } } void PrintDialog::storeToSettings() @@ -1859,7 +1876,8 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr, - aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY() + aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY(), + aPrt->GetPrinterOptions().IsConvertToGreyscales() ); maForwardBtn.Enable( mnCurPage < nPages-1 ); @@ -2046,6 +2064,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox ) String aNewPrinter( pBox->GetSelectEntry() ); // set new printer maPController->setPrinter( boost::shared_ptr( new Printer( aNewPrinter ) ) ); + maPController->resetPrinterOptions( maOptionsPage.maToFileBox.IsChecked() ); // update text fields updatePrinterText(); } @@ -2091,7 +2110,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) else if( pButton == &maOptionsPage.maToFileBox ) { maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); + maPController->resetPrinterOptions( maOptionsPage.maToFileBox.IsChecked() ); maLayout.resize(); + preparePreview( true, true ); } else if( pButton == &maNUpPage.maBrochureBtn ) { -- cgit From 6cd16b7bc3fa70ba6c93fe64256e5ce16ab19c9f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 4 Nov 2010 18:48:18 +0100 Subject: vcl117: #i115056# clean up functions no longer used --- vcl/inc/vcl/print.hxx | 11 ++++++----- vcl/source/gdi/print.cxx | 5 +++++ vcl/source/gdi/print3.cxx | 4 ---- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 04f47d16bba8..1f3eba2610fd 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -318,7 +318,12 @@ public: BOOL Setup( Window* pWindow = NULL ); BOOL SetPrinterProps( const Printer* pPrinter ); - void SetPrinterOptions( const PrinterOptions& rOptions ) { *mpPrinterOptions = rOptions; } + // SetPrinterOptions is used internally only now + // in earlier times it was used only to set the options loaded directly from the configuration + // in SfxPrinter::InitJob, this is now handled internally + // should the need arise to set the printer options outside vcl, also a method would have to be devised + // to not override these again internally + SAL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions ); const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); } BOOL SetOrientation( Orientation eOrient ); @@ -354,10 +359,6 @@ public: 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; } diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index cafaf5cad6eb..78456992340f 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -230,6 +230,11 @@ bool PrinterOptions::ReadFromConfig( bool i_bFile ) return bSuccess; } +void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions ) +{ + *mpPrinterOptions = i_rOptions; +} + // ------------- // - QueueInfo - // ------------- diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index afb510b05a17..0effb7e3ca44 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -533,10 +533,6 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrValue >>= bSinglePrintJobs; } - // remark: currently it is still possible to use EnablePrintFile and - // SetPrintFileName to redirect printout into file - // it can be argued that those methods should be removed in favor - // of only using the LocalFileName property beans::PropertyValue* pFileValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ) ); if( pFileValue ) { -- cgit From 508ed1f813934bdb6e33747e1b26afd1b7c8980d Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 5 Nov 2010 16:11:41 +0100 Subject: remove ignored help strings --- vcl/source/src/btntext.src | 64 ---------------------------------------------- 1 file changed, 64 deletions(-) (limited to 'vcl') diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src index 6d2360dae6cb..b786184fa2f3 100644 --- a/vcl/source/src/btntext.src +++ b/vcl/source/src/btntext.src @@ -80,68 +80,4 @@ String SV_BUTTONTEXT_ABORT { Text [ en-US ] = "~Abort"; }; - -/* HelpTexte, die wir derzeit nicht mehr verwenden: -SV_BUTTONHELPTEXT_OK -{ - Text = "Schließt dieses Dialogfeld und speichert alle vorgenommenen Änderungen." ; -}; - -SV_BUTTONHELPTEXT_CANCEL -{ - Text = "Schließt dieses Dialogfeld, ohne Ihre Änderungen zu speichern." ; -}; - -SV_BUTTONHELPTEXT_HELP -{ - Text = "Zeigt Hilfe zu diesem Fenster an." ; -}; - -SV_BUTTONHELPTEXT_MORE -{ - Text = "Zeigt weitere EinstellmÖglichkeiten an oder versteckt diese wieder." ; -}; - -Finnische-Texte: -OK OK -CANCEL Peruuta -HELP ~Ohje -MORE ~Enemmän -YES ~Kyllä -NO ~Ei -RETRY ~Yritäuudelleen -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit From 93924469d64d5a316fa78c18a1dd571e51b09824 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 5 Nov 2010 16:18:53 +0100 Subject: #i115432# fix test string for UI-font check --- vcl/source/window/window.cxx | 46 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) (limited to 'vcl') diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 69999f6c7188..cddd0f898392 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -270,19 +270,41 @@ bool Window::ImplCheckUIFont( const Font& rFont ) if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) return true; + // create a text string using the localized text of important buttons String aTestText; - aTestText.Append( Button::GetStandardText( BUTTON_OK ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) ); - aTestText.Append( Button::GetStandardText( BUTTON_YES ) ); - aTestText.Append( Button::GetStandardText( BUTTON_NO ) ); - aTestText.Append( Button::GetStandardText( BUTTON_RETRY ) ); - aTestText.Append( Button::GetStandardText( BUTTON_HELP ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CLOSE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_MORE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_LESS ) ); - aTestText.Append( Button::GetStandardText( BUTTON_ABORT ) ); - - return HasGlyphs( rFont, aTestText ) >= aTestText.Len(); + static const StandardButtonType aTestButtons[] = + { + BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT, + BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_LESS, + BUTTON_RETRY, BUTTON_HELP + }; + + const int nTestButtonCount = sizeof(aTestButtons)/sizeof(*aTestButtons); + for( int n = 0; n < nTestButtonCount; ++n ) + { + String aButtonStr = Button::GetStandardText( aTestButtons[n] ); + // #i115432# ignore mnemonic+accelerator part of each string + // TODO: use a string filtering method when it becomes available + const int nLen = aButtonStr.Len(); + bool bInside = false; + for( int i = 0; i < nLen; ++i ) { + const sal_Unicode c = aButtonStr.GetChar( i ); + if( (c == '(')) + bInside = true; + if( (c == ')')) + bInside = false; + if( (c == '~') + || (c == '(') || (c == ')') + || ((c >= 'A') && (c <= 'Z') && bInside) ) + aButtonStr.SetChar( i, ' ' ); + } + // append sanitized button text to test string + aTestText.Append( aButtonStr ); + } + + const int nFirstChar = HasGlyphs( rFont, aTestText ); + const bool bUIFontOk = (nFirstChar >= aTestText.Len()); + return bUIFontOk; } // ----------------------------------------------------------------------- -- cgit From d38917161cff8b8f4f6edb622e571c3a5b5bca88 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 5 Nov 2010 16:20:01 +0100 Subject: #i115432# less is more since CWS pbfinal01 --- vcl/source/window/window.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index cddd0f898392..8054afd33080 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -275,7 +275,7 @@ bool Window::ImplCheckUIFont( const Font& rFont ) static const StandardButtonType aTestButtons[] = { BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT, - BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_LESS, + BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE, BUTTON_RETRY, BUTTON_HELP }; -- cgit From 49c2ff49746388195e25d2f222132e6424261bd8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 8 Nov 2010 12:33:56 +0100 Subject: vcl117: #i115469# activate application if termination was canceled --- vcl/aqua/source/app/vclnsapp.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index ff2b4226bfa0..caa506772272 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -360,6 +360,8 @@ { YIELD_GUARD; + NSApplicationTerminateReply aReply = NSTerminateNow; + SalData* pSalData = GetSalData(); #if 1 // currently do some really bad hack if( ! pSalData->maFrames.empty() ) @@ -399,7 +401,7 @@ #endif [(*it) release]; } - return NSTerminateCancel; + aReply = NSTerminateCancel; } #if OSL_DEBUG_LEVEL > 1 for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); @@ -416,9 +418,12 @@ #endif } #else // the clean version follows - return pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; + aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; #endif - return NSTerminateNow; + + if( aReply != NSTerminateNow ) + [NSApp activateIgnoringOtherApps: YES]; + return aReply; } -(void)systemColorsChanged: (NSNotification*) pNotification -- cgit From 65dcdf44cec6dfdad0b90250c579a66968417677 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 9 Nov 2010 11:55:19 +0100 Subject: minor cleanup in outfont.hxx: prefer fwd-decls and explicit conversions --- vcl/inc/vcl/outfont.hxx | 16 ++++++++-------- vcl/source/gdi/outdev3.cxx | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 4bbf7176ddb2..7ad233449d93 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -39,8 +39,6 @@ #include -#include - class ImplDevFontListData; class ImplGetDevFontList; class ImplGetDevSizeList; @@ -54,6 +52,8 @@ class ConvertChar; struct FontMatchStatus; class OutputDevice; +namespace com { namespace sun { namespace star { namespace lang { struct Locale; }}}} + // ---------------------- // - ImplFontAttributes - // ---------------------- @@ -140,7 +140,7 @@ public: virtual ImplFontData* Clone() const = 0; protected: - ImplFontData( const ImplDevFontAttributes&, int nMagic ); + explicit ImplFontData( const ImplDevFontAttributes&, int nMagic ); void SetBitmapSize( int nW, int nH ) { mnWidth=nW; mnHeight=nH; } long mnWidth; // Width (in pixels) @@ -199,8 +199,8 @@ private: ImplGlyphFallbackFontSubstitution* mpFallbackHook; // device specific glyh fallback substitution public: - ImplDevFontList(); - ~ImplDevFontList(); + explicit ImplDevFontList(); + virtual ~ImplDevFontList(); // fill the list with device fonts void Add( ImplFontData* ); @@ -226,7 +226,7 @@ public: ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; //used by 2-level font fallback - ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const; + ImplDevFontListData* ImplFindByLocale( com::sun::star::lang::Locale& ) const; protected: void InitMatchData() const; @@ -267,7 +267,7 @@ struct ImplKernPairData class ImplFontMetricData : public ImplFontAttributes { public: - ImplFontMetricData( const ImplFontSelectData& ); + explicit ImplFontMetricData( const ImplFontSelectData& ); void ImplInitTextLineSize( const OutputDevice* pDev ); void ImplInitAboveTextLineSize(); @@ -327,7 +327,7 @@ public: // TODO: hide members behind accessor methods class VCL_DLLPUBLIC ImplFontEntry { public: - ImplFontEntry( const ImplFontSelectData& ); + explicit ImplFontEntry( const ImplFontSelectData& ); virtual ~ImplFontEntry(); public: // TODO: make data members private diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index f4ea98484c33..ca50e4bf6c82 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1686,15 +1686,15 @@ void ImplDevFontList::InitMatchData() const } //---------------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const +ImplDevFontListData* ImplDevFontList::ImplFindByLocale( com::sun::star::lang::Locale& rLocale ) const { // get the default font for a specified locale const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); - String aDefault = rDefaults.getUserInterfaceFont( lc ); + const String aDefault = rDefaults.getUserInterfaceFont( rLocale ); ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); if( pFontData ) return pFontData; - return 0; + return NULL; } // ----------------------------------------------------------------------- -- cgit From 2d2592be455526fd7bfa9611eb166f37193fd4d3 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 9 Nov 2010 15:42:55 +0100 Subject: enable optimized drawing for NSWindows --- vcl/aqua/source/window/salframeview.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 240a915e4e12..bc87ea444710 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -154,7 +154,9 @@ static AquaSalFrame* getMouseContainerFrame() NSRect aRect = { { pFrame->maGeometry.nX, pFrame->maGeometry.nY }, { pFrame->maGeometry.nWidth, pFrame->maGeometry.nHeight } }; pFrame->VCLToCocoa( aRect ); - return [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ]; + NSWindow* pNSWindow = [super initWithContentRect: aRect styleMask: mpFrame->getStyleMask() backing: NSBackingStoreBuffered defer: NO ]; + [pNSWindow useOptimizedDrawing: YES]; // OSX recommendation when there are no overlapping subviews within the receiver + return pNSWindow; } -(AquaSalFrame*)getSalFrame -- cgit From 9015fa6906c13e8c2e36ed29f1ce5c222612b6e4 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 15 Nov 2010 16:04:30 +0100 Subject: #i112446# win-port baseline nowdays assumes SalShlData::mbWNT==true --- vcl/win/inc/saldata.hxx | 1 - vcl/win/source/app/saldata.cxx | 37 ++----- vcl/win/source/app/salinst.cxx | 48 +-------- vcl/win/source/gdi/salgdi3.cxx | 208 ++++--------------------------------- vcl/win/source/gdi/winlayout.cxx | 90 +++++----------- vcl/win/source/window/salframe.cxx | 129 ++--------------------- vcl/win/source/window/salobj.cxx | 12 +-- 7 files changed, 63 insertions(+), 462 deletions(-) (limited to 'vcl') diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx index ec67272ed07f..a960d117eed0 100644 --- a/vcl/win/inc/saldata.hxx +++ b/vcl/win/inc/saldata.hxx @@ -154,7 +154,6 @@ struct SalShlData UINT mnWheelScrollChars; // WheelScrollChars UINT mnWheelMsgId; // Wheel-Message-Id fuer W95 WORD mnVersion; // System-Version (311 == 3.11) - WIN_BOOL mbWNT; // kein W16/W95/W98 sondern ein NT WIN_BOOL mbW40; // Is System-Version >= 4.0 WIN_BOOL mbWXP; // Windows XP WIN_BOOL mbWPrinter; // true: use unicode printer functions diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index bb8a198a96e6..5f94029ad817 100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx @@ -119,42 +119,28 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong ) { - if ( aSalShlData.mbWNT ) - return SetWindowLongW( hWnd, nIndex, dwNewLong ); - else - return SetWindowLongA( hWnd, nIndex, dwNewLong ); + return SetWindowLongW( hWnd, nIndex, dwNewLong ); } // ----------------------------------------------------------------------- LONG ImplGetWindowLong( HWND hWnd, int nIndex ) { - if ( aSalShlData.mbWNT ) - return GetWindowLongW( hWnd, nIndex ); - else - return GetWindowLongA( hWnd, nIndex ); + return GetWindowLongW( hWnd, nIndex ); } // ----------------------------------------------------------------------- WIN_BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - if ( aSalShlData.mbWNT ) - return PostMessageW( hWnd, nMsg, wParam, lParam ); - else - return PostMessageA( hWnd, nMsg, wParam, lParam ); + return PostMessageW( hWnd, nMsg, wParam, lParam ); } // ----------------------------------------------------------------------- WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) { - WIN_BOOL bRet; - if ( aSalShlData.mbWNT ) - bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); - else - bRet = SendMessageA( hWnd, nMsg, wParam, lParam ); - + WIN_BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); return bRet; } @@ -162,29 +148,20 @@ WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) { - if ( aSalShlData.mbWNT ) - return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); - else - return GetMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); + return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); } // ----------------------------------------------------------------------- WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) { - if ( aSalShlData.mbWNT ) - return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); - else - return PeekMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); + return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); } // ----------------------------------------------------------------------- LONG ImplDispatchMessage( CONST MSG *lpMsg ) { - if ( aSalShlData.mbWNT ) - return DispatchMessageW( lpMsg ); - else - return DispatchMessageA( lpMsg ); + return DispatchMessageW( lpMsg ); } diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 419723ee6442..d05f64d147ed 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -503,7 +503,6 @@ SalInstance* CreateSalInstance() SalData* pSalData = GetSalData(); // determine the windows version - aSalShlData.mbWNT = 0; aSalShlData.mbWXP = 0; aSalShlData.mbWPrinter = 0; WORD nVer = (WORD)GetVersion(); @@ -516,7 +515,6 @@ SalInstance* CreateSalInstance() { if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) { - aSalShlData.mbWNT = 1; // Windows XP ? if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) @@ -531,8 +529,6 @@ SalInstance* CreateSalInstance() // register frame class if ( !pSalData->mhPrevInst ) { - if ( aSalShlData.mbWNT ) - { WNDCLASSEXW aWndClassEx; aWndClassEx.cbSize = sizeof( aWndClassEx ); aWndClassEx.style = CS_OWNDC; @@ -568,53 +564,11 @@ SalInstance* CreateSalInstance() aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW; if ( !RegisterClassExW( &aWndClassEx ) ) return NULL; - } - else - { - WNDCLASSEXA aWndClassEx; - aWndClassEx.cbSize = sizeof( aWndClassEx ); - aWndClassEx.style = CS_OWNDC; - aWndClassEx.lpfnWndProc = SalFrameWndProcA; - aWndClassEx.cbClsExtra = 0; - aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA; - aWndClassEx.hInstance = pSalData->mhInst; - aWndClassEx.hCursor = 0; - aWndClassEx.hbrBackground = 0; - aWndClassEx.lpszMenuName = 0; - aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEA; - ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm ); - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - - aWndClassEx.hIcon = 0; - aWndClassEx.hIconSm = 0; - aWndClassEx.style |= CS_SAVEBITS; - aWndClassEx.lpszClassName = SAL_SUBFRAME_CLASSNAMEA; - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - - aWndClassEx.style = 0; - aWndClassEx.lpfnWndProc = SalComWndProcA; - aWndClassEx.cbWndExtra = 0; - aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEA; - if ( !RegisterClassExA( &aWndClassEx ) ) - return NULL; - } } - HWND hComWnd; - if ( aSalShlData.mbWNT ) - { - hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW, + HWND hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW, L"", WS_POPUP, 0, 0, 0, 0, 0, 0, pSalData->mhInst, NULL ); - } - else - { - hComWnd = CreateWindowExA( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEA, - "", WS_POPUP, 0, 0, 0, 0, 0, 0, - pSalData->mhInst, NULL ); - } if ( !hComWnd ) return NULL; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index c8e0210196e6..29e4bd786735 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1366,10 +1366,6 @@ int CALLBACK SalEnumQueryFontProcExA( const ENUMLOGFONTEXA*, bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) { - bool bAvailable = false; - - if ( aSalShlData.mbWNT ) - { // Test, if Font available LOGFONTW aLogFont; memset( &aLogFont, 0, sizeof( aLogFont ) ); @@ -1381,27 +1377,9 @@ bool ImplIsFontAvailable( HDC hDC, const UniString& rName ) memcpy( aLogFont.lfFaceName, rName.GetBuffer(), nNameLen*sizeof( wchar_t ) ); aLogFont.lfFaceName[nNameLen] = 0; - EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, - (LPARAM)(void*)&bAvailable, 0 ); - } - else - { - ByteString aTemp = ImplSalGetWinAnsiString( rName ); - - // Test, if Font available - LOGFONTA aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - - UINT nNameLen = aTemp.Len(); - if ( nNameLen > sizeof( aLogFont.lfFaceName )-1 ) - nNameLen = sizeof( aLogFont.lfFaceName )-1; - memcpy( aLogFont.lfFaceName, aTemp.GetBuffer(), nNameLen ); - aLogFont.lfFaceName[nNameLen] = 0; - - EnumFontFamiliesExA( hDC, &aLogFont, (FONTENUMPROCA)SalEnumQueryFontProcExA, + bool bAvailable = false; + EnumFontFamiliesExW( hDC, &aLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW, (LPARAM)(void*)&bAvailable, 0 ); - } return bAvailable; } @@ -1564,7 +1542,7 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont // only required for virtual devices, see below for details hdcScreen = GetDC(0); - if( aSalShlData.mbWNT ) + if( true/*aSalShlData.mbWNT*/ ) { LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); @@ -1624,63 +1602,6 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont hNewFont = hNewFont2; } } - else - { - if( !mpLogFont ) - // mpLogFont is needed for getting the kerning pairs - // TODO: get them from somewhere else - mpLogFont = new LOGFONTA; - LOGFONTA& aLogFont = *mpLogFont; - ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true ); - - // on the display we prefer Courier New when Courier is a - // bitmap only font and we need to stretch or rotate it - if( mbScreen - && (i_pFont->mnWidth != 0 - || i_pFont->mnOrientation != 0 - || i_pFont->mpFontData == NULL - || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight)) - && !bImplSalCourierScalable - && bImplSalCourierNew - && (stricmp( aLogFont.lfFaceName, "Courier" ) == 0) ) - strncpy( aLogFont.lfFaceName, "Courier New", 11 ); - - // limit font requests to MAXFONTHEIGHT to work around driver problems - // TODO: share MAXFONTHEIGHT font instance - if( -aLogFont.lfHeight <= MAXFONTHEIGHT ) - o_rFontScale = 1.0; - else - { - o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; - aLogFont.lfHeight = -MAXFONTHEIGHT; - aLogFont.lfWidth = static_cast( aLogFont.lfWidth / o_rFontScale ); - } - - hNewFont = ::CreateFontIndirectA( &aLogFont ); - if( hdcScreen ) - { - // select font into screen hdc first to get an antialiased font - // see knowledge base article 305290: - // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface" - ::SelectFont( hdcScreen, ::SelectFont( hdcScreen , hNewFont ) ); - } - o_rOldFont = ::SelectFont( mhDC, hNewFont ); - - TEXTMETRICA aTextMetricA; - // when the font doesn't work try a replacement - if ( !::GetTextMetricsA( mhDC, &aTextMetricA ) ) - { - // the selected font doesn't work => try a replacement - // TODO: use its font fallback instead - LOGFONTA aTempLogFont = aLogFont; - strncpy( aTempLogFont.lfFaceName, "Courier New", 11 ); - aTempLogFont.lfPitchAndFamily = FIXED_PITCH; - HFONT hNewFont2 = CreateFontIndirectA( &aTempLogFont ); - ::SelectFont( mhDC, hNewFont2 ); - ::DeleteFont( hNewFont ); - hNewFont = hNewFont2; - } - } if( hdcScreen ) ::ReleaseDC( NULL, hdcScreen ); @@ -1767,18 +1688,9 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe // temporarily change the HDC to the font in the fallback level HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] ); - if ( aSalShlData.mbWNT ) - { wchar_t aFaceName[LF_FACESIZE+60]; if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) ) pMetric->maName = reinterpret_cast(aFaceName); - } - else - { - char aFaceName[LF_FACESIZE+60]; - if( ::GetTextFaceA( mhDC, sizeof(aFaceName), aFaceName ) ) - pMetric->maName = ImplSalGetUniString( aFaceName ); - } // get the font metric TEXTMETRICA aWinMetric; @@ -1842,11 +1754,6 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe pMetric->mnAscent += nHalfTmpExtLeading; pMetric->mnDescent += nOtherHalfTmpExtLeading; - - // #109280# HACK korean only: increase descent for wavelines and impr - if( !aSalShlData.mbWNT ) - if( mpWinFontData[nFallbackLevel]->SupportsKorean() ) - pMetric->mnDescent += pMetric->mnExtLeading; } pMetric->mnMinKashida = GetMinKashidaWidth(); @@ -2000,8 +1907,6 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) } mnFontKernPairCount = 0; - if ( aSalShlData.mbWNT ) - { KERNINGPAIR* pPairs = NULL; int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); if( nCount ) @@ -2019,27 +1924,6 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) #endif // GCP_KERN_HACK } } - else - { - if ( !mnFontCharSetCount ) - ImplGetAllFontCharSets( this ); - - if ( mnFontCharSetCount <= 1 ) - ImplAddKerningPairs( this ); - else - { - // Query All Kerning Pairs from all possible CharSets - for ( BYTE i = 0; i < mnFontCharSetCount; i++ ) - { - mpLogFont->lfCharSet = mpFontCharSets[i]; - HFONT hNewFont = CreateFontIndirectA( mpLogFont ); - HFONT hOldFont = SelectFont( mhDC, hNewFont ); - ImplAddKerningPairs( this ); - SelectFont( mhDC, hOldFont ); - DeleteFont( hNewFont ); - } - } - } mbFontKernInit = FALSE; @@ -2270,19 +2154,7 @@ void ImplReleaseTempFonts( SalData& rSalData ) } else { - if( aSalShlData.mbWNT ) - ::RemoveFontResourceW( reinterpret_cast(p->maFontFilePath.getStr()) ); - else - { - // poor man's string conversion because converter is gone - int nLen = p->maFontFilePath.getLength(); - char* pNameA = new char[ nLen + 1 ]; - for( int i = 0; i < nLen; ++i ) - pNameA[i] = (char)(p->maFontFilePath.getStr())[i]; - pNameA[ nLen ] = 0; - ::RemoveFontResourceA( pNameA ); - delete[] pNameA; - } + ::RemoveFontResourceW( reinterpret_cast(p->maFontFilePath.getStr()) ); } rSalData.mpTempFontItem = p->mpNextItem; @@ -2424,14 +2296,6 @@ bool WinSalGraphics::AddTempDevFont( ImplDevFontList* pFontList, return false; UINT nPreferedCharSet = DEFAULT_CHARSET; - if ( !aSalShlData.mbWNT ) - { - // for W98 guess charset preference from active codepage - CHARSETINFO aCharSetInfo; - DWORD nCP = GetACP(); - if ( TranslateCharsetInfo( (DWORD*)nCP, &aCharSetInfo, TCI_SRCCODEPAGE ) ) - nPreferedCharSet = aCharSetInfo.ciCharset; - } // create matching FontData struct aDFA.mbSymbolFlag = false; // TODO: how to know it without accessing the font? @@ -2536,24 +2400,12 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) if ( TranslateCharsetInfo( (DWORD*)nCP, &aCharSetInfo, TCI_SRCCODEPAGE ) ) aInfo.mnPreferedCharSet = aCharSetInfo.ciCharset; - if ( aSalShlData.mbWNT ) - { - LOGFONTW aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - aInfo.mpLogFontW = &aLogFont; - EnumFontFamiliesExW( mhDC, &aLogFont, + LOGFONTW aLogFont; + memset( &aLogFont, 0, sizeof( aLogFont ) ); + aLogFont.lfCharSet = DEFAULT_CHARSET; + aInfo.mpLogFontW = &aLogFont; + EnumFontFamiliesExW( mhDC, &aLogFont, (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 ); - } - else - { - LOGFONTA aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); - aLogFont.lfCharSet = DEFAULT_CHARSET; - aInfo.mpLogFontA = &aLogFont; - EnumFontFamiliesExA( mhDC, &aLogFont, - (FONTENUMPROCA)SalEnumFontsProcExA, (LPARAM)(void*)&aInfo, 0 ); - } // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt, // um in SetFont() evt. Courier auf Courier New zu mappen @@ -2592,12 +2444,7 @@ BOOL WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect ) GLYPHMETRICS aGM; aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0; aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0; - DWORD nSize = GDI_ERROR; - if ( aSalShlData.mbWNT ) - nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - else if( (nGGOFlags & GGO_GLYPH_INDEX) || (nIndex <= 255) ) - nSize = ::GetGlyphOutlineA( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); - + DWORD nSize = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGM, 0, NULL, &aMat ); if( nSize == GDI_ERROR ) return false; @@ -2617,7 +2464,6 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, { rB2DPolyPoly.clear(); - BOOL bRet = FALSE; HDC hDC = mhDC; // use unity matrix @@ -2631,29 +2477,20 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, nIndex &= GF_IDXMASK; GLYPHMETRICS aGlyphMetrics; - DWORD nSize1 = GDI_ERROR; - if ( aSalShlData.mbWNT ) - nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - else if( (nGGOFlags & GGO_GLYPH_INDEX) || (nIndex <= 255) ) - nSize1 = ::GetGlyphOutlineA( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); - + const DWORD nSize1 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat ); if( !nSize1 ) // blank glyphs are ok - bRet = TRUE; - else if( nSize1 != GDI_ERROR ) - { - BYTE* pData = new BYTE[ nSize1 ]; - DWORD nSize2; - if ( aSalShlData.mbWNT ) - nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); - else - nSize2 = ::GetGlyphOutlineA( hDC, nIndex, nGGOFlags, - &aGlyphMetrics, nSize1, pData, &aMat ); + return TRUE; + else if( nSize1 == GDI_ERROR ) + return FALSE; - if( nSize1 == nSize2 ) - { - bRet = TRUE; + BYTE* pData = new BYTE[ nSize1 ]; + const DWORD nSize2 = ::GetGlyphOutlineW( hDC, nIndex, nGGOFlags, + &aGlyphMetrics, nSize1, pData, &aMat ); + if( nSize1 != nSize2 ) + return FALSE; + + // TODO: avoid tools polygon by creating B2DPolygon directly int nPtSize = 512; Point* pPoints = new Point[ nPtSize ]; BYTE* pFlags = new BYTE[ nPtSize ]; @@ -2791,7 +2628,6 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, delete[] pPoints; delete[] pFlags; - } delete[] pData; } @@ -2803,7 +2639,7 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } - return bRet; + return TRUE; } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 82fa9bb4b5e1..6a4bbe885bd3 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -244,24 +244,11 @@ HFONT WinLayout::DisableFontScaling() const if( mfFontScale == 1.0 ) return 0; - HFONT hHugeFont = 0; - if( aSalShlData.mbWNT ) - { - LOGFONTW aLogFont; - ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectW( &aLogFont); - } - else - { - LOGFONTA aLogFont; - ::GetObjectA( mhFont, sizeof(LOGFONTA), &aLogFont); - aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); - aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); - hHugeFont = ::CreateFontIndirectA( &aLogFont); - } - + LOGFONTW aLogFont; + ::GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont); + aLogFont.lfHeight = (LONG)(mfFontScale * aLogFont.lfHeight); + aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth); + HFONT hHugeFont = ::CreateFontIndirectW( &aLogFont); if( !hHugeFont ) return 0; @@ -671,57 +658,30 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const Point aPos = GetDrawPosition( Point( mnBaseAdv, 0 ) ); - // #108267#, limit the number of glyphs to avoid paint errors - UINT limitedGlyphCount = Min( 8192, mnGlyphCount ); - if( mnDrawOptions || aSalShlData.mbWNT ) - { - // #108267#, break up into glyph portions of a limited size required by Win32 API - const unsigned int maxGlyphCount = 8192; - UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; - UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; + // #108267#, break up into glyph portions of a limited size required by Win32 API + const unsigned int maxGlyphCount = 8192; + UINT numGlyphPortions = mnGlyphCount / maxGlyphCount; + UINT remainingGlyphs = mnGlyphCount % maxGlyphCount; - if( numGlyphPortions ) - { - // #108267#,#109387# break up string into smaller chunks - // the output positions will be updated by windows (SetTextAlign) - unsigned int i,n; - POINT oldPos; - UINT oldTa = ::GetTextAlign( aHDC ); - ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); - ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); - for( i=n=0; nmhInst, (void*)pFrame ); - } if ( !hWnd ) { delete pFrame; @@ -617,21 +606,10 @@ HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, BOOL bAsChild ) nExSysStyle = 0; } - HWND hWnd = NULL; - if ( aSalShlData.mbWNT ) - { - LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW; - hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, - CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, - hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); - } - else - { - LPCSTR pClassName = SAL_SUBFRAME_CLASSNAMEA; - hWnd = CreateWindowExA( nExSysStyle, pClassName, "", nSysStyle, + LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW; + HWND hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) ); - } return hWnd; } @@ -2531,7 +2509,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, int nKeyLen = 0; if ( lParam ) { - if ( aSalShlData.mbWNT ) + if ( true/*aSalShlData.mbWNT*/ ) { nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, nMaxKeyLen ); // #i12401# the current unicows.dll has a bug in CharUpperBuffW, which corrupts the stack @@ -2553,32 +2531,6 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, } } } - else // !mbWnt - { - sal_Char aAnsiKeyBuf[ nMaxKeyLen ]; - int nAnsiKeyLen = GetKeyNameTextA( lParam, aAnsiKeyBuf, nMaxKeyLen ); - DBG_ASSERT( nAnsiKeyLen <= nMaxKeyLen, "Invalid key name length!" ); - if( nAnsiKeyLen > nMaxKeyLen ) - nAnsiKeyLen = 0; - else if( nAnsiKeyLen > 0 ) - { - // Capitalize just the first letter of key names - // TODO: check MCBS key names - CharLowerBuffA( aAnsiKeyBuf, nAnsiKeyLen ); - - bool bUpper = true; - for( sal_Char *pA=aAnsiKeyBuf, *pE=pA+nAnsiKeyLen; pA < pE; ++pA ) - { - if( bUpper ) - CharUpperBuffA( pA, 1 ); - bUpper = (*pA=='+') || (*pA=='-') || (*pA==' ') || (*pA=='.'); - } - - // Convert to Unicode and copy the data in the Unicode Buffer - nKeyLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, - aAnsiKeyBuf, nAnsiKeyLen, aKeyBuf, nMaxKeyLen ); - } - } } if ( (nKeyLen > 0) || pReplace ) @@ -3027,7 +2979,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) Font aAppFont = aStyleSettings.GetAppFont(); Font aIconFont = aStyleSettings.GetIconFont(); HDC hDC = GetDC( 0 ); - if ( aSalShlData.mbWNT ) + if( true/*aSalShlData.mbWNT*/ ) { NONCLIENTMETRICSW aNonClientMetrics; aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); @@ -3044,23 +2996,6 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) ImplSalUpdateStyleFontW( hDC, aLogFont, aIconFont ); } } - else - { - NONCLIENTMETRICSA aNonClientMetrics; - aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); - if ( SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) - { - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfMenuFont, aMenuFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfCaptionFont, aTitleFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfStatusFont, aHelpFont ); - ImplSalUpdateStyleFontA( hDC, aNonClientMetrics.lfMessageFont, aAppFont ); - - LOGFONTA aLogFont; - if ( SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) ) - ImplSalUpdateStyleFontA( hDC, aLogFont, aIconFont ); - } - } // get screen font resolution to calculate toolbox item size long nDPIY = GetDeviceCaps( hDC, LOGPIXELSY ); @@ -3649,27 +3584,7 @@ static void ImplUpdateInputLang( WinSalFrame* pFrame ) // If we are on Windows NT we use Unicode FrameProcs and so we // get Unicode charcodes directly from Windows // no need to set up a code page - if ( aSalShlData.mbWNT ) - return; - - if ( !nLang ) - { - pFrame->mnInputLang = 0; - pFrame->mnInputCodePage = GetACP(); - } - else if ( bLanguageChange ) - { - sal_Char aBuf[10]; - if ( GetLocaleInfoA( MAKELCID( nLang, SORT_DEFAULT ), LOCALE_IDEFAULTANSICODEPAGE, - aBuf, sizeof(aBuf) ) > 0 ) - { - pFrame->mnInputCodePage = ImplStrToNum( aBuf ); - if ( !pFrame->mnInputCodePage ) - pFrame->mnInputCodePage = GetACP(); - } - else - pFrame->mnInputCodePage = GetACP(); - } + return; } @@ -3679,29 +3594,7 @@ static sal_Unicode ImplGetCharCode( WinSalFrame* pFrame, WPARAM nCharCode ) // If we are on Windows NT we use Unicode FrameProcs and so we // get Unicode charcodes directly from Windows - if ( aSalShlData.mbWNT ) - return (sal_Unicode)nCharCode; - - sal_Char aCharBuf[2]; - int nCharLen; - WCHAR c; - if ( nCharCode > 0xFF ) - { - aCharBuf[0] = (sal_Char)(nCharCode>>8); - aCharBuf[1] = (sal_Char)nCharCode; - nCharLen = 2; - } - else - { - aCharBuf[0] = (sal_Char)nCharCode; - nCharLen = 1; - } - if ( ::MultiByteToWideChar( pFrame->mnInputCodePage, - MB_PRECOMPOSED, - aCharBuf, nCharLen, &c, 1 ) ) - return (sal_Unicode)c; - else - return (sal_Unicode)nCharCode; + return (sal_Unicode)nCharCode; } // ----------------------------------------------------------------------- @@ -4507,16 +4400,8 @@ static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg, { if ( lParam ) { - if ( aSalShlData.mbWNT ) - { if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 ) nSalEvent = SALEVENT_PRINTERCHANGED; - } - else - { - if ( stricmp( (const char*)lParam, "devices" ) == 0 ) - nSalEvent = SALEVENT_PRINTERCHANGED; - } } } diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index 2f657968284f..4c38ec49d403 100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx @@ -493,20 +493,10 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent ) // Hook installieren, wenn es das erste SalObject ist if ( !pSalData->mpFirstObject ) { - if ( aSalShlData.mbWNT ) - { - pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC, - SalSysMsgProc, - pSalData->mhInst, - pSalData->mnAppThreadId ); - } - else - { - pSalData->mhSalObjMsgHook = SetWindowsHookExA( WH_CALLWNDPROC, + pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC, SalSysMsgProc, pSalData->mhInst, pSalData->mnAppThreadId ); - } } if ( !pSalData->mbObjClassInit ) -- cgit From b3a698533c14db14beae871486270b752d21774c Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 15 Nov 2010 16:15:10 +0100 Subject: vcl117: #i115133# catch an XError in gtk_im_context_set_cursor_location --- vcl/unx/gtk/window/gtkframe.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index d04d5c0ce684..9181ee3fd40d 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -3339,7 +3339,9 @@ void GtkSalFrame::IMHandler::updateIMSpotLocation() aArea.y = aPosEvent.mnY; aArea.width = aPosEvent.mnWidth; aArea.height = aPosEvent.mnHeight; + m_pFrame->getDisplay()->GetXLib()->PushXErrorLevel( true ); gtk_im_context_set_cursor_location( m_pIMContext, &aArea ); + m_pFrame->getDisplay()->GetXLib()->PopXErrorLevel(); } void GtkSalFrame::IMHandler::setInputContext( SalInputContext* ) -- cgit From cd17f5da7f69678d3cec9af251dbfc3651b950be Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 16 Nov 2010 17:28:04 +0100 Subject: vcl117: add debug clarity --- vcl/unx/source/app/saldisp.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'vcl') diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 354c4d433d42..063b03de7798 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2575,6 +2575,7 @@ void SalDisplay::PrintInfo() const fprintf( stderr, "\tProperties \t0x%lX\n", GetProperties() ); if( eWindowManager_ != otherwm ) fprintf( stderr, "\tWindowmanager \t%d\n", eWindowManager_ ); + fprintf( stderr, "\tWMName \t%s\n", rtl::OUStringToOString( getWMAdaptor()->getWindowManagerName(), osl_getThreadTextEncoding() ).getStr() ); } fprintf( stderr, "Screen\n" ); fprintf( stderr, "\tResolution/Size \t%ld*%ld %ld*%ld %.1lf\"\n", -- cgit From 269f91cd65551454c94d71bfd6f688c949c22a66 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 16 Nov 2010 17:31:59 +0100 Subject: #i110171# RIP XLFD --- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 7 +- vcl/unx/inc/saldisp.hxx | 18 - vcl/unx/inc/salgdi.h | 9 +- vcl/unx/inc/xfont.hxx | 162 ----- vcl/unx/source/app/saldisp.cxx | 4 - vcl/unx/source/gdi/makefile.mk | 5 - vcl/unx/source/gdi/salgdi.cxx | 10 +- vcl/unx/source/gdi/salgdi3.cxx | 561 +---------------- vcl/unx/source/gdi/xfont.cxx | 780 ----------------------- vcl/unx/source/gdi/xlfd_attr.cxx | 686 -------------------- vcl/unx/source/gdi/xlfd_attr.hxx | 228 ------- vcl/unx/source/gdi/xlfd_extd.cxx | 1001 ------------------------------ vcl/unx/source/gdi/xlfd_extd.hxx | 272 -------- vcl/unx/source/gdi/xlfd_smpl.cxx | 268 -------- vcl/unx/source/gdi/xlfd_smpl.hxx | 92 --- 15 files changed, 11 insertions(+), 4092 deletions(-) delete mode 100644 vcl/unx/inc/xfont.hxx delete mode 100644 vcl/unx/source/gdi/xfont.cxx delete mode 100644 vcl/unx/source/gdi/xlfd_attr.cxx delete mode 100644 vcl/unx/source/gdi/xlfd_attr.hxx delete mode 100644 vcl/unx/source/gdi/xlfd_extd.cxx delete mode 100644 vcl/unx/source/gdi/xlfd_extd.hxx delete mode 100644 vcl/unx/source/gdi/xlfd_smpl.cxx delete mode 100644 vcl/unx/source/gdi/xlfd_smpl.hxx (limited to 'vcl') diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 318f593ac6a3..ff615f5ede74 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -737,7 +737,7 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, { BOOL returnVal = FALSE; // get a GC with current clipping region set - SelectFont(); + GetFontGC(); // theme changed ? @@ -3687,7 +3687,8 @@ GdkPixmap* GtkSalGraphics::NWGetPixmapFromScreen( Rectangle srcRect ) BOOL GtkSalGraphics::NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect ) { // The GC can't be null, otherwise we'd have no clip region - if( SelectFont() == NULL ) + GC aFontGC = GetFontGC(); + if( aFontGC == NULL ) { std::fprintf(stderr, "salnativewidgets.cxx: no valid GC\n" ); return( FALSE ); @@ -3702,7 +3703,7 @@ BOOL GtkSalGraphics::NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRe gdk_screen_get_number( gdk_drawable_get_screen( GDK_DRAWABLE(pPixmap) ) ), gdk_drawable_get_depth( GDK_DRAWABLE(pPixmap) ), GetDrawable(), m_nScreen, GetVisual().GetDepth(), - SelectFont(), + aFontGC, 0, 0, dstRect.GetWidth(), dstRect.GetHeight(), dstRect.Left(), dstRect.Top() ); return( TRUE ); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 99c9bea699d6..89efad3cde4d 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -269,15 +269,10 @@ public: class SalI18N_InputMethod; class SalI18N_KeyboardExtension; -class XlfdStorage; -class ExtendedFontStruct; -class ExtendedXlfd; class AttributeProvider; class SalUnicodeConverter; class SalConverterCache; -DECLARE_LIST( SalFontCache, ExtendedFontStruct* ) - extern "C" { struct SnDisplay; struct SnLauncheeContext; @@ -349,8 +344,6 @@ protected: SalI18N_KeyboardExtension *mpKbdExtension; AttributeProvider *mpFactory; - XlfdStorage *mpFontList; - const ExtendedXlfd *mpFallbackFactory; Display *pDisp_; // X Display int m_nDefaultScreen; // XDefaultScreen @@ -374,8 +367,6 @@ protected: XLIB_Cursor aPointerCache_[POINTER_COUNT]; SalFrame* m_pCapture; - mutable SalFontCache* m_pFontCache; - // Keyboard BOOL bNumLockFromXS_; // Num Lock handled by X Server int nNumLockIndex_; // modifier index in modmap @@ -397,7 +388,6 @@ protected: mutable XLIB_Time m_nLastUserEventTime; // mutable because changed on first access - void DestroyFontCache(); virtual long Dispatch( XEvent *pEvent ) = 0; void InitXinerama(); void InitRandR( XLIB_Window aRoot ) const; @@ -434,14 +424,6 @@ public: void PrintEvent( const ByteString &rComment, XEvent *pEvent ) const; - XlfdStorage* GetXlfdList() const; - ExtendedFontStruct* - GetFont( const ExtendedXlfd *pFont, - const Size& rPixelSize, sal_Bool bVertical ) const; - const ExtendedXlfd* - GetFallbackFactory() - { return mpFallbackFactory; } - void Beep() const; void ModifierMapping(); diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index b5fdce50eee9..6a77d4bacf96 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -38,8 +38,9 @@ class SalFontCacheItem; #include "vcl/salgtype.hxx" #include "tools/fract.hxx" #include "vcl/dllapi.h" +#include +#include #include -#include "xfont.hxx" // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= struct ImplFontMetricData; @@ -100,7 +101,6 @@ protected: Pixel nPenPixel_; GC pFontGC_; // Font attributes - ExtendedFontStructRef mXFont[ MAX_FALLBACK ]; ServerFont* mpServerFont[ MAX_FALLBACK ]; SalColor nTextColor_; @@ -185,7 +185,7 @@ protected: const SalBitmap &rTransparentBitmap, SalColor nTransparentColor ); - GC SelectFont(); + GC GetFontGC(); bool setFont( const ImplFontSelectData* pEntry, int nFallbackLevel ); void drawMaskedBitmap( const SalTwoRect* pPosAry, @@ -193,9 +193,6 @@ protected: const SalBitmap& rTransparentBitmap ); protected: - void DrawStringUCS2MB( ExtendedFontStruct& rFont, const Point&, - const sal_Unicode* pStr, int nLength ); - void DrawPrinterString( const SalLayout& ); void DrawServerFontString( const ServerFontLayout& ); diff --git a/vcl/unx/inc/xfont.hxx b/vcl/unx/inc/xfont.hxx deleted file mode 100644 index 4041ed7ce67d..000000000000 --- a/vcl/unx/inc/xfont.hxx +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef EXTENDED_FONTSTRUCT_HXX -#define EXTENDED_FONTSTRUCT_HXX - -#ifndef _XLIB_H_ -#include -#include -#include -#endif -#include -#include -#include -#include - -typedef unsigned short sal_MultiByte; - -class ImplFontMetricData; -class ExtendedXlfd; - -struct VerticalTextItem -{ - BOOL mbFixed; - XFontStruct* mpXFontStruct; - const sal_Unicode* mpString; - int mnLength; - int mnTransX; - int mnTransY; - int mnFixedAdvance; - int* mpAdvanceAry; - - VerticalTextItem( XFontStruct* pXFontStruct, - const sal_Unicode* pString, - int nLength, - int nTransX, - int nTransY, - int nFixedAdvance ) - : mbFixed( TRUE ), - mpXFontStruct( pXFontStruct ), - mpString( pString ), - mnLength( nLength ), - mnTransX( nTransX ), - mnTransY( nTransY ), - mnFixedAdvance( nFixedAdvance ) - {} - - VerticalTextItem( XFontStruct* pXFontStruct, - const sal_Unicode* pString, - int nLength, - int nTransX, - int nTransY, - int* pAdvanceAry ) - : mbFixed( FALSE ), - mpXFontStruct( pXFontStruct ), - mpString( pString ), - mnLength( nLength ), - mnTransX( nTransX ), - mnTransY( nTransY ), - mpAdvanceAry( pAdvanceAry ) - {} - - ~VerticalTextItem() - { - if (!mbFixed) - { - delete( mpAdvanceAry ); - } - } -}; - -class ExtendedFontStruct : public SvRefBase -{ - private: - Display* mpDisplay; - Size maPixelSize; - float mfXScale; - float mfYScale; - sal_Size mnDefaultWidth; - sal_Bool mbVertical; - rtl_TextEncoding mnCachedEncoding; - rtl_TextEncoding mnAsciiEncoding; - - ExtendedXlfd* mpXlfd; - XFontStruct** mpXFontStruct; - - // unicode range cache - mutable sal_uInt32* mpRangeCodes; - mutable int mnRangeCount; - - int LoadEncoding( rtl_TextEncoding nEncoding ); - FontPitch GetSpacing( rtl_TextEncoding nEncoding ); - bool GetFontBoundingBox( XCharStruct *pCharStruct, - int *pAscent, int *pDescent ) ; - - sal_Size GetDefaultWidth(); - sal_Size GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray, - rtl_TextEncoding nEncoding ); - sal_Size GetCharWidthUTF16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray ); - sal_Size GetCharWidth16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32 *pWidthArray, ExtendedFontStruct *pFallback ); - public: - ExtendedFontStruct( Display* pDisplay, - const Size& rPixelSize, sal_Bool bVertical, - ExtendedXlfd* pXlfd ); - ~ExtendedFontStruct(); - bool Match( const ExtendedXlfd *pXlfd, - const Size& rPixelSize, sal_Bool bVertical ) const; - XFontStruct* GetFontStruct( rtl_TextEncoding nEncoding ); - XFontStruct* GetFontStruct( sal_Unicode nChar, - rtl_TextEncoding *pEncoding ); - bool ToImplFontMetricData( ImplFontMetricData *pMetric ); - rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const; - sal_Size GetCharWidth( sal_Unicode, - sal_Int32* pPhysWidth, sal_Int32* pLogWidth ); - int GetFontCodeRanges( sal_uInt32* pCodePairs ) const; - bool HasUnicodeChar( sal_Unicode ) const; -}; - -// Declaration and Implementation for ExtendedFontStructRef: Add RefCounting -// to ExtendedFontStruct (it's not possible to separate decl and impl into -// a separate source file: all ref member functions are inline -SV_DECL_IMPL_REF( ExtendedFontStruct ); - -class X11FontLayout : public GenericSalLayout -{ -public: - X11FontLayout( ExtendedFontStruct& ); - virtual bool LayoutText( ImplLayoutArgs& ); - virtual void AdjustLayout( ImplLayoutArgs& ); - virtual void DrawText( SalGraphics& ) const; - -private: - ExtendedFontStruct& mrFont; -}; - -#endif /* EXTENDED_FONTSTRUCT_HXX */ diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 063b03de7798..cd3d7ea06fde 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -508,7 +508,6 @@ BOOL SalDisplay::BestVisual( Display *pDisplay, SalDisplay::SalDisplay( Display *display ) : mpInputMethod( NULL ), - mpFallbackFactory ( NULL ), pDisp_( display ), m_pWMAdaptor( NULL ), m_pDtIntegrator( NULL ), @@ -557,7 +556,6 @@ void SalDisplay::doDestruct() m_pDtIntegrator = NULL; X11SalBitmap::ImplDestroyCache(); X11SalGraphics::releaseGlyphPeer(); - DestroyFontCache(); if( IsDisplay() ) { @@ -814,8 +812,6 @@ void SalDisplay::Init() eWindowManager_ = otherwm; nProperties_ = PROPERTY_DEFAULT; hEventGuard_ = NULL; - m_pFontCache = NULL; - mpFontList = (XlfdStorage*)NULL; mpFactory = (AttributeProvider*)NULL; m_pCapture = NULL; m_bXinerama = false; diff --git a/vcl/unx/source/gdi/makefile.mk b/vcl/unx/source/gdi/makefile.mk index 536aadcac015..7e889266a831 100644 --- a/vcl/unx/source/gdi/makefile.mk +++ b/vcl/unx/source/gdi/makefile.mk @@ -53,17 +53,12 @@ SLOFILES= \ $(SLO)$/salvd.obj \ $(SLO)$/dtint.obj \ $(SLO)$/salcvt.obj \ - $(SLO)$/xfont.obj \ - $(SLO)$/xlfd_attr.obj \ - $(SLO)$/xlfd_extd.obj \ - $(SLO)$/xlfd_smpl.obj \ $(SLO)$/salgdi3.obj \ $(SLO)$/gcach_xpeer.obj \ $(SLO)$/xrender_peer.obj \ $(SLO)$/pspgraphics.obj EXCEPTIONSFILES=\ - $(SLO)$/xlfd_extd.obj \ $(SLO)$/salgdi.obj \ $(SLO)$/salbmp.obj \ $(SLO)$/salgdi3.obj \ diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 9215f2e25b16..b2e40310a03e 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -111,12 +111,8 @@ X11SalGraphics::X11SalGraphics() nPenPixel_ = 0; nPenColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black - pFontGC_ = NULL; for( int i = 0; i < MAX_FALLBACK; ++i ) - { - mXFont[i] = NULL; mpServerFont[i] = NULL; - } nTextPixel_ = 0; nTextColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black @@ -144,7 +140,6 @@ X11SalGraphics::X11SalGraphics() bPrinter_ = FALSE; bVirDev_ = FALSE; bPenGC_ = FALSE; - bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; @@ -174,7 +169,6 @@ void X11SalGraphics::freeResources() if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None; if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None; - if( pFontGC_ ) XFreeGC( pDisplay, pFontGC_ ), pFontGC_ = None; if( pBrushGC_ ) XFreeGC( pDisplay, pBrushGC_ ), pBrushGC_ = None; if( pMonoGC_ ) XFreeGC( pDisplay, pMonoGC_ ), pMonoGC_ = None; if( pCopyGC_ ) XFreeGC( pDisplay, pCopyGC_ ), pCopyGC_ = None; @@ -189,7 +183,7 @@ void X11SalGraphics::freeResources() if( m_aRenderPicture ) XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0; - bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false; + bPenGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false; } void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen ) @@ -582,7 +576,6 @@ void X11SalGraphics::ResetClipRegion() if( pClipRegion_ ) { bPenGC_ = FALSE; - bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; @@ -632,7 +625,6 @@ bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) void X11SalGraphics::EndSetClipRegion() { bPenGC_ = FALSE; - bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 62e575ebc5ef..360c7e95d8f9 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -46,11 +46,7 @@ #include "salgdi.h" #include "pspgraphics.h" #include "salvd.h" -#include "xfont.hxx" #include -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" -#include "xlfd_extd.hxx" #include "salcvt.hxx" #include "vcl/printergfx.hxx" @@ -112,391 +108,6 @@ struct _XRegion }; using namespace rtl; -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -// ---------------------------------------------------------------------------- -// -// manage X11 fonts and self rastered fonts -// -// ---------------------------------------------------------------------------- - -#ifndef _USE_PRINT_EXTENSION_ - -class FontLookup -{ - public: - - struct hash; - struct equal; - typedef ::std::hash_set< FontLookup, - FontLookup::hash, - FontLookup::equal > fl_hashset; - - private: - - rtl::OString maName; - FontWeight mnWeight; - FontItalic mnItalic; - sal_Bool mbDisplay; - - public: - - FontLookup ( ::std::list< psp::fontID >::iterator& it, - const psp::PrintFontManager& rMgr ); - FontLookup (const Xlfd& rFont); - FontLookup (const FontLookup &rRef) : - maName (rRef.maName), - mnWeight (rRef.mnWeight), - mnItalic (rRef.mnItalic), - mbDisplay(rRef.mbDisplay) - {} - ~FontLookup () - {} - - static void BuildSet (fl_hashset& rSet); - static bool InSet (const fl_hashset& rSet, const Xlfd& rXfld); - bool InSet (const fl_hashset& rSet) const; - - bool operator== (const FontLookup &rRef) const - { - return (abs(mnWeight - rRef.mnWeight) < 2) - && (mnItalic == rRef.mnItalic) - && (maName == rRef.maName) - && (mbDisplay== rRef.mbDisplay); - } - FontLookup& operator= (const FontLookup &rRef) - { - mnWeight = rRef.mnWeight; - mnItalic = rRef.mnItalic; - maName = rRef.maName; - mbDisplay= rRef.mbDisplay; - - return *this; - } - size_t Hash() const - { - return maName.hashCode (); - } - - struct equal - { - bool operator()(const FontLookup &r1, const FontLookup &r2) const - { - return r1 == r2; - } - }; - struct hash - { - size_t operator()(const FontLookup &rArg) const - { - return rArg.Hash(); - } - }; -}; - -FontLookup::FontLookup ( ::std::list< psp::fontID >::iterator& it, - const psp::PrintFontManager& rMgr ) -{ - psp::FastPrintFontInfo aInfo; - if (rMgr.getFontFastInfo (*it, aInfo)) - { - mnItalic = PspGraphics::ToFontItalic (aInfo.m_eItalic); - mnWeight = PspGraphics::ToFontWeight (aInfo.m_eWeight); - mbDisplay= aInfo.m_eType == psp::fonttype::Builtin - || aInfo.m_eType == psp::fonttype::Unknown ? False : True; - maName = rtl::OUStringToOString - ( aInfo.m_aFamilyName, - RTL_TEXTENCODING_ISO_8859_1).toAsciiLowerCase(); - - sal_Int32 n_length = maName.getLength(); - const sal_Char* p_from = maName.getStr(); - sal_Char* p_to = (sal_Char*)alloca (n_length + 1); - - sal_Int32 i, j; - for (i = 0, j = 0; i < n_length; i++) - { - if ( p_from[i] != ' ' ) - p_to[j++] = p_from[i]; - } - maName = rtl::OString (p_to, j); - if (mnItalic == ITALIC_OBLIQUE) - mnItalic = ITALIC_NORMAL; - } - else - { - mnItalic = ITALIC_DONTKNOW; - mnWeight = WEIGHT_DONTKNOW; - mbDisplay= False; - } -} - -FontLookup::FontLookup (const Xlfd& rFont) -{ - AttributeProvider* pFactory = rFont.mpFactory; - Attribute* pAttr; - - pAttr = pFactory->RetrieveSlant (rFont.mnSlant); - mnItalic = (FontItalic)pAttr->GetValue(); - pAttr = pFactory->RetrieveWeight (rFont.mnWeight); - mnWeight = (FontWeight)pAttr->GetValue(); - pAttr = pFactory->RetrieveFamily (rFont.mnFamily); - maName = pAttr->GetKey(); - - if (mnItalic == ITALIC_OBLIQUE) - mnItalic = ITALIC_NORMAL; - - mbDisplay = True; -} - -void -FontLookup::BuildSet (FontLookup::fl_hashset &rSet) -{ - ::std::list< psp::fontID > aIdList; - - psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - rMgr.getFontList( aIdList, NULL, false ); - - ::std::list< psp::fontID >::iterator it; - for (it = aIdList.begin(); it != aIdList.end(); ++it) - { - FontLookup aItem (it, rMgr); - rSet.insert (aItem); - } -} - -bool -FontLookup::InSet (const FontLookup::fl_hashset& rSet) const -{ - fl_hashset::const_iterator it = rSet.find(*this); - return it == rSet.end() ? false : true; -} - -bool -FontLookup::InSet (const FontLookup::fl_hashset& rSet, const Xlfd& rXlfd) -{ - FontLookup aNeedle (rXlfd); - return aNeedle.InSet (rSet); -} - -#endif - -// ---------------------------------------------------------------------------- -// -// SalDisplay -// -// ---------------------------------------------------------------------------- - -XlfdStorage* -SalDisplay::GetXlfdList() const -{ - if ( mpFontList != NULL ) - { - return mpFontList; - } - else - { - const_cast(this)->mpFactory = new AttributeProvider; - const_cast(this)->mpFontList = new XlfdStorage; - const_cast(this)->mpFallbackFactory = new VirtualXlfd; - - int i, nFontCount; - const int nMaxCount = 64 * 1024 - 1; - Display *pDisplay = GetDisplay(); - char **ppFontList = XListFonts(pDisplay, "-*", nMaxCount, &nFontCount); - - // - // create a list of simple Xlfd font information - // - - Xlfd *pXlfdList = (Xlfd*)malloc( nFontCount * sizeof(Xlfd) ); - int nXlfdCount = 0; - - for ( i = 0; i < nFontCount; i++ ) - { - if ( pXlfdList[ nXlfdCount ].FromString(ppFontList[i], mpFactory) ) - ++nXlfdCount; - } - - XFreeFontNames( ppFontList ); - - mpFactory->AddClassification(); - // add some pretty print description - mpFactory->AddAnnotation(); - // misc feature checking - mpFactory->TagFeature(); - - // sort according to font style - qsort( pXlfdList, nXlfdCount, sizeof(Xlfd), XlfdCompare ); - -#ifndef _USE_PRINT_EXTENSION_ - // create a list of fonts already managed by the fontmanager - FontLookup::fl_hashset aSet; - FontLookup::BuildSet (aSet); -#endif - - // - // create a font list with merged encoding information - // - - BitmapXlfdStorage aBitmapList; - ScalableXlfd *pScalableFont = NULL; - - int nFrom = 0; - for ( i = 0; i < nXlfdCount; i++ ) - { - // exclude openlook glyph and cursor - Attribute *pAttr = mpFactory->RetrieveFamily(pXlfdList[i].mnFamily); - if ( pAttr->HasFeature( XLFD_FEATURE_OL_GLYPH - | XLFD_FEATURE_OL_CURSOR) ) - continue; - // exclude fonts with unknown encoding - if ( pXlfdList[i].GetEncoding() == RTL_TEXTENCODING_DONTKNOW ) - continue; - // exclude "interface system" and "interface user" - if (pAttr->HasFeature( XLFD_FEATURE_APPLICATION_FONT ) ) - continue; - // exclude fonts already managed by fontmanager, anyway keep - // gui fonts: they are candidates for GetInterfaceFont () - if (pXlfdList[i].Fonttype() == eTypeScalable) - ((VirtualXlfd*)mpFallbackFactory)->FilterInterfaceFont (pXlfdList + i); -#ifndef _USE_PRINT_EXTENSION_ - if (FontLookup::InSet (aSet, pXlfdList[i])) - continue; -#endif - Bool bSameOutline = pXlfdList[i].SameFontoutline(pXlfdList + nFrom); - XlfdFonttype eType = pXlfdList[i].Fonttype(); - - // flush the old merged font list if the name doesn't match any more - if ( !bSameOutline ) - { - mpFontList->Add( pScalableFont ); - mpFontList->Add( &aBitmapList ); - pScalableFont = NULL; - aBitmapList.Reset(); - } - - // merge the font or generate a new one - switch( eType ) - { - case eTypeScalable: - if ( pScalableFont == NULL ) - pScalableFont = new ScalableXlfd; - pScalableFont->AddEncoding(pXlfdList + i); - break; - - case eTypeBitmap: - aBitmapList.AddBitmapFont( pXlfdList + i ); - break; - - case eTypeScalableBitmap: - // ignore scaled X11 bitmap fonts because they look too ugly - default: - break; - } - - nFrom = i; - } - - // flush the merged list into the global list - mpFontList->Add( pScalableFont ); - mpFontList->Add( &aBitmapList ); - if (mpFallbackFactory->NumEncodings() > 0) - mpFontList->Add( mpFallbackFactory ); - // cleanup the list of simple font information - if ( pXlfdList != NULL ) - free( pXlfdList ); - - return mpFontList; - } -} - -// --------------------------------------------------------------------------- - -ExtendedFontStruct* -SalDisplay::GetFont( const ExtendedXlfd *pRequestedFont, - const Size& rPixelSize, sal_Bool bVertical ) const -{ - // TODO: either get rid of X11 fonts or get rid of the non-hashmapped cache - if( !m_pFontCache ) - { - m_pFontCache = new SalFontCache( 64, 64, 16 ); // ??? - } - else - { - ExtendedFontStruct *pItem; - for ( pItem = m_pFontCache->First(); - pItem != NULL; - pItem = m_pFontCache->Next() ) - { - if ( pItem->Match(pRequestedFont, rPixelSize, bVertical) ) - { - if( m_pFontCache->GetCurPos() ) - { - m_pFontCache->Remove( pItem ); - m_pFontCache->Insert( pItem, 0UL ); - } - return pItem; - } - } - } - - // before we expand the cache, we look for very old and unused items - if( m_pFontCache->Count() >= 64 ) - { - ExtendedFontStruct *pItem; - for ( pItem = m_pFontCache->Last(); - pItem != NULL; - pItem = m_pFontCache->Prev() ) - { - if( 1 == pItem->GetRefCount() ) - { - m_pFontCache->Remove( pItem ); - pItem->ReleaseRef(); - if( m_pFontCache->Count() < 64 ) - break; - } - } - } - - ExtendedFontStruct *pItem = new ExtendedFontStruct( GetDisplay(), - rPixelSize, bVertical, - const_cast(pRequestedFont) ); - m_pFontCache->Insert( pItem, 0UL ); - pItem->AddRef(); - - return pItem; -} - -// --------------------------------------------------------------------------- - -void -SalDisplay::DestroyFontCache() -{ - if( m_pFontCache ) - { - ExtendedFontStruct *pItem = m_pFontCache->First(); - while( pItem ) - { - delete pItem; - pItem = m_pFontCache->Next(); - } - delete m_pFontCache; - } - if( mpFontList ) - { - mpFontList->Dispose(); - delete mpFontList; - } - if ( mpFactory ) - { - delete mpFactory; - } - - m_pFontCache = (SalFontCache*)NULL; - mpFontList = (XlfdStorage*)NULL; - mpFactory = (AttributeProvider*)NULL; -} - // =========================================================================== // PspKernInfo allows on-demand-querying of psprint provided kerning info (#i29881#) @@ -538,7 +149,7 @@ void PspKernInfo::Initialize() const // ---------------------------------------------------------------------------- GC -X11SalGraphics::SelectFont() +X11SalGraphics::GetFontGC() { Display *pDisplay = GetXDisplay(); @@ -594,8 +205,6 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev // release all no longer needed font resources for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i ) { - mXFont[i] = NULL; // ->ReleaseRef() - if( mpServerFont[i] != NULL ) { // old server side font is no longer referenced @@ -614,18 +223,6 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev if( !pEntry->mpFontData ) return false; - // handle the request for a native X11-font - if( ImplX11FontData::CheckFontData( *pEntry->mpFontData ) ) - { - const ImplX11FontData* pRequestedFont = static_cast( pEntry->mpFontData ); - const ExtendedXlfd& rX11Font = pRequestedFont->GetExtendedXlfd(); - - Size aReqSize( pEntry->mnWidth, pEntry->mnHeight ); - mXFont[ nFallbackLevel ] = GetDisplay()->GetFont( &rX11Font, aReqSize, bFontVertical_ ); - bFontGC_ = FALSE; - return true; - } - // handle the request for a non-native X11-font => use the GlyphCache ServerFont* pServerFont = GlyphCache::GetInstance().CacheFont( *pEntry ); if( pServerFont != NULL ) @@ -674,83 +271,6 @@ void ImplServerFontEntry::HandleFontOptions( void ) //-------------------------------------------------------------------------- -inline sal_Unicode SwapBytes( const sal_Unicode nIn ) -{ - return ((nIn >> 8) & 0x00ff) | ((nIn & 0x00ff) << 8); -} - -// draw string in a specific multibyte encoding -static void -ConvertTextItem16( XTextItem16* pTextItem, rtl_TextEncoding nEncoding ) -{ - if ( (pTextItem == NULL) || (pTextItem->nchars <= 0) ) - return; - - SalConverterCache* pCvt = SalConverterCache::GetInstance(); - // convert the string into the font encoding - sal_Size nSize; - sal_Size nBufferSize = pTextItem->nchars * 2; - sal_Char *pBuffer = (sal_Char*)alloca( nBufferSize ); - - nSize = pCvt->ConvertStringUTF16( (sal_Unicode*)pTextItem->chars, pTextItem->nchars, - pBuffer, nBufferSize, nEncoding); - - sal_Char *pTextChars = (sal_Char*)pTextItem->chars; - unsigned int n = 0, m = 0; - - if ( nEncoding == RTL_TEXTENCODING_GB_2312 - || nEncoding == RTL_TEXTENCODING_GBT_12345 - || nEncoding == RTL_TEXTENCODING_GBK - || nEncoding == RTL_TEXTENCODING_BIG5 ) - { - // GB and Big5 needs special treatment since chars can be single or - // double byte: encoding is - // [ 0x00 - 0x7f ] | [ 0x81 - 0xfe ] [ 0x40 - 0x7e 0x80 - 0xfe ] - while ( n < nSize ) - { - if ( (unsigned char)pBuffer[ n ] < 0x80 ) - { - pTextChars[ m++ ] = 0x0; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - else - { - pTextChars[ m++ ] = pBuffer[ n++ ]; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - } - pTextItem->nchars = m / 2; - } - else - if ( pCvt->IsSingleByteEncoding(nEncoding) ) - { - // Single Byte encoding has to be padded - while ( n < nSize ) - { - pTextChars[ m++ ] = 0x0; - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - pTextItem->nchars = nSize; - } - else - { - while ( n < nSize ) - { - pTextChars[ m++ ] = pBuffer[ n++ ]; - } - pTextItem->nchars = nSize / 2; - } - - // XXX FIXME - if ( (nEncoding == RTL_TEXTENCODING_GB_2312) - || (nEncoding == RTL_TEXTENCODING_EUC_KR) ) - { - for (unsigned int n_char = 0; n_char < m; n_char++ ) - pTextChars[ n_char ] &= 0x7F; - } -} - -//-------------------------------------------------------------------------- namespace { class CairoWrapper @@ -1289,7 +809,7 @@ bool X11SalGraphics::DrawServerAAForcedString( const ServerFontLayout& rLayout ) } // prepare context - GC nGC = SelectFont(); + GC nGC = GetFontGC(); XGCValues aGCVal; XGetGCValues( pDisplay, nGC, GCForeground, &aGCVal ); @@ -1376,7 +896,7 @@ void X11SalGraphics::DrawServerSimpleFontString( const ServerFontLayout& rSalLay X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer(); Display* pDisplay = GetXDisplay(); - GC nGC = SelectFont(); + GC nGC = GetFontGC(); XGCValues aGCVal; aGCVal.fill_style = FillStippled; @@ -1439,61 +959,6 @@ void X11SalGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout ) //-------------------------------------------------------------------------- -void X11SalGraphics::DrawStringUCS2MB( ExtendedFontStruct& rFont, - const Point& rPoint, const sal_Unicode* pStr, int nLength ) -{ - Display* pDisplay = GetXDisplay(); - GC nGC = SelectFont(); - - if( rFont.GetAsciiEncoding() == RTL_TEXTENCODING_UNICODE ) - { - // plain Unicode, can handle all chars and can be handled straight forward - XFontStruct* pFontStruct = rFont.GetFontStruct( RTL_TEXTENCODING_UNICODE ); - if( !pFontStruct ) - return; - - XSetFont( pDisplay, nGC, pFontStruct->fid ); - - #ifdef OSL_LITENDIAN - sal_Unicode *pBuffer = (sal_Unicode*)alloca( nLength * sizeof(sal_Unicode) ); - for ( int i = 0; i < nLength; i++ ) - pBuffer[ i ] = SwapBytes(pStr[ i ]) ; - #else - sal_Unicode *pBuffer = const_cast(pStr); - #endif - - XDrawString16( pDisplay, hDrawable_, nGC, rPoint.X(), rPoint.Y(), (XChar2b*)pBuffer, nLength ); - } - else - { - XTextItem16 *pTextItem = (XTextItem16*)alloca( nLength * sizeof(XTextItem16) ); - XChar2b *pMBChar = (XChar2b*)pStr; - int nItem = 0; - - DBG_ASSERT( nLength<=1, "#i49902# DrawStringUCS2MB with nLength>1 => problems with XOrg6.8.[0123]"); - - for( int nChar = 0; nChar < nLength; ++nChar ) - { - rtl_TextEncoding nEnc; - XFontStruct* pFontStruct = rFont.GetFontStruct( pStr[nChar], &nEnc ); - if( !pFontStruct ) - continue; - - pTextItem[ nItem ].chars = pMBChar + nChar; - pTextItem[ nItem ].delta = 0; - pTextItem[ nItem ].font = pFontStruct->fid; - pTextItem[ nItem ].nchars = 1; - - ConvertTextItem16( &pTextItem[ nItem ], nEnc ); - ++nItem; - } - - XDrawText16( pDisplay, hDrawable_, nGC, rPoint.X(), rPoint.Y(), pTextItem, nItem ); - } -} - -//-------------------------------------------------------------------------- - const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const { if( !mpServerFont[0] ) @@ -1528,7 +993,6 @@ X11SalGraphics::SetTextColor( SalColor nSalColor ) { nTextColor_ = nSalColor; nTextPixel_ = GetPixel( nSalColor ); - bFontGC_ = FALSE; } } @@ -1575,15 +1039,6 @@ void RegisterFontSubstitutors( ImplDevFontList* ); void X11SalGraphics::GetDevFontList( ImplDevFontList *pList ) { - // allow disabling of native X11 fonts - static const char* pEnableX11FontStr = getenv( "SAL_ENABLE_NATIVE_XFONTS" ); - if( pEnableX11FontStr && (pEnableX11FontStr[0] != '0') ) - { - // announce X11 fonts - XlfdStorage* pX11FontList = GetDisplay()->GetXlfdList(); - pX11FontList->AnnounceFonts( pList ); - } - // prepare the GlyphCache using psprint's font infos X11GlyphCache& rGC = X11GlyphCache::GetInstance(); @@ -1766,12 +1221,6 @@ X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel ) long rDummyFactor; mpServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor ); } - else if( mXFont[nFallbackLevel] != NULL ) - { - mXFont[nFallbackLevel]->ToImplFontMetricData( pMetric ); - if ( bFontVertical_ ) - pMetric->mnOrientation = 0; - } } // --------------------------------------------------------------------------- @@ -1859,10 +1308,6 @@ SalLayout* X11SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe #endif pLayout = new ServerFontLayout( *mpServerFont[ nFallbackLevel ] ); } - else if( mXFont[ nFallbackLevel ] ) - pLayout = new X11FontLayout( *mXFont[ nFallbackLevel ] ); - else - pLayout = NULL; return pLayout; } diff --git a/vcl/unx/source/gdi/xfont.cxx b/vcl/unx/source/gdi/xfont.cxx deleted file mode 100644 index f6d19909cd4a..000000000000 --- a/vcl/unx/source/gdi/xfont.cxx +++ /dev/null @@ -1,780 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -#include -#include "xfont.hxx" -#include "xlfd_extd.hxx" -#include "salcvt.hxx" -#include -#include -#include -#include - -// for GetMirroredChar -#include - -#if OSL_DEBUG_LEVEL > 1 -#include -#endif - -#include - -#define VCLASS_ROTATE 0 -#define VCLASS_ROTATE_REVERSE 1 -#define VCLASS_TRANSFORM1 2 -#define VCLASS_TRANSFORM2 3 -#define VCLASS_CJK 4 -#define VCLASS_DONTKNOW 5 -#define VCLASS_FONT_NUM 2 // Other than rotate and rotate_reverse, - // don't have spacial font - -// Select the max size of a font, which is token for real -// This routine is (and should be) called only once, the result should be -// stored in some static variable - -static int GetMaxFontHeight() -{ - static int nMaxFontHeight = 0; - if( nMaxFontHeight <= 0 ) - { - const char *pFontHeight = getenv ("SAL_MAXFONTHEIGHT"); - if( pFontHeight ) - nMaxFontHeight = atoi( pFontHeight ); - static const int DEFAULT_MAXFONTHEIGHT = 250; - if (nMaxFontHeight <= 20) - nMaxFontHeight = DEFAULT_MAXFONTHEIGHT; - } - - return nMaxFontHeight; -} - - -ExtendedFontStruct::ExtendedFontStruct( Display* pDisplay, const Size& rPixelSize, - sal_Bool bVertical, ExtendedXlfd* pXlfd ) : - mpDisplay( pDisplay ), - maPixelSize( rPixelSize ), - mfXScale(1.0), mfYScale(1.0), - mbVertical( bVertical ), - mnCachedEncoding( RTL_TEXTENCODING_DONTKNOW ), - mpXlfd( pXlfd ), - mpRangeCodes(NULL), - mnRangeCount(-1) -{ - if( !maPixelSize.Width() ) - maPixelSize.Width() = maPixelSize.Height(); - mnAsciiEncoding = GetAsciiEncoding (NULL); - mnDefaultWidth = GetDefaultWidth(); - - mpXFontStruct = (XFontStruct**)calloc( mpXlfd->NumEncodings(), - sizeof(XFontStruct*) ); -} - -ExtendedFontStruct::~ExtendedFontStruct() -{ - delete[] mpRangeCodes; - - for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - if ( mpXFontStruct[nIdx] != NULL ) - XFreeFont( mpDisplay, mpXFontStruct[nIdx] ); - - free(mpXFontStruct); -} - -rtl_TextEncoding -ExtendedFontStruct::GetAsciiEncoding( int *pAsciiRange ) const -{ - return mpXlfd->GetAsciiEncoding( pAsciiRange ); -} - -FontPitch -ExtendedFontStruct::GetSpacing( rtl_TextEncoding nEncoding ) -{ - return mpXlfd->GetPitch( nEncoding ); -} - -static XFontStruct* -LoadXFont (Display* pDisplay, const char* pFontName) -{ - XFontStruct* pFont = XLoadQueryFont (pDisplay, pFontName); - if ((pFont != NULL) && (pFont->fid == 0)) - pFont->fid = XLoadFont(pDisplay, pFontName); - -#ifdef HDU_DEBUG - fprintf( stderr, "XLoadFont \"%s\" => %d\n", pFontName, (pFont!= NULL) ); -#endif - return pFont; -} - -int -ExtendedFontStruct::LoadEncoding( rtl_TextEncoding nEncoding ) -{ - int nIdx = mpXlfd->GetEncodingIdx( nEncoding ); - if ( (nIdx < 0) || (mpXFontStruct[ nIdx ] != NULL) ) - return nIdx; - - // limit font height that gets requested from the XServer - // see BugId #44528# FontWork (-> #45038#) and as well Bug #47127# - int nReqPixelHeight = maPixelSize.Height(); - if( nReqPixelHeight > GetMaxFontHeight() ) - nReqPixelHeight = GetMaxFontHeight(); - else if( nReqPixelHeight < 2 ) - nReqPixelHeight = 2; - - // get the X11 font from a matching XLFD - ByteString aFontName; - mpXlfd->ToString( aFontName, nReqPixelHeight, nEncoding ); - mpXFontStruct[ nIdx ] = LoadXFont( mpDisplay, aFontName.GetBuffer() ); - if (mpXFontStruct[nIdx] == NULL) - mpXFontStruct[nIdx] = LoadXFont( mpDisplay, "fixed" ); - - // calculate correction factors to improve matching - // the selected font size to the used bitmap font - int nRealPixelSize = mpXlfd->GetPixelSize(); - if( !nRealPixelSize ) // check for scalable mpXlfd - nRealPixelSize = nReqPixelHeight; - if( nRealPixelSize && (nRealPixelSize != maPixelSize.Width()) ) - mfXScale = (float)maPixelSize.Width() / nRealPixelSize; - if( nRealPixelSize && (nRealPixelSize != maPixelSize.Height()) ) - mfYScale = (float)maPixelSize.Height() / nRealPixelSize; - - return nIdx; -} - -XFontStruct* -ExtendedFontStruct::GetFontStruct( rtl_TextEncoding nEncoding ) -{ - int nIdx = LoadEncoding( nEncoding ); - return nIdx < 0 ? NULL : mpXFontStruct[nIdx] ; -} - -bool -ExtendedFontStruct::GetFontBoundingBox( XCharStruct *pCharStruct, - int *pAscent, int *pDescent ) -{ - pCharStruct->lbearing = 0; - pCharStruct->rbearing = 0; - pCharStruct->width = 0; - pCharStruct->ascent = 0; - pCharStruct->descent = 0; - - *pAscent = 0; - *pDescent = 0; - - int nIdx; - - // check if there is at least one encoding already loaded - bool bEmpty = true; - for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - bEmpty &= (mpXFontStruct[nIdx] == NULL); - if ( bEmpty ) - LoadEncoding( mpXlfd->GetAsciiEncoding() ); - - // get the max bounding box from all font structs - for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - if ( mpXFontStruct[ nIdx ] != NULL ) - { - *pAscent = std::max( mpXFontStruct[nIdx]->ascent, *pAscent ); - *pDescent = std::max( mpXFontStruct[nIdx]->descent, *pDescent ); - - XCharStruct* pMaxBounds = &(mpXFontStruct[nIdx]->max_bounds); - - pCharStruct->lbearing = std::max( pMaxBounds->lbearing, - pCharStruct->lbearing ); - pCharStruct->rbearing = std::max( pMaxBounds->rbearing, - pCharStruct->rbearing ); - pCharStruct->width = std::max( pMaxBounds->width, - pCharStruct->width ); - pCharStruct->ascent = std::max( pMaxBounds->ascent, - pCharStruct->ascent ); - pCharStruct->descent = std::max( pMaxBounds->descent, - pCharStruct->descent ); - } - - // apply correction factors to better match selected size to available size - if( mfYScale != 1.0 ) - { - *pAscent = int(*pAscent * mfYScale); - *pDescent = int(*pDescent * mfYScale); - pCharStruct->ascent = (short int)(pCharStruct->ascent * mfYScale); - pCharStruct->descent = (short int)(pCharStruct->descent * mfYScale); - } - if( mfXScale != 1.0 ) - { - pCharStruct->lbearing = (short int)(pCharStruct->lbearing * mfXScale); - pCharStruct->rbearing = (short int)(pCharStruct->rbearing * mfXScale); - pCharStruct->width = (short int)(pCharStruct->width * mfXScale); - } - - return (pCharStruct->width > 0); -} - -bool -ExtendedFontStruct::ToImplFontMetricData(ImplFontMetricData *pFontMetric) -{ - pFontMetric->mnOrientation = 0; - pFontMetric->mnSlant = 0; - pFontMetric->mbDevice = true; - pFontMetric->mbScalableFont = mpXlfd->IsScalable(); - pFontMetric->mbKernableFont = false; - pFontMetric->mbSymbolFlag= mpXlfd->IsSymbolFont(); - pFontMetric->meFamily = mpXlfd->GetFamilyType(); - pFontMetric->meWeight = mpXlfd->GetWeight(); - pFontMetric->mePitch = mpXlfd->GetPitch(); - pFontMetric->meItalic = mpXlfd->GetSlant(); - - int nAscent, nDescent; - XCharStruct aBoundingBox; - if ( GetFontBoundingBox(&aBoundingBox, &nAscent, &nDescent) ) - { - pFontMetric->mnWidth = aBoundingBox.width; - pFontMetric->mnAscent = aBoundingBox.ascent; - pFontMetric->mnDescent = aBoundingBox.descent; - pFontMetric->mnIntLeading = std::max(0, aBoundingBox.ascent - nAscent - + aBoundingBox.descent - nDescent ); - pFontMetric->mnExtLeading = 0; // TODO!!! - return true; - } - else - { - return false; - } -} - -bool -ExtendedFontStruct::Match( const ExtendedXlfd *pXlfd, - const Size& rPixelSize, sal_Bool bVertical ) const -{ - if( mpXlfd != pXlfd ) - return false; - - if( bVertical != mbVertical ) - return FALSE; - - if( rPixelSize.Height() != maPixelSize.Height() ) - return FALSE; - - long nReqWidth = rPixelSize.Width(); - if( !nReqWidth ) - nReqWidth = rPixelSize.Height(); - if( nReqWidth != maPixelSize.Width() ) - return FALSE; - - return true; -} - -// Get an appropriate x-font that contains a glyph for the given unicode -// code point. -// This routine is designed to be called for each character in a text. -// It first checks the given encoding to optimize for the fact that two -// adjacent characters in a text most probably have the same encoding -// In the first call initialize pEncodingInOut to dontknow, this causes -// EncodingHasChar() to fail and thus bootstraps the encoding, otherwise -// make sure that the initial value of pFontInOut matches the encoding and -// that the encoding is valid for the font. -XFontStruct* -ExtendedFontStruct::GetFontStruct( sal_Unicode nChar, rtl_TextEncoding *pEncoding ) -{ - SalConverterCache *pCvt = SalConverterCache::GetInstance(); - - if ( pCvt->EncodingHasChar(mnAsciiEncoding, nChar) ) - { - *pEncoding = mnAsciiEncoding; - return GetFontStruct (mnAsciiEncoding); - } - else - if ( pCvt->EncodingHasChar(mnCachedEncoding, nChar) ) - { - *pEncoding = mnCachedEncoding; - return GetFontStruct (mnCachedEncoding); - } - else - { - for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ ) - { - rtl_TextEncoding nEnc = mpXlfd->GetEncoding(nIdx); - if ( (nEnc != mnCachedEncoding) && (nEnc != mnAsciiEncoding) - && pCvt->EncodingHasChar(nEnc, nChar)) - { - mnCachedEncoding = nEnc; - *pEncoding = mnCachedEncoding; - return GetFontStruct (mnCachedEncoding); - } - } - } - - *pEncoding = RTL_TEXTENCODING_DONTKNOW; - return NULL; -} - -// --------------------------------------------------------------------------- -// utility functions to handle xfontstruct information, this is all to -// calculate charwidth information -// --------------------------------------------------------------------------- - -static bool -CharExists( const XCharStruct* pChar ) -{ - if ( pChar == NULL ) - return false; - - return pChar->width - || pChar->ascent || pChar->descent - || pChar->lbearing || pChar->rbearing; -} - -// this relies on non-null per_char information in the fontstruct -static XCharStruct* -GetCharinfo( const XFontStruct *pXFontStruct, sal_MultiByte nChar ) -{ - unsigned int nRow = nChar >> 8; - unsigned int nCol = nChar & 0xFF; - - unsigned int nMinRow = pXFontStruct->min_byte1; - unsigned int nMaxRow = pXFontStruct->max_byte1; - unsigned int nMinCol = pXFontStruct->min_char_or_byte2; - unsigned int nMaxCol = pXFontStruct->max_char_or_byte2; - - if ( nRow >= nMinRow && nRow <= nMaxRow - && nCol >= nMinCol && nCol <= nMaxCol ) - { - return &pXFontStruct->per_char[ - (nRow-nMinRow) * (nMaxCol-nMinCol+1) + (nCol-nMinCol) ]; - } - - return NULL; -} - -static sal_Size -QueryCharWidth16( Display* pDisplay, XLIB_Font nFontID, sal_MultiByte nChar, - sal_Size nDefaultWidth ) -{ - int nDirection, nFontAscent, nFontDescent; - XCharStruct aBoundingBox; - - XQueryTextExtents16( pDisplay, nFontID, (XChar2b*)&nChar, 1, - &nDirection, &nFontAscent, &nFontDescent, &aBoundingBox ); - - return CharExists( &aBoundingBox ) ? aBoundingBox.width : nDefaultWidth; -} - -#if 0 -// currently not used -static sal_Size -QueryCharWidth8( XFontStruct* pXFontStruct, sal_Char nChar, - sal_Size nDefaultWidth ) -{ - int nDirection, nFontAscent, nFontDescent; - XCharStruct aBoundingBox; - - XTextExtents( pXFontStruct, &nChar, 1, - &nDirection, &nFontAscent, &nFontDescent, &aBoundingBox ); - - return CharExists( &aBoundingBox ) ? aBoundingBox.width : nDefaultWidth; -} -#endif - -sal_Size -ExtendedFontStruct::GetDefaultWidth() -{ - return (maPixelSize.Width() + 1) / 2; -} - -// Handle single byte fonts which do not require conversion, this exploits -// the fact that unicode equals latin1 or ansi1252 in the range [0..0xff] and -// is compatible with iso8859-X at least in the range to 0x7f -sal_Size -ExtendedFontStruct::GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray, rtl_TextEncoding nEncoding ) -{ - if ( !(nFrom <= nTo) ) - return 0; - - XFontStruct* pXFontStruct = GetFontStruct( nEncoding ); - if ( pXFontStruct == NULL ) - return 0; - - // query the font metrics - if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width) - || (pXFontStruct->per_char == NULL) ) - { - // fixed width font - for ( int nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = pXFontStruct->max_bounds.width; - } - else - { - // variable width font - int nMinChar = pXFontStruct->min_char_or_byte2; - int nMaxChar = pXFontStruct->max_char_or_byte2; - - int nIdx = nFrom; - - for ( ; nIdx < std::min((int)nTo, nMinChar); nIdx++, pWidthArray++ ) - *pWidthArray = mnDefaultWidth; - for ( ; nIdx <= std::min((int)nTo, nMaxChar); nIdx++, pWidthArray++ ) - { - XCharStruct* pChar = &(pXFontStruct->per_char[nIdx - nMinChar]); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - for ( ; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = mnDefaultWidth; - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -// Handle utf16 encoded fonts, which do not require conversion -sal_Size -ExtendedFontStruct::GetCharWidthUTF16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray ) -{ - if ( !(nFrom <= nTo) ) - return 0; - - XFontStruct* pXFontStruct = GetFontStruct( RTL_TEXTENCODING_UNICODE ); - FontPitch nSpacing = mpXlfd->GetPitch( RTL_TEXTENCODING_UNICODE ); - - if ( pXFontStruct == NULL ) - return 0; - - // query the font metrics - if ( nSpacing == PITCH_VARIABLE - && pXFontStruct->per_char == NULL) - { - // get per_char information from the server - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = QueryCharWidth16( mpDisplay, pXFontStruct->fid, - nIdx, mnDefaultWidth ); - } - else - if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width) - || (pXFontStruct->per_char == NULL) ) - { - // really a fixed width font - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - *pWidthArray = pXFontStruct->max_bounds.width; - } - else - { - // get per_char information from the xfontstruct - for ( sal_Int32 nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ ) - { - XCharStruct* pChar = GetCharinfo( pXFontStruct, nIdx ); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -// handle non unicode fonts that are converted into encoding matching the -// font in fontstruct, 8 and 16 bit fonts are handled the same way -sal_Size -ExtendedFontStruct::GetCharWidth16( sal_Unicode nFrom, sal_Unicode nTo, - sal_Int32* pWidthArray, ExtendedFontStruct *pFallback ) -{ - if ( nFrom > nTo ) - return 0; - - sal_Char pBuffer[64]; - - SalConverterCache *pCvt = SalConverterCache::GetInstance(); - for ( sal_Int32 nIdx = nFrom ; nIdx <= nTo ; nIdx++, pWidthArray++ ) - { - FontPitch nSpacing; - sal_Size nSize; - sal_Unicode nUniIdx = (sal_Unicode)nIdx; - - // get a matching fontstruct - rtl_TextEncoding nEnc; - XFontStruct *pFont; - - if ( (pFont = GetFontStruct(nUniIdx, &nEnc)) != NULL ) - { - nSpacing = GetSpacing( nEnc ); - } - else - if ( (pFallback != NULL) - && ((pFont = pFallback->GetFontStruct(nUniIdx, &nEnc)) != NULL) ) - { - nSpacing = pFallback->GetSpacing( nEnc ); - } - else - if ( (pFallback != NULL) - && ((pFont = pFallback->GetFontStruct(nUniIdx = '?', &nEnc)) != NULL) ) - { - nSpacing = pFallback->GetSpacing( nEnc ); - } - else - { - // TODO What should the default value be? - nSpacing = PITCH_FIXED; - } - - if ( pFont ) - { - nSize = pCvt->ConvertStringUTF16(&nUniIdx, 1, pBuffer, sizeof(pBuffer), nEnc); - // XXX FIXME - if ((nEnc == RTL_TEXTENCODING_GB_2312) || (nEnc == RTL_TEXTENCODING_EUC_KR)) - { - for (unsigned int n_char = 0; n_char < nSize; n_char++ ) - pBuffer[ n_char ] &= 0x7F; - } - } - - // query font metrics - if ( pFont && (nSize == 1 || nSize == 2) ) - { - sal_MultiByte nChar = (nSize == 1) ? (unsigned char)pBuffer[0] : - ((sal_MultiByte)pBuffer[0] << 8) + (sal_MultiByte)pBuffer[1]; - - if ( nSpacing == PITCH_VARIABLE - && pFont->per_char == NULL) - { - // get per_char information from the x-server - *pWidthArray = QueryCharWidth16( mpDisplay, pFont->fid, - nChar, mnDefaultWidth ); - } - else - if ( (pFont->max_bounds.width == pFont->min_bounds.width) - || (pFont->per_char == NULL) ) - { - // fixed width font - *pWidthArray = pFont->max_bounds.width; - } - else - { - // get per_char information from the xfontstruct - XCharStruct* pChar = GetCharinfo( pFont, nChar ); - *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth; - } - } - else - { - // conversion error - *pWidthArray = mnDefaultWidth; - } - } - - // return amount of handled chars - return nTo - nFrom + 1; -} - -sal_Size -ExtendedFontStruct::GetCharWidth( sal_Unicode cChar, sal_Int32 *pPhysicalWidth, - sal_Int32 *pLogicalWidth ) -{ - sal_Size nConverted = 0; - - // dispatch querying of metrics to most promising encoding candidate - int nAsciiRange; - rtl_TextEncoding nEncoding = mpXlfd->GetAsciiEncoding(&nAsciiRange); - if ( nEncoding == RTL_TEXTENCODING_UNICODE ) - { - // if we have a unicode encoded system font than we get the charwidth - // straight forward - nConverted = GetCharWidthUTF16( cChar, cChar, pPhysicalWidth ); - } - else - { - if ( cChar < nAsciiRange ) - { - // optimize the most frequent case, requesting only the latin1 - // chars which are mappable to a single encoding - nConverted = GetCharWidth8( cChar, cChar, pPhysicalWidth, nEncoding ); - } - - // if further requests are pending, then the according unicode - // codepoint has to be dispatched to one of the system fonts and - // converted to this fonts encoding - nConverted += GetCharWidth16( cChar + nConverted, cChar, - pPhysicalWidth + nConverted, NULL ); - } - - // convert physical width to logical width, apply correction factor if needed - *pLogicalWidth = *pPhysicalWidth; - if( mfXScale != 1.0 ) - *pLogicalWidth = sal_Int32(*pLogicalWidth * mfXScale); - - return nConverted; -} - -bool ExtendedFontStruct::HasUnicodeChar( sal_Unicode cChar ) const -{ - // #i18818# return false if there are no known encodings - if( !mnRangeCount ) - return false; - - // init unicode range cache if needed - if( mnRangeCount < 0 ) - { - mnRangeCount = mpXlfd->GetFontCodeRanges( NULL ); - if( !mnRangeCount ) - return false; - mpRangeCodes = new sal_uInt32[ 2*mnRangeCount ]; - mpXlfd->GetFontCodeRanges( mpRangeCodes ); - // TODO: make sure everything is sorted - } - - // binary search in unicode ranges - int nLower = 0; - int nMid = mnRangeCount; - int nUpper = 2 * mnRangeCount - 1; - while( nLower < nUpper ) - { - if( cChar >= mpRangeCodes[ nMid ] ) - nLower = nMid; - else - nUpper = nMid - 1; - nMid = (nLower + nUpper + 1) / 2; - } - if( (nMid == 0) && (cChar < mpRangeCodes[0]) ) - return false; - return (nMid & 1) ? false: true; -} - -int ExtendedFontStruct::GetFontCodeRanges( sal_uInt32* pCodePairs ) const -{ - // make sure unicode range cache is initialized - HasUnicodeChar(0); - - // transfer range pairs if requested - if( pCodePairs ) - { - for( int i = 0; i < 2*mnRangeCount; ++i ) - pCodePairs[i] = mpRangeCodes[i]; - } - - return mnRangeCount; -} - -// ======================================================================= - -X11FontLayout::X11FontLayout( ExtendedFontStruct& rFont ) -: mrFont( rFont ) -{} - -// ----------------------------------------------------------------------- - -bool X11FontLayout::LayoutText( ImplLayoutArgs& rArgs ) -{ - Point aNewPos( 0, 0 ); - bool bRightToLeft; - int nCharPos; - - for( nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); ) - { - sal_UCS4 cChar = rArgs.mpStr[ nCharPos ]; - if( bRightToLeft ) - cChar = GetMirroredChar( cChar ); - int nGlyphIndex = cChar | GF_ISCHAR; - - // check if the font supports the char - if( !mrFont.HasUnicodeChar( cChar ) ) - { - // try to replace the failing char using the same font - const char* pApproxUTF8 = GetAutofallback( cChar ); - cChar = 0; - if( pApproxUTF8 ) - { - String aApproxStr( pApproxUTF8, RTL_TEXTENCODING_UTF8 ); - if( aApproxStr.Len() == 1 ) - { - // TODO: support Autofallback for len>1 - sal_Unicode cApprox = aApproxStr.GetChar( 0 ); - if( mrFont.HasUnicodeChar( cApprox ) ) - nGlyphIndex = (cChar = cApprox) | GF_ISCHAR; - } - } - // request fallback glyph if necessary - if( !cChar ) - { - rArgs.NeedFallback( nCharPos, bRightToLeft ); - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) - nGlyphIndex = 0; // drop NotDef fallback glyphs - } - } - - sal_Int32 nPhysGlyphWidth, nLogGlyphWidth; - mrFont.GetCharWidth( cChar, &nPhysGlyphWidth, &nLogGlyphWidth ); - int nGlyphFlags = (nPhysGlyphWidth > 0) ? 0 : GlyphItem::IS_IN_CLUSTER; - if( bRightToLeft ) - nGlyphFlags |= GlyphItem::IS_RTL_GLYPH; - GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nPhysGlyphWidth ); - aGI.mnNewWidth = nLogGlyphWidth; - AppendGlyph( aGI ); - - aNewPos.X() += nLogGlyphWidth; - } - - return (nCharPos >= 0); -} - -// ----------------------------------------------------------------------- - -void X11FontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) -{ - GenericSalLayout::AdjustLayout( rArgs ); - SetOrientation( 0 ); // X11 fonts are to be rotated in upper layers -} - -// ----------------------------------------------------------------------- - -void X11FontLayout::DrawText( SalGraphics& rSalGraphics ) const -{ - static const int MAXGLYPHS = 160; - int nMaxGlyphs = GetOrientation() ? 1 : MAXGLYPHS; - - // workaround for #i49902# similar to #b6228733 with XDrawText items - // => output each item separately for non-unicode font encodings! - // this is done here instead of in DrawStringUCS2MB() because - // it needs the item positions and they are easily available here - if( mrFont.GetAsciiEncoding() != RTL_TEXTENCODING_UNICODE ) - nMaxGlyphs = 1; - - Point aPos; - sal_GlyphId aGlyphAry[ MAXGLYPHS ]; - sal_Unicode pStr[ MAXGLYPHS ]; - for( int nStart=0;;) - { - int nGlyphCount = GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart ); - if( !nGlyphCount ) - break; - - for( int i = 0; i < nGlyphCount; ++i ) - pStr[ i ] = aGlyphAry[ i ] & GF_IDXMASK; - - static_cast(rSalGraphics).DrawStringUCS2MB( mrFont, aPos, pStr, nGlyphCount ); - } -} - -// ======================================================================= diff --git a/vcl/unx/source/gdi/xlfd_attr.cxx b/vcl/unx/source/gdi/xlfd_attr.cxx deleted file mode 100644 index ca49a8548afb..000000000000 --- a/vcl/unx/source/gdi/xlfd_attr.cxx +++ /dev/null @@ -1,686 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include -#include -#include -#include -#include "xlfd_attr.hxx" -#include -#include - -// --------------------------------------------------------------------------- -// -// -// Attribute is a container for simple name value pairs -// eg. ( "times", FAMILY_ROMAN ) or ( "demi bold", WEIGHT_SEMIBOLD ) -// enriched with an annotation which is a pretty-printed version of the -// string, i.e. "itc avant garde" would get an annotation of "Itc Avant Garde" -// -// -// --------------------------------------------------------------------------- - -// release the stored string -void -Attribute::Release() -{ - if ( mpAnnotation != NULL ) - delete mpAnnotation; - if ( mpKeyName != NULL ) - delete mpKeyName; - if ( mpName != NULL ) - free( (void*)mpName ); -} - -// get a private copy of the given argument -void -Attribute::SetName( const char *p, int nLen ) -{ - mpName = (char*)malloc( nLen + 1 ); - mnLength = nLen; - memcpy( (void*)mpName, p, mnLength ); - ((char*)mpName)[ mnLength ] = '\0'; -} - -// Compare whether two strings a equal for the first nLen bytes -// i.e. arial == arialnarrow -int -Attribute::Compare( const char *p, int nLen ) -{ - return strncmp( mpName, p, nLen ); -} - -// Get a all lowercase name with all blanks removed -const rtl::OString& -Attribute::GetKey () -{ - static rtl::OString aEmptyStr; - - if (mpKeyName != NULL) - return *mpKeyName; - if (mnLength == 0) - return aEmptyStr; - - sal_Char* pBuffer = (sal_Char*)alloca (mnLength); - - sal_Int32 i, j; - for (i = 0, j = 0; i < mnLength; i++) - { - if ( mpName[i] != ' ' ) - pBuffer[j++] = mpName[i]; - } - mpKeyName = new rtl::OString(pBuffer, j); - - return *mpKeyName; -} - -void -Attribute::InitKey () -{ - mpKeyName = NULL; -} - -// Compare two strings, they have to be equal for nLen bytes, after nLen -// bytes both strings have to be terminated either by '\0' or by '-' -// this is for comparing a string being a substring in a Xlfd with a -// zeroterminated string -Bool -Attribute::ExactMatch( const char *p, int nLen ) -{ - Bool bMatch; - if ( nLen > 0 ) - bMatch = Compare( p, nLen ) == 0; - else - bMatch = True; - if ( bMatch ) - { - char c1 = p[ nLen ]; - char c2 = mpName[ nLen ]; - bMatch = (c1 == '-' || c1 == '\0') && (c2 == '-' || c2 == '\0'); - } - - return bMatch; -} - -void -Attribute::TagFeature( unsigned short nFeature ) -{ - if ( (nFeature & XLFD_FEATURE_NARROW) - && (strstr(mpName, "narrow") != NULL) ) - { - mnFeature |= XLFD_FEATURE_NARROW; - } - - if ( (nFeature & XLFD_FEATURE_OL_CURSOR) - && (strcmp(mpName, "open look cursor") == 0) ) - { - mnFeature |= XLFD_FEATURE_OL_CURSOR; - } - - if ( (nFeature & XLFD_FEATURE_OL_GLYPH) - && (strcmp(mpName, "open look glyph") == 0) ) - { - mnFeature |= XLFD_FEATURE_OL_GLYPH; - } - - if ( (nFeature & XLFD_FEATURE_APPLICATION_FONT) - && ( (strcmp(mpName, "interface user") == 0) - || (strcmp(mpName, "interface system") == 0))) - { - mnFeature |= XLFD_FEATURE_APPLICATION_FONT; - } - - if (nFeature & XLFD_FEATURE_INTERFACE_FONT) - { - // european - if (strcmp(mpName, "arial") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_HQ | XLFD_FEATURE_MQ); - else - if (strcmp(mpName, "helvetica") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_HQ); - else - if ( (strcmp(mpName, "lucidux sans") == 0) - || (strcmp(mpName, "luxi sans") == 0)) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_MQ | XLFD_FEATURE_LQ); - else - if (strcmp(mpName, "charter") == 0) - mnFeature |= (XLFD_FEATURE_INTERFACE_FONT | XLFD_FEATURE_MQ); - else - // japanese - if ( (strcmp(mpName, "hg mincho l") == 0) /* Solaris: jisx0208 jisx0201 */ - || (strcmp(mpName, "heiseimin") == 0) /* Solaris: jisx0212 */ - || (strcmp(mpName, "minchol") == 0) /* TurboLinux */ - || (strcmp(mpName, "mincho") == 0)) /* Redhat 6.2 JP */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - else - // chinese - if ( (strcmp(mpName, "kai") == 0) /* Solaris */ - || (strcmp(mpName, "ar pl mingti2l big5") == 0)) /* TurboLinux */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - else - // korean - if ( (strcmp(mpName, "myeongjo") == 0)) /* Solaris */ - { - mnFeature |= XLFD_FEATURE_INTERFACE_FONT; - } - } - - if ( nFeature & XLFD_FEATURE_REDUNDANTSTYLE ) - { - switch ( mpName[0] ) - { - case '\0': - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'b': - if ( (strcmp(mpName, "bold") == 0) - || (strcmp(mpName, "bold italic") == 0) - || (strcmp(mpName, "bold sans") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'd': - if ( (strcmp(mpName, "demi") == 0) - || (strcmp(mpName, "demi italic") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 'i': - if ( strcmp(mpName, "italic") == 0 ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - - case 's': - if ( (strcmp(mpName, "sans") == 0) - || (strcmp(mpName, "serif") == 0) ) - mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE; - break; - } - } -} - -// given Attribute classifications, strings have to be in alphabetical -// order, since they are treated by binary search algorithm - -#define InitializeAttributeWith( p, a ) p, sizeof(p) - 1, a, 0, NULL, NULL -#define MembersOf( p ) (sizeof(p) / sizeof(p[0]) ) - -const Attribute pFamilyAttribute[] = { - { InitializeAttributeWith( "arial", FAMILY_SWISS ) }, - { InitializeAttributeWith( "arioso", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "avant garde", FAMILY_SWISS ) }, - { InitializeAttributeWith( "avantgarde", FAMILY_SWISS ) }, - { InitializeAttributeWith( "bembo", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "bookman", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "conga", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "courier", FAMILY_MODERN ) }, - { InitializeAttributeWith( "curl", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "fixed", FAMILY_MODERN ) }, - { InitializeAttributeWith( "gill", FAMILY_SWISS ) }, - { InitializeAttributeWith( "helmet", FAMILY_MODERN ) }, - { InitializeAttributeWith( "helvetica", FAMILY_SWISS ) }, - { InitializeAttributeWith( "international", FAMILY_MODERN ) }, - { InitializeAttributeWith( "lucida", FAMILY_SWISS ) }, - { InitializeAttributeWith( "new century schoolbook", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "palatino", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "roman", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "sans serif", FAMILY_SWISS ) }, - { InitializeAttributeWith( "sansserif", FAMILY_SWISS ) }, - { InitializeAttributeWith( "serf", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "serif", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "times", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "utopia", FAMILY_ROMAN ) }, - { InitializeAttributeWith( "zapf chancery", FAMILY_SCRIPT ) }, - { InitializeAttributeWith( "zapfchancery", FAMILY_SCRIPT ) } -}; - -const Attribute pWeightAttribute[] = { - { InitializeAttributeWith( "black", WEIGHT_BLACK ) }, - { InitializeAttributeWith( "bold", WEIGHT_BOLD ) }, - { InitializeAttributeWith( "book", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "demi", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "demi bold", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "demibold", WEIGHT_SEMIBOLD ) }, - { InitializeAttributeWith( "light", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "medium", WEIGHT_MEDIUM ) }, - { InitializeAttributeWith( "normal", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "regular", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "roman", WEIGHT_NORMAL ) }, - { InitializeAttributeWith( "semicondensed", WEIGHT_LIGHT ) }, - { InitializeAttributeWith( "ultrabold", WEIGHT_ULTRABOLD ) } -}; - -const Attribute pSlantAttribute[] = { - { InitializeAttributeWith( "i", ITALIC_NORMAL ) }, - { InitializeAttributeWith( "o", ITALIC_OBLIQUE ) }, - { InitializeAttributeWith( "r", ITALIC_NONE ) } -}; - -const Attribute pSetwidthAttribute[] = { - { InitializeAttributeWith( "bold", WIDTH_SEMI_EXPANDED ) }, - { InitializeAttributeWith( "condensed", WIDTH_CONDENSED ) }, - { InitializeAttributeWith( "double wide", WIDTH_ULTRA_EXPANDED ) }, - { InitializeAttributeWith( "expanded", WIDTH_EXPANDED ) }, - { InitializeAttributeWith( "extracondensed", WIDTH_EXTRA_CONDENSED ) }, - { InitializeAttributeWith( "extraexpanded", WIDTH_EXTRA_EXPANDED ) }, - { InitializeAttributeWith( "medium", WIDTH_NORMAL ) }, - { InitializeAttributeWith( "narrow", WIDTH_CONDENSED ) }, - { InitializeAttributeWith( "normal", WIDTH_NORMAL ) }, - { InitializeAttributeWith( "semicondensed", WIDTH_SEMI_CONDENSED ) }, - { InitializeAttributeWith( "semiexpanded", WIDTH_SEMI_EXPANDED ) }, - { InitializeAttributeWith( "ultracondensed", WIDTH_ULTRA_CONDENSED ) }, - { InitializeAttributeWith( "ultraexpanded", WIDTH_ULTRA_EXPANDED ) }, - { InitializeAttributeWith( "wide", WIDTH_EXPANDED ) } -}; - -const Attribute pEnhancedCharsetAttribute[] = { - { InitializeAttributeWith( "iso8859-1", RTL_TEXTENCODING_MS_1252 ) }, - { InitializeAttributeWith( "iso8859_1", RTL_TEXTENCODING_MS_1252 ) } -}; - -// ------------------------------------------------------------------------- -// -// String handling utility functions -// -// ------------------------------------------------------------------------- - - -void -AppendAttribute( Attribute *pAttribute, ByteString &rString ) -{ - if ( pAttribute == NULL ) - return ; - - int nLength = pAttribute->GetLength(); - char *pBuffer = (char*)alloca( nLength + 1); - - pBuffer[ 0 ] = '-'; - memcpy( pBuffer + 1, pAttribute->GetName(), nLength ); - rString.Append( pBuffer, nLength + 1); -} - -// -// Prettify the font name: make each leading character of a fontname -// uppercase. For example -// times new roman -> Times New Roman -// - -static void -ToUpper( char *pCharacter ) -{ - // replace [a,z] with [A,Z] - if ( (*pCharacter >= 97) && (*pCharacter <= 122) ) - *pCharacter -= 32; -} - -static String* -Capitalize( const char *pStr, int nLength ) -{ - char *pCopy = (char*)alloca( nLength + 1 ); - char *pPtr = pCopy; - memcpy( pPtr, pStr, nLength + 1 ); - - // loop over string data and uppercase first char and all chars - // following a space (other white space would be unexpected here) - char nPreviousChar = ' '; - while ( *pPtr ) - { - if ( nPreviousChar == ' ' ) - ToUpper( pPtr ); - nPreviousChar = *pPtr++; - } - - return new String( pCopy, RTL_TEXTENCODING_ISO_8859_1 ); -} - -String* -AnnotateString( const Attribute& rAttribute ) -{ - return Capitalize(rAttribute.GetName(), rAttribute.GetLength()); -} - -String* -AnnotateSlant( const Attribute& rAttribute ) -{ - const char* pStr = rAttribute.GetName(); - int nLen = rAttribute.GetLength(); - - static const struct { - const char *pFrom; const char *pTo; - } pTranslation[] = { - { "r", "Roman" }, - { "o", "Oblique" }, - { "i", "Italic" }, - { "ri", "Reverse Italic" }, - { "ro", "Reverse Oblique" }, - { "ot", "Other" } - }; - - for ( unsigned int i = 0; i < MembersOf(pTranslation); i++ ) - if ( strcmp(pStr, pTranslation[i].pFrom) == 0 ) - { - return new String( pTranslation[i].pTo, - RTL_TEXTENCODING_ISO_8859_1 ); - } - - return Capitalize(pStr, nLen); -} - -String* -AnnotateNone( const Attribute& ) -{ - return new String(); -} - -// --------------------------------------------------------------------------- -// -// -// manage global lists of Attributes -// since XListFonts does never list more than 64K fonts this storage does -// handle array size and indices with unsigned short values for low -// memory consumption -// -// -// --------------------------------------------------------------------------- - -AttributeStorage::AttributeStorage( unsigned short nDefaultValue ) : - mpList( NULL ), - mnSize( 0 ), - mnCount( 0 ), - mnLastmatch( 0 ), - mnDefaultValue( nDefaultValue ) -{ -} - -AttributeStorage::~AttributeStorage() -{ - if ( mpList != NULL ) - { - for ( int i = 0; i < mnCount; i++ ) - mpList[i].Release(); - free( mpList ); - } -} - -#if OSL_DEBUG_LEVEL > 1 -void -AttributeStorage::Dump() -{ - fprintf(stderr, "AttributeStorage: size=%i, used=%i\n", mnSize, mnCount); - for ( int i = 0; i < mnCount; i++ ) - { - ByteString aAnnotation = ByteString( - mpList[i].GetAnnotation(), - RTL_TEXTENCODING_ISO_8859_1 ); - fprintf(stderr, "\t%4i: <%s><%s>\n", i, mpList[i].GetName(), - mpList[i].GetLength(), mpList[i].GetValue(), - aAnnotation.GetBuffer() ); - } - fprintf(stderr, "\n"); -} -#endif - -Attribute* -AttributeStorage::Retrieve( unsigned short nIndex ) const -{ - return nIndex < mnCount ? &mpList[ nIndex ] : (Attribute*)NULL ; -} - -// pClassification contains a list of name-value pairs. If names in -// the AttributeStorage match those in the pClassification then -// the according value is copied. Matching means match for the length -// of the string in pClassification (i.e. arial matches arialnarrow) -// the strings in pClassification must be in alphabetical order, all -// strings Lowercase -void -AttributeStorage::AddClassification( Attribute *pClassification, - unsigned short nNum ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - unsigned int nLower = 0; - unsigned int nUpper = nNum; - unsigned int nCurrent; - int nComparison = 1; - Attribute *pHaystack = 0, *pNeedle; - - pNeedle = &mpList[ i ]; - - // binary search - while ( nLower < nUpper ) - { - nCurrent = (nLower + nUpper) / 2; - pHaystack = &pClassification[ nCurrent ]; - nComparison = pNeedle->Compare( pHaystack->GetName(), - pHaystack->GetLength() ); - if (nComparison < 0) - nUpper = nCurrent; - else - if (nComparison > 0) - nLower = nCurrent + 1; - else - break; - } - - // if there's a match store the according classification in the - // Attribute storage, otherwise do nothing since defaults are - // already provided in AttributeStorage::Insert() - if ( nComparison == 0 ) - pNeedle->SetValue( pHaystack->GetValue() ); - } -} - -void -AttributeStorage::AddClassification( AttributeClassifierT Classify ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - Attribute& rCurrent = mpList[i] ; - int nValue = Classify( rCurrent.GetName() ); - rCurrent.SetValue( nValue ); - } -} - -void -AttributeStorage::AddAnnotation( AttributeAnnotatorT Annotate ) -{ - for ( int i = 0; i < mnCount; i++ ) - { - String* pAnnotation = Annotate( mpList[i] ); - mpList[i].SetAnnotation( pAnnotation ); - } -} - -void -AttributeStorage::TagFeature( unsigned short nFeature ) -{ - for ( int i = 0; i < mnCount; i++ ) - mpList[i].TagFeature( nFeature ); -} - -// Enlarge the list of Attributes -void -AttributeStorage::Enlarge() -{ - if ( mnSize == 0 ) - { - mnSize = 8; - mpList = (Attribute*) malloc( mnSize * sizeof(Attribute) ); - } - else - { - mnSize = mnSize < 32768 ? (mnSize * 2) : 65535; - mpList = (Attribute*) realloc( mpList, mnSize * sizeof(Attribute) ); - } -} - -// nLength is the length as it would be reported by strlen(3) -// for an null-terminated string. if a string is part of a Xlfd -// the field separator '-' is taken as '\0' -// the AttributeStorage itself is NOT sorted to make sure that the -// leased keys are still valid -unsigned short -AttributeStorage::Insert( const char *pString, int nLength ) -{ - // check whether the last match is still equal to the current - // string since XListFonts lists fonts in sets of similar fontnames - if ( mnLastmatch < mnCount ) - { - if ( mpList[mnLastmatch].ExactMatch(pString, nLength) ) - return mnLastmatch; - } - - // otherwise search in list - for ( int i = 0; i < mnCount; i++ ) - { - if ( mpList[i].ExactMatch(pString, nLength) ) - return mnLastmatch = i; - } - - // if still not found we have to Insert the new string - if ( mnSize == mnCount ) - Enlarge(); - mpList[mnCount].SetName( pString, nLength ); - mpList[mnCount].SetValue( mnDefaultValue ); - mpList[mnCount].SetAnnotation( NULL ); - mpList[mnCount].SetFeature( XLFD_FEATURE_NONE ); - mpList[mnCount].InitKey( ); - mnLastmatch = mnCount; - mnCount = mnCount < 65535 ? mnCount + 1 : mnCount; - - return mnLastmatch; -} - - -// --------------------------------------------------------------------------- -// -// -// Attribute provider is a frame for a set of AttributeStorages. -// -// -// --------------------------------------------------------------------------- - -AttributeProvider::AttributeProvider () -{ - mpField[eXLFDFoundry ] = new AttributeStorage(0); - mpField[eXLFDFamilyName ] = new AttributeStorage(FAMILY_DONTKNOW); - mpField[eXLFDWeightName ] = new AttributeStorage(WEIGHT_NORMAL); - mpField[eXLFDSlant ] = new AttributeStorage(ITALIC_NONE); - mpField[eXLFDSetwidthName] = new AttributeStorage(WIDTH_NORMAL); - mpField[eXLFDAddstyleName] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW); - mpField[eXLFDCharset ] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW); -} - -AttributeProvider::~AttributeProvider() -{ - for ( int i = 0; i < eXLFDMaxEntry; i++ ) - delete mpField[ i ]; -} - -#if OSL_DEBUG_LEVEL > 1 -void -AttributeProvider::Dump() -{ - for ( int i = 0; i < eXLFDMaxEntry; i++ ) - mpField[ i ]->Dump(); -} -#endif - -extern "C" rtl_TextEncoding -GetTextEncodingFromAddStylename( const sal_Char *pAddStylename ) -{ - int nBufferLength = strlen( pAddStylename ) + 1; - sal_Char *pBuffer = (sal_Char*)alloca( nBufferLength ); - for ( int i = 0; i < nBufferLength; i++ ) - pBuffer[i] = pAddStylename[i] == '_' ? '-' : pAddStylename[i] ; - - return rtl_getTextEncodingFromUnixCharset( pBuffer ); -} - - -// classification information is needed before sorting because of course the -// classification is the sort criteria -void -AttributeProvider::AddClassification() -{ - /* mpField[ eXLFDFoundry ] doesn't need classification */ - mpField[ eXLFDFamilyName ]->AddClassification( - (Attribute*)pFamilyAttribute, - MembersOf(pFamilyAttribute) ); - mpField[ eXLFDWeightName ]->AddClassification( - (Attribute*)pWeightAttribute, - MembersOf(pWeightAttribute) ); - mpField[ eXLFDSlant ]->AddClassification( - (Attribute*)pSlantAttribute, - MembersOf(pSlantAttribute) ); - mpField[ eXLFDSetwidthName ]->AddClassification( - (Attribute*)pSetwidthAttribute, - MembersOf(pSetwidthAttribute) ); - mpField[ eXLFDAddstyleName ]->AddClassification( - GetTextEncodingFromAddStylename ); - mpField[ eXLFDCharset ]->AddClassification( - rtl_getTextEncodingFromUnixCharset ); -} - -// add some pretty print description -void -AttributeProvider::AddAnnotation() -{ - mpField[ eXLFDFoundry ]->AddAnnotation( AnnotateNone ); - mpField[ eXLFDFamilyName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDWeightName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDSlant ]->AddAnnotation( AnnotateSlant ); - mpField[ eXLFDSetwidthName ]->AddAnnotation( AnnotateString ); - mpField[ eXLFDAddstyleName ]->AddAnnotation( AnnotateNone ); - mpField[ eXLFDCharset ]->AddAnnotation( AnnotateNone ); -} - -// this is the misc or any section: dirty hacks for dirty xlfd usage -void -AttributeProvider::TagFeature() -{ - mpField[ eXLFDFamilyName ]->TagFeature( - XLFD_FEATURE_OL_GLYPH - | XLFD_FEATURE_OL_CURSOR - | XLFD_FEATURE_NARROW - | XLFD_FEATURE_INTERFACE_FONT - | XLFD_FEATURE_APPLICATION_FONT); - - mpField[ eXLFDSetwidthName ]->TagFeature( - XLFD_FEATURE_NARROW ); - - mpField[ eXLFDAddstyleName ]->TagFeature( - XLFD_FEATURE_REDUNDANTSTYLE ); -} - diff --git a/vcl/unx/source/gdi/xlfd_attr.hxx b/vcl/unx/source/gdi/xlfd_attr.hxx deleted file mode 100644 index b721310da506..000000000000 --- a/vcl/unx/source/gdi/xlfd_attr.hxx +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_ATTRIBUTE_HXX -#define XLFD_ATTRIBUTE_HXX - -#include -#include - - -struct Attribute { - - const char* mpName; - unsigned short mnLength; - unsigned short mnValue; - unsigned short mnFeature; - String* mpAnnotation; - rtl::OString* mpKeyName; - - const char* GetName() const - { return mpName; } - unsigned short GetValue() const - { return mnValue; } - unsigned short GetLength() const - { return mnLength; } - Bool HasFeature( unsigned short nFeature ) const - { return ((mnFeature & nFeature) != 0); } - const String &GetAnnotation() const - { return *mpAnnotation; } - const rtl::OString& - GetKey(); - void InitKey(); - - void SetName( const char *p, int nLen ); - void SetValue( unsigned short nIn ) - { mnValue = nIn; } - void SetAnnotation( String *pString ) - { mpAnnotation = pString; } - void SetFeature( unsigned short nFeature ) - { mnFeature = nFeature; } - void TagFeature( unsigned short nFeature ); - - int Compare( const char *p, int nLen ); - Bool ExactMatch( const char *p, int nLen ); - void Release(); -}; - - -void -AppendAttribute( Attribute *pAttribute, ByteString &rString ); - - -typedef String*(*AttributeAnnotatorT)(const Attribute &rAttribute); -extern "C" { -typedef rtl_TextEncoding(*AttributeClassifierT)(const char* pStr); -} - -#define XLFD_FEATURE_NONE 0x0000 -#define XLFD_FEATURE_NARROW 0x0001 -#define XLFD_FEATURE_OL_GLYPH 0x0002 -#define XLFD_FEATURE_OL_CURSOR 0x0004 -#define XLFD_FEATURE_REDUNDANTSTYLE 0x0008 -#define XLFD_FEATURE_APPLICATION_FONT 0x0010 - -#define XLFD_FEATURE_INTERFACE_FONT 0x0020 -#define XLFD_FEATURE_LQ 0x0040 -#define XLFD_FEATURE_MQ 0x0080 -#define XLFD_FEATURE_HQ 0x0100 - -// --------------------------------------------------------------------------- -// -// -// manage global lists of Attributes -// since XListFonts does never list more than 64K fonts this storage does -// handle array size and indices with unsigned short values for low -// memory consumption -// -// -// --------------------------------------------------------------------------- - -class AttributeStorage { - - private: - - Attribute* mpList; - unsigned short mnSize; - unsigned short mnCount; - unsigned short mnLastmatch; - unsigned short mnDefaultValue; - - void Enlarge(); - AttributeStorage(); - - public: - - AttributeStorage( unsigned short nDefaultValue ); - ~AttributeStorage(); - unsigned short Insert( const char *pString, int nLength ); - Attribute* Retrieve( unsigned short nIndex ) const ; - void AddClassification( Attribute *pClassification, - unsigned short nNum ); - void AddClassification( AttributeClassifierT Classify ); - void TagFeature( unsigned short nFeature ); - void AddAnnotation( AttributeAnnotatorT Annotate ); - #if OSL_DEBUG_LEVEL > 1 - void Dump(); - #endif -}; - - -// --------------------------------------------------------------------------- -// -// -// Attribute provider is a frame for a set of AttributeStorages. For XLFD -// interpretation and efficient storage, AttributeStorages for foundry, -// family_name, weight_name, slant, setwidth_name, add_style_name and combined -// charset_registry and charset_encoding are used. pixel_size, point_size, -// resolution_x and resolution_y are stored as numbers. please note that this -// does not allow storage of matrix-enhanced fonts. spacing is stored as -// a char, since only the 'm', 'c' and 'p' types are defined. -// -// -// --------------------------------------------------------------------------- - -enum eXLFDAttributeT { - eXLFDFoundry = 0, - eXLFDFamilyName, - eXLFDWeightName, - eXLFDSlant, - eXLFDSetwidthName, - eXLFDAddstyleName, - eXLFDCharset, - eXLFDMaxEntry -}; - -class AttributeProvider { - - private: - - AttributeStorage* mpField[ eXLFDMaxEntry ]; - - AttributeStorage* GetField( eXLFDAttributeT eXLFDField ) - { return mpField[ eXLFDField]; } - public: - - AttributeProvider (); - ~AttributeProvider (); - - void AddClassification(); - void AddAnnotation(); - void TagFeature(); - #if OSL_DEBUG_LEVEL > 1 - void Dump(); - #endif - - // these are just shortcuts or proxies for the most common used - // AttributeStorage functionality - AttributeStorage* GetFoundry() - { return GetField(eXLFDFoundry); } - AttributeStorage* GetFamily() - { return GetField(eXLFDFamilyName); } - AttributeStorage* GetWeight() - { return GetField(eXLFDWeightName); } - AttributeStorage* GetSlant() - { return GetField(eXLFDSlant); } - AttributeStorage* GetSetwidth() - { return GetField(eXLFDSetwidthName); } - AttributeStorage* GetAddstyle() - { return GetField(eXLFDAddstyleName); } - AttributeStorage* GetCharset() - { return GetField(eXLFDCharset); } - - Attribute* RetrieveFoundry( unsigned short nIndex ) - { return GetFoundry()->Retrieve(nIndex); } - Attribute* RetrieveFamily( unsigned short nIndex ) - { return GetFamily()->Retrieve(nIndex); } - Attribute* RetrieveWeight( unsigned short nIndex ) - { return GetWeight()->Retrieve(nIndex); } - Attribute* RetrieveSlant( unsigned short nIndex ) - { return GetSlant()->Retrieve(nIndex); } - Attribute* RetrieveSetwidth( unsigned short nIndex ) - { return GetSetwidth()->Retrieve(nIndex); } - Attribute* RetrieveAddstyle( unsigned short nIndex ) - { return GetAddstyle()->Retrieve(nIndex); } - Attribute* RetrieveCharset( unsigned short nIndex ) - { return GetCharset()->Retrieve(nIndex); } - - unsigned short InsertFoundry( const char *pString, int nLength ) - { return GetFoundry()->Insert(pString, nLength); } - unsigned short InsertFamily( const char *pString, int nLength ) - { return GetFamily()->Insert(pString, nLength); } - unsigned short InsertWeight( const char *pString, int nLength ) - { return GetWeight()->Insert(pString, nLength); } - unsigned short InsertSlant( const char *pString, int nLength ) - { return GetSlant()->Insert(pString, nLength); } - unsigned short InsertSetwidth( const char *pString, int nLength ) - { return GetSetwidth()->Insert(pString, nLength);} - unsigned short InsertAddstyle( const char *pString, int nLength ) - { return GetAddstyle()->Insert(pString, nLength);} - unsigned short InsertCharset( const char *pString, int nLength ) - { return GetCharset()->Insert(pString, nLength); } -}; - -#endif /* XLFD_ATTRIBUTE_HXX */ - diff --git a/vcl/unx/source/gdi/xlfd_extd.cxx b/vcl/unx/source/gdi/xlfd_extd.cxx deleted file mode 100644 index 73731eddf115..000000000000 --- a/vcl/unx/source/gdi/xlfd_extd.cxx +++ /dev/null @@ -1,1001 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include -#include -#include -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" -#include "xlfd_extd.hxx" -#include -#include - -#ifndef _RTL_TENCINFO_H_ -#include -#endif - -#include - -// -------------------------------------------------------------------------- - -ImplX11FontData::ImplX11FontData( const ExtendedXlfd& rXlfd, int nHeight ) -: ImplFontData( rXlfd, X11IFD_MAGIC ), - mrXlfd( rXlfd ) -{ - mnHeight = nHeight; - mnWidth = 0; -} - -ImplFontEntry* ImplX11FontData::CreateFontInstance( ImplFontSelectData& rFSD ) const -{ - ImplFontEntry* pEntry = new ImplFontEntry( rFSD ); - return pEntry; -} - -sal_IntPtr ImplX11FontData::GetFontId() const -{ - return reinterpret_cast(&mrXlfd); -} - -// -------------------------------------------------------------------------- -// -// classes for Xlfd handling that contain more than a single encoding. -// Members that may vary through different encodings are stored in -// a mpEncodingInfo member. There are three different classes: -// true scalable fonts (truetype and type1) scalable bitmap fonts -// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members -// that are specific to a font outline -// ( e.g. adobe-times-roman-medium-r-normal- X -p- X ) -// and specifies the interface. -// -// -------------------------------------------------------------------------- - -ExtendedXlfd::EncodingInfo& -ExtendedXlfd::EncodingInfo::operator= ( const Xlfd *pXlfd ) -{ - mcSpacing = pXlfd->mcSpacing; - mnResolutionX = pXlfd->mnResolutionX; - mnResolutionY = pXlfd->mnResolutionY; - mnAddstyle = pXlfd->mnAddstyle; - mnCharset = pXlfd->mnCharset; - mnEncoding = pXlfd->GetEncoding(); - - return *this; -} - -// ------ base class -------------------------------------------------------- - -ExtendedXlfd::ExtendedXlfd( bool bScalable ) -: mbScalable( bScalable ), - mnEncodings( 0 ), - mnEncCapacity( 0 ), - mpEncodingInfo( NULL ) -{ - mbOrientation = false; - mbDevice = false; - mbSubsettable = false; - mbEmbeddable = false; - - mnQuality = -1; -} - -ExtendedXlfd::~ExtendedXlfd() -{ - if ( mnEncodings != 0 ) - rtl_freeMemory( mpEncodingInfo ); -} - -inline void* -Realloc( void *pPtr, sal_Size nSize ) -{ - return rtl_reallocateMemory( pPtr, nSize ); -} - -int -ExtendedXlfd::GetEncodingIdx( rtl_TextEncoding nEncoding ) const -{ - for ( int i = 0; i < mnEncodings; i++ ) - if ( nEncoding == mpEncodingInfo[i].mnEncoding ) - return i; - return -1; -} - -bool -ExtendedXlfd::HasEncoding( rtl_TextEncoding nEncoding ) const -{ - return !(GetEncodingIdx( nEncoding ) < 0) ; -} - -rtl_TextEncoding -ExtendedXlfd::GetEncoding( int i ) const -{ - if ( i < mnEncodings && i >= 0 ) - return mpEncodingInfo[i].mnEncoding; - - return RTL_TEXTENCODING_DONTKNOW; -} - -rtl_TextEncoding -ExtendedXlfd::GetEncoding() const -{ - return mnEncodings == 1 ? mpEncodingInfo[0].mnEncoding : RTL_TEXTENCODING_DONTKNOW; -} - -// query the most unicode / Ascii compatible font: either one of the fonts -// is utf16 encoded or there's a single byte font which is unicode -// compatible for the first 256 chars (latin1) or for at least 128 -// chars (most latin-X encodings, cyrillic encodings) -rtl_TextEncoding -ExtendedXlfd::GetAsciiEncoding( int *pAsciiRange ) const -{ - rtl_TextEncoding nBestEncoding = RTL_TEXTENCODING_DONTKNOW; - int nLargestRange = 0x0000; - - for ( int i = 0; i < mnEncodings && nLargestRange < 0xffff; i++ ) - { - rtl_TextEncoding nCurEncoding = mpEncodingInfo[i].mnEncoding; - switch ( nCurEncoding ) - { - case RTL_TEXTENCODING_UNICODE: - nLargestRange = 0xffff; - nBestEncoding = nCurEncoding; - break; - - case RTL_TEXTENCODING_ISO_8859_1: - case RTL_TEXTENCODING_MS_1252: - nLargestRange = 0x00ff; - nBestEncoding = nCurEncoding; - break; - - case RTL_TEXTENCODING_ISO_8859_2: - case RTL_TEXTENCODING_ISO_8859_4: - case RTL_TEXTENCODING_ISO_8859_5: - case RTL_TEXTENCODING_ISO_8859_6: - case RTL_TEXTENCODING_ISO_8859_7: - case RTL_TEXTENCODING_ISO_8859_8: - case RTL_TEXTENCODING_ISO_8859_9: - case RTL_TEXTENCODING_ISO_8859_13: - case RTL_TEXTENCODING_ISO_8859_15: - case RTL_TEXTENCODING_MS_1251: - case RTL_TEXTENCODING_KOI8_R: - case RTL_TEXTENCODING_JIS_X_0201: - if ( nLargestRange < 0x0080 ) - { - nLargestRange = 0x0080; - nBestEncoding = nCurEncoding; - } - break; - - default: - if ( nLargestRange == 0x0000 ) - { - nBestEncoding = nCurEncoding; - } - break; - } - } - - if ( pAsciiRange != NULL ) - *pAsciiRange = nLargestRange; - - return nBestEncoding; -} - -bool -ExtendedXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - rtl_TextEncoding nEncoding = pXlfd->GetEncoding(); - if ( HasEncoding(nEncoding) ) - return false; - - if ( mnEncodings == 0 ) - { - // bootstrap - mnFoundry = pXlfd->mnFoundry; - mnFamily = pXlfd->mnFamily; - mnWeight = pXlfd->mnWeight; - mnSlant = pXlfd->mnSlant; - mnSetwidth = pXlfd->mnSetwidth; - mpFactory = pXlfd->mpFactory; - - Attribute *pFamilyAttr = mpFactory->RetrieveFamily( mnFamily ); - Attribute *pWeightAttr = mpFactory->RetrieveWeight( mnWeight ); - Attribute *pWidthAttr = mpFactory->RetrieveSetwidth( mnSetwidth ); - Attribute *pSlantAttr = mpFactory->RetrieveSlant( mnSlant ); - - meFamily = GetFamilyType(); - meWeight = GetWeight(); - meItalic = GetSlant(); - meWidthType = GetWidthType(); - mbSymbolFlag= (GetEncoding() == RTL_TEXTENCODING_SYMBOL); - mePitch = GetPitch(); - - maName = pFamilyAttr->GetAnnotation(); - - // the helvetica narrow hack - if ( ! pFamilyAttr->HasFeature(XLFD_FEATURE_NARROW) - && pWidthAttr->HasFeature(XLFD_FEATURE_NARROW) ) - { - static const String aNarrow( RTL_CONSTASCII_USTRINGPARAM(" Narrow") ); - maName += aNarrow; - } - - // stylename = weight + slant + width - // XXX Fix me: there may be a space missing between them - if ( meWeight != WEIGHT_NORMAL ) - maStyleName += pWeightAttr->GetAnnotation(); - if ( meItalic != ITALIC_NONE ) - maStyleName += pSlantAttr->GetAnnotation(); - if ( (meWidthType != WIDTH_NORMAL) - && (! pWidthAttr->HasFeature(XLFD_FEATURE_NARROW)) ) - maStyleName += pWidthAttr->GetAnnotation(); - } - - if( mnEncodings <= mnEncCapacity ) - { - mnEncCapacity += mnEncodings + 4; - mpEncodingInfo = (EncodingInfo*)Realloc( mpEncodingInfo, mnEncCapacity * sizeof(EncodingInfo) ); - } - - mpEncodingInfo[ mnEncodings ] = pXlfd; - mnEncodings += 1; - return true; -} - -void -ExtendedXlfd::ToString( ByteString &rString, - unsigned short /*nPixelSize*/, rtl_TextEncoding /*nEncoding*/ ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); -} - -void -ExtendedXlfd::ToString( ByteString &rString, - unsigned short /*nPixelSize*/, char* /*pMatricsString*/, rtl_TextEncoding /*nEncoding*/ ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); -} - -static FontPitch GetPitchFromX11Pitch( const char cSpacing ) -{ - switch ( cSpacing ) - { - case 'c': // fall through - case 'm': return PITCH_FIXED; - case 'p': return PITCH_VARIABLE; - default: return PITCH_DONTKNOW; - } -} - -// you must not call any of the ExtendedXlfd::GetXXX() functions if the -// ExtendedXlfd is really empty (i.e. mnEncodings is zero) - -FontPitch ExtendedXlfd::GetPitch() const -{ - if( mnEncodings > 1 ) - return PITCH_VARIABLE; - if( mnEncodings == 1 ) - return GetPitchFromX11Pitch( mpEncodingInfo[0].mcSpacing ); - return PITCH_DONTKNOW; -} - -FontPitch ExtendedXlfd::GetPitch( rtl_TextEncoding nEncoding ) const -{ - for ( int nIdx = 0; nIdx < mnEncodings; nIdx++ ) - if ( mpEncodingInfo[nIdx].mnEncoding == nEncoding ) - return GetPitchFromX11Pitch( mpEncodingInfo[nIdx].mcSpacing ); - return PITCH_DONTKNOW; -} - -FontFamily ExtendedXlfd::GetFamilyType() const -{ - Attribute *pFamilyAttr= mpFactory->RetrieveFamily(mnFamily); - return (FontFamily)pFamilyAttr->GetValue(); -} - -FontWeight ExtendedXlfd::GetWeight() const -{ - Attribute *pWeightAttr = mpFactory->RetrieveWeight(mnWeight); - return (FontWeight)pWeightAttr->GetValue(); -} - -FontItalic ExtendedXlfd::GetSlant() const -{ - Attribute *pSlantAttr = mpFactory->RetrieveSlant(mnSlant); - return (FontItalic)pSlantAttr->GetValue(); -} - -FontWidth ExtendedXlfd::GetWidthType() const -{ - Attribute *pWidthAttr = mpFactory->RetrieveSetwidth(mnSetwidth); - return (FontWidth)pWidthAttr->GetValue(); -} - -class CodeRange -{ -public: - CodeRange( int nMin, int nEnd ) : mnMin( nMin ), mnEnd( nEnd ) {} - - sal_uInt32 GetMin() const { return mnMin; } - sal_uInt32 GetEnd() const { return mnEnd; } - - bool operator<( const CodeRange& r ) const - { return (mnMin RangeSet; - RangeSet aRangeSet; - - for( unsigned short i = 0; i < mnEncodings; ++i ) - { - // TODO: move encoding -> unicode range mapping to RTL - // NOTE: for now only some are VERY roughly approximated - const rtl_TextEncoding eEncoding = mpEncodingInfo[i].mnEncoding; - switch( mpEncodingInfo[i].mnEncoding ) - { - case RTL_TEXTENCODING_SYMBOL: // postscript symbol encoding - aRangeSet.insert( CodeRange( 0x0020, 0x0100 ) ); // symbol aliasing - aRangeSet.insert( CodeRange( 0xF020, 0xF100 ) ); - break; - - case RTL_TEXTENCODING_ISO_8859_15: - aRangeSet.insert( CodeRange( 0x20AC, 0x20AD ) ); // Euro currency symbol - // fall through - case RTL_TEXTENCODING_APPLE_ROMAN: - case RTL_TEXTENCODING_ISO_8859_1: - case RTL_TEXTENCODING_MS_1252: - case RTL_TEXTENCODING_IBM_437: - case RTL_TEXTENCODING_IBM_852: - aRangeSet.insert( CodeRange( 0x0020, 0x0080 ) ); - aRangeSet.insert( CodeRange( 0x00A0, 0x0100 ) ); - break; - - // Traditional, Simplified, Japanese - case RTL_TEXTENCODING_APPLE_CHINSIMP: - case RTL_TEXTENCODING_APPLE_CHINTRAD: - case RTL_TEXTENCODING_APPLE_JAPANESE: - case RTL_TEXTENCODING_SHIFT_JIS: - case RTL_TEXTENCODING_GB_2312: - case RTL_TEXTENCODING_GBT_12345: - case RTL_TEXTENCODING_GBK: - case RTL_TEXTENCODING_BIG5: - case RTL_TEXTENCODING_EUC_JP: - case RTL_TEXTENCODING_EUC_CN: - case RTL_TEXTENCODING_EUC_TW: - case RTL_TEXTENCODING_ISO_2022_JP: - case RTL_TEXTENCODING_ISO_2022_CN: - case RTL_TEXTENCODING_GB_18030: - case RTL_TEXTENCODING_BIG5_HKSCS: - case RTL_TEXTENCODING_JIS_X_0201: - case RTL_TEXTENCODING_JIS_X_0208: - case RTL_TEXTENCODING_JIS_X_0212: - case RTL_TEXTENCODING_MS_932: - case RTL_TEXTENCODING_MS_936: - case RTL_TEXTENCODING_MS_950: - aRangeSet.insert( CodeRange( 0x3000, 0xA000 ) ); - aRangeSet.insert( CodeRange( 0xF900, 0xFB00 ) ); - break; - - // Korean - case RTL_TEXTENCODING_APPLE_KOREAN: - case RTL_TEXTENCODING_MS_949: - case RTL_TEXTENCODING_MS_1361: - case RTL_TEXTENCODING_EUC_KR: - case RTL_TEXTENCODING_ISO_2022_KR: - aRangeSet.insert( CodeRange( 0x1100, 0x1200 ) ); - aRangeSet.insert( CodeRange( 0x3130, 0x3190 ) ); - aRangeSet.insert( CodeRange( 0xAC00, 0xD7A4 ) ); - break; - - // unknown encoding - case RTL_TEXTENCODING_DONTKNOW: - bHasUnknownEncoding = true; - break; - - // Unicode - case RTL_TEXTENCODING_UNICODE: - case RTL_TEXTENCODING_UTF7: - case RTL_TEXTENCODING_UTF8: - bHasUnicode = true; - break; - - // misc 8bit encodings - default: - if( !rtl_isOctetTextEncoding( eEncoding ) ) - bHasUnknownEncoding = true; - else - { - // use the unicode converter to get the coverage of an 8bit encoding - rtl_TextToUnicodeConverter aConverter = rtl_createTextToUnicodeConverter( eEncoding ); - rtl_UnicodeToTextContext aCvtContext = rtl_createTextToUnicodeContext( aConverter ); - if( !aConverter || !aCvtContext ) - bHasUnknownEncoding = true; - else - { - sal_Char cCharsInp[ 0x100 ]; - for( int j = 0x20; j < 0x080; ++j ) - cCharsInp[ j-0x20 ] = j; - for( int j = 0xA0; j < 0x100; ++j ) - cCharsInp[ j-0x40 ] = j; - - sal_Unicode cCharsOut[ 0x100 ]; - sal_uInt32 nCvtInfo; - sal_Size nSrcCvtBytes; - int nOutLen = rtl_convertTextToUnicode( - aConverter, aCvtContext, - cCharsInp, 0xC0, - cCharsOut, sizeof(cCharsOut)/sizeof(*cCharsOut), - RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE - | RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE, - &nCvtInfo, &nSrcCvtBytes ); - - for( int j = 0; j < nOutLen; ++j ) - aRangeSet.insert( CodeRange( cCharsOut[j], cCharsOut[j]+1 ) ); - - rtl_destroyTextToUnicodeConverter( aCvtContext ); - rtl_destroyTextToUnicodeConverter( aConverter ); - } - } - break; - } - } - - // unicode encoded fonts usually do not cover the entire unicode range - // => only use them to determine coverage when no other encodings are available - if( aRangeSet.empty() && (bHasUnicode || bHasUnknownEncoding) ) - { - if( pCodePairs ) - { - pCodePairs[0] = 0x0020; - pCodePairs[1] = 0xD800; - pCodePairs[2] = 0xE000; - pCodePairs[3] = 0xFFFE; - } - return 2; - } - - if( aRangeSet.empty() ) - return 0; - - // sort and merge the code pairs - sal_uInt32* pDst = pCodePairs; - RangeSet::const_iterator it = aRangeSet.begin(); - for( sal_uInt32 nEnd = 0; it != aRangeSet.end(); ++it ) - { - // check overlap with to previous range - const CodeRange& rSrc = *it; - if( nEnd < rSrc.GetMin() ) - { - nEnd = rSrc.GetEnd(); - if( pCodePairs ) - { - pDst[0] = rSrc.GetMin(); - pDst[1] = rSrc.GetEnd(); - } - pDst += 2; - } - else - { - // merge overlapping ranges - if( nEnd < rSrc.GetEnd() ) - { - nEnd = rSrc.GetEnd(); - if( pCodePairs ) - pDst[-1] = nEnd; - } - } - } - - int nRangeCount = (pDst - pCodePairs) / 2; - return nRangeCount; -} - -// ------ class to handle scalable bitmap fonts ------------------------------ - -ScalableBitmapXlfd::ScalableBitmapXlfd() -: ExtendedXlfd( true ) -{} - -ScalableBitmapXlfd::~ScalableBitmapXlfd() -{} - -void -ScalableBitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-"; - rString += ByteString::CreateFromInt32( rInfo.mnResolutionX ); - rString += '-'; - rString += ByteString::CreateFromInt32( rInfo.mnResolutionY ); - rString += '-'; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -ScalableBitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char *pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* ScalableBitmapXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - pFontData->mnQuality= 0; - return pFontData; -} - -// ------ class to handle true bitmap fonts ---------------------------------- - -void -BitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char *pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -BitmapXlfd::BitmapXlfd( ) -: ExtendedXlfd( false ) -{} - -BitmapXlfd::~BitmapXlfd( ) -{} - -bool -BitmapXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - if ( mnEncodings == 0 ) - { - mnPixelSize = pXlfd->mnPixelSize; - mnPointSize = pXlfd->mnPointSize; - mnAverageWidth = pXlfd->mnAverageWidth; - } - - return ExtendedXlfd::AddEncoding( pXlfd ); -} - -void -BitmapXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding ); - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - rString += '-'; - rString += ByteString::CreateFromInt32( mnPixelSize ); - rString += "-*-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* BitmapXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, mnPixelSize ); - pFontData->mnQuality= 100; - return pFontData; -} - -// ------ class to handle true scalable fonts -------------------------------- - -ScalableXlfd::ScalableXlfd() -: ExtendedXlfd( true ) -{} - -ScalableXlfd::~ScalableXlfd() -{} - -void -ScalableXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-0-0-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -ScalableXlfd::ToString( ByteString &rString, - unsigned short nPixelSize, char* pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtendedXlfd::ToString( rString, nPixelSize, nEncoding); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* ScalableXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - pFontData->mnQuality= 200; - return pFontData; -} - -/* ------- virtual fonts for user interface ------------------------------- */ - -VirtualXlfd::ExtEncodingInfo& -VirtualXlfd::ExtEncodingInfo::operator= ( const Xlfd *pXlfd ) -{ - mnFoundry = pXlfd->mnFoundry; - mnFamily = pXlfd->mnFamily; - mnWeight = pXlfd->mnWeight; - mnSlant = pXlfd->mnSlant; - mnSetwidth = pXlfd->mnSetwidth; - - return *this; -} - -VirtualXlfd::VirtualXlfd() -: ExtendedXlfd( true ), - mnExtCapacity(0), - mpExtEncodingInfo(NULL) -{ - mnFoundry = 0; - mnFamily = 0; - mnWeight = 0; - mnSlant = 0; - mnSetwidth = 0; -} - -VirtualXlfd::~VirtualXlfd() -{ - if ( mpExtEncodingInfo != NULL ) - rtl_freeMemory( mpExtEncodingInfo ); -} - -int -VirtualXlfd::GetFontQuality (unsigned short nFamily) -{ - Attribute *pFamily = mpFactory->RetrieveFamily(nFamily); - int nQuality = 0; - - if (pFamily->HasFeature(XLFD_FEATURE_HQ)) - nQuality += 16; - if (pFamily->HasFeature(XLFD_FEATURE_MQ)) - nQuality += 8; - if (pFamily->HasFeature(XLFD_FEATURE_LQ)) - nQuality += 4; - return nQuality; -} - -bool -VirtualXlfd::AddEncoding( const Xlfd *pXlfd ) -{ - // add new font - bool bRC = ExtendedXlfd::AddEncoding( pXlfd ); - - int nIdx; - if( bRC ) - { - // new encoding => append the new pXlfd - nIdx = mnEncodings - 1; - if( nIdx >= mnExtCapacity ) - { - mnExtCapacity = mnEncCapacity; - mpExtEncodingInfo = (ExtEncodingInfo*)Realloc( mpExtEncodingInfo, - mnExtCapacity * sizeof(ExtEncodingInfo) ); - } - } - else - { - // existing encoding => check if the new pXlfd is better - rtl_TextEncoding nEncoding = pXlfd->GetEncoding(); - nIdx = GetEncodingIdx( nEncoding ); - - int nOldQuality = GetFontQuality( mpExtEncodingInfo[nIdx].mnFamily ); - int nNewQuality = GetFontQuality( pXlfd->mnFamily ); - if( nOldQuality >= nNewQuality ) - return false; - } - - mpExtEncodingInfo[ nIdx ] = pXlfd; - return true; -} - -void -VirtualXlfd::FilterInterfaceFont (const Xlfd *pXlfd) -{ - Attribute *pAttr; - AttributeProvider *pFactory = pXlfd->mpFactory; - - if (! pXlfd->Fonttype() == TYPE_SCALABLE) - return; - pAttr = pFactory->RetrieveFamily(pXlfd->mnFamily); - if (! pAttr->HasFeature(XLFD_FEATURE_INTERFACE_FONT)) - return; - pAttr = pFactory->RetrieveSlant(pXlfd->mnSlant); - if (! (FontItalic)pAttr->GetValue() == ITALIC_NONE) - return; - pAttr = pFactory->RetrieveSetwidth(pXlfd->mnSetwidth); - if (pAttr->HasFeature(XLFD_FEATURE_NARROW)) - return; - pAttr = pFactory->RetrieveWeight(pXlfd->mnWeight); - FontWeight eWeight = (FontWeight)pAttr->GetValue(); - if ((eWeight != WEIGHT_NORMAL) && (eWeight != WEIGHT_MEDIUM)) - return; - - AddEncoding (pXlfd); -} - -void -VirtualXlfd::ToString( ByteString &rString, unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtEncodingInfo &rExtInfo = mpExtEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveFoundry(rExtInfo.mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(rExtInfo.mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(rExtInfo.mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(rExtInfo.mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(rExtInfo.mnSetwidth), rString ); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += '-'; - rString += ByteString::CreateFromInt32( nPixelSize ); - rString += "-0-0-0-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-0"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -void -VirtualXlfd::ToString( ByteString &rString, unsigned short nPixelSize, - char* pMatricsString, rtl_TextEncoding nEncoding ) const -{ - int nIdx = GetEncodingIdx( nEncoding ); - if ( nIdx < 0 ) - return; - - ExtEncodingInfo &rExtInfo = mpExtEncodingInfo[ nIdx ]; - - AppendAttribute( mpFactory->RetrieveFoundry(rExtInfo.mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(rExtInfo.mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(rExtInfo.mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(rExtInfo.mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(rExtInfo.mnSetwidth), rString ); - - EncodingInfo& rInfo = mpEncodingInfo[ nIdx ]; - AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString ); - - rString += "-*-"; - char pTmp[256]; - snprintf( pTmp, sizeof(pTmp), pMatricsString, nPixelSize, nPixelSize ); - rString += pTmp; - rString += "-*-*-"; - rString += static_cast< char >(rInfo.mcSpacing); - rString += "-*"; - - AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString ); -} - -ImplFontData* VirtualXlfd::GetImplFontData() const -{ - ImplX11FontData* pFontData = new ImplX11FontData( *this, 0 ); - - // family name - static const String aFontName( RTL_CONSTASCII_USTRINGPARAM("Interface User") ); - pFontData->maName = aFontName; - // pFontData->maStyleName = aStyleName; - pFontData->meFamily = FAMILY_SWISS; - pFontData->meWeight = WEIGHT_NORMAL; - pFontData->meItalic = ITALIC_NONE; - pFontData->meWidthType = WIDTH_NORMAL; - pFontData->mePitch = PITCH_VARIABLE; - - pFontData->mbSymbolFlag = false; - pFontData->mbOrientation= false; - pFontData->mbDevice = true; - pFontData->mnQuality = 100; - - return pFontData; -} - -// ------ font list ------------------------------------------------------- - -XlfdStorage::XlfdStorage() -{ - maXlfdList.reserve( 256 ); -} - -void -XlfdStorage::Dispose() -{ - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - delete *it; - maXlfdList.clear(); -} - -void -XlfdStorage::Reset() -{ - maXlfdList.clear(); -} - -void -XlfdStorage::Add( const ExtendedXlfd* pXlfd ) -{ - if ( pXlfd != NULL ) - maXlfdList.push_back( pXlfd ); -} - -void -XlfdStorage::Add( const XlfdStorage* pXlfd ) -{ - if ( !pXlfd || pXlfd->maXlfdList.empty() ) - return; - - maXlfdList.reserve( maXlfdList.size() + pXlfd->maXlfdList.size() ); - XlfdList::const_iterator it = pXlfd->maXlfdList.begin(); - for(; it != pXlfd->maXlfdList.end(); ++it ) - maXlfdList.push_back( *it ); -} - -void XlfdStorage::AnnounceFonts( ImplDevFontList* pList ) const -{ - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - { - const ExtendedXlfd* pXlfd = *it; - ImplFontData* pFontData = pXlfd->GetImplFontData(); - pList->Add( pFontData ); - } -} - -// ------ bitmap font list -------------------------------------------------- - -void -BitmapXlfdStorage::AddBitmapFont( const Xlfd *pXlfd ) -{ - if ( pXlfd == NULL ) - return; - - int nPixelSize = pXlfd->mnPixelSize; - XlfdList::const_iterator it = maXlfdList.begin(); - for(; it != maXlfdList.end(); ++it ) - { - BitmapXlfd* pBitmapXlfd = (BitmapXlfd*)*it; - if( nPixelSize == pBitmapXlfd->GetPixelSize() ) - { - // we need to add an encoding to an existing bitmap font - pBitmapXlfd->AddEncoding( pXlfd ); - return; - } - } - - // we have a new bitmap font - BitmapXlfd* pBitmapXlfd = new BitmapXlfd; - pBitmapXlfd->AddEncoding( pXlfd ); - Add( pBitmapXlfd ); -} diff --git a/vcl/unx/source/gdi/xlfd_extd.hxx b/vcl/unx/source/gdi/xlfd_extd.hxx deleted file mode 100644 index 523f87fac477..000000000000 --- a/vcl/unx/source/gdi/xlfd_extd.hxx +++ /dev/null @@ -1,272 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_EXTENDED_HXX -#define XLFD_EXTENDED_HXX - -#include -#ifndef _VCL_VCLENUM_HXX -#include -#endif -#ifndef _VCL_OUTFONT_HXX -#include -#endif - -#include - -class Xlfd; -class AttributeProvider; -class ImplDevFontList; -class ByteString; - -// -------------------------------------------------------------------------- -// -// classes for Xlfd handling that contain more than a single encoding. -// Members that may vary through different encodings are stored in -// a mpEncodingInfo member. There are three different classes: -// true scalable fonts (truetype and type1) scalable bitmap fonts -// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members -// that are specific to a font outline -// ( e.g. adobe-times-roman-medium-r-normal- * -p- * ) -// and specifies the interface. -// -// -------------------------------------------------------------------------- - -// base class - -class ExtendedXlfd : public ImplDevFontAttributes -{ - public: - ExtendedXlfd( bool bScalable ); - virtual ~ExtendedXlfd(); - virtual bool AddEncoding( const Xlfd* ); - bool HasEncoding( rtl_TextEncoding ) const; - int GetEncodingIdx( rtl_TextEncoding nEncoding ) const; - unsigned short NumEncodings() const - { return mnEncodings; } - virtual int GetPixelSize() const - { return 0; } - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const ; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const = 0; - bool IsScalable() const { return mbScalable; } - virtual FontFamily GetFamilyType() const; - virtual FontWeight GetWeight() const; - virtual FontItalic GetSlant() const; - virtual FontWidth GetWidthType() const; - virtual FontPitch GetPitch() const; - virtual FontPitch GetPitch( rtl_TextEncoding ) const; - rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const; - rtl_TextEncoding GetEncoding() const; - rtl_TextEncoding GetEncoding( int i ) const; - - int GetFontCodeRanges( sal_uInt32* pCodePairs ) const; - - protected: - AttributeProvider* mpFactory; - - public: - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - bool mbScalable; - - protected: - unsigned short mnEncodings; - unsigned short mnEncCapacity; - struct EncodingInfo { - unsigned char mcSpacing; - unsigned short mnResolutionX; - unsigned short mnResolutionY; - unsigned short mnAddstyle; - unsigned short mnCharset; - rtl_TextEncoding mnEncoding; - - EncodingInfo& operator= ( const Xlfd *pXlfd ); - } *mpEncodingInfo; -}; - -// class to handle scalable bitmap fonts - -class ScalableBitmapXlfd : public ExtendedXlfd { - - public: - ScalableBitmapXlfd(); - virtual ~ScalableBitmapXlfd(); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const ; -}; - -// class to handle true bitmap fonts - -class ScalableXlfd; - -class BitmapXlfd : public ExtendedXlfd { - - public: - BitmapXlfd(); - ~BitmapXlfd(); - bool AddEncoding( const Xlfd* ); - virtual int GetPixelSize() const - { return mnPixelSize; } - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - virtual ImplFontData* GetImplFontData() const ; - protected: - - unsigned short mnPixelSize; - unsigned short mnPointSize; - unsigned short mnAverageWidth; -}; - -// class to handle true scalable fonts - -class ScalableXlfd : public ExtendedXlfd { - - friend class BitmapXlfd; - - public: - ScalableXlfd(); - virtual ~ScalableXlfd(); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const; - - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - virtual ImplFontData* GetImplFontData() const ; -}; - -// class to maintain a list of fonts ( bitmap and scalable ) - -class XlfdStorage { - - public: - XlfdStorage(); - - void Dispose(); - void Reset(); - - void Add( const ExtendedXlfd *pXlfd ); - void Add( const XlfdStorage *pXlfd ); - void AnnounceFonts( ImplDevFontList* ) const; - - protected: - - typedef ::std::vector XlfdList; - XlfdList maXlfdList; -}; - -// list of fonts specific for bitmap fonts - -class BitmapXlfdStorage : public XlfdStorage { - - public: - - void AddBitmapFont( const Xlfd *pXlfd ); -}; - - -/* Virtual font for User Interface */ - -class VirtualXlfd : public ExtendedXlfd -{ - private: - - int GetFontQuality (unsigned short nFamily); - - public: - VirtualXlfd(); - virtual ~VirtualXlfd(); - virtual bool AddEncoding( const Xlfd* ); - void FilterInterfaceFont (const Xlfd *pXlfd); - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - rtl_TextEncoding nEncoding ) const ; - virtual void ToString( ByteString &rString, - unsigned short nPixelSize, - char* pMatricsString, - rtl_TextEncoding nEncoding ) const; - - virtual ImplFontData* GetImplFontData() const ; - protected: - - unsigned short mnExtCapacity; - struct ExtEncodingInfo { - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - - ExtEncodingInfo& operator= ( const Xlfd *pXlfd ); - } *mpExtEncodingInfo; - - friend class ExtEncodingInfo; -}; - - -// class to describe a X11 physically available font face - -class ImplX11FontData : public ImplFontData -{ -private: - enum { X11IFD_MAGIC = 0x111FDA1C }; - const ExtendedXlfd& mrXlfd; - -public: - ImplX11FontData( const ExtendedXlfd&, int nHeight ); - const ExtendedXlfd& GetExtendedXlfd() const { return mrXlfd; } - virtual ImplFontData* Clone() const { return new ImplX11FontData( *this ); } - virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; - virtual sal_IntPtr GetFontId() const; - - static bool CheckFontData( const ImplFontData& r ) { return r.CheckMagic( X11IFD_MAGIC ); } -}; - -#endif /* XLFD_EXTENDED_HXX */ diff --git a/vcl/unx/source/gdi/xlfd_smpl.cxx b/vcl/unx/source/gdi/xlfd_smpl.cxx deleted file mode 100644 index 6cf18d98de1e..000000000000 --- a/vcl/unx/source/gdi/xlfd_smpl.cxx +++ /dev/null @@ -1,268 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include -#include -#include -#include "xlfd_attr.hxx" -#include "xlfd_smpl.hxx" - -// -------------------------------------------------------------------------- -// -// -// broken down structure equivalent to a Xlfd string -// -// -// -------------------------------------------------------------------------- - -Xlfd::Xlfd() -{ -} - -// XlfdCompare abi has to be qsort(3) compatible, the sorting result must -// guarantee that fonts with SameFontoutline() are successive -// XlfdCompare relies on vFrom->mpFactory eq vTo->mpFactory. Since comparing -// Xlfd's is done by comparing attributes there is no way around this. -extern "C" int -XlfdCompare( const void *vFrom, const void *vTo ) -{ - const Xlfd *pFrom = (Xlfd*)vFrom; - const Xlfd *pTo = (Xlfd*)vTo; - - // Compare outline description - if ( pFrom->mnFoundry != pTo->mnFoundry ) - return (int)pFrom->mnFoundry - (int)pTo->mnFoundry; - if ( pFrom->mnFamily != pTo->mnFamily ) - return (int)pFrom->mnFamily - (int)pTo->mnFamily; - if ( pFrom->mnWeight != pTo->mnWeight ) - return (int)pFrom->mnWeight - (int)pTo->mnWeight; - if ( pFrom->mnSlant != pTo->mnSlant ) - return (int)pFrom->mnSlant - (int)pTo->mnSlant; - if ( pFrom->mnSetwidth != pTo->mnSetwidth ) - return (int)pFrom->mnSetwidth - (int)pTo->mnSetwidth; - - // Addstyle name is futile tricky. it may contain encoding information - // (like "ansi_1251") which Compares equal, or it may contain style - // information (like "serif") which Compares unequal, anyway if the font - // is "interface user" or "interface system" then compare equal anyway to - // build fontsets as large as possible - if ( pFrom->mnAddstyle == pTo->mnAddstyle ) - return 0; - - AttributeProvider *pFactory = pFrom->mpFactory; - Attribute *pFamily = pFactory->RetrieveFamily( pFrom->mnFamily ); - if ( pFamily->HasFeature(XLFD_FEATURE_APPLICATION_FONT) ) - return 0; - - Attribute *pFromAddStyle = pFactory->RetrieveAddstyle( pFrom->mnAddstyle ); - Attribute *pToAddStyle = pFactory->RetrieveAddstyle( pTo->mnAddstyle ); - - // if both addstyles denote encodings or if one denotes an - // encoding and the other denotes a style which really - // duplicates weight and slant information - - int nFromCompare = (pFromAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW) - || (pFromAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ? - -1 : pFrom->mnAddstyle; - int nToCompare = (pToAddStyle->GetValue() != RTL_TEXTENCODING_DONTKNOW) - || (pToAddStyle->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ? - -1 : pTo->mnAddstyle; - - return nFromCompare - nToCompare; -} - -// check whether two fonts are identical as appearance is concerned -// this does not Compare the actual scaling of two fonts -Bool -Xlfd::SameFontoutline( const Xlfd* pComparedTo ) const -{ - void* pThis = (void*)this; - return XlfdCompare( (void*)pThis, (void*)pComparedTo ) == 0 ; -} - -unsigned short -Xlfd::GetEncoding() const -{ - Attribute *pAddstyle = mpFactory->RetrieveAddstyle( mnAddstyle ); - if ( pAddstyle->GetValue() != RTL_TEXTENCODING_DONTKNOW ) - return pAddstyle->GetValue(); - - Attribute *pEncoding = mpFactory->RetrieveCharset( mnCharset ); - return pEncoding->GetValue(); -} - -XlfdFonttype -Xlfd::Fonttype() const -{ - if ( (mnAverageWidth == 0) && (mnPixelSize == 0) && (mnPointSize == 0) ) - { - return (mnResolutionX == 0) - && (mnResolutionY == 0) ? eTypeScalable : eTypeScalableBitmap; - } - - return eTypeBitmap; -} - -void -Advance( const char** pFrom, const char** pTo ) -{ - const char *pTmp = *pTo; - - for( ; (*pTmp != '\0') && (*pTmp++ != '-'); ) - {} - *pFrom = *pTo; - *pTo = pTmp; -} - -Bool -Xlfd::IsConformant (const char* pXlfd) const -{ - // X FontNameRegistry prefix "-" - if (*pXlfd++ != '-') - return False; - - // All Xlfd FontName fields are defined - int nNumFields = 1; - while (*pXlfd != '\0') - { - if (*pXlfd++ == '-') - nNumFields++; - } - // enough entries ? - if (nNumFields != 14) - return False; - // and the last one is not empty as well ? - if (*(pXlfd - 1) == '-') - return False; - - return True; -} - -// this is the real workhorse function. Since this is called for every font -// in the fontpath it has to be as fast a possible -Bool -Xlfd::FromString( const char* pXlfdstring, AttributeProvider *pFactory ) -{ - if (!IsConformant(pXlfdstring)) - return False; - - const char* pFrom = pXlfdstring + 1; - const char* pTo = pFrom; - mpFactory = pFactory; - - Advance( &pFrom, &pTo ); //-foundry-* - mnFoundry = mpFactory->InsertFoundry( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); // -*-family-* - mnFamily = mpFactory->InsertFamily( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); // -*-*-weight-* - mnWeight = mpFactory->InsertWeight( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-slant-* - mnSlant = mpFactory->InsertSlant( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-setwidth-* - mnSetwidth = mpFactory->InsertSetwidth( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-Addstyle-* - mnAddstyle = mpFactory->InsertAddstyle( pFrom, pTo - pFrom - 1 ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-height-* - mnPixelSize = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-pt height-* - mnPointSize = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-x resolution-* - mnResolutionX = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-y resolution-* - mnResolutionY = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-spacing-* - mcSpacing = pFrom == pTo ? '\0' : *pFrom; - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-average-* - mnAverageWidth = atoi( pFrom ); - - Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-*-registry-encoding - const char* pTmp = pFrom; - Advance( &pTmp, &pTo ); - mnCharset = mpFactory->InsertCharset( pFrom, pTo - pFrom ); - - // sanity check whether we have really found a valid XLFD, if not - // throw away the whole font, since we have no idea what parts of - // the XLFD contains the error. - if ( !(pTo > pFrom) ) - return False; - - // a non-empty family name is essential, since otherwise the font - // would match the "default font" #52299# - Attribute* pFamily = mpFactory->RetrieveFamily( mnFamily ); - const char* pFamilyName = pFamily->GetName(); - if ( pFamilyName[0] == '\0' ) - return False; - - // well done - return True; -} - -#if OSL_DEBUG_LEVEL > 1 -// pure debug for now: this is only to inspect/pretty print a Xlfd struct -const char* -Xlfd::ToString( ByteString &rString ) const -{ - AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString ); - AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString ); - AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString ); - AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString ); - AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString ); - AppendAttribute( mpFactory->RetrieveAddstyle(mnAddstyle), rString ); - - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPixelSize ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnPointSize ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionX ) ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnResolutionY ) ); - rString.Append("-"); rString.Append( (char)mcSpacing ); - rString.Append("-"); rString.Append( ByteString::CreateFromInt32( mnAverageWidth ) ); - - AppendAttribute( mpFactory->RetrieveCharset(mnCharset), rString ); - - return rString.GetBuffer() ; -} - -void -Xlfd::Dump() const -{ - ByteString aString; - fprintf(stderr, "Xlfd: %s\n", ToString(aString) ); -} -#endif - diff --git a/vcl/unx/source/gdi/xlfd_smpl.hxx b/vcl/unx/source/gdi/xlfd_smpl.hxx deleted file mode 100644 index f62ac381e6b9..000000000000 --- a/vcl/unx/source/gdi/xlfd_smpl.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef XLFD_SIMPLE_HXX -#define XLFD_SIMPLE_HXX - -#include -#include -#include - -class AttributeProvider; - -// -------------------------------------------------------------------------- -// -// -// broken down structure equivalent to a Xlfd string -// -// -// -------------------------------------------------------------------------- - -enum XlfdFonttype { - eTypeUnknown = TYPE_DONTKNOW, - eTypeBitmap = TYPE_RASTER, - eTypeScalableBitmap = TYPE_VECTOR, - eTypeScalable = TYPE_SCALABLE -}; - -class Xlfd { - - public: - - unsigned short mnFoundry; - unsigned short mnFamily; - unsigned short mnWeight; - unsigned short mnSlant; - unsigned short mnSetwidth; - unsigned short mnAddstyle; - unsigned short mnPixelSize; - unsigned short mnPointSize; - unsigned short mnResolutionX; - unsigned short mnResolutionY; - unsigned char mcSpacing; - unsigned short mnAverageWidth; - unsigned short mnCharset; - - // all foundry, family, weight ... information referres - // to this factory - AttributeProvider *mpFactory; - - Bool IsConformant( const char* pXlfdstring ) const; - - public: - Xlfd(); - Bool FromString( const char* pXlfdstring, - AttributeProvider *pFactory ); - Bool SameFontoutline( const Xlfd *pComparedTo ) const ; - XlfdFonttype Fonttype() const ; - unsigned short GetEncoding() const ; - #if OSL_DEBUG_LEVEL > 1 - const char* ToString( ByteString &rString ) const ; - void Dump() const; - #endif -}; - -extern "C" int -XlfdCompare( const void *vFrom, const void *vTo ); - -#endif /* XLFD_SIMPLE_HXX */ - -- cgit From 098a95148b87e2cae95912459703ac5b2fb9b722 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Nov 2010 11:35:55 +0100 Subject: #i110171# FontGC is still needed for clipping/forcedAA/gtk/kde-plugins --- vcl/unx/source/gdi/salgdi.cxx | 8 +++++++- vcl/unx/source/gdi/salgdi3.cxx | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index b2e40310a03e..10532b811d68 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -111,6 +111,7 @@ X11SalGraphics::X11SalGraphics() nPenPixel_ = 0; nPenColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black + pFontGC_ = NULL; for( int i = 0; i < MAX_FALLBACK; ++i ) mpServerFont[i] = NULL; @@ -140,6 +141,7 @@ X11SalGraphics::X11SalGraphics() bPrinter_ = FALSE; bVirDev_ = FALSE; bPenGC_ = FALSE; + bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; @@ -169,6 +171,7 @@ void X11SalGraphics::freeResources() if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None; if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None; + if( pFontGC_ ) XFreeGC( pDisplay, pFontGC_ ), pFontGC_ = None; if( pBrushGC_ ) XFreeGC( pDisplay, pBrushGC_ ), pBrushGC_ = None; if( pMonoGC_ ) XFreeGC( pDisplay, pMonoGC_ ), pMonoGC_ = None; if( pCopyGC_ ) XFreeGC( pDisplay, pCopyGC_ ), pCopyGC_ = None; @@ -183,7 +186,7 @@ void X11SalGraphics::freeResources() if( m_aRenderPicture ) XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0; - bPenGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false; + bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false; } void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen ) @@ -576,6 +579,7 @@ void X11SalGraphics::ResetClipRegion() if( pClipRegion_ ) { bPenGC_ = FALSE; + bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; @@ -625,6 +629,7 @@ bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) void X11SalGraphics::EndSetClipRegion() { bPenGC_ = FALSE; + bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; @@ -749,6 +754,7 @@ void X11SalGraphics::SetXORMode( bool bSet, bool ) { bXORMode_ = bSet; bPenGC_ = FALSE; + bFontGC_ = FALSE; bBrushGC_ = FALSE; bMonoGC_ = FALSE; bCopyGC_ = FALSE; diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 360c7e95d8f9..0861b778ed57 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -993,6 +993,7 @@ X11SalGraphics::SetTextColor( SalColor nSalColor ) { nTextColor_ = nSalColor; nTextPixel_ = GetPixel( nSalColor ); + bFontGC_ = FALSE; } } -- cgit From 84444c912fd76c38d39c9db7ad94648b49e912ba Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Nov 2010 15:10:23 +0100 Subject: #i110171# remove obsoleted fwd-decls and dbg-utils --- vcl/unx/inc/salgdi.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index 6a77d4bacf96..8af62a5c6607 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -28,10 +28,6 @@ #ifndef _SV_SALGDI_H #define _SV_SALGDI_H - -// -=-= exports -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -class SalFontCacheItem; - // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #include "salstd.hxx" #include "vcl/salgdi.hxx" @@ -383,19 +379,8 @@ inline Pixel X11SalGraphics::GetPixel( SalColor nSalColor ) const #ifdef DBG_UTIL #define stderr0( s ) fprintf( stderr, s ) -#define stderr1( s, a ) fprintf( stderr, s, a ) -#define stderr2( s, a, b ) fprintf( stderr, s, a, b ) -#define stderr3( s, a, b, c ) fprintf( stderr, s, a, b, c ) -#define stdass0( b ) (void)( !(b) \ - ? fprintf( stderr, "\"%s\" (%s line %d)\n", \ - #b, __FILE__, __LINE__ ) \ - : 0 ) #else #define stderr0( s ) ; -#define stderr1( s, a ) ; -#define stderr2( s, a, b ) ; -#define stderr3( s, a, b, c ) ; -#define stdass0( b ) ; #endif #endif // _SV_SALGDI_H -- cgit From f01fbf1d4f68ddd9dae19de5138e213764be8c1d Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Nov 2010 15:36:53 +0100 Subject: #i115635# finish of remainders of xprint usage --- vcl/unx/inc/i18n_im.hxx | 4 ---- vcl/unx/source/app/saldisp.cxx | 5 ----- vcl/unx/source/gdi/makefile.mk | 5 ----- vcl/unx/source/gdi/salgdi.cxx | 5 ----- vcl/unx/source/gdi/salgdi3.cxx | 18 ------------------ vcl/unx/source/window/salframe.cxx | 2 -- vcl/util/target.pmk | 5 ----- 7 files changed, 44 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/inc/i18n_im.hxx b/vcl/unx/inc/i18n_im.hxx index 297bc8edec17..a22a57b976c8 100644 --- a/vcl/unx/inc/i18n_im.hxx +++ b/vcl/unx/inc/i18n_im.hxx @@ -56,10 +56,6 @@ public: Bool FilterEvent( XEvent *pEvent, XLIB_Window window ); Bool AddConnectionWatch (Display *pDisplay, void *pConnectionHandler); - #ifdef _USE_PRINT_EXTENSION_ - void Invalidate() { mbUseable = False; } - #endif - SalI18N_InputMethod(); ~SalI18N_InputMethod(); }; diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index cd3d7ea06fde..92d5f75f7315 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -375,11 +375,6 @@ sal_GetServerVendor( Display *p_display ) { vendor_none, NULL, 0 }, }; -#ifdef _USE_PRINT_EXTENSION_ - if ( ! XSalIsDisplay( p_display ) ) - return vendor_xprinter; -#endif - // handle regular server vendors char *p_name = ServerVendor( p_display ); vendor_t *p_vendor; diff --git a/vcl/unx/source/gdi/makefile.mk b/vcl/unx/source/gdi/makefile.mk index 7e889266a831..123fcbcf9131 100644 --- a/vcl/unx/source/gdi/makefile.mk +++ b/vcl/unx/source/gdi/makefile.mk @@ -64,13 +64,8 @@ EXCEPTIONSFILES=\ $(SLO)$/salgdi3.obj \ $(SLO)$/salcvt.obj -.IF "$(USE_XPRINT)" == "TRUE" -CFLAGS+=-D_USE_PRINT_EXTENSION_=1 -SLOFILES+=$(SLO)$/xprintext.obj -.ELSE SLOFILES+=$(SLO)$/salprnpsp.obj EXCEPTIONSFILES+=$(SLO)$/salprnpsp.obj -.ENDIF .IF "$(OS)"=="SOLARIS" SLOFILES+=$(SLO)$/cdeint.obj diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 10532b811d68..9dfbfff22d03 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -335,13 +335,8 @@ GC X11SalGraphics::SelectBrush() { XSetFillStyle ( pDisplay, pBrushGC_, FillSolid ); XSetForeground( pDisplay, pBrushGC_, nBrushPixel_ ); - #if defined(_USE_PRINT_EXTENSION_) - XSetBackground( pDisplay, pBrushGC_, - WhitePixel(pDisplay, DefaultScreen(pDisplay)) ); - #else if( bPrinter_ ) XSetTile( pDisplay, pBrushGC_, None ); - #endif } else { diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 0861b778ed57..d9f81c0f67d2 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -160,18 +160,10 @@ X11SalGraphics::GetFontGC() values.fill_rule = EvenOddRule; // Pict import/ Gradient values.graphics_exposures = False; values.foreground = nTextPixel_; -#ifdef _USE_PRINT_EXTENSION_ - values.background = xColormap_->GetWhitePixel(); - pFontGC_ = XCreateGC( pDisplay, hDrawable_, - GCSubwindowMode | GCFillRule - | GCGraphicsExposures | GCBackground | GCForeground, - &values ); -#else pFontGC_ = XCreateGC( pDisplay, hDrawable_, GCSubwindowMode | GCFillRule | GCGraphicsExposures | GCForeground, &values ); -#endif } if( !bFontGC_ ) { @@ -1372,7 +1364,6 @@ BOOL X11SalGraphics::CreateFontSubset( const void* X11SalGraphics::GetEmbedFontData( const ImplFontData* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen ) { -#ifndef _USE_PRINT_EXTENSION_ // in this context the pFont->GetFontId() is a valid PSP // font since they are the only ones left after the PDF // export has filtered its list of subsettable fonts (for @@ -1380,25 +1371,19 @@ const void* X11SalGraphics::GetEmbedFontData( const ImplFontData* pFont, const s // be to have the GlyphCache search for the ImplFontData pFont psp::fontID aFont = pFont->GetFontId(); return PspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, rInfo, pDataLen ); -#else - return NULL; -#endif } //-------------------------------------------------------------------------- void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen ) { -#ifndef _USE_PRINT_EXTENSION_ PspGraphics::DoFreeEmbedFontData( pData, nLen ); -#endif } //-------------------------------------------------------------------------- const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const ImplFontData* pFont, const Ucs2OStrMap** pNonEncoded ) { -#ifndef _USE_PRINT_EXTENSION_ // in this context the pFont->GetFontId() is a valid PSP // font since they are the only ones left after the PDF // export has filtered its list of subsettable fonts (for @@ -1406,9 +1391,6 @@ const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const ImplFontData* pF // be to have the GlyphCache search for the ImplFontData pFont psp::fontID aFont = pFont->GetFontId(); return PspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded ); -#else - return NULL; -#endif } //-------------------------------------------------------------------------- diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 9934277302e1..11c20aa40f5a 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -3588,9 +3588,7 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) if( FocusIn == pEvent->type ) { -#ifndef _USE_PRINT_EXTENSION_ vcl_sal::PrinterUpdate::update(); -#endif mbInputFocus = True; ImplSVData* pSVData = ImplGetSVData(); diff --git a/vcl/util/target.pmk b/vcl/util/target.pmk index 3144acc4bc05..8ec15475bc90 100644 --- a/vcl/util/target.pmk +++ b/vcl/util/target.pmk @@ -37,8 +37,3 @@ ONLYDLL .SETDIR=$(PRJ)$/util: $(SLOFILES) dmake debug=t prjpch=t linkinc=t compinc=t ..$/$(OUTPATH)$/bin$/sv$(DLLPOSTFIX).dll @echo "READY" -.IF "$(USE_XPRINT)"!="TRUE" -.ELSE -CFLAGS+=-D_USE_PRINT_EXTENSION_=1 -.ENDIF - -- cgit From 5bfa292fa2935335d2bf62a5655099798ed37ae6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 18 Nov 2010 12:04:52 +0100 Subject: vcl117: solve some compilation issues --- vcl/win/source/gdi/salgdi3.cxx | 276 +++++++++++++++++++-------------------- vcl/win/source/gdi/winlayout.cxx | 3 +- 2 files changed, 139 insertions(+), 140 deletions(-) mode change 100644 => 100755 vcl/win/source/gdi/salgdi3.cxx mode change 100644 => 100755 vcl/win/source/gdi/winlayout.cxx (limited to 'vcl') diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx old mode 100644 new mode 100755 index 29e4bd786735..91662fb8aded --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1907,22 +1907,21 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) } mnFontKernPairCount = 0; - KERNINGPAIR* pPairs = NULL; - int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); - if( nCount ) - { -#ifdef GCP_KERN_HACK - pPairs = new KERNINGPAIR[ nCount+1 ]; - mpFontKernPairs = pPairs; - mnFontKernPairCount = nCount; - ::GetKerningPairsW( mhDC, nCount, pPairs ); -#else // GCP_KERN_HACK - pPairs = pKernPairs; - nCount = (nCount < nPairs) : nCount : nPairs; - ::GetKerningPairsW( mhDC, nCount, pPairs ); - return nCount; -#endif // GCP_KERN_HACK - } + KERNINGPAIR* pPairs = NULL; + int nCount = ::GetKerningPairsW( mhDC, 0, NULL ); + if( nCount ) + { + #ifdef GCP_KERN_HACK + pPairs = new KERNINGPAIR[ nCount+1 ]; + mpFontKernPairs = pPairs; + mnFontKernPairCount = nCount; + ::GetKerningPairsW( mhDC, nCount, pPairs ); + #else // GCP_KERN_HACK + pPairs = pKernPairs; + nCount = (nCount < nPairs) : nCount : nPairs; + ::GetKerningPairsW( mhDC, nCount, pPairs ); + return nCount; + #endif // GCP_KERN_HACK } mbFontKernInit = FALSE; @@ -2491,147 +2490,146 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, return FALSE; // TODO: avoid tools polygon by creating B2DPolygon directly - int nPtSize = 512; - Point* pPoints = new Point[ nPtSize ]; - BYTE* pFlags = new BYTE[ nPtSize ]; + int nPtSize = 512; + Point* pPoints = new Point[ nPtSize ]; + BYTE* pFlags = new BYTE[ nPtSize ]; + + TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; + while( (BYTE*)pHeader < pData+nSize2 ) + { + // only outline data is interesting + if( pHeader->dwType != TT_POLYGON_TYPE ) + break; + + // get start point; next start points are end points + // of previous segment + USHORT nPnt = 0; - TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData; - while( (BYTE*)pHeader < pData+nSize2 ) + long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); + long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); + pPoints[ nPnt ] = Point( nX, nY ); + pFlags[ nPnt++ ] = POLY_NORMAL; + + bool bHasOfflinePoints = false; + TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); + pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); + while( (BYTE*)pCurve < (BYTE*)pHeader ) + { + int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; + if( nPtSize < nNeededSize ) { - // only outline data is interesting - if( pHeader->dwType != TT_POLYGON_TYPE ) - break; - - // get start point; next start points are end points - // of previous segment - USHORT nPnt = 0; - - long nX = IntTimes256FromFixed( pHeader->pfxStart.x ); - long nY = IntTimes256FromFixed( pHeader->pfxStart.y ); - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt++ ] = POLY_NORMAL; - - bool bHasOfflinePoints = false; - TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 ); - pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb ); - while( (BYTE*)pCurve < (BYTE*)pHeader ) + Point* pOldPoints = pPoints; + BYTE* pOldFlags = pFlags; + nPtSize = 2 * nNeededSize; + pPoints = new Point[ nPtSize ]; + pFlags = new BYTE[ nPtSize ]; + for( USHORT i = 0; i < nPnt; ++i ) { - int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx; - if( nPtSize < nNeededSize ) - { - Point* pOldPoints = pPoints; - BYTE* pOldFlags = pFlags; - nPtSize = 2 * nNeededSize; - pPoints = new Point[ nPtSize ]; - pFlags = new BYTE[ nPtSize ]; - for( USHORT i = 0; i < nPnt; ++i ) - { - pPoints[ i ] = pOldPoints[ i ]; - pFlags[ i ] = pOldFlags[ i ]; - } - delete[] pOldPoints; - delete[] pOldFlags; - } + pPoints[ i ] = pOldPoints[ i ]; + pFlags[ i ] = pOldFlags[ i ]; + } + delete[] pOldPoints; + delete[] pOldFlags; + } - int i = 0; - if( TT_PRIM_LINE == pCurve->wType ) + int i = 0; + if( TT_PRIM_LINE == pCurve->wType ) + { + while( i < pCurve->cpfx ) + { + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + ++i; + pPoints[ nPnt ] = Point( nX, nY ); + pFlags[ nPnt ] = POLY_NORMAL; + ++nPnt; + } + } + else if( TT_PRIM_QSPLINE == pCurve->wType ) + { + bHasOfflinePoints = true; + while( i < pCurve->cpfx ) + { + // get control point of quadratic bezier spline + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + ++i; + Point aControlP( nX, nY ); + + // calculate first cubic control point + // P0 = 1/3 * (PBeg + 2 * PQControl) + nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); + nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); + pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); + pFlags[ nPnt+0 ] = POLY_CONTROL; + + // calculate endpoint of segment + nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); + nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); + + if ( i+1 >= pCurve->cpfx ) { - while( i < pCurve->cpfx ) - { - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - pPoints[ nPnt ] = Point( nX, nY ); - pFlags[ nPnt ] = POLY_NORMAL; - ++nPnt; - } + // endpoint is either last point in segment => advance + ++i; } - else if( TT_PRIM_QSPLINE == pCurve->wType ) + else { - bHasOfflinePoints = true; - while( i < pCurve->cpfx ) - { - // get control point of quadratic bezier spline - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - ++i; - Point aControlP( nX, nY ); - - // calculate first cubic control point - // P0 = 1/3 * (PBeg + 2 * PQControl) - nX = pPoints[ nPnt-1 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt-1 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+0 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+0 ] = POLY_CONTROL; - - // calculate endpoint of segment - nX = IntTimes256FromFixed( pCurve->apfx[ i ].x ); - nY = IntTimes256FromFixed( pCurve->apfx[ i ].y ); - - if ( i+1 >= pCurve->cpfx ) - { - // endpoint is either last point in segment => advance - ++i; - } - else - { - // or endpoint is the middle of two control points - nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); - nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); - nX = (nX + 1) / 2; - nY = (nY + 1) / 2; - // no need to advance, because the current point - // is the control point in next bezier spline - } - - pPoints[ nPnt+2 ] = Point( nX, nY ); - pFlags[ nPnt+2 ] = POLY_NORMAL; - - // calculate second cubic control point - // P1 = 1/3 * (PEnd + 2 * PQControl) - nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); - nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); - pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); - pFlags[ nPnt+1 ] = POLY_CONTROL; - - nPnt += 3; - } + // or endpoint is the middle of two control points + nX += IntTimes256FromFixed( pCurve->apfx[ i-1 ].x ); + nY += IntTimes256FromFixed( pCurve->apfx[ i-1 ].y ); + nX = (nX + 1) / 2; + nY = (nY + 1) / 2; + // no need to advance, because the current point + // is the control point in next bezier spline } - // next curve segment - pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; - } + pPoints[ nPnt+2 ] = Point( nX, nY ); + pFlags[ nPnt+2 ] = POLY_NORMAL; - // end point is start point for closed contour - // disabled, because Polygon class closes the contour itself - // pPoints[nPnt++] = pPoints[0]; - // #i35928# - // Added again, but add only when not yet closed - if(pPoints[nPnt - 1] != pPoints[0]) - { - if( bHasOfflinePoints ) - pFlags[nPnt] = pFlags[0]; + // calculate second cubic control point + // P1 = 1/3 * (PEnd + 2 * PQControl) + nX = pPoints[ nPnt+2 ].X() + 2 * aControlP.X(); + nY = pPoints[ nPnt+2 ].Y() + 2 * aControlP.Y(); + pPoints[ nPnt+1 ] = Point( (2*nX+3)/6, (2*nY+3)/6 ); + pFlags[ nPnt+1 ] = POLY_CONTROL; - pPoints[nPnt++] = pPoints[0]; + nPnt += 3; } + } - // convert y-coordinates W32 -> VCL - for( int i = 0; i < nPnt; ++i ) - pPoints[i].Y() = -pPoints[i].Y(); + // next curve segment + pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ]; + } - // insert into polypolygon - Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); - // convert to B2DPolyPolygon - // TODO: get rid of the intermediate PolyPolygon - rB2DPolyPoly.append( aPoly.getB2DPolygon() ); - } + // end point is start point for closed contour + // disabled, because Polygon class closes the contour itself + // pPoints[nPnt++] = pPoints[0]; + // #i35928# + // Added again, but add only when not yet closed + if(pPoints[nPnt - 1] != pPoints[0]) + { + if( bHasOfflinePoints ) + pFlags[nPnt] = pFlags[0]; - delete[] pPoints; - delete[] pFlags; + pPoints[nPnt++] = pPoints[0]; + } - delete[] pData; + // convert y-coordinates W32 -> VCL + for( int i = 0; i < nPnt; ++i ) + pPoints[i].Y() = -pPoints[i].Y(); + + // insert into polypolygon + Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) ); + // convert to B2DPolyPolygon + // TODO: get rid of the intermediate PolyPolygon + rB2DPolyPoly.append( aPoly.getB2DPolygon() ); } + delete[] pPoints; + delete[] pFlags; + + delete[] pData; + // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx old mode 100644 new mode 100755 index 6a4bbe885bd3..a4c588f059d4 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -671,7 +671,8 @@ void SimpleWinLayout::DrawText( SalGraphics& rGraphics ) const UINT oldTa = ::GetTextAlign( aHDC ); ::SetTextAlign( aHDC, (oldTa & ~TA_NOUPDATECP) | TA_UPDATECP ); ::MoveToEx( aHDC, aPos.X(), aPos.Y(), &oldPos ); - for( int i = 0, n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount ) + unsigned int i = 0; + for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount ) ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i ); ::ExtTextOutW( aHDC, 0, 0, mnDrawOptions, NULL, -- cgit From 140e83be45834d050d91cd7fad5984f690be09d4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 18 Nov 2010 15:28:06 +0100 Subject: vcl117: #i114937# give application a hint for cleanup, call DeInitVCL --- vcl/aqua/source/app/vclnsapp.mm | 120 ++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 53 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index caa506772272..df089fe17cb1 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -358,71 +358,85 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { - YIELD_GUARD; - + bool bCallDeInit = false; NSApplicationTerminateReply aReply = NSTerminateNow; - - SalData* pSalData = GetSalData(); - #if 1 // currently do some really bad hack - if( ! pSalData->maFrames.empty() ) { - /* #i92766# something really weird is going on with the retain count of - our windows; sometimes we get a duplicate free before exit on one of our - NSWindows. The reason is unclear; to avoid this currently we retain them once more - - FIXME: this is a really bad hack, relying on the system to catch the leaked - resources. Find out what really goes on here and fix it ! - */ - std::vector< NSWindow* > aHackRetainedWindows; - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) - { - #if OSL_DEBUG_LEVEL > 1 - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "retaining %p (old count %d) windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, [(*it)->mpWindow retainCount], - typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - [(*it)->mpWindow retain]; - aHackRetainedWindows.push_back( (*it)->mpWindow ); - } - if( pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ) + YIELD_GUARD; + + SalData* pSalData = GetSalData(); + #if 0 // currently do some really bad hack + if( ! pSalData->maFrames.empty() ) { - for( std::vector< NSWindow* >::iterator it = aHackRetainedWindows.begin(); - it != aHackRetainedWindows.end(); ++it ) + /* #i92766# something really weird is going on with the retain count of + our windows; sometimes we get a duplicate free before exit on one of our + NSWindows. The reason is unclear; to avoid this currently we retain them once more + + FIXME: this is a really bad hack, relying on the system to catch the leaked + resources. Find out what really goes on here and fix it ! + */ + std::vector< NSWindow* > aHackRetainedWindows; + for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); + it != pSalData->maFrames.end(); ++it ) { - // clean up the retaing count again from the shutdown workaround #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "releasing %p\n", (*it) ); + Window* pWin = (*it)->GetWindow(); + String aTitle = pWin->GetText(); + Window* pClient = pWin->ImplGetClientWindow(); + fprintf( stderr, "retaining %p (old count %d) windowtype=%s clienttyp=%s title=%s\n", + (*it)->mpWindow, [(*it)->mpWindow retainCount], + typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", + rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() + ); #endif - [(*it) release]; + [(*it)->mpWindow retain]; + aHackRetainedWindows.push_back( (*it)->mpWindow ); } - aReply = NSTerminateCancel; + if( pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ) + { + for( std::vector< NSWindow* >::iterator it = aHackRetainedWindows.begin(); + it != aHackRetainedWindows.end(); ++it ) + { + // clean up the retaing count again from the shutdown workaround + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "releasing %p\n", (*it) ); + #endif + [(*it) release]; + } + aReply = NSTerminateCancel; + } + #if OSL_DEBUG_LEVEL > 1 + for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); + it != pSalData->maFrames.end(); ++it ) + { + Window* pWin = (*it)->GetWindow(); + String aTitle = pWin->GetText(); + Window* pClient = pWin->ImplGetClientWindow(); + fprintf( stderr, "frame still alive: NSWindow %p windowtype=%s clienttyp=%s title=%s\n", + (*it)->mpWindow, typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", + rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() + ); + } + #endif } - #if OSL_DEBUG_LEVEL > 1 - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) + #else // the clean version follows + if( ! pSalData->maFrames.empty() ) + aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; + #endif + + if( aReply != NSTerminateNow ) + [NSApp activateIgnoringOtherApps: YES]; + else { - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "frame still alive: NSWindow %p windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); + ApplicationEvent aEv( String(), ApplicationAddress(), ByteString( "PRIVATE:DOSHUTDOWN" ), String() ); + GetpApp()->AppEvent( aEv ); + // call DeInitVCL only after our YIELD_GUARD has expired, + // else its Mutex will be alredy destroyed when it runs out of scope ! + bCallDeInit = true; } - #endif } - #else // the clean version follows - aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; - #endif + if( bCallDeInit ) + DeInitVCL(); - if( aReply != NSTerminateNow ) - [NSApp activateIgnoringOtherApps: YES]; return aReply; } -- cgit From 7d914d89219cca3c179951e5c8516726712c9ac5 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 19 Nov 2010 16:24:37 +0100 Subject: vcl117: #i115607# support NWF for menus on Windows --- vcl/inc/vcl/salnativewidgets.hxx | 19 ++++ vcl/source/gdi/outdevnative.cxx | 63 +++--------- vcl/source/window/menu.cxx | 60 ++++++----- vcl/win/inc/saldata.hxx | 7 ++ vcl/win/source/app/salinst.cxx | 3 + vcl/win/source/gdi/salnativewidgets-luna.cxx | 143 +++++++++++++++++++++++++-- vcl/win/source/window/salframe.cxx | 40 ++++++++ 7 files changed, 254 insertions(+), 81 deletions(-) mode change 100644 => 100755 vcl/inc/vcl/salnativewidgets.hxx mode change 100644 => 100755 vcl/source/gdi/outdevnative.cxx mode change 100644 => 100755 vcl/source/window/menu.cxx mode change 100644 => 100755 vcl/win/inc/saldata.hxx mode change 100644 => 100755 vcl/win/source/app/salinst.cxx (limited to 'vcl') diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx old mode 100644 new mode 100755 index 19c34cbc5e34..621cf0e90c5a --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -175,6 +175,7 @@ typedef sal_uInt32 ControlPart; #define PART_MENU_ITEM 250 #define PART_MENU_ITEM_CHECK_MARK 251 #define PART_MENU_ITEM_RADIO_MARK 252 +#define PART_MENU_SEPARATOR 253 /* #i77549# HACK: for scrollbars in case of thumb rect, page up and page down rect we @@ -432,6 +433,24 @@ public: int maTopDockingAreaHeight; }; +/* MenupopupValue: + * + * Value container for menu items; specifies the rectangle for the whole item which + * may be useful when drawing parts with a smaller rectangle. + */ +class MenupopupValue : public ImplControlValue +{ +public: + MenupopupValue() : ImplControlValue( CTRL_MENU_POPUP, BUTTONVALUE_DONTKNOW, 0 ) + {} + MenupopupValue( long i_nGutterWidth, const Rectangle& i_rItemRect ) + : ImplControlValue( CTRL_MENU_POPUP, BUTTONVALUE_DONTKNOW, i_nGutterWidth ) + , maItemRect( i_rItemRect ) + {} + virtual ~MenupopupValue(); + Rectangle maItemRect; +}; + /* PushButtonValue: * * Value container for pushbuttons specifying additional drawing hints diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx old mode 100644 new mode 100755 index 521f4d7ea62d..b5b745b708fa --- a/vcl/source/gdi/outdevnative.cxx +++ b/vcl/source/gdi/outdevnative.cxx @@ -87,6 +87,10 @@ MenubarValue::~MenubarValue() { } +MenupopupValue::~MenupopupValue() +{ +} + PushButtonValue::~PushButtonValue() { } @@ -200,49 +204,20 @@ static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const Im case CTRL_GENERIC: aResult.reset( new ImplControlValue( rVal ) ); break; - default: - OSL_ENSURE( 0, "unknown ImplControlValue type !" ); - break; - } - return aResult; -} - -#if 0 -static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) -{ - switch( aValue.getType() ) - { - case CTRL_SLIDER: - { - SliderValue* pSlVal = static_cast(const_cast(&aValue)); - pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SCROLLBAR: - { - ScrollbarValue* pScVal = static_cast(const_cast(&aValue)); - pScVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton1Rect.Move( rDelta.X(), rDelta.Y() ); - pScVal->maButton2Rect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_SPINBOX: - case CTRL_SPINBUTTONS: + case CTRL_MENU_POPUP: { - SpinbuttonValue* pSpVal = static_cast(const_cast(&aValue)); - pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); - pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); + const MenupopupValue* pMVal = static_cast(&rVal); + MenupopupValue* pNew = new MenupopupValue( *pMVal ); + pNew->maItemRect = rDev.ImplLogicToDevicePixel( pMVal->maItemRect ); + aResult.reset( pNew ); } break; - case CTRL_TOOLBAR: - { - ToolbarValue* pTVal = static_cast(const_cast(&aValue)); - pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); - } + default: + OSL_ENSURE( 0, "unknown ImplControlValue type !" ); break; } + return aResult; } -#endif BOOL OutputDevice::DrawNativeControl( ControlType nType, ControlPart nPart, @@ -254,20 +229,6 @@ BOOL OutputDevice::DrawNativeControl( ControlType nType, if( !lcl_enableNativeWidget( *this ) ) return FALSE; - /* - if( !IsInPaint() && IsPaintTransparent() ) - { - // only required if called directly (ie, we're not in Paint() ): - // force redraw (Paint()) for transparent controls - // to trigger a repaint of the background - Region aClipRgn( GetClipRegion() ); - if( !rControlRegion.IsEmpty() ) - aClipRgn.Intersect( rControlRegion ); - Invalidate( aClipRgn, INVALIDATE_UPDATE ); - return TRUE; - } - */ - // make sure the current clip region is initialized correctly if ( !mpGraphics ) if ( !ImplGetGraphics() ) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx old mode 100644 new mode 100755 index 52ad54957dd0..5909ab9f8489 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -96,6 +96,7 @@ DBG_NAME( Menu ) #define EXTRASPACEY 2 #define EXTRAITEMHEIGHT 4 +#define GUTTERBORDER 8 // document closer #define IID_DOCUMENTCLOSE 1 @@ -2670,14 +2671,36 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* // Separator if ( !bLayout && !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) { - aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2); - aTmpPos.X() = aPos.X() + 2 + nOuterSpace; - pWin->SetLineColor( rSettings.GetShadowColor() ); - pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); - aTmpPos.Y()++; - pWin->SetLineColor( rSettings.GetLightColor() ); - pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); - pWin->SetLineColor(); + bool bNativeOk = false; + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, + PART_MENU_SEPARATOR ) ) + { + ControlState nState = 0; + if ( pData->bEnabled ) + nState |= CTRL_STATE_ENABLED; + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + Size aSz( pData->aSz ); + aSz.Width() = aOutSz.Width() - 2*nOuterSpace; + Rectangle aItemRect( aPos, aSz ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect ); + bNativeOk = pWin->DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_SEPARATOR, + aItemRect, + nState, + aVal, + OUString() ); + } + if( ! bNativeOk ) + { + aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2); + aTmpPos.X() = aPos.X() + 2 + nOuterSpace; + pWin->SetLineColor( rSettings.GetShadowColor() ); + pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + aTmpPos.Y()++; + pWin->SetLineColor( rSettings.GetLightColor() ); + pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + pWin->SetLineColor(); + } } Rectangle aOuterCheckRect( Point( aPos.X()+nCheckPos, aPos.Y() ), Size( pData->aSz.Height(), pData->aSz.Height() ) ); @@ -2722,10 +2745,11 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, Rectangle( aPos, pData->aSz ) ); pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, - ImplControlValue(), + aVal, OUString() ); } else if ( pData->bChecked ) // by default do nothing for unchecked items @@ -2845,16 +2869,6 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* aDecoView.DrawSymbol( Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle ); -// if ( pData->nBits & MIB_POPUPSELECT ) -// { -// aTmpPos.Y() += nFontHeight/2 ; -// pWin->SetLineColor( rSettings.GetShadowColor() ); -// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// pWin->SetLineColor( rSettings.GetLightColor() ); -// aTmpPos.Y()++; -// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// pWin->SetLineColor(); -// } } if ( pThisItemOnly && bHighlighted ) @@ -4724,10 +4738,11 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) Push( PUSH_CLIPREGION ); IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) ) ); Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); + MenupopupValue aVal( pMenu->nTextPos-GUTTERBORDER, aItemRect ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, aCtrlRect, CTRL_STATE_ENABLED, - ImplControlValue(), + aVal, OUString() ); if( bHighlight && IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) ) @@ -4736,7 +4751,7 @@ void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight ) if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, aItemRect, CTRL_STATE_SELECTED | ( pData->bEnabled? CTRL_STATE_ENABLED: 0 ), - ImplControlValue(), + aVal, OUString() ) ) { bDrawItemRect = bHighlight; @@ -5071,10 +5086,11 @@ void MenuFloatingWindow::Paint( const Rectangle& ) long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0; Size aPxSize( GetOutputSizePixel() ); aPxSize.Width() -= nX; + ImplControlValue aVal( pMenu->nTextPos-GUTTERBORDER ); DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, Rectangle( Point( nX, 0 ), aPxSize ), CTRL_STATE_ENABLED, - ImplControlValue(), + aVal, OUString() ); ImplInitClipRegion(); } diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx old mode 100644 new mode 100755 index a960d117eed0..a29010fa6d4b --- a/vcl/win/inc/saldata.hxx +++ b/vcl/win/inc/saldata.hxx @@ -33,6 +33,8 @@ #include #include +#include "osl/module.h" + #include // for hMenu validation #include @@ -46,6 +48,8 @@ class Font; struct HDCCache; struct TempFontItem; +typedef HRESULT (WINAPI *DwmIsCompositionEnabled_ptr)(WIN_BOOL*); + // -------------------- // - Standard-Defines - // -------------------- @@ -131,12 +135,15 @@ public: SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none TempFontItem* mpTempFontItem; BOOL mbThemeChanged; // true if visual theme was changed: throw away theme handles + BOOL mbThemeMenuSupport; // for GdiPlus GdiplusStartup/GdiplusShutdown ULONG_PTR gdiplusToken; std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle() std::map< UINT,USHORT > maVKMap; // map some dynamic VK_* entries + oslModule maDwmLib; + DwmIsCompositionEnabled_ptr mpDwmIsCompositionEnabled; }; inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; } diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx old mode 100644 new mode 100755 index d05f64d147ed..c056bf8281ba --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -434,9 +434,12 @@ SalData::SalData() mpFirstIcon = 0; // icon cache, points to first icon, NULL if none mpTempFontItem = 0; mbThemeChanged = FALSE; // true if visual theme was changed: throw away theme handles + mbThemeMenuSupport = FALSE; // init with NULL gdiplusToken = 0; + maDwmLib = 0; + mpDwmIsCompositionEnabled = 0; initKeyCodeMap(); diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 8197fb37cd6d..97e3e1b48c79 100755 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -188,6 +188,8 @@ void SalData::deInitNWF( void ) iter++; } aThemeMap.clear(); + if( maDwmLib ) + osl_unloadModule( maDwmLib ); } static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name ) @@ -286,6 +288,22 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP case CTRL_MENUBAR: if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Rebar"); + else if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_MENU_ITEM ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } + break; + case CTRL_MENU_POPUP: + if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_ENTIRE_CONTROL || + nPart == PART_MENU_ITEM || + nPart == PART_MENU_ITEM_CHECK_MARK || + nPart == PART_MENU_ITEM_RADIO_MARK || + nPart == PART_MENU_SEPARATOR ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } break; case CTRL_PROGRESS: if( nPart == PART_ENTIRE_CONTROL ) @@ -867,15 +885,23 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nType == CTRL_MENUBAR ) { - if( nPart != PART_ENTIRE_CONTROL ) - return FALSE; - - if( aValue.getType() == CTRL_MENUBAR ) + if( nPart == PART_ENTIRE_CONTROL ) { - const MenubarValue *pValue = static_cast(&aValue); - rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well + if( aValue.getType() == CTRL_MENUBAR ) + { + const MenubarValue *pValue = static_cast(&aValue); + rc.bottom += pValue->maTopDockingAreaHeight; // extend potential gradient to cover docking area as well + } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); + } + else if( nPart == PART_MENU_ITEM ) + { + if( (nState & CTRL_STATE_ENABLED) ) + iState = (nState & CTRL_STATE_SELECTED) ? MBI_HOT : MBI_NORMAL; + else + iState = (nState & CTRL_STATE_SELECTED) ? MBI_DISABLEDHOT : MBI_DISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_BARITEM, iState, rc, aCaption ); } - return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption); } if( nType == CTRL_PROGRESS ) @@ -954,6 +980,69 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption ); } + if( GetSalData()->mbThemeMenuSupport ) + { + if( nType == CTRL_MENU_POPUP ) + { + if( nPart == PART_ENTIRE_CONTROL ) + { + RECT aGutterRC = rc; + aGutterRC.left += aValue.getNumericVal(); + aGutterRC.right = aGutterRC.left+3; + return + ImplDrawTheme( hTheme, hDC, MENU_POPUPBACKGROUND, 0, rc, aCaption ) && + ImplDrawTheme( hTheme, hDC, MENU_POPUPGUTTER, 0, aGutterRC, aCaption ) + ; + } + else if( nPart == PART_MENU_ITEM ) + { + if( (nState & CTRL_STATE_ENABLED) ) + iState = (nState & CTRL_STATE_SELECTED) ? MPI_HOT : MPI_NORMAL; + else + iState = (nState & CTRL_STATE_SELECTED) ? MPI_DISABLEDHOT : MPI_DISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPITEM, iState, rc, aCaption ); + } + else if( nPart == PART_MENU_ITEM_CHECK_MARK || nPart == PART_MENU_ITEM_RADIO_MARK ) + { + if( (nState & CTRL_STATE_PRESSED) ) + { + RECT aBGRect = rc; + if( aValue.getType() == CTRL_MENU_POPUP ) + { + const MenupopupValue& rMVal( static_cast(aValue) ); + aBGRect.left = rMVal.maItemRect.Left(); + aBGRect.top = rMVal.maItemRect.Top(); + aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl + aBGRect.right = rMVal.getNumericVal(); + + // FIXME: magic + aBGRect.left += 1; aBGRect.top += 1; aBGRect.bottom +=1; + } + iState = (nState & CTRL_STATE_ENABLED) ? MCB_NORMAL : MCB_DISABLED; + ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, iState, aBGRect, aCaption ); + if( nPart == PART_MENU_ITEM_CHECK_MARK ) + iState = (nState & CTRL_STATE_ENABLED) ? MC_CHECKMARKNORMAL : MC_CHECKMARKDISABLED; + else + iState = (nState & CTRL_STATE_ENABLED) ? MC_BULLETNORMAL : MC_BULLETDISABLED; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECK, iState, rc, aCaption ); + } + else + return true; // unchecked: do nothing + } + else if( nPart == PART_MENU_SEPARATOR ) + { + rc.left += aValue.getNumericVal(); // adjust for gutter position + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, + MENU_POPUPSEPARATOR, 0, Rectangle( rc.left, rc.top, rc.right, rc.bottom ) ) ); + // center the separator inside the passed rectangle + long nDY = ((rc.bottom - rc.top + 1) - aRect.GetHeight()) / 2; + rc.top += nDY; + rc.bottom = rc.top+aRect.GetHeight()-1; + return ImplDrawTheme( hTheme, hDC, MENU_POPUPSEPARATOR, 0, rc, aCaption ); + } + } + } + return false; } @@ -1027,6 +1116,11 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, case CTRL_MENUBAR: if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Rebar"); + else if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_MENU_ITEM ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } break; case CTRL_PROGRESS: if( nPart == PART_ENTIRE_CONTROL ) @@ -1040,6 +1134,16 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) hTheme = getThemeHandle( mhWnd, L"Trackbar" ); break; + case CTRL_MENU_POPUP: + if( GetSalData()->mbThemeMenuSupport ) + { + if( nPart == PART_ENTIRE_CONTROL || nPart == PART_MENU_ITEM || + nPart == PART_MENU_ITEM_CHECK_MARK || nPart == PART_MENU_ITEM_RADIO_MARK || + nPart == PART_MENU_SEPARATOR + ) + hTheme = getThemeHandle( mhWnd, L"Menu" ); + } + break; default: hTheme = NULL; break; @@ -1196,7 +1300,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, HTHEME hTheme = getThemeHandle( mhWnd, L"Edit"); if( hTheme ) { - // get borderr size + // get border size Rectangle aBoxRect( rControlRegion ); Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER, EBWBS_HOT, aBoxRect ) ); @@ -1225,6 +1329,29 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } + if( GetSalData()->mbThemeMenuSupport ) + { + if( nType == CTRL_MENU_POPUP ) + { + if( nPart == PART_MENU_ITEM_CHECK_MARK || + nPart == PART_MENU_ITEM_RADIO_MARK ) + { + HTHEME hTheme = getThemeHandle( mhWnd, L"Menu"); + Rectangle aBoxRect( rControlRegion ); + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, + MENU_POPUPCHECK, + MC_CHECKMARKNORMAL, + aBoxRect ) ); + if( aBoxRect.GetWidth() && aBoxRect.GetHeight() ) + { + rNativeContentRegion = aRect; + rNativeBoundingRegion = rNativeContentRegion; + bRet = TRUE; + } + } + } + } + if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) ) { HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar"); diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index d6b05c5bb032..df077cc4c4e5 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2835,6 +2835,29 @@ static long ImplA2I( const BYTE* pStr ) } // ----------------------------------------------------------------------- +static HRESULT WINAPI backwardCompatibleDwmIsCompositionEnabled( WIN_BOOL* pOut ) +{ + *pOut = FALSE; + return S_OK; +} + +static WIN_BOOL ImplDwmIsCompositionEnabled() +{ + SalData* pSalData = GetSalData(); + if( ! pSalData->mpDwmIsCompositionEnabled ) + { + rtl::OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "Dwmapi.dll" ) ); + pSalData->maDwmLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); + if( pSalData->maDwmLib ) + pSalData->mpDwmIsCompositionEnabled = (DwmIsCompositionEnabled_ptr)osl_getAsciiFunctionSymbol( pSalData->maDwmLib, "DwmIsCompositionEnabled" ); + if( ! pSalData->mpDwmIsCompositionEnabled ) // something failed + pSalData->mpDwmIsCompositionEnabled = backwardCompatibleDwmIsCompositionEnabled; + } + WIN_BOOL aResult = FALSE; + HRESULT nError = pSalData->mpDwmIsCompositionEnabled( &aResult ); + return nError == S_OK && aResult; +} + void WinSalFrame::UpdateSettings( AllSettings& rSettings ) { @@ -2912,6 +2935,10 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) ); aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() ); aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetHighlightTextColor() ); + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maNWFData.mnMenuFormatExtraBorder = 0; + pSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); + GetSalData()->mbThemeMenuSupport = FALSE; if ( bCompBorder ) { aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); @@ -2942,6 +2969,19 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetUseFlatBorders( TRUE ); } } + // check if vista or newer runs + // in Aero theme (and similar ?) the menu text color does not change + // for selected items; also on WinXP and earlier menus are not themed + if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 && + ImplDwmIsCompositionEnabled() + ) + { + // in aero menuitem highlight text is drawn in the same color as normal + aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); + pSVData->maNWFData.mnMenuFormatExtraBorder = 2; + pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); + GetSalData()->mbThemeMenuSupport = TRUE; + } } // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) -- cgit From 21d610c5dc0fcf7adf08d045af1d90eeb5b1b53e Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 22 Nov 2010 15:46:16 +0100 Subject: #i115718# fix IFCM refcounting while subsetting fonts on OSX --- vcl/aqua/source/gdi/salgdi.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vcl') diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index e1daf649f6da..070c0753637d 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -2356,8 +2356,10 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti const ImplFontCharMap* pMap = mpMacFontData->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no charmap" ); + pMap->AddReference(); // TODO: add and use RAII object instead // get unicode<->glyph encoding + // TODO? avoid sft mapping by using the pMap itself int nCharCount = pMap->GetCharCount(); sal_uInt32 nChar = pMap->GetFirstChar(); for(; --nCharCount >= 0; nChar = pMap->GetNextChar( nChar ) ) -- cgit From 75a3de669fef8dff6cdbe430437f8666ba55029f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Nov 2010 13:57:59 +0100 Subject: vcl117: removed useless header --- vcl/inc/vcl/salatype.hxx | 47 ------------------------------------------ vcl/os2/source/app/salinst.cxx | 2 +- vcl/unx/headless/svpinst.cxx | 2 +- vcl/unx/source/app/salinst.cxx | 2 +- vcl/win/source/app/salinst.cxx | 2 +- 5 files changed, 4 insertions(+), 51 deletions(-) delete mode 100644 vcl/inc/vcl/salatype.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/salatype.hxx b/vcl/inc/vcl/salatype.hxx deleted file mode 100644 index d9e25c0cada9..000000000000 --- a/vcl/inc/vcl/salatype.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALATYPE_HXX -#define _SV_SALATYPE_HXX - -#include - -// --------------------- -// - 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/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index df564f36ee0a..9d74f281d680 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -43,7 +43,7 @@ #ifndef _SV_SALIDS_HRC #include #endif -#include +#include #include #include #include diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index fc788b2a0530..09e359ca3f71 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 88af0b70ef7e..f125d5f98fa6 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -45,7 +45,7 @@ #include "sm.hxx" #include "vcl/salwtype.hxx" -#include "vcl/salatype.hxx" +#include "vcl/apptypes.hxx" #include "vcl/helper.hxx" #include #include "vos/mutex.hxx" diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index c056bf8281ba..ef6d82f53d7d 100755 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include -- cgit From c66cef317dc9ef81fa46da221bdd3bccb3ef0953 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Nov 2010 16:05:43 +0100 Subject: vcl117: removed useless header --- vcl/inc/vcl/salctrlhandle.hxx | 48 ------------------------------------------- vcl/inc/vcl/salgdi.hxx | 1 - vcl/inc/vcl/window.h | 1 - vcl/source/app/salvtables.cxx | 4 ---- vcl/source/window/window.cxx | 1 - 5 files changed, 55 deletions(-) delete mode 100644 vcl/inc/vcl/salctrlhandle.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/salctrlhandle.hxx b/vcl/inc/vcl/salctrlhandle.hxx deleted file mode 100644 index 4a0a3a0f5b0a..000000000000 --- a/vcl/inc/vcl/salctrlhandle.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * 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/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index d8276406746e..b4769c045708 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -36,7 +36,6 @@ #include "vos/thread.hxx" #include "vcl/outdev.hxx" #include "vcl/salnativewidgets.hxx" -#include "vcl/salctrlhandle.hxx" #include diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index ff76874de11a..f4338a895a69 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -56,7 +56,6 @@ class VirtualDevice; class Cursor; class ImplDevFontList; class ImplFontCache; -class SalControlHandle; class VCLXWindow; class SalFrame; class SalObject; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2a04389d8f44..73eaa8f965d2 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -38,7 +38,6 @@ #include #include #include -#include // this file contains the virtual destructors of the sal interface // compilers ususally put their vtables where the destructor is @@ -161,7 +160,4 @@ Rectangle SalMenu::GetMenuBarButtonRectPixel( USHORT, SalFrame* ) SalMenuItem::~SalMenuItem() { } -SalControlHandle::~SalControlHandle() -{ -} diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8054afd33080..b432cd0f73f1 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -35,7 +35,6 @@ #include "vcl/salinst.hxx" #include "vcl/salgtype.hxx" #include "vcl/salgdi.hxx" -#include "vcl/salctrlhandle.hxx" #include "vcl/unohelp.hxx" #include "tools/time.hxx" -- cgit From 1002a3c9c689f3738b981ca993b5bc529d781e28 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Nov 2010 16:26:05 +0100 Subject: vcl117: removed useless header --- vcl/inc/vcl/windata.hxx | 49 ------------------------------------------- vcl/inc/vcl/window.h | 11 ++++++++++ vcl/source/app/svapp.cxx | 1 - vcl/source/window/window.cxx | 1 - vcl/source/window/winproc.cxx | 1 - 5 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 vcl/inc/vcl/windata.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/windata.hxx b/vcl/inc/vcl/windata.hxx deleted file mode 100644 index 9436352e4927..000000000000 --- a/vcl/inc/vcl/windata.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_WINDATA_HXX -#define _SV_WINDATA_HXX - -#include - -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 index f4338a895a69..c80cb45c2222 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -101,7 +101,18 @@ namespace dnd { namespace vcl { struct ControlLayoutData; } +// -------------- +// - 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) // --------------- // - ImplWinData - diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index e503172eb2c6..dd1ea7c0469e 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -45,7 +45,6 @@ #include "vcl/event.hxx" #include "vcl/vclevent.hxx" #include "vcl/virdev.hxx" -#include "vcl/windata.hxx" #include "vcl/window.h" #include "vcl/wrkwin.hxx" #include "vcl/idlemgr.hxx" diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b432cd0f73f1..49851e0cdf4a 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -43,7 +43,6 @@ #include "tools/rc.h" #endif #include "vcl/svdata.hxx" -#include "vcl/windata.hxx" #include "vcl/dbggui.hxx" #include "vcl/outfont.hxx" #include "vcl/outdev.h" diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index c964ad0d739b..2fce7e52f24c 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include -- cgit From 14f48dfabbd5ba686195406c815b55abf1a35bf8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Nov 2010 16:50:09 +0100 Subject: vcl117: removed useless header --- vcl/inc/vcl/impbmpconv.hxx | 39 --------------------------------------- vcl/inc/vcl/salctype.hxx | 12 ++++++++++++ vcl/source/gdi/bmpconv.cxx | 16 ++++++++-------- vcl/source/window/window.cxx | 1 - 4 files changed, 20 insertions(+), 48 deletions(-) delete mode 100644 vcl/inc/vcl/impbmpconv.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/impbmpconv.hxx b/vcl/inc/vcl/impbmpconv.hxx deleted file mode 100644 index d95da9a4093a..000000000000 --- a/vcl/inc/vcl/impbmpconv.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _VCL_IMPBMPCONV_HXX_ -#define _VCL_IMPBMPCONV_HXX_ - -#include -#include - -namespace vcl -{ -com::sun::star::uno::Reference< com::sun::star::script::XInvocation > createBmpConverter(); -} - -#endif diff --git a/vcl/inc/vcl/salctype.hxx b/vcl/inc/vcl/salctype.hxx index 1566f02a1299..0cb037ad40e1 100644 --- a/vcl/inc/vcl/salctype.hxx +++ b/vcl/inc/vcl/salctype.hxx @@ -28,6 +28,9 @@ #ifndef _SV_SALCTYPE_HXX #define _SV_SALCTYPE_HXX +#include +#include + #include // ----------- @@ -77,4 +80,13 @@ typedef ULONG (*SALGRFCVTPROC)( void* pInst, ULONG nInFormat, void* pInBuffer, ULONG nInBufSize, ULONG nOutFormat, void** ppOutBuffer ); +// ------------------- +// - BitmapConverter - +// ------------------- + +namespace vcl +{ +com::sun::star::uno::Reference< com::sun::star::script::XInvocation > createBmpConverter(); +} + #endif // _SV_SALCTYPE_HXX diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx index d949f519d197..188b4e49f0c5 100644 --- a/vcl/source/gdi/bmpconv.cxx +++ b/vcl/source/gdi/bmpconv.cxx @@ -28,14 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include -#include -#include -#include -#include -#include -#include -#include +#include "vcl/bitmap.hxx" +#include "vcl/svapp.hxx" +#include "vcl/salctype.hxx" +#include "vos/mutex.hxx" +#include "tools/stream.hxx" +#include "com/sun/star/script/XInvocation.hpp" +#include "com/sun/star/awt/XBitmap.hpp" +#include "cppuhelper/compbase1.hxx" using namespace com::sun::star::uno; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 49851e0cdf4a..e790b467350d 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -88,7 +88,6 @@ #include "vcl/unowrap.hxx" #include "vcl/dndlcon.hxx" #include "vcl/dndevdis.hxx" -#include "vcl/impbmpconv.hxx" #include "unotools/confignode.hxx" #include "vcl/gdimtf.hxx" -- cgit From eb2b6f72121ded03321d58feb495abd615a8e898 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Nov 2010 18:41:04 +0100 Subject: vcl117: removed obsolete header --- vcl/inc/vcl/field.hxx | 2 +- vcl/inc/vcl/fldunit.hxx | 33 --------------------------------- vcl/inc/vcl/mapmod.hxx | 2 +- vcl/inc/vcl/mapunit.hxx | 33 --------------------------------- vcl/inc/vcl/window.h | 2 +- vcl/inc/vcl/window.hxx | 2 +- vcl/inc/vcl/wintypes.hxx | 33 --------------------------------- vcl/prj/d.lst | 3 --- vcl/source/window/window.cxx | 1 + vcl/util/makefile.mk | 1 - 10 files changed, 5 insertions(+), 107 deletions(-) delete mode 100644 vcl/inc/vcl/fldunit.hxx delete mode 100644 vcl/inc/vcl/mapunit.hxx delete mode 100644 vcl/inc/vcl/wintypes.hxx (limited to 'vcl') diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index e1f39cc78966..6be9fd8d42c5 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } } diff --git a/vcl/inc/vcl/fldunit.hxx b/vcl/inc/vcl/fldunit.hxx deleted file mode 100644 index aa76f34332d6..000000000000 --- a/vcl/inc/vcl/fldunit.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _VCL_FLDUNIT_HXX -#define _VCL_FLDUNIT_HXX - -#include - -#endif // _VCL_FLDUNIT_HXX diff --git a/vcl/inc/vcl/mapmod.hxx b/vcl/inc/vcl/mapmod.hxx index b2ea32958e90..260a5f4f86c2 100644 --- a/vcl/inc/vcl/mapmod.hxx +++ b/vcl/inc/vcl/mapmod.hxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include class SvStream; diff --git a/vcl/inc/vcl/mapunit.hxx b/vcl/inc/vcl/mapunit.hxx deleted file mode 100644 index b4c757c538e6..000000000000 --- a/vcl/inc/vcl/mapunit.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _VCL_MAPUNIT_HXX -#define _VCL_MAPUNIT_HXX - -#include - -#endif // _VCL_MAPUNIT_HXX diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index c80cb45c2222..be6447194ad6 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -38,7 +38,7 @@ #ifndef _SV_POINTR_HXX #include #endif -#include +#include #include #include #include diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 7c72f40d2767..f72036fadc35 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -35,7 +35,7 @@ #ifndef _SV_POINTR_HXX #include #endif -#include +#include #ifndef _SV_APPTYPES_HXX #include #endif diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx deleted file mode 100644 index 6da4e4e3d988..000000000000 --- a/vcl/inc/vcl/wintypes.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SV_WINTYPES_HXX -#define _SV_WINTYPES_HXX - -#include - -#endif // _SV_WINTYPES_HXX - diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index e28dc755e8a8..028118327e7b 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -42,7 +42,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\field.hxx %_DEST%\inc%_EXT%\vcl\field.hxx ..\inc\vcl\fixbrd.hxx %_DEST%\inc%_EXT%\vcl\fixbrd.hxx ..\inc\vcl\fixed.hxx %_DEST%\inc%_EXT%\vcl\fixed.hxx -..\inc\vcl\fldunit.hxx %_DEST%\inc%_EXT%\vcl\fldunit.hxx ..\inc\vcl\floatwin.hxx %_DEST%\inc%_EXT%\vcl\floatwin.hxx ..\inc\vcl\fntstyle.hxx %_DEST%\inc%_EXT%\vcl\fntstyle.hxx ..\inc\vcl\font.hxx %_DEST%\inc%_EXT%\vcl\font.hxx @@ -70,7 +69,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\lstbox.h %_DEST%\inc%_EXT%\vcl\lstbox.h ..\inc\vcl\lstbox.hxx %_DEST%\inc%_EXT%\vcl\lstbox.hxx ..\inc\vcl\mapmod.hxx %_DEST%\inc%_EXT%\vcl\mapmod.hxx -..\inc\vcl\mapunit.hxx %_DEST%\inc%_EXT%\vcl\mapunit.hxx ..\inc\vcl\menu.hxx %_DEST%\inc%_EXT%\vcl\menu.hxx ..\inc\vcl\menubtn.hxx %_DEST%\inc%_EXT%\vcl\menubtn.hxx ..\inc\vcl\metaact.hxx %_DEST%\inc%_EXT%\vcl\metaact.hxx @@ -128,7 +126,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\waitobj.hxx %_DEST%\inc%_EXT%\vcl\waitobj.hxx ..\inc\vcl\wall.hxx %_DEST%\inc%_EXT%\vcl\wall.hxx ..\inc\vcl\window.hxx %_DEST%\inc%_EXT%\vcl\window.hxx -..\inc\vcl\wintypes.hxx %_DEST%\inc%_EXT%\vcl\wintypes.hxx ..\inc\vcl\wrkwin.hxx %_DEST%\inc%_EXT%\vcl\wrkwin.hxx ..\inc\vcl\threadex.hxx %_DEST%\inc%_EXT%\vcl\threadex.hxx ..\inc\vcl\evntpost.hxx %_DEST%\inc%_EXT%\vcl\evntpost.hxx diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index e790b467350d..0c91d0a0bc16 100755 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -66,6 +66,7 @@ #include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" +#include "vcl/salctype.hxx" #include "vcl/button.hxx" // Button::GetStandardText #include "vcl/taskpanelist.hxx" #include "com/sun/star/awt/XWindowPeer.hpp" diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index d21e9dcb3eed..8d1de2ed30f0 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -125,7 +125,6 @@ HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ $(INC)$/vcl$/virdev.hxx \ $(INC)$/vcl$/wall.hxx \ $(INC)$/vcl$/waitobj.hxx \ - $(INC)$/vcl$/wintypes.hxx \ $(INC)$/vcl$/window.hxx \ $(INC)$/vcl$/wrkwin.hxx -- cgit From 696996791d1dbfd8f410236e30be5a1fb100de70 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 24 Nov 2010 18:39:49 +0100 Subject: vcl117: #i115686# remove old unused style setting --- vcl/inc/vcl/button.hxx | 1 - vcl/inc/vcl/settings.hxx | 54 +---------- vcl/inc/vcl/svids.hrc | 6 +- vcl/inc/vcl/symbol.hxx | 3 - vcl/inc/vcl/tabctrl.hxx | 12 --- vcl/os2/source/window/salframe.cxx | 51 +++++------ vcl/source/app/settings.cxx | 46 ---------- vcl/source/control/button.cxx | 178 +------------------------------------ vcl/source/control/menubtn.cxx | 9 -- vcl/source/control/scrbar.cxx | 57 ------------ vcl/source/control/slider.cxx | 7 -- vcl/source/control/tabctrl.cxx | 149 ++----------------------------- vcl/source/src/images.src | 39 -------- vcl/source/window/decoview.cxx | 100 --------------------- vcl/win/source/window/salframe.cxx | 114 +++++++++++------------- 15 files changed, 85 insertions(+), 741 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index ab92445b5e03..ddd023a3aaa4 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -78,7 +78,6 @@ public: ~Button(); virtual void Click(); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } const Link& GetClickHdl() const { return maClickHdl; } diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 24fd30750501..cc5cbcbc4d0f 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -423,10 +423,6 @@ private: ULONG mnOptions; USHORT mnScreenZoom; USHORT mnScreenFontZoom; - USHORT mnRadioButtonStyle; - USHORT mnCheckBoxStyle; - USHORT mnPushButtonStyle; - USHORT mnTabControlStyle; USHORT mnHighContrast; USHORT mnUseSystemUIFonts; USHORT mnAutoMnemonic; @@ -457,11 +453,6 @@ private: #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) @@ -488,28 +479,8 @@ private: #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_RADIOBUTTON_MONO ((USHORT)0x0001) // legacy +#define STYLE_CHECKBOX_MONO ((USHORT)0x0001) // legacy #define STYLE_TOOLBAR_ICONSIZE_UNKNOWN ((ULONG)0) #define STYLE_TOOLBAR_ICONSIZE_SMALL ((ULONG)1) @@ -813,23 +784,6 @@ public: 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 @@ -971,10 +925,6 @@ public: { CopyData(); mpData->maWorkspaceGradient = rWall; } void SetStandardStyles(); - void SetStandardWinStyles(); - void SetStandardOS2Styles(); - void SetStandardMacStyles(); - void SetStandardUnixStyles(); const StyleSettings& operator =( const StyleSettings& rSet ); diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index e915644aa8ec..432a30c3a748 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -31,11 +31,7 @@ #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 +#define SV_RESID_MONOOFFSET 1 // Achtung: Diese Id's muessen min. 10 Werte auseinanderliegen, da // je nach Style noch ein Offset aufgerechnet wird diff --git a/vcl/inc/vcl/symbol.hxx b/vcl/inc/vcl/symbol.hxx index c7a745516856..0f0627fb41e3 100644 --- a/vcl/inc/vcl/symbol.hxx +++ b/vcl/inc/vcl/symbol.hxx @@ -71,9 +71,6 @@ typedef USHORT SymbolType; #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) diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index ad702ac4dc54..430a99235b52 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -63,13 +63,9 @@ private: long mnMaxPageWidth; USHORT mnActPageId; USHORT mnCurPageId; - USHORT mnFirstPagePos; - USHORT mnLastFirstPagePos; BOOL mbFormat; BOOL mbRestoreHelpId; BOOL mbRestoreUnqId; - BOOL mbSingleLine; - BOOL mbScroll; BOOL mbSmallInvalidate; BOOL mbExtraSpace; Link maActivateHdl; @@ -78,22 +74,17 @@ private: 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* ); @@ -156,9 +147,6 @@ public: 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; } diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index f3314c725255..f465dc741a60 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -2122,8 +2122,6 @@ void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) // --- Style settings --- StyleSettings aStyleSettings = rSettings.GetStyleSettings(); - BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0; - // General settings LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 ); ULONG nSalDisplayTime; @@ -2145,32 +2143,26 @@ void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) // Size settings aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) ); - if ( bCompBorder ) - { - aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); - } + aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); // Color settings - if ( bCompBorder ) - { - aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); - aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); - aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); - aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); - aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); - aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); - aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); - aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); - aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); - aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); - aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); - aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); - } + aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); + aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); + aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); + aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); + aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); + aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); + aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); + aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); + aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); + aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); + aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); + aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); + aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); + aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); + aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); + aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) ); @@ -2187,11 +2179,8 @@ void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) ); if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) ) { - if ( bCompBorder ) - { - aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); - aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); - } + aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); + aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); } else { diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index b91afbbae9fe..dbc792039f80 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -419,10 +419,6 @@ ImplStyleData::ImplStyleData() mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME; mnScreenZoom = 100; mnScreenFontZoom = 100; - mnRadioButtonStyle = 0; - mnCheckBoxStyle = 0; - mnPushButtonStyle = 0; - mnTabControlStyle = 0; mnLogoDisplayTime = LOGO_DISPLAYTIME_STARTTIME; mnDragFullOptions = DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_OBJECTMOVE | DRAGFULL_OPTION_OBJECTSIZE | @@ -523,10 +519,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : mnCursorBlinkTime = rData.mnCursorBlinkTime; mnScreenZoom = rData.mnScreenZoom; mnScreenFontZoom = rData.mnScreenFontZoom; - mnRadioButtonStyle = rData.mnRadioButtonStyle; - mnCheckBoxStyle = rData.mnCheckBoxStyle; - mnPushButtonStyle = rData.mnPushButtonStyle; - mnTabControlStyle = rData.mnTabControlStyle; mnLogoDisplayTime = rData.mnLogoDisplayTime; mnDragFullOptions = rData.mnDragFullOptions; mnAnimationOptions = rData.mnAnimationOptions; @@ -617,12 +609,6 @@ void ImplStyleData::SetStandardStyles() maHighlightLinkColor = Color( COL_LIGHTBLUE ); maFontColor = Color( COL_BLACK ); - mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE; - mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE; - mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE; - mnTabControlStyle = 0; - - mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE); mnBorderSize = 1; mnTitleHeight = 18; mnFloatTitleHeight = 13; @@ -874,34 +860,6 @@ void StyleSettings::SetStandardStyles() // ----------------------------------------------------------------------- -void StyleSettings::SetStandardWinStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardOS2Styles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardMacStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - -void StyleSettings::SetStandardUnixStyles() -{ - return; // no more style changes since NWF -} - -// ----------------------------------------------------------------------- - Color StyleSettings::GetFaceGradientColor() const { // compute a brighter face color that can be used in gradients @@ -1036,10 +994,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mnAntialiasedMin == rSet.mpData->mnAntialiasedMin) && (mpData->mnScreenZoom == rSet.mpData->mnScreenZoom) && (mpData->mnScreenFontZoom == rSet.mpData->mnScreenFontZoom) && - (mpData->mnRadioButtonStyle == rSet.mpData->mnRadioButtonStyle) && - (mpData->mnCheckBoxStyle == rSet.mpData->mnCheckBoxStyle) && - (mpData->mnPushButtonStyle == rSet.mpData->mnPushButtonStyle) && - (mpData->mnTabControlStyle == rSet.mpData->mnTabControlStyle) && (mpData->mnHighContrast == rSet.mpData->mnHighContrast) && (mpData->mnUseSystemUIFonts == rSet.mpData->mnUseSystemUIFonts) && (mpData->mnUseFlatBorders == rSet.mpData->mnUseFlatBorders) && diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index db7649a90258..82bec2214dff 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -769,47 +769,6 @@ BOOL Button::IsTextDisplayEnabled() } // ----------------------------------------------------------------------- -void Button::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Control::DataChanged( rDCEvt ); - - // The flag SETTINGS_IN_UPDATE_SETTINGS is set when the settings changed due to a - // Application::SettingsChanged event. In this scenario we want to keep the style settings - // of our radio buttons and our check boxes. - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && - ( rDCEvt.GetFlags() & SETTINGS_IN_UPDATE_SETTINGS ) ) - - { - const AllSettings* pOldSettings = rDCEvt.GetOldSettings(); - if ( pOldSettings ) - { - BOOL bResetStyleSettings = FALSE; - AllSettings aAllSettings = GetSettings(); - StyleSettings aStyleSetting = aAllSettings.GetStyleSettings(); - - USHORT nCheckBoxStyle = aStyleSetting.GetCheckBoxStyle(); - if ( nCheckBoxStyle != pOldSettings->GetStyleSettings().GetCheckBoxStyle() ) - { - aStyleSetting.SetCheckBoxStyle( pOldSettings->GetStyleSettings().GetCheckBoxStyle() ); - bResetStyleSettings = TRUE; - } - - USHORT nRadioButtonStyle = aStyleSetting.GetRadioButtonStyle(); - if ( nRadioButtonStyle != pOldSettings->GetStyleSettings().GetRadioButtonStyle() ) - { - aStyleSetting.SetRadioButtonStyle( pOldSettings->GetStyleSettings().GetRadioButtonStyle() ); - bResetStyleSettings = TRUE; - } - - if ( bResetStyleSettings ) - { - aAllSettings.SetStyleSettings( pOldSettings->GetStyleSettings() ); - SetSettings( aAllSettings ); - } - } - } -} - void Button::SetSmallSymbol (bool small) { ImplSetSmallSymbol (small); @@ -925,125 +884,6 @@ void PushButton::ImplDrawPushButtonFrame( Window* pDev, StyleSettings aStyleSettings = pDev->GetSettings().GetStyleSettings(); if ( pDev->IsControlBackground() ) aStyleSettings.Set3DColors( pDev->GetControlBackground() ); - - USHORT nPushButtonSysStyle = aStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE; - if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC ) - { - pDev->SetLineColor(); - pDev->SetFillColor( aStyleSettings.GetFaceColor() ); - pDev->DrawRect( rRect ); - - if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) || - (pDev->GetOutDevType() == OUTDEV_PRINTER) ) - nStyle |= BUTTON_DRAW_MONO; - - if ( nStyle & BUTTON_DRAW_DEFAULT ) - { - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() ); - - pDev->DrawLine( Point( rRect.Left()+3, rRect.Top() ), - Point( rRect.Right()-3, rRect.Top() ) ); - pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom() ), - Point( rRect.Right()-3, rRect.Bottom() ) ); - pDev->DrawLine( Point( rRect.Left(), rRect.Top()+3 ), - Point( rRect.Left(), rRect.Bottom()-3 ) ); - pDev->DrawLine( Point( rRect.Right(), rRect.Top()+3 ), - Point( rRect.Right(), rRect.Bottom()-3 ) ); - pDev->DrawPixel( Point( rRect.Left()+2, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+2 ) ); - pDev->DrawPixel( Point( rRect.Left()+2, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-2 ) ); - - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom()-1 ), - Point( rRect.Right()-3, rRect.Bottom()-1 ) ); - pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+3 ), - Point( rRect.Right()-1, rRect.Bottom()-3 ) ); - pDev->DrawPixel( Point( rRect.Right()-3, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-3 ) ); - } - - rRect.Left() += 2; - rRect.Top() += 2; - rRect.Right() -= 2; - rRect.Bottom() -= 2; - - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() ); - - pDev->DrawLine( Point( rRect.Left()+2, rRect.Top() ), - Point( rRect.Right()-2, rRect.Top() ) ); - pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom() ), - Point( rRect.Right()-2, rRect.Bottom() ) ); - pDev->DrawLine( Point( rRect.Left(), rRect.Top()+2 ), - Point( rRect.Left(), rRect.Bottom()-2 ) ); - pDev->DrawLine( Point( rRect.Right(), rRect.Top()+2 ), - Point( rRect.Right(), rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+1 ) ); - pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-1 ) ); - pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-1 ) ); - - pDev->SetLineColor(); - if ( nStyle & BUTTON_DRAW_CHECKED ) - pDev->SetFillColor( aStyleSettings.GetCheckedColor() ); - else - pDev->SetFillColor( aStyleSettings.GetFaceColor() ); - pDev->DrawRect( Rectangle( rRect.Left()+2, rRect.Top()+2, rRect.Right()-2, rRect.Bottom()-2 ) ); - - if ( !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) ) - { - if ( nStyle & BUTTON_DRAW_MONO ) - pDev->SetLineColor( Color( COL_BLACK ) ); - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom()-1 ), - Point( rRect.Right()-2, rRect.Bottom()-1 ) ); - pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+2 ), - Point( rRect.Right()-1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) ); - pDev->SetLineColor( aStyleSettings.GetLightColor() ); - } - else - pDev->SetLineColor( aStyleSettings.GetShadowColor() ); - - if ( !(nStyle & BUTTON_DRAW_MONO) ) - { - pDev->DrawLine( Point( rRect.Left()+2, rRect.Top()+1 ), - Point( rRect.Right()-2, rRect.Top()+1 ) ); - pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()+2 ), - Point( rRect.Left()+1, rRect.Bottom()-2 ) ); - pDev->DrawPixel( Point( rRect.Top()+2, rRect.Right()+2 ) ); - } - - rRect.Left() += 2; - rRect.Top() += 2; - rRect.Right() -= 2; - rRect.Bottom() -= 2; - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - { - rRect.Left()++; - rRect.Top()++; - rRect.Right()++; - rRect.Bottom()++; - } - - return; - } } DecorationView aDecoView( pDev ); @@ -1070,20 +910,6 @@ BOOL PushButton::ImplHitTestPushButton( Window* pDev, Point aTempPoint; Rectangle aTestRect( aTempPoint, pDev->GetOutputSizePixel() ); - if ( !(pDev->GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) ) - { - const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); - - USHORT nPushButtonSysStyle = rStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE; - if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC ) - { - aTestRect.Left() += 2; - aTestRect.Top() += 2; - aTestRect.Right() -= 2; - aTestRect.Bottom() -= 2; - } - } - return aTestRect.IsInside( rPos ); } @@ -3274,7 +3100,7 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags ) { ImplSVData* pSVData = ImplGetSVData(); const StyleSettings& rStyleSettings = rSettings.GetStyleSettings(); - USHORT nStyle = rStyleSettings.GetRadioButtonStyle() & STYLE_RADIOBUTTON_STYLE; + USHORT nStyle = 0; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle = STYLE_RADIOBUTTON_MONO; @@ -4192,7 +4018,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags ) { ImplSVData* pSVData = ImplGetSVData(); const StyleSettings& rStyleSettings = rSettings.GetStyleSettings(); - USHORT nStyle = rStyleSettings.GetCheckBoxStyle() & STYLE_CHECKBOX_STYLE; + USHORT nStyle = 0; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle = STYLE_CHECKBOX_MONO; diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx index 1c83779da1a9..c264d01916fc 100644 --- a/vcl/source/control/menubtn.cxx +++ b/vcl/source/control/menubtn.cxx @@ -78,15 +78,6 @@ void MenuButton::ImplExecuteMenu() Point aPos( 0, 1 ); Size aSize = GetSizePixel(); Rectangle aRect( aPos, aSize ); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( !((GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) || - !(rStyleSettings.GetOptions() & STYLE_OPTION_MACSTYLE)) ) - { - aRect.Left() += 2; - aRect.Top() += 2; - aRect.Right() -= 2; - aRect.Bottom() -= 2; - } SetPressed( TRUE ); EndSelection(); mnCurItemId = mpMenu->Execute( this, aRect, POPUPMENU_EXECUTE_DOWN ); diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index 9c82bb096dec..4261965995fa 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -770,64 +770,7 @@ void ScrollBar::ImplDraw( USHORT nDrawFlags, OutputDevice* pOutDev ) if ( bEnabled ) { nStyle = BUTTON_DRAW_NOLIGHTBORDER; - // pressed thumbs only in OS2 style - if ( rStyleSettings.GetOptions() & STYLE_OPTION_OS2STYLE ) - if ( mnStateFlags & SCRBAR_STATE_THUMB_DOWN ) - nStyle |= BUTTON_DRAW_PRESSED; aTempRect = aDecoView.DrawButton( maThumbRect, nStyle ); - // OS2 style requires pattern on the thumb - if ( rStyleSettings.GetOptions() & STYLE_OPTION_OS2STYLE ) - { - if ( GetStyle() & WB_HORZ ) - { - if ( aTempRect.GetWidth() > 6 ) - { - long nX = aTempRect.Center().X(); - nX -= 6; - if ( nX < aTempRect.Left() ) - nX = aTempRect.Left(); - for ( int i = 0; i < 6; i++ ) - { - if ( nX > aTempRect.Right()-1 ) - break; - - pOutDev->SetLineColor( rStyleSettings.GetButtonTextColor() ); - pOutDev->DrawLine( Point( nX, aTempRect.Top()+1 ), - Point( nX, aTempRect.Bottom()-1 ) ); - nX++; - pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); - pOutDev->DrawLine( Point( nX, aTempRect.Top()+1 ), - Point( nX, aTempRect.Bottom()-1 ) ); - nX++; - } - } - } - else - { - if ( aTempRect.GetHeight() > 6 ) - { - long nY = aTempRect.Center().Y(); - nY -= 6; - if ( nY < aTempRect.Top() ) - nY = aTempRect.Top(); - for ( int i = 0; i < 6; i++ ) - { - if ( nY > aTempRect.Bottom()-1 ) - break; - - pOutDev->SetLineColor( rStyleSettings.GetButtonTextColor() ); - pOutDev->DrawLine( Point( aTempRect.Left()+1, nY ), - Point( aTempRect.Right()-1, nY ) ); - nY++; - pOutDev->SetLineColor( rStyleSettings.GetLightColor() ); - pOutDev->DrawLine( Point( aTempRect.Left()+1, nY ), - Point( aTempRect.Right()-1, nY ) ); - nY++; - } - } - } - pOutDev->SetLineColor(); - } } else { diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index daf733a57a33..26a4c1cfd205 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -713,13 +713,6 @@ void Slider::MouseButtonDown( const MouseEvent& rMEvt ) mnMouseOff = rMousePos.X()-aCenterPos.X(); else mnMouseOff = rMousePos.Y()-aCenterPos.Y(); - - // Im OS2-Look geben wir den Thumb gedrueckt aus - if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_OS2STYLE ) - { - mnStateFlags |= SLIDER_STATE_THUMB_DOWN; - ImplDraw( SLIDER_DRAW_THUMB ); - } } else if ( ImplIsPageUp( rMousePos ) ) { diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index e9696aa8c492..2c81b6af241b 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -75,8 +75,6 @@ struct ImplTabItem struct ImplTabCtrlData { - PushButton* mpLeftBtn; - PushButton* mpRightBtn; std::hash_map< int, int > maLayoutPageIdToLine; std::hash_map< int, int > maLayoutLineToPageId; std::vector< Rectangle > maTabRectangles; @@ -88,27 +86,6 @@ struct ImplTabCtrlData // ----------------------------------------------------------------------- -#if 0 -// not used -#define TABCOLORCOUNT 10 - -static ColorData aImplTabColorAry[TABCOLORCOUNT] = -{ - RGB_COLORDATA( 80, 216, 248 ), - RGB_COLORDATA( 128, 216, 168 ), - RGB_COLORDATA( 128, 144, 248 ), - RGB_COLORDATA( 208, 180, 168 ), - RGB_COLORDATA( 248, 252, 168 ), - RGB_COLORDATA( 168, 144, 168 ), - RGB_COLORDATA( 248, 144, 80 ), - RGB_COLORDATA( 248, 216, 80 ), - RGB_COLORDATA( 248, 180, 168 ), - RGB_COLORDATA( 248, 216, 168 ) -}; -#endif - -// ----------------------------------------------------------------------- - #define TAB_OFFSET 3 #define TAB_TABOFFSET_X 3 #define TAB_TABOFFSET_Y 3 @@ -132,9 +109,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) if ( !(nStyle & WB_NODIALOGCONTROL) ) nStyle |= WB_DIALOGCONTROL; - // no single line tabs since NWF - nStyle &= ~WB_SINGLELINE; - Control::ImplInit( pParent, nStyle, NULL ); mnLastWidth = 0; @@ -143,18 +117,12 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) mnMaxPageWidth = 0; mnActPageId = 0; mnCurPageId = 0; - mnFirstPagePos = 0; - mnLastFirstPagePos = 0; mbFormat = TRUE; mbRestoreHelpId = FALSE; mbRestoreUnqId = FALSE; - mbSingleLine = FALSE; - mbScroll = FALSE; mbSmallInvalidate = FALSE; mbExtraSpace = FALSE; mpTabCtrlData = new ImplTabCtrlData; - mpTabCtrlData->mpLeftBtn = NULL; - mpTabCtrlData->mpRightBtn = NULL; mpTabCtrlData->mpListBox = NULL; @@ -226,8 +194,6 @@ void TabControl::ImplInitSettings( BOOL bFont, SetBackground( pParent->GetBackground() ); } } - - ImplScrollBtnsColor(); } // ----------------------------------------------------------------------- @@ -299,10 +265,6 @@ TabControl::~TabControl() { if( mpTabCtrlData->mpListBox ) delete mpTabCtrlData->mpListBox; - if ( mpTabCtrlData->mpLeftBtn ) - delete mpTabCtrlData->mpLeftBtn; - if ( mpTabCtrlData->mpRightBtn ) - delete mpTabCtrlData->mpRightBtn; delete mpTabCtrlData; } } @@ -323,74 +285,6 @@ ImplTabItem* TabControl::ImplGetItem( USHORT nId ) const // ----------------------------------------------------------------------- -void TabControl::ImplScrollBtnsColor() -{ - if ( mpTabCtrlData && mpTabCtrlData->mpLeftBtn ) - { - mpTabCtrlData->mpLeftBtn->SetControlForeground(); - mpTabCtrlData->mpRightBtn->SetControlForeground(); - } -} - -// ----------------------------------------------------------------------- - -void TabControl::ImplSetScrollBtnsState() -{ - if ( mbScroll ) - { - mpTabCtrlData->mpLeftBtn->Enable( mnFirstPagePos != 0 ); - mpTabCtrlData->mpRightBtn->Enable( mnFirstPagePos < mnLastFirstPagePos ); - } -} - -// ----------------------------------------------------------------------- - -void TabControl::ImplPosScrollBtns() -{ - if ( mbScroll ) - { - if ( !mpTabCtrlData->mpLeftBtn ) - { - mpTabCtrlData->mpLeftBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT ); - mpTabCtrlData->mpLeftBtn->SetSymbol( SYMBOL_PREV ); - mpTabCtrlData->mpLeftBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) ); - } - if ( !mpTabCtrlData->mpRightBtn ) - { - mpTabCtrlData->mpRightBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT ); - mpTabCtrlData->mpRightBtn->SetSymbol( SYMBOL_NEXT ); - mpTabCtrlData->mpRightBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) ); - } - - Rectangle aRect = ImplGetTabRect( TAB_PAGERECT ); - aRect.Left() -= TAB_OFFSET; - aRect.Top() -= TAB_OFFSET; - aRect.Right() += TAB_OFFSET; - aRect.Bottom() += TAB_OFFSET; - long nX = aRect.Right()-mnBtnSize+1; - long nY = aRect.Top()-mnBtnSize; - mpTabCtrlData->mpRightBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize ); - nX -= mnBtnSize; - mpTabCtrlData->mpLeftBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize ); - ImplScrollBtnsColor(); - ImplSetScrollBtnsState(); - mpTabCtrlData->mpLeftBtn->Show(); - mpTabCtrlData->mpRightBtn->Show(); - } - else - { - if ( mpTabCtrlData ) - { - if ( mpTabCtrlData->mpLeftBtn ) - mpTabCtrlData->mpLeftBtn->Hide(); - if ( mpTabCtrlData->mpRightBtn ) - mpTabCtrlData->mpRightBtn->Hide(); - } - } -} - -// ----------------------------------------------------------------------- - Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) { pItem->maFormatText = pItem->maText; @@ -524,8 +418,6 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight nMaxWidth = mnMaxPageWidth; nMaxWidth -= GetItemsOffset().X(); - mbScroll = FALSE; - USHORT nLines = 0; USHORT nCurLine = 0; long nLineWidthAry[100]; @@ -650,8 +542,6 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight mnLastWidth = nWidth; mnLastHeight = nHeight; mbFormat = FALSE; - - ImplPosScrollBtns(); } return size_t(nItemPos) < mpTabCtrlData->maItemList.size() ? mpTabCtrlData->maItemList[nItemPos].maRect : Rectangle(); @@ -795,13 +685,6 @@ void TabControl::ImplActivateTabPage( BOOL bNext ) // ----------------------------------------------------------------------- -void TabControl::ImplSetFirstPagePos( USHORT ) -{ - return; // was only required for single line -} - -// ----------------------------------------------------------------------- - void TabControl::ImplShowFocus() { if ( !GetPageCount() || mpTabCtrlData->mpListBox ) @@ -1099,14 +982,6 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) } -// ----------------------------------------------------------------------- - -IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG ) -{ - ImplSetScrollBtnsState(); - return 0; -} - // ----------------------------------------------------------------------- IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG ) @@ -1387,19 +1262,14 @@ void TabControl::Resize() // Feststellen, was invalidiert werden muss Size aNewSize = Control::GetOutputSizePixel(); long nNewWidth = aNewSize.Width(); - if ( mbScroll ) - mbSmallInvalidate = FALSE; - else + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); - it != mpTabCtrlData->maItemList.end(); ++it ) + if ( !it->mbFullVisible || + (it->maRect.Right()-2 >= nNewWidth) ) { - if ( !it->mbFullVisible || - (it->maRect.Right()-2 >= nNewWidth) ) - { - mbSmallInvalidate = FALSE; - break; - } + mbSmallInvalidate = FALSE; + break; } } @@ -2013,13 +1883,6 @@ USHORT TabControl::GetCurPageId() const // ----------------------------------------------------------------------- -void TabControl::SetFirstPageId( USHORT ) -{ - return; // was only required for single line -} - -// ----------------------------------------------------------------------- - void TabControl::SelectTabPage( USHORT nPageId ) { if ( nPageId && (nPageId != mnCurPageId) ) diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index fdb1e755c86a..000d7215d80d 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -38,25 +38,6 @@ Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET) File = "check.bmp"; }; -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_WINOFFSET) -{ - File = "checkwin.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_OS2OFFSET) -{ - File = "checkos2.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MACOFFSET) -{ - File = "checkmac.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_UNIXOFFSET) -{ - File = "checkunx.bmp"; -}; Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MONOOFFSET) { @@ -80,26 +61,6 @@ Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET) File = "radio.bmp"; }; -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_WINOFFSET) -{ - File = "radiowin.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_OS2OFFSET) -{ - File = "radioos2.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MACOFFSET) -{ - File = "radiomac.bmp"; -}; - -Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_UNIXOFFSET) -{ - File = "radiounx.bmp"; -}; - Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET) { File = "radiomono.bmp"; diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index e5c3dc525cec..d51988d4d5d3 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -44,71 +44,6 @@ // ======================================================================= -void ImplDrawOS2Symbol( OutputDevice* pDev, const Rectangle& rRect, - USHORT nStyle, BOOL bClose ) -{ - DecorationView aView( pDev ); - const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); - Rectangle aRect = rRect; - Color aColor1; - Color aColor2; - - pDev->SetFillColor(); - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - { - aColor1 = rStyleSettings.GetShadowColor(); - aColor2 = rStyleSettings.GetLightColor(); - } - else - { - aColor1 = rStyleSettings.GetLightColor(); - aColor2 = rStyleSettings.GetShadowColor(); - } - aView.DrawFrame( aRect, aColor1, aColor2 ); - - aRect.Left() += 2; - aRect.Top() += 2; - aRect.Right() -= 2; - aRect.Bottom() -= 2; - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - else - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - if ( bClose ) - { - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-2 ) ); - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-2, aRect.Top() ) ); - pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom()-1 ), - Point( aRect.Right()-1, aRect.Top()+2 ) ); - } - else - { - pDev->DrawLine( aRect.TopLeft(), aRect.BottomLeft() ); - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) ); - } - - if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) ) - pDev->SetLineColor( rStyleSettings.GetShadowColor() ); - else - pDev->SetLineColor( rStyleSettings.GetLightColor() ); - if ( bClose ) - { - pDev->DrawLine( Point( aRect.Right(), aRect.Top()+2 ), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom() ), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Right()-2, aRect.Top()+1 ), - Point( aRect.Left()+1, aRect.Bottom()-2 ) ); - } - else - { - pDev->DrawLine( aRect.TopRight(), aRect.BottomRight() ); - pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() ); - } -} - -// ======================================================================= - static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect, SymbolType eType ) { @@ -630,41 +565,6 @@ static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect, pDev->DrawRect( aRect ); } break; - - case SYMBOL_OS2CLOSE: - { - Rectangle aRect( nCenterX-n2, nCenterY-n2, - nCenterX+n2, nCenterY+n2 ); - ImplDrawOS2Symbol( pDev, aRect, 0, TRUE ); - } - break; - - case SYMBOL_OS2FLOAT: - { - Rectangle aRect( nCenterX-n2+4, nCenterY-n2+4, - nCenterX+n2-4, nCenterY+n2-3 ); - ImplDrawOS2Symbol( pDev, aRect, 0, FALSE ); - DecorationView aDecoView( pDev ); - Rectangle aRect2( nCenterX-n2, nCenterY-n2, - nCenterX-n2+2, nCenterY+n2 ); - aDecoView.DrawFrame( aRect2, - pDev->GetSettings().GetStyleSettings().GetLightColor(), - pDev->GetSettings().GetStyleSettings().GetShadowColor() ); - Rectangle aRect3( nCenterX+n2-2, nCenterY-n2, - nCenterX+n2, nCenterY+n2 ); - aDecoView.DrawFrame( aRect3, - pDev->GetSettings().GetStyleSettings().GetLightColor(), - pDev->GetSettings().GetStyleSettings().GetShadowColor() ); - } - break; - - case SYMBOL_OS2HIDE: - { - Rectangle aRect( nCenterX-n2+3, nCenterY-n2+3, - nCenterX+n2-3, nCenterY+n2-3 ); - ImplDrawOS2Symbol( pDev, aRect, 0, FALSE ); - } - break; } } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index df077cc4c4e5..89a191c99ef6 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2890,30 +2890,26 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) } StyleSettings aStyleSettings = rSettings.GetStyleSettings(); - BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0; // TODO: once those options vanish: just set bCompBorder to TRUE // to have the system colors read aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) ); aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) ); aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() ); - if ( bCompBorder ) - { - aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) ); - aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) ); - aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) ); - aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) ); - if ( aSalShlData.mnVersion >= 410 ) - { - aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); - aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); - } - aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) ); - aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); - aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) ); - aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) ); - aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); - aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) ); - } + aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) ); + aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) ); + aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) ); + aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) ); + if ( aSalShlData.mnVersion >= 410 ) + { + aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) ); + aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) ); + } + aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) ); + aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); + aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) ); + aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) ); + aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); + aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) ); aStyleSettings.SetWorkspaceColor( ImplWinColorToSal( GetSysColor( COLOR_APPWORKSPACE ) ) ); aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK ) ) ); aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( COLOR_INFOTEXT ) ) ); @@ -2935,54 +2931,52 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) ); aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() ); aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetHighlightTextColor() ); + ImplSVData* pSVData = ImplGetSVData(); pSVData->maNWFData.mnMenuFormatExtraBorder = 0; pSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT ); GetSalData()->mbThemeMenuSupport = FALSE; - if ( bCompBorder ) - { - aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); - aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() ); - aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); // overriden below for flat menus - aStyleSettings.SetUseFlatBorders( FALSE ); - aStyleSettings.SetUseFlatMenues( FALSE ); - aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); - aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); - aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); - aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); - aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); - aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) ); - if ( aSalShlData.mbWXP ) + aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) ); + aStyleSettings.SetMenuBarColor( aStyleSettings.GetMenuColor() ); + aStyleSettings.SetMenuBorderColor( aStyleSettings.GetLightBorderColor() ); // overriden below for flat menus + aStyleSettings.SetUseFlatBorders( FALSE ); + aStyleSettings.SetUseFlatMenues( FALSE ); + aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); + aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); + aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); + aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) ); + if ( aSalShlData.mbWXP ) + { + // only xp supports a different menu bar color + long bFlatMenues = 0; + SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenues, 0); + if( bFlatMenues ) { - // only xp supports a different menu bar color - long bFlatMenues = 0; - SystemParametersInfo( SPI_GETFLATMENU, 0, &bFlatMenues, 0); - if( bFlatMenues ) - { - aStyleSettings.SetUseFlatMenues( TRUE ); - aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) ); - aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); - aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); - - // flat borders for our controls etc. as well in this mode (ie, no 3d borders) - // this is not active in the classic style appearance - aStyleSettings.SetUseFlatBorders( TRUE ); - } - } - // check if vista or newer runs - // in Aero theme (and similar ?) the menu text color does not change - // for selected items; also on WinXP and earlier menus are not themed - if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 && - ImplDwmIsCompositionEnabled() - ) - { - // in aero menuitem highlight text is drawn in the same color as normal - aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); - pSVData->maNWFData.mnMenuFormatExtraBorder = 2; - pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); - GetSalData()->mbThemeMenuSupport = TRUE; + aStyleSettings.SetUseFlatMenues( TRUE ); + aStyleSettings.SetMenuBarColor( ImplWinColorToSal( GetSysColor( COLOR_MENUBAR ) ) ); + aStyleSettings.SetMenuHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_MENUHILIGHT ) ) ); + aStyleSettings.SetMenuBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) ); + + // flat borders for our controls etc. as well in this mode (ie, no 3d borders) + // this is not active in the classic style appearance + aStyleSettings.SetUseFlatBorders( TRUE ); } } + // check if vista or newer runs + // in Aero theme (and similar ?) the menu text color does not change + // for selected items; also on WinXP and earlier menus are not themed + if( aSalShlData.maVersionInfo.dwMajorVersion >= 6 && + ImplDwmIsCompositionEnabled() + ) + { + // in aero menuitem highlight text is drawn in the same color as normal + aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetMenuTextColor() ); + pSVData->maNWFData.mnMenuFormatExtraBorder = 2; + pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); + GetSalData()->mbThemeMenuSupport = TRUE; + } // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); -- cgit From e6d57bcd5ec9d88ebbc6911fb93f3c013508f3bf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 25 Nov 2010 13:09:33 +0100 Subject: vcl117: #i114937# fix DeInitVCL --- vcl/aqua/source/app/vclnsapp.mm | 70 ++++------------------------------------- 1 file changed, 6 insertions(+), 64 deletions(-) (limited to 'vcl') diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 6402f5c60d75..5a476e0a54cc 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -360,85 +360,27 @@ -(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app { - bool bCallDeInit = false; NSApplicationTerminateReply aReply = NSTerminateNow; { YIELD_GUARD; SalData* pSalData = GetSalData(); - #if 0 // currently do some really bad hack if( ! pSalData->maFrames.empty() ) { - /* #i92766# something really weird is going on with the retain count of - our windows; sometimes we get a duplicate free before exit on one of our - NSWindows. The reason is unclear; to avoid this currently we retain them once more - - FIXME: this is a really bad hack, relying on the system to catch the leaked - resources. Find out what really goes on here and fix it ! - */ - std::vector< NSWindow* > aHackRetainedWindows; - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) - { - #if OSL_DEBUG_LEVEL > 1 - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "retaining %p (old count %d) windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, [(*it)->mpWindow retainCount], - typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); - #endif - [(*it)->mpWindow retain]; - aHackRetainedWindows.push_back( (*it)->mpWindow ); - } - if( pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ) - { - for( std::vector< NSWindow* >::iterator it = aHackRetainedWindows.begin(); - it != aHackRetainedWindows.end(); ++it ) - { - // clean up the retaing count again from the shutdown workaround - #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "releasing %p\n", (*it) ); - #endif - [(*it) release]; - } - aReply = NSTerminateCancel; - } - #if OSL_DEBUG_LEVEL > 1 - for( std::list< AquaSalFrame* >::iterator it = pSalData->maFrames.begin(); - it != pSalData->maFrames.end(); ++it ) - { - Window* pWin = (*it)->GetWindow(); - String aTitle = pWin->GetText(); - Window* pClient = pWin->ImplGetClientWindow(); - fprintf( stderr, "frame still alive: NSWindow %p windowtype=%s clienttyp=%s title=%s\n", - (*it)->mpWindow, typeid(*pWin).name(), pClient ? typeid(*pClient).name() : "", - rtl::OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() - ); - } - #endif - } - #else // the clean version follows - if( ! pSalData->maFrames.empty() ) + // the following QueryExit will likely present a message box, activate application + [NSApp activateIgnoringOtherApps: YES]; aReply = pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; - #endif + } - if( aReply != NSTerminateNow ) - [NSApp activateIgnoringOtherApps: YES]; - else + if( aReply == NSTerminateNow ) { ApplicationEvent aEv( String(), ApplicationAddress(), ByteString( "PRIVATE:DOSHUTDOWN" ), String() ); GetpApp()->AppEvent( aEv ); - // call DeInitVCL only after our YIELD_GUARD has expired, - // else its Mutex will be alredy destroyed when it runs out of scope ! ImplImageTreeSingletonRef()->shutDown(); - bCallDeInit = true; + // DeInitVCL should be called in ImplSVMain - unless someon _exits first which + // can occur in Desktop::doShutdown for example } } - if( bCallDeInit ) - DeInitVCL(); return aReply; } -- cgit From 23cdc612ccef2d48c6c5abad534f40990e921003 Mon Sep 17 00:00:00 2001 From: sj Date: Tue, 30 Nov 2010 13:41:46 +0100 Subject: impress205: #i115825# fixed copy&paste problem of metafiles --- vcl/source/gdi/metaact.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 79d875542509..9a7fb6527e26 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1441,7 +1441,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) rIStm >> mnLen; rIStm >> nAryLen; - if ( mnIndex > mnLen ) + if ( mnIndex + mnLen > maStr.Len() ) { mnIndex = 0; mpDXAry = 0; -- cgit From c79a8e5b49efcace06ae56b00d435481cbd59c90 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 2 Dec 2010 13:28:04 +0100 Subject: impressdefaults1: #i113019# lazy delete static canvas factory --- vcl/inc/vcl/lazydelete.hxx | 34 ++++++++++++++++++++++++++++++++++ vcl/source/window/window.cxx | 13 ++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx index 4176d5b4454f..ab39147d03de 100644 --- a/vcl/inc/vcl/lazydelete.hxx +++ b/vcl/inc/vcl/lazydelete.hxx @@ -39,6 +39,8 @@ #include #endif +#include + namespace vcl { /* Helpers for lazy object deletion @@ -256,6 +258,38 @@ namespace vcl // ownership is transfered ! T* set( T* i_pNew ) { T* pOld = m_pT; m_pT = i_pNew; return pOld; } }; + + /** Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit + template class makes sure that a static UNO object is disposed + and released at the right time. + + Use like + static DeleteUnoReferenceOnDeinit + xStaticFactory (); + Reference xFactory (xStaticFactory.get()); + if (xFactory.is()) + + */ + template + class DeleteUnoReferenceOnDeinit : public ::vcl::DeleteOnDeinitBase + { + ::com::sun::star::uno::Reference m_xI; + virtual void doCleanup() { set(NULL); } + public: + DeleteUnoReferenceOnDeinit(const ::com::sun::star::uno::Reference& r_xI ) : m_xI( r_xI ) { + addDeinitContainer( this ); } + virtual ~DeleteUnoReferenceOnDeinit() {} + + ::com::sun::star::uno::Reference get (void) { return m_xI; } + + void set (const ::com::sun::star::uno::Reference& r_xNew ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xComponent (m_xI, UNO_QUERY); + m_xI.clear(); + if (xComponent.is()) + xComponent->dispose(); + } + }; } #endif diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 77da205131ea..a1941bc5a1f6 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9702,11 +9702,14 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi // ========================================= if ( xFactory.is() ) { - static Reference xCanvasFactory( - xFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star." - "rendering.CanvasFactory") ) ), UNO_QUERY ); + static ::vcl::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( + Reference( + xFactory->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.rendering.CanvasFactory") ) ), + UNO_QUERY )); + uno::Reference xCanvasFactory(xStaticCanvasFactory.get()); + if(xCanvasFactory.is()) { #ifdef WNT -- cgit From 4f84e7bb10c7418472bceb5083ddc1302c9bcf2d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 2 Dec 2010 13:30:14 +0100 Subject: vcl117: #i115056# fix dialog HelpID --- vcl/source/src/print.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 5a6a0964101c..dcc780f99b72 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -29,7 +29,7 @@ ModalDialog SV_DLG_PRINT { - HelpID = "vcl:ModalDialog:SV_DLG_PRINT"; + HelpID = ".HelpId:vcl:PrintDialog:Dialog"; Text [en-US] = "Print"; Closeable = TRUE; Sizeable = TRUE; -- cgit From 2e512af879c769bd29ddaf00dbd3eae60d3d4813 Mon Sep 17 00:00:00 2001 From: sj Date: Thu, 2 Dec 2010 14:31:22 +0100 Subject: impress205: #i115825# fixed metatextarray issues --- vcl/source/gdi/metaact.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vcl') diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 9a7fb6527e26..f398888a33b6 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1481,6 +1481,12 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) sal_Unicode* pBuffer = maStr.AllocBuffer( nLen ); while ( nLen-- ) rIStm >> *pBuffer++; + + if ( mnIndex + mnLen > maStr.Len() ) + { + mnIndex = 0; + delete[] mpDXAry, mpDXAry = NULL; + } } } -- cgit From 045d00e69a22d56c8327e03116ce59057726d30d Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 2 Dec 2010 23:33:09 +0100 Subject: impressdefaults1: fixed compile warnings on unix --- vcl/inc/vcl/lazydelete.hxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx index ab39147d03de..f09614cc85e0 100644 --- a/vcl/inc/vcl/lazydelete.hxx +++ b/vcl/inc/vcl/lazydelete.hxx @@ -284,10 +284,15 @@ namespace vcl void set (const ::com::sun::star::uno::Reference& r_xNew ) { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xComponent (m_xI, UNO_QUERY); - m_xI.clear(); - if (xComponent.is()) + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xComponent (m_xI, ::com::sun::star::uno::UNO_QUERY); + m_xI = r_xNew; + if (xComponent.is()) try + { xComponent->dispose(); + } + catch( Exception& ) + { + } } }; } -- cgit From 8dd20306c4be9d0dfa0bc231a5c268efdba0aac3 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 3 Dec 2010 00:48:03 +0100 Subject: impressdefaults1: fixed linux compile error --- vcl/inc/vcl/lazydelete.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/lazydelete.hxx b/vcl/inc/vcl/lazydelete.hxx index f09614cc85e0..dad10fb62b33 100644 --- a/vcl/inc/vcl/lazydelete.hxx +++ b/vcl/inc/vcl/lazydelete.hxx @@ -290,7 +290,7 @@ namespace vcl { xComponent->dispose(); } - catch( Exception& ) + catch( ::com::sun::star::uno::Exception& ) { } } -- cgit From 8e96aa5f95a7694e3ffbbe0655cc5d947007dafa Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 8 Dec 2010 16:14:33 +0100 Subject: vcl117: clean up helpid mismatch --- vcl/source/src/print.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index dcc780f99b72..cf7ede385e50 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -29,7 +29,7 @@ ModalDialog SV_DLG_PRINT { - HelpID = ".HelpId:vcl:PrintDialog:Dialog"; + HelpID = ".HelpID:vcl:PrintDialog:Dialog"; Text [en-US] = "Print"; Closeable = TRUE; Sizeable = TRUE; -- cgit From 456861df0288465b642fbf777f70ac07cd53eba5 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 9 Dec 2010 11:30:23 +0100 Subject: vcl117: more HelpID cleanup --- vcl/source/src/print.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vcl') diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index cf7ede385e50..04ab77f09288 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -130,7 +130,7 @@ ModalDialog SV_DLG_PRINT TabPage SV_PRINT_TAB_NUP { - HelpID = ".HelpID:vcl:PrintDialog:TabNUp"; + HelpID = ".HelpID:vcl:PrintDialog:NUpPage"; Text [en-US] = "Page Layout"; Hide = TRUE; @@ -307,7 +307,7 @@ ModalDialog SV_DLG_PRINT TabPage SV_PRINT_TAB_JOB { - HelpID = ".HelpID:vcl:PrintDialog:TabJob"; + HelpID = ".HelpID:vcl:PrintDialog:JobPage"; Text [en-US] = "General"; Hide = TRUE; @@ -418,7 +418,7 @@ ModalDialog SV_DLG_PRINT { Text [en-US] = "Options"; Hide = TRUE; - HelpID = ".HelpID:vcl:PrintDialog:TabOpt"; + HelpID = ".HelpID:vcl:PrintDialog:OptPage"; FixedLine SV_PRINT_OPT_PRINT_FL { -- cgit From 90caa1cd9c39fdaf4a94880cafbb7f242925e8a6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 10 Dec 2010 11:39:42 +0100 Subject: vcl117: more help id woes --- vcl/source/window/printdlg.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'vcl') diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a7832aa191d9..f07ee9e51e8b 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -2139,8 +2139,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) Help* pHelp = Application::GetHelp(); if( pHelp ) { - // FIXME: find out proper help URL and use here - pHelp->Start( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ), GetParent() ); + pHelp->Start( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:OK" ) ), &maOKButton ); } } else if( pButton == &maForwardBtn ) -- cgit