-- cgit From 6485417ddb43981ebc67ed22c0b585a8841ae1ab Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Sep 2009 07:31:47 +0000 Subject: #i1601# Sentence case, Title case, and Toggle case transliteration added --- i18npool/inc/transliteration_body.hxx | 13 ++ i18npool/inc/transliteration_sentencecase.hxx | 69 ++++++++ i18npool/source/localedata/data/ak_GH.xml | 3 + i18npool/source/localedata/data/bs_BA.xml | 9 +- i18npool/source/localedata/data/ee_GH.xml | 3 + i18npool/source/localedata/data/en_GH.xml | 6 +- i18npool/source/localedata/data/en_US.xml | 3 + i18npool/source/localedata/data/eo.xml | 3 + i18npool/source/localedata/data/eu.xml | 5 +- i18npool/source/localedata/data/fur_IT.xml | 3 + i18npool/source/localedata/data/fy_NL.xml | 3 + i18npool/source/localedata/data/gsc_FR.xml | 11 +- i18npool/source/localedata/data/gug_PY.xml | 3 + i18npool/source/localedata/data/ha_GH.xml | 3 + i18npool/source/localedata/data/hil_PH.xml | 3 + i18npool/source/localedata/data/hr_HR.xml | 9 +- i18npool/source/localedata/data/hy_AM.xml | 3 + i18npool/source/localedata/data/is_IS.xml | 5 +- i18npool/source/localedata/data/ka_GE.xml | 3 + i18npool/source/localedata/data/kk_KZ.xml | 3 + i18npool/source/localedata/data/km_KH.xml | 3 + i18npool/source/localedata/data/ko_KR.xml | 5 +- i18npool/source/localedata/data/ku_TR.xml | 3 + i18npool/source/localedata/data/lg_UG.xml | 7 +- i18npool/source/localedata/data/ln_CD.xml | 3 + i18npool/source/localedata/data/lt_LT.xml | 5 +- i18npool/source/localedata/data/lv_LV.xml | 9 +- i18npool/source/localedata/data/mk_MK.xml | 3 + i18npool/source/localedata/data/mt_MT.xml | 3 + i18npool/source/localedata/data/my_MM.xml | 3 + i18npool/source/localedata/data/ne_NP.xml | 3 + i18npool/source/localedata/data/oc_FR.xml | 3 + i18npool/source/localedata/data/or_IN.xml | 3 + i18npool/source/localedata/data/sg_CF.xml | 3 + i18npool/source/localedata/data/sh_RS.xml | 3 + i18npool/source/localedata/data/shs_CA.xml | 3 + i18npool/source/localedata/data/sk_SK.xml | 5 +- i18npool/source/localedata/data/sl_SI.xml | 3 + i18npool/source/localedata/data/so_SO.xml | 3 + i18npool/source/localedata/data/sr_RS.xml | 3 + i18npool/source/localedata/data/sw_TZ.xml | 3 + i18npool/source/localedata/data/tk_TM.xml | 3 + i18npool/source/localedata/data/tpi_PG.xml | 3 + i18npool/source/localedata/data/uk_UA.xml | 9 +- i18npool/source/localedata/data/vi_VN.xml | 3 + i18npool/source/localedata/data/zh_CN.xml | 23 +-- i18npool/source/localedata/data/zh_TW.xml | 25 +-- .../source/registerservices/registerservices.cxx | 13 ++ i18npool/source/transliteration/makefile.mk | 1 + .../transliteration/transliteration_body.cxx | 15 ++ .../transliteration_sentencecase.cxx | 190 +++++++++++++++++++++ 51 files changed, 478 insertions(+), 49 deletions(-) create mode 100644 i18npool/inc/transliteration_sentencecase.hxx create mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index 518f4efd0d2f..6e5ef5c32776 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -93,6 +93,19 @@ public: }; #endif + +class Transliteration_titlecase : public Transliteration_body +{ +public: + Transliteration_titlecase(); +}; + +class Transliteration_togglecase : public Transliteration_body +{ +public: + Transliteration_togglecase(); +}; + } } } } #endif diff --git a/i18npool/inc/transliteration_sentencecase.hxx b/i18npool/inc/transliteration_sentencecase.hxx new file mode 100644 index 000000000000..11318f5cc963 --- /dev/null +++ b/i18npool/inc/transliteration_sentencecase.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: transliteration_Numeric.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ +#define _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ + +#include + +namespace com { namespace sun { namespace star { namespace i18n { + +class Transliteration_sentencecase : public transliteration_commonclass { +public: + Transliteration_sentencecase( ); + + ::rtl::OUString SAL_CALL + transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException); + + sal_Unicode SAL_CALL + transliterateChar2Char( sal_Unicode inChar) + throw(com::sun::star::i18n::MultipleCharsOutputException, + com::sun::star::uno::RuntimeException); + + // Methods which are shared. + sal_Int16 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); + + ::rtl::OUString SAL_CALL + folding( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) + throw(::com::sun::star::uno::RuntimeException); + + sal_Bool SAL_CALL + equals( const ::rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const ::rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) + throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + transliterateRange( const ::rtl::OUString& str1, const ::rtl::OUString& str2 ) + throw(::com::sun::star::uno::RuntimeException); +}; + +} } } } + +#endif // _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ + diff --git a/i18npool/source/localedata/data/ak_GH.xml b/i18npool/source/localedata/data/ak_GH.xml index 95ac2069db31..afdbf1c2b227 100644 --- a/i18npool/source/localedata/data/ak_GH.xml +++ b/i18npool/source/localedata/data/ak_GH.xml @@ -337,8 +337,11 @@ + + + diff --git a/i18npool/source/localedata/data/bs_BA.xml b/i18npool/source/localedata/data/bs_BA.xml index 1a6eeb82ff44..0dea5e435ec5 100644 --- a/i18npool/source/localedata/data/bs_BA.xml +++ b/i18npool/source/localedata/data/bs_BA.xml @@ -366,9 +366,12 @@ - - - + + + + + + diff --git a/i18npool/source/localedata/data/ee_GH.xml b/i18npool/source/localedata/data/ee_GH.xml index eb19dec770da..2d4807774a8b 100644 --- a/i18npool/source/localedata/data/ee_GH.xml +++ b/i18npool/source/localedata/data/ee_GH.xml @@ -331,8 +331,11 @@ + + + diff --git a/i18npool/source/localedata/data/en_GH.xml b/i18npool/source/localedata/data/en_GH.xml index 660cd759944b..37437468a651 100644 --- a/i18npool/source/localedata/data/en_GH.xml +++ b/i18npool/source/localedata/data/en_GH.xml @@ -329,11 +329,7 @@ 2 - - - - - + True diff --git a/i18npool/source/localedata/data/en_US.xml b/i18npool/source/localedata/data/en_US.xml index 2a99dcd0fb14..7029b7cc5b30 100644 --- a/i18npool/source/localedata/data/en_US.xml +++ b/i18npool/source/localedata/data/en_US.xml @@ -475,8 +475,11 @@ + + + diff --git a/i18npool/source/localedata/data/eo.xml b/i18npool/source/localedata/data/eo.xml index 62098fdf75ef..33a42a8fd675 100644 --- a/i18npool/source/localedata/data/eo.xml +++ b/i18npool/source/localedata/data/eo.xml @@ -321,8 +321,11 @@ + + + diff --git a/i18npool/source/localedata/data/eu.xml b/i18npool/source/localedata/data/eu.xml index 5f0119b1285d..64184d0125f0 100644 --- a/i18npool/source/localedata/data/eu.xml +++ b/i18npool/source/localedata/data/eu.xml @@ -328,9 +328,12 @@ + + + + - diff --git a/i18npool/source/localedata/data/fur_IT.xml b/i18npool/source/localedata/data/fur_IT.xml index cfec124d68b6..5aee7cbfdf15 100644 --- a/i18npool/source/localedata/data/fur_IT.xml +++ b/i18npool/source/localedata/data/fur_IT.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/fy_NL.xml b/i18npool/source/localedata/data/fy_NL.xml index 651d13417842..a4a7cc48f2da 100644 --- a/i18npool/source/localedata/data/fy_NL.xml +++ b/i18npool/source/localedata/data/fy_NL.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/gsc_FR.xml b/i18npool/source/localedata/data/gsc_FR.xml index 0a13281f9d7b..01242e586e7a 100644 --- a/i18npool/source/localedata/data/gsc_FR.xml +++ b/i18npool/source/localedata/data/gsc_FR.xml @@ -323,9 +323,12 @@ - - - + + + + + + @@ -355,4 +358,4 @@ - \ No newline at end of file + diff --git a/i18npool/source/localedata/data/gug_PY.xml b/i18npool/source/localedata/data/gug_PY.xml index c21104c3d13e..60230ae64dac 100644 --- a/i18npool/source/localedata/data/gug_PY.xml +++ b/i18npool/source/localedata/data/gug_PY.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/ha_GH.xml b/i18npool/source/localedata/data/ha_GH.xml index 1794447c0e4d..6d56b80cc580 100644 --- a/i18npool/source/localedata/data/ha_GH.xml +++ b/i18npool/source/localedata/data/ha_GH.xml @@ -334,8 +334,11 @@ + + + diff --git a/i18npool/source/localedata/data/hil_PH.xml b/i18npool/source/localedata/data/hil_PH.xml index 6396ff261c90..1bd10219d366 100644 --- a/i18npool/source/localedata/data/hil_PH.xml +++ b/i18npool/source/localedata/data/hil_PH.xml @@ -324,8 +324,11 @@ + + + diff --git a/i18npool/source/localedata/data/hr_HR.xml b/i18npool/source/localedata/data/hr_HR.xml index 4c3786539b38..484efdcb9ba0 100644 --- a/i18npool/source/localedata/data/hr_HR.xml +++ b/i18npool/source/localedata/data/hr_HR.xml @@ -318,9 +318,12 @@ - - - + + + + + + diff --git a/i18npool/source/localedata/data/hy_AM.xml b/i18npool/source/localedata/data/hy_AM.xml index 92913732a090..47c2e35d6e7b 100644 --- a/i18npool/source/localedata/data/hy_AM.xml +++ b/i18npool/source/localedata/data/hy_AM.xml @@ -320,8 +320,11 @@ + + + diff --git a/i18npool/source/localedata/data/is_IS.xml b/i18npool/source/localedata/data/is_IS.xml index 7e77c1d2cdad..3b16c6e4bca5 100644 --- a/i18npool/source/localedata/data/is_IS.xml +++ b/i18npool/source/localedata/data/is_IS.xml @@ -314,9 +314,12 @@ + + + + - diff --git a/i18npool/source/localedata/data/ka_GE.xml b/i18npool/source/localedata/data/ka_GE.xml index d0a9a20369e1..ada35b465543 100644 --- a/i18npool/source/localedata/data/ka_GE.xml +++ b/i18npool/source/localedata/data/ka_GE.xml @@ -320,8 +320,11 @@ + + + diff --git a/i18npool/source/localedata/data/kk_KZ.xml b/i18npool/source/localedata/data/kk_KZ.xml index e5c8cc95d2fe..a9147655cdec 100644 --- a/i18npool/source/localedata/data/kk_KZ.xml +++ b/i18npool/source/localedata/data/kk_KZ.xml @@ -322,8 +322,11 @@ + + + diff --git a/i18npool/source/localedata/data/km_KH.xml b/i18npool/source/localedata/data/km_KH.xml index dff43def273b..bddd0e91791e 100644 --- a/i18npool/source/localedata/data/km_KH.xml +++ b/i18npool/source/localedata/data/km_KH.xml @@ -346,8 +346,11 @@ + + + diff --git a/i18npool/source/localedata/data/ko_KR.xml b/i18npool/source/localedata/data/ko_KR.xml index bbd5b0ded2be..3a3fbb0fb9a9 100644 --- a/i18npool/source/localedata/data/ko_KR.xml +++ b/i18npool/source/localedata/data/ko_KR.xml @@ -564,8 +564,11 @@ - + + + + diff --git a/i18npool/source/localedata/data/ku_TR.xml b/i18npool/source/localedata/data/ku_TR.xml index 4af9e2cd28d2..0413353b8486 100644 --- a/i18npool/source/localedata/data/ku_TR.xml +++ b/i18npool/source/localedata/data/ku_TR.xml @@ -330,8 +330,11 @@ + + + diff --git a/i18npool/source/localedata/data/lg_UG.xml b/i18npool/source/localedata/data/lg_UG.xml index c6b3b740b10d..5fc78c71cec2 100644 --- a/i18npool/source/localedata/data/lg_UG.xml +++ b/i18npool/source/localedata/data/lg_UG.xml @@ -323,8 +323,11 @@ - - + + + + + diff --git a/i18npool/source/localedata/data/ln_CD.xml b/i18npool/source/localedata/data/ln_CD.xml index 602b19fb8fd8..daf7376c9df5 100644 --- a/i18npool/source/localedata/data/ln_CD.xml +++ b/i18npool/source/localedata/data/ln_CD.xml @@ -327,8 +327,11 @@ + + + diff --git a/i18npool/source/localedata/data/lt_LT.xml b/i18npool/source/localedata/data/lt_LT.xml index c23f542d6b5d..cd4cb0aca929 100644 --- a/i18npool/source/localedata/data/lt_LT.xml +++ b/i18npool/source/localedata/data/lt_LT.xml @@ -346,9 +346,12 @@ + + + + - diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index e29a06eaf274..884980762a0e 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -371,9 +371,12 @@ - - - + + + + + + diff --git a/i18npool/source/localedata/data/mk_MK.xml b/i18npool/source/localedata/data/mk_MK.xml index b9862478513e..10e488e3cac1 100644 --- a/i18npool/source/localedata/data/mk_MK.xml +++ b/i18npool/source/localedata/data/mk_MK.xml @@ -322,8 +322,11 @@ + + + diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml index 790bd97303e0..bcc5869932b4 100644 --- a/i18npool/source/localedata/data/mt_MT.xml +++ b/i18npool/source/localedata/data/mt_MT.xml @@ -324,8 +324,11 @@ + + + diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml index dada8a5402d9..6c12c8986c8f 100644 --- a/i18npool/source/localedata/data/my_MM.xml +++ b/i18npool/source/localedata/data/my_MM.xml @@ -395,8 +395,11 @@ + + + diff --git a/i18npool/source/localedata/data/ne_NP.xml b/i18npool/source/localedata/data/ne_NP.xml index cca8be996a70..558027ac0e1c 100644 --- a/i18npool/source/localedata/data/ne_NP.xml +++ b/i18npool/source/localedata/data/ne_NP.xml @@ -322,8 +322,11 @@ + + + diff --git a/i18npool/source/localedata/data/oc_FR.xml b/i18npool/source/localedata/data/oc_FR.xml index 236f1c8dbb09..bb7e7ef02da1 100644 --- a/i18npool/source/localedata/data/oc_FR.xml +++ b/i18npool/source/localedata/data/oc_FR.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/or_IN.xml b/i18npool/source/localedata/data/or_IN.xml index 168b542f1894..22333451f6ea 100644 --- a/i18npool/source/localedata/data/or_IN.xml +++ b/i18npool/source/localedata/data/or_IN.xml @@ -322,8 +322,11 @@ + + + diff --git a/i18npool/source/localedata/data/sg_CF.xml b/i18npool/source/localedata/data/sg_CF.xml index 075b1a43ae18..61ee40b8081e 100644 --- a/i18npool/source/localedata/data/sg_CF.xml +++ b/i18npool/source/localedata/data/sg_CF.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml index 4b744bdd5913..01faa188c9e2 100644 --- a/i18npool/source/localedata/data/sh_RS.xml +++ b/i18npool/source/localedata/data/sh_RS.xml @@ -211,8 +211,11 @@ + + + diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml index 4060d002bbe2..505771c81eda 100644 --- a/i18npool/source/localedata/data/shs_CA.xml +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/sk_SK.xml b/i18npool/source/localedata/data/sk_SK.xml index 7820ef290a46..b233f3981284 100644 --- a/i18npool/source/localedata/data/sk_SK.xml +++ b/i18npool/source/localedata/data/sk_SK.xml @@ -369,9 +369,12 @@ + + + + - diff --git a/i18npool/source/localedata/data/sl_SI.xml b/i18npool/source/localedata/data/sl_SI.xml index b4de5c4a184b..19139d5e0cc0 100644 --- a/i18npool/source/localedata/data/sl_SI.xml +++ b/i18npool/source/localedata/data/sl_SI.xml @@ -331,8 +331,11 @@ + + + diff --git a/i18npool/source/localedata/data/so_SO.xml b/i18npool/source/localedata/data/so_SO.xml index f5d666ec7e5a..4b8fb2e266ff 100644 --- a/i18npool/source/localedata/data/so_SO.xml +++ b/i18npool/source/localedata/data/so_SO.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml index 4023c2d4afeb..13133333f37e 100644 --- a/i18npool/source/localedata/data/sr_RS.xml +++ b/i18npool/source/localedata/data/sr_RS.xml @@ -350,8 +350,11 @@ + + + diff --git a/i18npool/source/localedata/data/sw_TZ.xml b/i18npool/source/localedata/data/sw_TZ.xml index 22bf61807a54..3a92d8eb3593 100644 --- a/i18npool/source/localedata/data/sw_TZ.xml +++ b/i18npool/source/localedata/data/sw_TZ.xml @@ -322,8 +322,11 @@ + + + diff --git a/i18npool/source/localedata/data/tk_TM.xml b/i18npool/source/localedata/data/tk_TM.xml index cfd09c63c4ab..c30d1f782811 100644 --- a/i18npool/source/localedata/data/tk_TM.xml +++ b/i18npool/source/localedata/data/tk_TM.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml index 0017a1081233..51cc3500cc57 100644 --- a/i18npool/source/localedata/data/tpi_PG.xml +++ b/i18npool/source/localedata/data/tpi_PG.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/uk_UA.xml b/i18npool/source/localedata/data/uk_UA.xml index 981c24f7c94f..1025096c7a6a 100644 --- a/i18npool/source/localedata/data/uk_UA.xml +++ b/i18npool/source/localedata/data/uk_UA.xml @@ -369,9 +369,12 @@ - - - + + + + + + diff --git a/i18npool/source/localedata/data/vi_VN.xml b/i18npool/source/localedata/data/vi_VN.xml index 4b9bfb266051..93fc1ee3adc4 100644 --- a/i18npool/source/localedata/data/vi_VN.xml +++ b/i18npool/source/localedata/data/vi_VN.xml @@ -323,8 +323,11 @@ + + + diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml index 0fadbf5d9075..c9d1371cb753 100644 --- a/i18npool/source/localedata/data/zh_CN.xml +++ b/i18npool/source/localedata/data/zh_CN.xml @@ -415,16 +415,19 @@ - - - - - - - - - - + + + + + + + + + + + + + diff --git a/i18npool/source/localedata/data/zh_TW.xml b/i18npool/source/localedata/data/zh_TW.xml index 1d1e476b7771..aa53647057f8 100644 --- a/i18npool/source/localedata/data/zh_TW.xml +++ b/i18npool/source/localedata/data/zh_TW.xml @@ -343,17 +343,20 @@ - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 870c49939648..697d3594e8d8 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,9 @@ IMPL_CREATEINSTANCE_MSF( TextConversion_zh ) IMPL_CREATEINSTANCE( Transliteration_u2l ) IMPL_CREATEINSTANCE( Transliteration_l2u ) +IMPL_CREATEINSTANCE( Transliteration_sentencecase ) +IMPL_CREATEINSTANCE( Transliteration_titlecase ) +IMPL_CREATEINSTANCE( Transliteration_togglecase ) IMPL_CREATEINSTANCE( Transliteration_caseignore ) IMPL_CREATEINSTANCE( hiraganaToKatakana ) IMPL_CREATEINSTANCE( katakanaToHiragana ) @@ -422,6 +426,15 @@ static const struct InstancesArray { { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "LOWERCASE_UPPERCASE", &Transliteration_l2u_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "SENTENCE_CASE", + &Transliteration_sentencecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TITLE_CASE", + &Transliteration_titlecase_CreateInstance }, + { TRLT_SERVICELNAME_L10N, + TRLT_IMPLNAME_PREFIX "TOGGLE_CASE", + &Transliteration_togglecase_CreateInstance }, { TRLT_SERVICELNAME_L10N, TRLT_IMPLNAME_PREFIX "IGNORE_CASE", &Transliteration_caseignore_CreateInstance }, diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index daf3068d4d20..5ad615c64dbe 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -50,6 +50,7 @@ SLOFILES= \ $(SLO)$/transliteration_OneToOne.obj \ $(SLO)$/transliteration_Ignore.obj \ $(SLO)$/transliteration_Numeric.obj \ + $(SLO)$/transliteration_sentencecase.obj \ $(SLO)$/hiraganaToKatakana.obj \ $(SLO)$/katakanaToHiragana.obj \ $(SLO)$/ignoreKana.obj \ diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 0bea721a0c9d..d75eede13bf9 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -261,4 +261,19 @@ Transliteration_l2u::Transliteration_l2u() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u"; } +Transliteration_titlecase::Transliteration_titlecase() +{ + nMappingType = MappingTypeToTitle; + transliterationName = "title(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; +} + +Transliteration_togglecase::Transliteration_togglecase() +{ + nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; + transliterationName = "toggle(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; +} + + } } } } diff --git a/i18npool/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx new file mode 100644 index 000000000000..35f9a69abb4d --- /dev/null +++ b/i18npool/source/transliteration/transliteration_sentencecase.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: halfwidthToFullwidth.cxx,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_i18npool.hxx" + +// prevent internal compiler error with MSVC6SP3 +#include + +#include +#include +#define TRANSLITERATION_sentencecase +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace rtl; + +namespace com { namespace sun { namespace star { namespace i18n { + + +Transliteration_sentencecase::Transliteration_sentencecase() +{ + transliterationName = "sentenceCase"; + implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; +} + +OUString SAL_CALL +Transliteration_sentencecase::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + // inspired from Transliteration_body::transliterate + sal_Int32 nOffCount = 0, i; + bool bPoint = true; + if (useOffset) + { + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + nOffCount++; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + bPoint = false; + + if(map == 0) + { + nOffCount++; + } + else + { + nOffCount += map->nmap; + } + } + else + { + nOffCount++; + } + } + } + + bPoint = true; + rtl::OUStringBuffer result; + + if (useOffset) + { + result.ensureCapacity(nOffCount); + if ( nOffCount != offset.getLength() ) + offset.realloc( nOffCount ); + } + + + sal_Int32 j = 0; + sal_Int32 * pArr = offset.getArray(); + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + result.append(c); + pArr[j++] = i + startPos; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + bPoint = false; + + if(map == 0) + { + result.append( c ); + pArr[j++] = i + startPos; + } + else + { + for (sal_Int32 k = 0; k < map->nmap; k++) + { + result.append( map->map[k] ); + pArr[j++] = i + startPos; + } + } + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +sal_Unicode SAL_CALL +Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) + throw(RuntimeException, MultipleCharsOutputException) +{ + return inChar; +} + +sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) +{ + return TransliterationType::IGNORE; +} + +OUString SAL_CALL +Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) throw(RuntimeException) +{ + return this->transliterate(inStr, startPos, nCount, offset); +} + +sal_Bool SAL_CALL Transliteration_sentencecase::equals( + const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, + const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) + throw(RuntimeException) +{ + throw RuntimeException(); +} + +Sequence< OUString > SAL_CALL +Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) + throw( RuntimeException) +{ + Sequence< OUString > ostr(2); + ostr[0] = str1; + ostr[1] = str2; + return ostr; +} + +} } } } + -- cgit From 76b8b7baa77573076292306400b7cb80ccc502e4 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Sep 2009 07:39:00 +0000 Subject: #i1601# Sentence case, Title case, and Toggle case transliteration added --- unotools/source/i18n/transliterationwrapper.cxx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index bd33e447471f..2536b1aee1ca 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -34,11 +34,12 @@ #include #include #include -#ifndef _COMPHELPER_COMPONENTFACTORY_HXX_ #include -#endif + #include #include +#include +#include #define TRANSLIT_LIBRARYNAME "i18n" #define TRANSLIT_SERVICENAME "com.sun.star.i18n.Transliteration" @@ -168,14 +169,22 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) sal_Bool bLoad = bFirstCall; bFirstCall = sal_False; - if( nLanguage != nLang ) + if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::SENTENCE_CASE ) { - setLanguageLocaleImpl( nLang ); - if( !bLoad ) - bLoad = needLanguageForTheMode(); + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); + } + else + { + if( nLanguage != nLang ) + { + setLanguageLocaleImpl( nLang ); + if( !bLoad ) + bLoad = needLanguageForTheMode(); + } + if( bLoad ) + loadModuleImpl(); } - if( bLoad ) - loadModuleImpl(); } -- cgit From 97dea0d4b527e7b530c86f2952263316184470d4 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 17 Sep 2009 15:48:04 -0400 Subject: #i5560# Applied & adjusted for the latest codebase the patches from go-oo. The original patches were contributed by Daniel Watson. --- svtools/inc/tabbar.hxx | 5 ++ svtools/source/control/tabbar.cxx | 110 ++++++++++++++++++++++++++++++++++---- 2 files changed, 106 insertions(+), 9 deletions(-) diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx index 5261697dd8b0..35d65c037a7a 100644 --- a/svtools/inc/tabbar.hxx +++ b/svtools/inc/tabbar.hxx @@ -430,6 +430,11 @@ public: USHORT nPos = TABBAR_APPEND ); void RemovePage( USHORT nPageId ); void MovePage( USHORT nPageId, USHORT nNewPos ); + + Color GetTabBgColor( USHORT nPageId ) const; + void SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ); + BOOL IsDefaultTabBgColor( USHORT nPageId ); + void Clear(); void EnablePage( USHORT nPageId, BOOL bEnable = TRUE ); diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index ed1abbe53a2a..f2fed5c96277 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -65,6 +65,10 @@ struct ImplTabBarItem BOOL mbShort; BOOL mbSelect; BOOL mbEnable; + Color maTabBgColor; + bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; }; + Color maTabTextColor; + bool IsDefaultTabTextColor() const { return maTabTextColor == Color(COL_AUTO) ? TRUE : FALSE; }; ImplTabBarItem( USHORT nItemId, const XubString& rText, TabBarPageBits nPageBits ) : @@ -77,6 +81,8 @@ struct ImplTabBarItem mbShort = FALSE; mbSelect = FALSE; mbEnable = TRUE; + maTabBgColor = Color( COL_AUTO ); + maTabTextColor = Color( COL_AUTO ); } }; @@ -1049,7 +1055,8 @@ void TabBar::Paint( const Rectangle& ) // Font selektieren Font aFont = GetFont(); Font aLightFont = aFont; - aLightFont.SetWeight( WEIGHT_LIGHT ); + //aLightFont.SetWeight( WEIGHT_LIGHT ); //TODO Make font weight light on custom color only? + aLightFont.SetWeight( WEIGHT_NORMAL ); // #i36013# exclude push buttons from painting area Rectangle aClipRect( Point( mnOffX, 0 ), Point( mnLastOffX, GetOutputHeightPixel() - 1 ) ); @@ -1123,15 +1130,23 @@ void TabBar::Paint( const Rectangle& ) SetFont( aLightFont ); // Je nach Status die richtige FillInBrush setzen + // Set the correct FillInBrush depending upon status if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + // Currently selected Tab SetFillColor( aSelectColor ); SetTextColor( aSelectTextColor ); } else { - SetFillColor( aFaceColor ); - SetTextColor( aFaceTextColor ); + if ( !pItem->IsDefaultTabBgColor() ) + { + SetFillColor( pItem->maTabBgColor ); + SetTextColor( pItem->maTabTextColor ); + } else { + SetFillColor( aFaceColor ); + SetTextColor( aFaceTextColor ); + } } // Muss Font Kursiv geschaltet werden @@ -1163,21 +1178,38 @@ void TabBar::Paint( const Rectangle& ) long nTextHeight = GetTextHeight(); Point aTxtPos( aRect.Left()+(aRectSize.Width()-nTextWidth)/2, (aRectSize.Height()-nTextHeight)/2 ); - if ( !pItem->mbEnable ) - DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); - else - DrawText( aTxtPos, aText ); - + if ( pItem->IsDefaultTabBgColor() || (!pItem->mbSelect) ) + { + if ( !pItem->mbEnable ) + DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); + else + DrawText( aTxtPos, aText ); + } // Jetzt im Inhalt den 3D-Effekt ausgeben aPos0.X()++; aPos1.X()++; aPos2.X()--; aPos3.X()--; - SetLineColor( rStyleSettings.GetLightColor() ); + + // If this is the current tab, draw the left inner shadow the default color, + // otherwise make it the same as the custom background color + if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + SetLineColor( rStyleSettings.GetLightColor() ); + } else { + if ( !pItem->IsDefaultTabBgColor() ) + { + SetLineColor( pItem->maTabBgColor ); + } else { + SetLineColor( rStyleSettings.GetLightColor() ); + } + } + // Draw the left side of the tab DrawLine( aPos0, aPos1 ); if ( !pItem->mbSelect && (pItem->mnId != mnCurPageId) ) { + // Draw the top inner shadow + // ToDo: Change from this static color to tab custom bg color DrawLine( Point( aPos0.X(), aPos0.Y()+1 ), Point( aPos3.X(), aPos3.Y()+1 ) ); } @@ -1187,8 +1219,27 @@ void TabBar::Paint( const Rectangle& ) aPos1.X()--; aPos1.Y()--; aPos2.Y()--; + if ( !pItem->IsDefaultTabBgColor() && ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) ) + { + SetLineColor( pItem->maTabBgColor ); + DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); + } DrawLine( aPos1, aPos2 ); + // draw a small 2px sliver of the original background color at the bottom of the selected tab + + if ( !pItem->IsDefaultTabBgColor() ) + { + if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + SetLineColor( pItem->maTabBgColor ); + DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); + if ( !pItem->mbEnable ) + DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); + else + DrawText( aTxtPos, aText ); + } + } + // Da etwas uebermalt werden konnte, muessen wir die Polygon- // umrandung nocheinmal ausgeben SetLineColor( rStyleSettings.GetDarkShadowColor() ); @@ -1565,6 +1616,42 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText, // ----------------------------------------------------------------------- +Color TabBar::GetTabBgColor( USHORT nPageId ) const +{ + USHORT nPos = GetPagePos( nPageId ); + + if ( nPos != TAB_PAGE_NOTFOUND ) + return mpItemList->GetObject( nPos )->maTabBgColor; + else + return Color( COL_AUTO ); +} + +void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) +{ + USHORT nPos = GetPagePos( nPageId ); + ImplTabBarItem* pItem; + if ( nPos != TAB_PAGE_NOTFOUND ) + { + pItem = mpItemList->GetObject( nPos ); + // TODO: Need to take the text color specification out of this code! + if ( aTabBgColor != Color( COL_AUTO ) ) + { + pItem->maTabBgColor = aTabBgColor; + if ( aTabBgColor.GetLuminance() <= 128 ) //Do not use aTabBgColor.IsDark(), because that threshold is way too low... + pItem->maTabTextColor = Color( COL_WHITE ); + else + pItem->maTabTextColor = Color( COL_BLACK ); + } + else + { + pItem->maTabBgColor = Color( COL_AUTO ); + pItem->maTabTextColor = Color( COL_AUTO ); + } + } +} + +// ----------------------------------------------------------------------- + void TabBar::RemovePage( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); @@ -2486,9 +2573,12 @@ USHORT TabBar::ShowDropPos( const Point& rPos ) nX--; else nX++; + if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect) + SetLineColor( pItem->maTabTextColor ); DrawLine( Point( nX, nY ), Point( nX, nY ) ); DrawLine( Point( nX+1, nY-1 ), Point( nX+1, nY+1 ) ); DrawLine( Point( nX+2, nY-2 ), Point( nX+2, nY+2 ) ); + SetLineColor( aBlackColor ); } if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) ) { @@ -2496,6 +2586,8 @@ USHORT TabBar::ShowDropPos( const Point& rPos ) nX = pItem->maRect.Right()-TABBAR_OFFSET_X; if ( mnDropPos == nCurPos ) nX++; + if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect) + SetLineColor( pItem->maTabTextColor ); DrawLine( Point( nX, nY ), Point( nX, nY ) ); DrawLine( Point( nX-1, nY-1 ), Point( nX-1, nY+1 ) ); DrawLine( Point( nX-2, nY-2 ), Point( nX-2, nY+2 ) ); -- cgit From 40b3c4a883e8f26136c996c9aefa79001f61a86b Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 17 Sep 2009 21:50:01 -0400 Subject: Fixed build breakages. Now the whole thing builds. --- svtools/source/control/tabbar.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index f2fed5c96277..50618901798c 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1620,7 +1620,7 @@ Color TabBar::GetTabBgColor( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TAB_PAGE_NOTFOUND ) + if ( nPos != TABBAR_PAGE_NOTFOUND ) return mpItemList->GetObject( nPos )->maTabBgColor; else return Color( COL_AUTO ); @@ -1630,7 +1630,7 @@ void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) { USHORT nPos = GetPagePos( nPageId ); ImplTabBarItem* pItem; - if ( nPos != TAB_PAGE_NOTFOUND ) + if ( nPos != TABBAR_PAGE_NOTFOUND ) { pItem = mpItemList->GetObject( nPos ); // TODO: Need to take the text color specification out of this code! -- cgit From 3327c079e5160ba94d92e4a728a017c904ed2b99 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 23 Sep 2009 12:28:22 +0000 Subject: #i1601# transliteration for sentence case, title case and toggle case --- unotools/source/i18n/transliterationwrapper.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index 2536b1aee1ca..90ee4d8db14b 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -151,7 +151,10 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const { return TransliterationModules_UPPERCASE_LOWERCASE == nType || TransliterationModules_LOWERCASE_UPPERCASE == nType || - TransliterationModules_IGNORE_CASE == nType; + TransliterationModules_IGNORE_CASE == nType || + TransliterationModulesExtra::SENTENCE_CASE == nType || + TransliterationModulesExtra::TITLE_CASE == nType || + TransliterationModulesExtra::TOGGLE_CASE == nType; } @@ -174,6 +177,16 @@ void TransliterationWrapper::loadModuleIfNeeded( sal_uInt16 nLang ) if( bLoad ) loadModuleByImplName(String::CreateFromAscii("SENTENCE_CASE"), nLang); } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TITLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TITLE_CASE"), nLang); + } + else if( static_cast< sal_Int32 >(nType) == TransliterationModulesExtra::TOGGLE_CASE ) + { + if( bLoad ) + loadModuleByImplName(String::CreateFromAscii("TOGGLE_CASE"), nLang); + } else { if( nLanguage != nLang ) -- cgit From 892a6935027c6817ddf45720109273bb4fd282c6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 23 Sep 2009 12:29:56 +0000 Subject: #i1601# transliteration for sentence case, title case and toggle case --- i18npool/inc/transliteration_body.hxx | 16 +- i18npool/inc/transliteration_sentencecase.hxx | 69 ------ .../source/registerservices/registerservices.cxx | 1 - i18npool/source/transliteration/makefile.mk | 1 - .../transliteration/transliteration_body.cxx | 256 ++++++++++++++++++++- .../transliteration_sentencecase.cxx | 190 --------------- i18npool/util/makefile.mk | 1 + 7 files changed, 262 insertions(+), 272 deletions(-) delete mode 100644 i18npool/inc/transliteration_sentencecase.hxx delete mode 100644 i18npool/source/transliteration/transliteration_sentencecase.cxx diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx index 6e5ef5c32776..cac2c99e8764 100644 --- a/i18npool/inc/transliteration_body.hxx +++ b/i18npool/inc/transliteration_body.hxx @@ -94,17 +94,29 @@ public: #endif +#if defined( TRANSLITERATION_ALL ) +class Transliteration_togglecase : public Transliteration_body +{ +public: + Transliteration_togglecase(); +}; + class Transliteration_titlecase : public Transliteration_body { public: Transliteration_titlecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); }; -class Transliteration_togglecase : public Transliteration_body +class Transliteration_sentencecase : public Transliteration_body { public: - Transliteration_togglecase(); + Transliteration_sentencecase(); + + virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); }; +#endif } } } } diff --git a/i18npool/inc/transliteration_sentencecase.hxx b/i18npool/inc/transliteration_sentencecase.hxx deleted file mode 100644 index 11318f5cc963..000000000000 --- a/i18npool/inc/transliteration_sentencecase.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: transliteration_Numeric.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ -#define _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ - -#include - -namespace com { namespace sun { namespace star { namespace i18n { - -class Transliteration_sentencecase : public transliteration_commonclass { -public: - Transliteration_sentencecase( ); - - ::rtl::OUString SAL_CALL - transliterate( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) - throw(::com::sun::star::uno::RuntimeException); - - sal_Unicode SAL_CALL - transliterateChar2Char( sal_Unicode inChar) - throw(com::sun::star::i18n::MultipleCharsOutputException, - com::sun::star::uno::RuntimeException); - - // Methods which are shared. - sal_Int16 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException); - - ::rtl::OUString SAL_CALL - folding( const ::rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, ::com::sun::star::uno::Sequence< sal_Int32 >& offset ) - throw(::com::sun::star::uno::RuntimeException); - - sal_Bool SAL_CALL - equals( const ::rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const ::rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) - throw(::com::sun::star::uno::RuntimeException); - - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - transliterateRange( const ::rtl::OUString& str1, const ::rtl::OUString& str2 ) - throw(::com::sun::star::uno::RuntimeException); -}; - -} } } } - -#endif // _I18NPPOL_TRANSLITERATION_SENTENCECASE_HXX_ - diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 697d3594e8d8..642e6b0f5736 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff --git a/i18npool/source/transliteration/makefile.mk b/i18npool/source/transliteration/makefile.mk index 5ad615c64dbe..daf3068d4d20 100644 --- a/i18npool/source/transliteration/makefile.mk +++ b/i18npool/source/transliteration/makefile.mk @@ -50,7 +50,6 @@ SLOFILES= \ $(SLO)$/transliteration_OneToOne.obj \ $(SLO)$/transliteration_Ignore.obj \ $(SLO)$/transliteration_Numeric.obj \ - $(SLO)$/transliteration_sentencecase.obj \ $(SLO)$/hiraganaToKatakana.obj \ $(SLO)$/katakanaToHiragana.obj \ $(SLO)$/ignoreKana.obj \ diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index d75eede13bf9..0426f89b604d 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -31,7 +31,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_i18npool.hxx" +#include #include +#include + +#include +#include + + +#include "CharacterClassificationImpl.hxx" +#include "breakiteratorImpl.hxx" + #define TRANSLITERATION_ALL #include "transliteration_body.hxx" @@ -39,8 +49,11 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::rtl; +#define A2OU(x) OUString::createFromAscii(x) + namespace com { namespace sun { namespace star { namespace i18n { + Transliteration_body::Transliteration_body() { nMappingType = 0; @@ -71,9 +84,35 @@ Transliteration_body::transliterateRange( const OUString& str1, const OUString& return ostr; } + +static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Unicode cChar ) +{ + sal_uInt8 nRes = nMappingType; + + // take care of TOGGLE_CASE transliteration: + // nMappingType should not be a combination of flags, thuse we decide now + // which one to use. + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + { + const sal_Int16 nType = unicode::getUnicodeType( cChar ); + if (nType & 0x02 /* lower case*/) + nRes = MappingTypeLowerToUpper; + else + { + DBG_ASSERT( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + nRes = MappingTypeUpperToLower; + } + } + + return nRes; +} + + OUString SAL_CALL -Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) +Transliteration_body::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset) + throw(RuntimeException) { #if 0 /* Performance optimization: @@ -142,7 +181,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nOffCount = 0, i; for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); nOffCount += map.nmap; } rtl_uString* pStr = x_rtl_uString_new_WithLength( nOffCount, 1 ); // our x_rtl_ustring.h @@ -155,7 +199,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 * pArr = offset.getArray(); for (i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { pArr[j] = i + startPos; @@ -187,7 +236,12 @@ Transliteration_body::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 j = 0; for ( sal_Int32 i = 0; i < nCount; i++) { - const Mapping &map = casefolding::getValue(in, i, nCount, aLocale, nMappingType); + // take care of TOGGLE_CASE transliteration: + sal_uInt8 nTmpMappingType = nMappingType; + if (nMappingType == (MappingTypeLowerToUpper | MappingTypeUpperToLower)) + nTmpMappingType = lcl_getMappingTypeForToggleCase( nMappingType, in[i] ); + + const Mapping &map = casefolding::getValue( in, i, nCount, aLocale, nTmpMappingType ); for (sal_Int32 k = 0; k < map.nmap; k++) { out[j++] = map.map[k]; @@ -261,6 +315,17 @@ Transliteration_l2u::Transliteration_l2u() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_l2u"; } +Transliteration_togglecase::Transliteration_togglecase() +{ + // usually nMappingType must NOT be a combiantion of different flages here, + // but we take care of that problem in Transliteration_body::transliterate above + // before that value is used. There we will decide which of both is to be used on + // a per character basis. + nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; + transliterationName = "toggle(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; +} + Transliteration_titlecase::Transliteration_titlecase() { nMappingType = MappingTypeToTitle; @@ -268,12 +333,185 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -Transliteration_togglecase::Transliteration_togglecase() +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // possible problem: the locale is not exactly specific for each word in the text... + OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); + return aRes; +} + +Transliteration_sentencecase::Transliteration_sentencecase() { - nMappingType = MappingTypeLowerToUpper | MappingTypeUpperToLower; - transliterationName = "toggle(generic)"; - implementationName = "com.sun.star.i18n.Transliteration.Transliteration_togglecase"; + nMappingType = MappingTypeToTitle; // though only to be applied to the first word... + transliterationName = "sentence(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; } +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + // inspired from Transliteration_body::transliterate + sal_Int32 nOffCount = 0, i; + bool bPoint = true; + if (useOffset) + { + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + nOffCount++; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + bPoint = false; + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + nOffCount++; + } + else + { + nOffCount += map->nmap; + } + } + else + { + nOffCount++; + } + } + } + + bPoint = true; + rtl::OUStringBuffer result; + + if (useOffset) + { + result.ensureCapacity(nOffCount); + if ( nOffCount != offset.getLength() ) + offset.realloc( nOffCount ); + } + + + sal_Int32 j = 0; + sal_Int32 * pArr = offset.getArray(); + for( i = 0; i < nCount; ++i ) { + sal_Unicode c = inStr.getStr()[ i + startPos ]; + if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { + bPoint = true; + result.append(c); + pArr[j++] = i + startPos; + } + else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) + { + const Mapping* map = 0; + if( bPoint && unicode::isLower( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); + } + else if (!bPoint && unicode::isUpper( c )) + { + map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); + } + + if(map == 0) + { + result.append( c ); + pArr[j++] = i + startPos; + } + else + { + for (sal_Int32 k = 0; k < map->nmap; k++) + { + result.append( map->map[k] ); + pArr[j++] = i + startPos; + } + } + bPoint = false; + } + else + { + result.append( c ); + pArr[j++] = i + startPos; + } + } + return result.makeStringAndClear(); +} + +#if 0 +// TL: alternative implemntation try. But breakiterator has its problem too since +// beginOfSentence does not work as expected with '.'. See comment below. +// For the time being I will leave this code here as a from-scratch sample if the +// breakiterator works better at some point... +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, + Sequence< sal_Int32 >& /*offset*/ ) + throw(RuntimeException) +{ + OUString aRes( inStr.copy( nStartPos, nCount ) ); + + if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) + { + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + BreakIteratorImpl brk( xMSF ); + + sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; + sal_Int32 nPos = nStartPos + nCount - 1; + while (nPos >= nStartPos && nPos != -1) + { + // possible problem: the locale is not exactly specific for each sentence in the text, + // but it is the only one we have... + nOldSentenceStart = nSentenceStart; + nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); + + // since the breakiterator completely ignores '.' characvters as end-of-sentence when + // the next word is lower case we need to take care of that ourself. The drawback: + // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-( + // Well, at least the other product does it in the same way... + sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos ); + nPos = nSentenceStart; + if (nFullStopPos > 0 && nFullStopPos > nSentenceStart) + { + Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD ); + nSentenceStart = aBd2.startPos; + nPos = nFullStopPos; + } + + if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1) + { + // the sentence start might be a quotation mark or some kind of bracket, thus + // we need the first dictionary word starting or following this position + // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD ); + Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true ); + // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) ); + OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) ); + } + else + break; // prevent endless loop + + // continue with previous sentence + if (nPos != -1) + --nPos; + } + } + return aRes; +} +#endif } } } } diff --git a/i18npool/source/transliteration/transliteration_sentencecase.cxx b/i18npool/source/transliteration/transliteration_sentencecase.cxx deleted file mode 100644 index 35f9a69abb4d..000000000000 --- a/i18npool/source/transliteration/transliteration_sentencecase.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: halfwidthToFullwidth.cxx,v $ - * $Revision: 1.12 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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_i18npool.hxx" - -// prevent internal compiler error with MSVC6SP3 -#include - -#include -#include -#define TRANSLITERATION_sentencecase -#include -#include -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace rtl; - -namespace com { namespace sun { namespace star { namespace i18n { - - -Transliteration_sentencecase::Transliteration_sentencecase() -{ - transliterationName = "sentenceCase"; - implementationName = "com.sun.star.i18n.Transliteration.SENTENCE_CASE"; -} - -OUString SAL_CALL -Transliteration_sentencecase::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) - throw(RuntimeException) -{ - // inspired from Transliteration_body::transliterate - sal_Int32 nOffCount = 0, i; - bool bPoint = true; - if (useOffset) - { - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - nOffCount++; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - bPoint = false; - - if(map == 0) - { - nOffCount++; - } - else - { - nOffCount += map->nmap; - } - } - else - { - nOffCount++; - } - } - } - - bPoint = true; - rtl::OUStringBuffer result; - - if (useOffset) - { - result.ensureCapacity(nOffCount); - if ( nOffCount != offset.getLength() ) - offset.realloc( nOffCount ); - } - - - sal_Int32 j = 0; - sal_Int32 * pArr = offset.getArray(); - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - result.append(c); - pArr[j++] = i + startPos; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - bPoint = false; - - if(map == 0) - { - result.append( c ); - pArr[j++] = i + startPos; - } - else - { - for (sal_Int32 k = 0; k < map->nmap; k++) - { - result.append( map->map[k] ); - pArr[j++] = i + startPos; - } - } - } - else - { - result.append( c ); - pArr[j++] = i + startPos; - } - } - return result.makeStringAndClear(); -} - -sal_Unicode SAL_CALL -Transliteration_sentencecase::transliterateChar2Char( sal_Unicode inChar) - throw(RuntimeException, MultipleCharsOutputException) -{ - return inChar; -} - -sal_Int16 SAL_CALL Transliteration_sentencecase::getType() throw(RuntimeException) -{ - return TransliterationType::IGNORE; -} - -OUString SAL_CALL -Transliteration_sentencecase::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& offset) throw(RuntimeException) -{ - return this->transliterate(inStr, startPos, nCount, offset); -} - -sal_Bool SAL_CALL Transliteration_sentencecase::equals( - const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/, sal_Int32& /*nMatch1*/, - const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/) - throw(RuntimeException) -{ - throw RuntimeException(); -} - -Sequence< OUString > SAL_CALL -Transliteration_sentencecase::transliterateRange( const OUString& str1, const OUString& str2 ) - throw( RuntimeException) -{ - Sequence< OUString > ostr(2); - ostr[0] = str1; - ostr[1] = str2; - return ostr; -} - -} } } } - diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index 582089a309e8..e6c243007fd2 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -72,6 +72,7 @@ SHL1LIBS=$(LIB1TARGET) SHL1STDLIBS= \ $(I18NUTILLIB) \ $(I18NISOLANGLIB) \ + $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ -- cgit From ee395cc711f6edcdc1d5a81aaa7c57cc9ef7255a Mon Sep 17 00:00:00 2001 From: Dirk Völzke Date: Wed, 7 Oct 2009 14:13:55 +0000 Subject: #i105452# Added alternative service names for the throbber --- toolkit/inc/toolkit/helper/servicenames.hxx | 6 ++++-- toolkit/source/controls/tksimpleanimation.cxx | 5 +++-- toolkit/source/controls/tkthrobber.cxx | 10 ++++++---- toolkit/source/helper/registerservices.cxx | 16 ++++++++-------- toolkit/source/helper/servicenames.cxx | 8 ++++---- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx index 31513f0f2358..a6573fff6966 100644 --- a/toolkit/inc/toolkit/helper/servicenames.hxx +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -95,8 +95,10 @@ extern const sal_Char __FAR_DATA szServiceName_TreeControl[]; extern const sal_Char __FAR_DATA szServiceName_TreeControlModel[]; extern const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[]; -extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[]; -extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[]; +extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[]; +extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[]; extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[]; // ExtUnoWrapper: diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx index 8d83b3a953d9..15d20a557396 100644 --- a/toolkit/source/controls/tksimpleanimation.cxx +++ b/toolkit/source/controls/tksimpleanimation.cxx @@ -112,8 +112,9 @@ namespace toolkit throw( uno::RuntimeException ) { uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() ); - aServices.realloc( aServices.getLength() + 1 ); - aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel ); + aServices.realloc( aServices.getLength() + 2 ); + aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel ); + aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel ); return aServices; } diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx index 153a19bf38c9..bea8f90a8b17 100644 --- a/toolkit/source/controls/tkthrobber.cxx +++ b/toolkit/source/controls/tkthrobber.cxx @@ -103,8 +103,9 @@ namespace toolkit throw( uno::RuntimeException ) { uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() ); - aServices.realloc( aServices.getLength() + 1 ); - aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel ); + aServices.realloc( aServices.getLength() + 2 ); + aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel ); + aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel ); return aServices; } @@ -154,8 +155,9 @@ namespace toolkit throw( uno::RuntimeException ) { uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() ); - aServices.realloc( aServices.getLength() + 1 ); - aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ); + aServices.realloc( aServices.getLength() + 2 ); + aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ); + aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControl ); return aServices; } diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index d9264f22cb51..d66ff3dd3610 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -281,10 +281,10 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, registerServices( xRegistryKey, "TreeControl", szServiceName_TreeControl ); registerServices( xRegistryKey, "TreeControlModel", szServiceName_TreeControlModel ); registerServices( xRegistryKey, "MutableTreeDataModel", szServiceName_MutableTreeDataModel ); - registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel ); - registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl ); - registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel ); - registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl ); + registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel ); + registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl ); + registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel ); + registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl ); registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink ); registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel ); @@ -363,10 +363,10 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL ) CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL ) CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL ) - CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, NULL ) - CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, NULL ) - CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, NULL ) - CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL ) + CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel ) + CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl ) + CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel ) + CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl ) CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL ) CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL ) diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx index 903f18f95eae..f05540334e7e 100644 --- a/toolkit/source/helper/servicenames.cxx +++ b/toolkit/source/helper/servicenames.cxx @@ -95,10 +95,10 @@ const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl"; const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel"; const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel"; -const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel"; -const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl"; -const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel"; -const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl"; +const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel"; +const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation"; +const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel"; +const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber"; const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink"; const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel"; -- cgit From 1837a267a2cf82b0152631e416d8be66c2adef25 Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 16 Oct 2009 00:43:16 +0200 Subject: #i105937# Much improved gradient support for canvas/basegfx/drawinglayer. See http://blog.thebehrens.net/2009/07/28/hackweek-iv-canvas-convwatch/ for more background information --- basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx | 6 + basegfx/inc/basegfx/numeric/ftools.hxx | 2 +- basegfx/inc/basegfx/tools/gradienttools.hxx | 18 +- basegfx/inc/basegfx/tools/keystoplerp.hxx | 100 ++++++ basegfx/inc/basegfx/tools/lerp.hxx | 60 ++++ basegfx/prj/d.lst | 2 + basegfx/source/matrix/b2dhommatrixtools.cxx | 28 ++ basegfx/source/tools/gradienttools.cxx | 81 +++-- basegfx/source/tools/keystoplerp.cxx | 104 +++++++ basegfx/source/tools/makefile.mk | 1 + basegfx/test/basegfxtools.cxx | 119 ++++++++ basegfx/test/makefile.mk | 1 + canvas/inc/canvas/base/graphicdevicebase.hxx | 82 +---- canvas/inc/canvas/canvastools.hxx | 22 -- canvas/inc/canvas/parametricpolypolygon.hxx | 40 +-- canvas/source/cairo/cairo_canvas.hxx | 3 +- canvas/source/cairo/cairo_canvashelper.cxx | 268 ++++++++++------ canvas/source/cairo/cairo_spritecanvas.hxx | 3 +- canvas/source/null/null_spritecanvas.hxx | 4 +- canvas/source/tools/parametricpolypolygon.cxx | 114 +++++-- canvas/source/vcl/canvas.hxx | 3 +- canvas/source/vcl/canvashelper_texturefill.cxx | 286 +++++++----------- canvas/source/vcl/spritecanvas.hxx | 3 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 369 ++++++++--------------- 24 files changed, 1032 insertions(+), 687 deletions(-) create mode 100644 basegfx/inc/basegfx/tools/keystoplerp.hxx create mode 100644 basegfx/inc/basegfx/tools/lerp.hxx create mode 100644 basegfx/source/tools/keystoplerp.cxx create mode 100644 basegfx/test/basegfxtools.cxx diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx index 0b200b812bed..54d961d40ac2 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx @@ -36,6 +36,8 @@ #include #include +namespace rtl { class OUString; } + /////////////////////////////////////////////////////////////////////////////// namespace basegfx @@ -79,6 +81,10 @@ namespace basegfx double getRotate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfRotate; } double getShearX() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfShearX; } }; + + /// Returns a string with svg's "matrix(m00,m10,m01,m11,m02,m12)" representation + ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix ); + } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx index 5003ede0c4cf..6cecbecc1f9f 100644 --- a/basegfx/inc/basegfx/numeric/ftools.hxx +++ b/basegfx/inc/basegfx/numeric/ftools.hxx @@ -112,7 +112,7 @@ namespace basegfx /** clamp given value against given minimum and maximum values */ - template const T& clamp(const T& value, const T& minimum, const T& maximum) + template inline const T& clamp(const T& value, const T& minimum, const T& maximum) { if(value < minimum) { diff --git a/basegfx/inc/basegfx/tools/gradienttools.hxx b/basegfx/inc/basegfx/tools/gradienttools.hxx index 0c7f2ab2c060..dbcc5a3221f0 100644 --- a/basegfx/inc/basegfx/tools/gradienttools.hxx +++ b/basegfx/inc/basegfx/tools/gradienttools.hxx @@ -37,6 +37,9 @@ #include #include +#include +#include + namespace basegfx { /** Gradient definition as used in ODF 1.2 @@ -78,6 +81,8 @@ namespace basegfx { /** Create matrix for ODF's linear gradient definition + Note that odf linear gradients are varying in y direction. + @param o_rGradientInfo Receives the calculated texture transformation matrix (for use with standard [0,1]x[0,1] texture coordinates) @@ -109,7 +114,7 @@ namespace basegfx @param rUV Current uv coordinate. Values outside [0,1] will be - clamped. + clamped. Assumes gradient color varies along the y axis. @param rGradInfo Gradient info, for transformation and number of steps @@ -129,6 +134,14 @@ namespace basegfx /** Create matrix for ODF's axial gradient definition + Note that odf axial gradients are varying in y + direction. Note further that you can map the axial + gradient to a linear gradient (in case you want or need to + avoid an extra gradient renderer), by using + createLinearODFGradientInfo() instead, shifting the + resulting texture transformation by 0.5 to the top and + appending the same stop colors again, but mirrored. + @param o_rGradientInfo Receives the calculated texture transformation matrix (for use with standard [0,1]x[0,1] texture coordinates) @@ -160,7 +173,7 @@ namespace basegfx @param rUV Current uv coordinate. Values outside [0,1] will be - clamped. + clamped. Assumes gradient color varies along the y axis. @param rGradInfo Gradient info, for transformation and number of steps @@ -394,7 +407,6 @@ namespace basegfx { return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs } - } } diff --git a/basegfx/inc/basegfx/tools/keystoplerp.hxx b/basegfx/inc/basegfx/tools/keystoplerp.hxx new file mode 100644 index 000000000000..a54b3485b1a1 --- /dev/null +++ b/basegfx/inc/basegfx/tools/keystoplerp.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: canvastools.hxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _BGFX_TOOLS_KEYSTOPLERP_HXX +#define _BGFX_TOOLS_KEYSTOPLERP_HXX + +#include +#include + +namespace com{ namespace sun{ namespace star{ namespace uno { + template class Sequence; +}}}} + +namespace basegfx +{ + namespace tools + { + /** Lerp in a vector of key stops + + This class holds a key stop vector and provides the + functionality to lerp inside it. Useful e.g. for + multi-stop gradients, or the SMIL key time activity. + + For those, given a global [0,1] lerp alpha, one need to + find the suitable bucket index from key stop vector, and + then calculate the relative alpha between the two buckets + found. + */ + class KeyStopLerp + { + public: + typedef std::pair ResultType; + + /** Create lerper with given vector of stops + + @param rKeyStops + + Vector of stops, must contain at least two elements + (though preferrably more, otherwise you probably don't + need key stop lerping in the first place). All + elements must be of monotonically increasing value. + */ + explicit KeyStopLerp( const std::vector& rKeyStops ); + + /** Create lerper with given sequence of stops + + @param rKeyStops + + Sequence of stops, must contain at least two elements + (though preferrably more, otherwise you probably don't + need key stop lerping in the first place). All + elements must be of monotonically increasing value. + */ + explicit KeyStopLerp( const ::com::sun::star::uno::Sequence& rKeyStops ); + + /** Find two nearest bucket index & interpolate + + @param fAlpha + Find bucket index i, with keyStops[i] < fAlpha <= + keyStops[i+1]. Return new alpha value in [0,1), + proportional to fAlpha's position between keyStops[i] + and keyStops[i+1] + */ + ResultType lerp(double fAlpha) const; + + private: + std::vector maKeyStops; + mutable std::ptrdiff_t mnLastIndex; + }; + } +} + +#endif diff --git a/basegfx/inc/basegfx/tools/lerp.hxx b/basegfx/inc/basegfx/tools/lerp.hxx new file mode 100644 index 000000000000..590ef34c2009 --- /dev/null +++ b/basegfx/inc/basegfx/tools/lerp.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: lerp.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _BGFX_TOOLS_LERP_HXX +#define _BGFX_TOOLS_LERP_HXX + +#include + +namespace basegfx +{ + namespace tools + { + /** Generic linear interpolator + + @tpl ValueType + Must have operator+ and operator* defined, and should + have value semantics. + + @param t + As usual, t must be in the [0,1] range + */ + template< typename ValueType > ValueType lerp( const ValueType& rFrom, + const ValueType& rTo, + double t ) + { + // This is only to suppress a double->int warning. All other + // types should be okay here. + return static_cast( (1.0-t)*rFrom + t*rTo ); + } + } +} + +#endif /* _BGFX_TOOLS_LERP_HXX */ diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index a58cd33e4f9c..170796920945 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -89,6 +89,8 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tuple mkdir: %_DEST%\inc%_EXT%\basegfx\tools ..\inc\basegfx\tools\canvastools.hxx %_DEST%\inc%_EXT%\basegfx\tools\canvastools.hxx +..\inc\basegfx\tools\keystoplerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\keystoplerp.hxx +..\inc\basegfx\tools\lerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\lerp.hxx ..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx ..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx ..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 59a1ff432fc7..366a08a1d202 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -33,11 +33,39 @@ #include "precompiled_basegfx.hxx" #include +#include +#include /////////////////////////////////////////////////////////////////////////////// namespace basegfx { + ::rtl::OUString exportToSvg( const B2DHomMatrix& rMatrix ) + { + rtl::OUStringBuffer aStrBuf; + aStrBuf.appendAscii("matrix("); + + aStrBuf.append(rMatrix.get(0,0)); + aStrBuf.appendAscii(", "); + + aStrBuf.append(rMatrix.get(1,0)); + aStrBuf.appendAscii(", "); + + aStrBuf.append(rMatrix.get(0,1)); + aStrBuf.appendAscii(", "); + + aStrBuf.append(rMatrix.get(1,1)); + aStrBuf.appendAscii(", "); + + aStrBuf.append(rMatrix.get(0,2)); + aStrBuf.appendAscii(", "); + + aStrBuf.append(rMatrix.get(1,2)); + aStrBuf.appendAscii(")"); + + return aStrBuf.makeStringAndClear(); + } + } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 9e78039cd590..337f9bd8e52b 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -52,6 +52,8 @@ namespace basegfx o_rGradientInfo.maBackTextureTransform.identity(); o_rGradientInfo.mnSteps = nSteps; + fAngle = -fAngle; + double fTargetSizeX(rTargetRange.getWidth()); double fTargetSizeY(rTargetRange.getHeight()); double fTargetOffsetX(rTargetRange.getMinX()); @@ -70,7 +72,23 @@ namespace basegfx fTargetSizeY = fNewY; } - // add object scale before rotate + double fSizeWithoutBorder=0; + double fTranslateY=0; + if( bAxial ) + { + fSizeWithoutBorder = (1.0 - fBorder) * 0.5; + fTranslateY = 0.5; + } + else + { + fSizeWithoutBorder = 1.0 - fBorder; + fTranslateY = fBorder; + } + + if(!fTools::equal(fSizeWithoutBorder, 0.0)) + o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder); + + o_rGradientInfo.maTextureTransform.translate(0.0, fTranslateY); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); // add texture rotate after scale to keep perpendicular angles @@ -90,24 +108,9 @@ namespace basegfx // prepare aspect for texture o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform + // build transform from u,v to [0.0 .. 1.0]. o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; o_rGradientInfo.maBackTextureTransform.invert(); - - double fSizeWithoutBorder=0; - if( bAxial ) - { - fSizeWithoutBorder = (1.0 - fBorder) * 0.5; - o_rGradientInfo.maBackTextureTransform.translate(0.0, -0.5); - } - else - { - fSizeWithoutBorder = 1.0 - fBorder; - o_rGradientInfo.maBackTextureTransform.translate(0.0, -fBorder); - } - - if(!fTools::equal(fSizeWithoutBorder, 0.0)) - o_rGradientInfo.maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder); } /** Most of the setup for radial & ellipsoidal gradient is the same, @@ -125,6 +128,8 @@ namespace basegfx o_rGradientInfo.maBackTextureTransform.identity(); o_rGradientInfo.mnSteps = nSteps; + fAngle = -fAngle; + double fTargetSizeX(rTargetRange.getWidth()); double fTargetSizeY(rTargetRange.getHeight()); double fTargetOffsetX(rTargetRange.getMinX()); @@ -147,7 +152,11 @@ namespace basegfx fTargetSizeY = 1.4142 * fTargetSizeY; } - // add object scale before rotate + const double fHalfBorder((1.0 - fBorder) * 0.5); + if(!fTools::equal(fHalfBorder, 0.0)) + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + + o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); if( !bCircular ) @@ -155,9 +164,8 @@ namespace basegfx // add texture rotate after scale to keep perpendicular angles if(0.0 != fAngle) { - B2DPoint aCenter(0.5, 0.5); - aCenter *= o_rGradientInfo.maTextureTransform; - + const B2DPoint aCenter(0.5*fTargetSizeX, + 0.5*fTargetSizeY); o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); o_rGradientInfo.maTextureTransform.rotate(fAngle); o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); @@ -178,17 +186,9 @@ namespace basegfx // prepare aspect for texture o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; - // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform + // build transform from u,v to [0.0 .. 1.0]. o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; o_rGradientInfo.maBackTextureTransform.invert(); - o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - fBorder) * 0.5); - - if(!fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor); - } } /** Setup for rect & square gradient is exactly the same. Factored out @@ -205,6 +205,8 @@ namespace basegfx o_rGradientInfo.maBackTextureTransform.identity(); o_rGradientInfo.mnSteps = nSteps; + fAngle = -fAngle; + double fTargetSizeX(rTargetRange.getWidth()); double fTargetSizeY(rTargetRange.getHeight()); double fTargetOffsetX(rTargetRange.getMinX()); @@ -223,15 +225,18 @@ namespace basegfx fTargetSizeY = fNewY; } - // add object scale before rotate + const double fHalfBorder((1.0 - fBorder) * 0.5); + if(!fTools::equal(fHalfBorder, 0.0)) + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + + o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); // add texture rotate after scale to keep perpendicular angles if(0.0 != fAngle) { - B2DPoint aCenter(0.5, 0.5); - aCenter *= o_rGradientInfo.maTextureTransform; - + const B2DPoint aCenter(0.5*fTargetSizeX, + 0.5*fTargetSizeY); o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); o_rGradientInfo.maTextureTransform.rotate(fAngle); o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); @@ -254,14 +259,6 @@ namespace basegfx // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; o_rGradientInfo.maBackTextureTransform.invert(); - o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5); - const double fHalfBorder((1.0 - fBorder) * 0.5); - - if(!fTools::equal(fHalfBorder, 0.0)) - { - const double fFactor(1.0 / fHalfBorder); - o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor); - } } namespace tools diff --git a/basegfx/source/tools/keystoplerp.cxx b/basegfx/source/tools/keystoplerp.cxx new file mode 100644 index 000000000000..99c74a350a69 --- /dev/null +++ b/basegfx/source/tools/keystoplerp.cxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: canvastools.hxx,v $ + * $Revision: 1.10 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include "basegfx/tools/keystoplerp.hxx" +#include + +#include + +static void validateInput(const std::vector& rKeyStops) +{ + (void)rKeyStops; +#ifdef DBG_UTIL + OSL_ENSURE( rKeyStops.size() > 1, + "KeyStopLerp::KeyStopLerp(): key stop vector must have two entries or more" ); + + // rKeyStops must be sorted in ascending order + for( ::std::size_t i=1, len=rKeyStops.size(); i rKeyStops[i] ) + OSL_ENSURE( false, + "KeyStopLerp::KeyStopLerp(): time vector is not sorted in ascending order!" ); + } +#endif +} + +namespace basegfx +{ + namespace tools + { + KeyStopLerp::KeyStopLerp( const std::vector& rKeyStops ) : + maKeyStops(rKeyStops), + mnLastIndex(0) + { + validateInput(maKeyStops); + } + + KeyStopLerp::KeyStopLerp( const ::com::sun::star::uno::Sequence& rKeyStops ) : + maKeyStops(rKeyStops.getLength()), + mnLastIndex(0) + { + std::copy( rKeyStops.getConstArray(), + rKeyStops.getConstArray()+rKeyStops.getLength(), + maKeyStops.begin() ); + validateInput(maKeyStops); + } + + KeyStopLerp::ResultType KeyStopLerp::lerp(double fAlpha) const + { + // cached value still okay? + if( maKeyStops.at(mnLastIndex) < fAlpha || + maKeyStops.at(mnLastIndex+1) >= fAlpha ) + { + // nope, find new index + mnLastIndex = std::min( + maKeyStops.size()-2, + // range is ensured by max below + std::max( + 0, + std::distance( maKeyStops.begin(), + std::lower_bound( maKeyStops.begin(), + maKeyStops.end(), + fAlpha )) - 1 )); + } + + // lerp between stop and stop+1 + const double fRawLerp= + (fAlpha-maKeyStops.at(mnLastIndex)) / + (maKeyStops.at(mnLastIndex+1) - maKeyStops.at(mnLastIndex)); + + // clamp to permissible range (input fAlpha might be + // everything) + return ResultType( + mnLastIndex, + clamp(fRawLerp,0.0,1.0)); + } + } +} diff --git a/basegfx/source/tools/makefile.mk b/basegfx/source/tools/makefile.mk index 1bede8b22d88..d55bbae12f8f 100755 --- a/basegfx/source/tools/makefile.mk +++ b/basegfx/source/tools/makefile.mk @@ -44,6 +44,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= $(SLO)$/canvastools.obj \ $(SLO)$/gradienttools.obj \ $(SLO)$/debugplotter.obj \ + $(SLO)$/keystoplerp.obj \ $(SLO)$/liangbarsky.obj \ $(SLO)$/tools.obj \ $(SLO)$/unopolypolygon.obj diff --git a/basegfx/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx new file mode 100644 index 000000000000..6ace65c5894d --- /dev/null +++ b/basegfx/test/basegfxtools.cxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: basegfx2d.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +// autogenerated file with codegen.pl + +#include + +#include +#include + +#include + +using namespace ::basegfx; +using namespace ::boost::tuples; + +namespace basegfxtools +{ + +class KeyStopLerpTest : public CppUnit::TestFixture +{ + tools::KeyStopLerp maKeyStops; + + static std::vector getTestVector() + { + std::vector aStops(3); + aStops[0] = 0.1; + aStops[1] = 0.5; + aStops[2] = 0.9; + return aStops; + } + +public: + KeyStopLerpTest() : + maKeyStops(getTestVector()) + {} + + void setUp() + {} + + void tearDown() + {} + + void test() + { + double fAlpha; + std::ptrdiff_t nIndex; + + tie(nIndex,fAlpha) = maKeyStops.lerp(-1.0); + CPPUNIT_ASSERT_MESSAGE("-1.0", nIndex==0 && fAlpha==0.0); + + tie(nIndex,fAlpha) = maKeyStops.lerp(0.1); + CPPUNIT_ASSERT_MESSAGE("0.1", nIndex==0 && fAlpha==0.0); + + tie(nIndex,fAlpha) = maKeyStops.lerp(0.3); + CPPUNIT_ASSERT_MESSAGE("0.3", nIndex==0 && fTools::equal(fAlpha,0.5)); + + tie(nIndex,fAlpha) = maKeyStops.lerp(0.5); + CPPUNIT_ASSERT_MESSAGE("0.5", nIndex==0 && fTools::equal(fAlpha,1.0)); + + tie(nIndex,fAlpha) = maKeyStops.lerp(0.51); + CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,0.025)); + + tie(nIndex,fAlpha) = maKeyStops.lerp(0.9); + CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fTools::equal(fAlpha,1.0)); + + tie(nIndex,fAlpha) = maKeyStops.lerp(1.0); + CPPUNIT_ASSERT_MESSAGE("0.51", nIndex==1 && fAlpha==1.0); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(KeyStopLerpTest); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); +}; + +// ----------------------------------------------------------------------------- +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfxtools::KeyStopLerpTest, "basegfxtools"); +} // namespace basegfxtools + + +// ----------------------------------------------------------------------------- + +// this macro creates an empty function, which will called by the RegisterAllFunctions() +// to let the user the possibility to also register some functions by hand. +// NOADDITIONAL; + diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 1bd4d59b98d5..bc44daffd27c 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -46,6 +46,7 @@ SHL1OBJS= \ $(SLO)$/basegfx1d.obj \ $(SLO)$/basegfx2d.obj \ $(SLO)$/basegfx3d.obj \ + $(SLO)$/basegfxtools.obj \ $(SLO)$/testtools.obj # linking statically against basegfx parts diff --git a/canvas/inc/canvas/base/graphicdevicebase.hxx b/canvas/inc/canvas/base/graphicdevicebase.hxx index d0cd621f65a2..1105fea55eab 100644 --- a/canvas/inc/canvas/base/graphicdevicebase.hxx +++ b/canvas/inc/canvas/base/graphicdevicebase.hxx @@ -33,11 +33,11 @@ #include #include +#include #include #include #include #include -#include #include #include @@ -50,8 +50,7 @@ namespace canvas /** Helper template base class for XGraphicDevice implementations. This base class provides partial implementations of the - XGraphicDevice-related interface, such as - XParametricPolyPolygon2DFactory and XColorSpace. + XGraphicDevice-related interface, such as XColorSpace. This template basically interposes itself between the full interface you implement (i.e. not restricted to XGraphicDevice @@ -249,7 +248,7 @@ namespace canvas return maDeviceHelper.createVolatileAlphaBitmap( this, size ); } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2DFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException) { return this; } @@ -268,79 +267,26 @@ namespace canvas return maDeviceHelper.enterFullScreenMode( bEnter ); } - // XParametricPolyPolygon2DFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) + // XMultiServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::createLinearHorizontalGradient( this, - colors, - stops ) ); + ParametricPolyPolygon::create(this, + aServiceSpecifier, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >())); } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) { return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::createAxialHorizontalGradient( this, - colors, - stops ) ); + ParametricPolyPolygon::create(this, + aServiceSpecifier, + Arguments)); } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException) { - return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::createEllipticalGradient( this, - colors, - stops, - boundRect ) ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( - ParametricPolyPolygon::createRectangularGradient( this, - colors, - stops, - boundRect ) ); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createVerticalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftColor*/, - const ::com::sun::star::uno::Sequence< double >& /*rightColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - // TODO(F1): hatch factory NYI - return ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XParametricPolyPolygon2D >(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createOrthogonalLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*leftTopColor*/, - const ::com::sun::star::uno::Sequence< double >& /*rightBottomColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - // TODO(F1): hatch factory NYI - return ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XParametricPolyPolygon2D >(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createThreeCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/, - const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - // TODO(F1): hatch factory NYI - return ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XParametricPolyPolygon2D >(); - } - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createFourCrossingLinesHatch( const ::com::sun::star::uno::Sequence< double >& /*startColor*/, - const ::com::sun::star::uno::Sequence< double >& /*endColor*/ ) throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - // TODO(F1): hatch factory NYI - return ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XParametricPolyPolygon2D >(); + return ParametricPolyPolygon::getAvailableServiceNames(); } diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx index 3942ab2726ef..345bcd9187ae 100644 --- a/canvas/inc/canvas/canvastools.hxx +++ b/canvas/inc/canvas/canvastools.hxx @@ -417,28 +417,6 @@ namespace canvas */ ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange ); - /** This method clamps the given value to the specified range - - @param val - The value to clamp - - @param minVal - The minimal value val is allowed to attain - - @param maxVal - The maximal value val is allowed to attain - - @return the clamped value - */ - template< typename T > T clamp( T val, - T minVal, - T maxVal ) - { - return ::std::max( minVal, - ::std::min( maxVal, - val ) ); - } - /** Retrieve various internal properties of the actual canvas implementation. This method retrieves a bunch of internal, implementation- diff --git a/canvas/inc/canvas/parametricpolypolygon.hxx b/canvas/inc/canvas/parametricpolypolygon.hxx index 9d0883192094..b93f1c27a682 100644 --- a/canvas/inc/canvas/parametricpolypolygon.hxx +++ b/canvas/inc/canvas/parametricpolypolygon.hxx @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -62,7 +62,6 @@ namespace canvas enum GradientType { GRADIENT_LINEAR, - GRADIENT_AXIAL, GRADIENT_ELLIPTICAL, GRADIENT_RECTANGULAR }; @@ -103,24 +102,11 @@ namespace canvas const GradientType meType; }; - static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops ); - static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops ); - static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops, - const ::com::sun::star::geometry::RealRectangle2D& boundRect ); - static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, - const ::com::sun::star::uno::Sequence< double >& stops, - const ::com::sun::star::geometry::RealRectangle2D& boundRect ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getAvailableServiceNames(); + static ParametricPolyPolygon* create( + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::rtl::OUString& rServiceName, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs ); /// Dispose all internal references virtual void SAL_CALL disposing(); @@ -143,6 +129,20 @@ namespace canvas ~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves. private: + static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, + const ::com::sun::star::uno::Sequence< double >& stops ); + static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, + const ::com::sun::star::uno::Sequence< double >& stops, + double fAspect ); + static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference< + ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, + const ::com::sun::star::uno::Sequence< double >& stops, + double fAspect ); /// Private, because objects can only be created from the static factories ParametricPolyPolygon( const ::com::sun::star::uno::Reference< diff --git a/canvas/source/cairo/cairo_canvas.hxx b/canvas/source/cairo/cairo_canvas.hxx index de2b9f8693a1..8fa56b5f4187 100644 --- a/canvas/source/cairo/cairo_canvas.hxx +++ b/canvas/source/cairo/cairo_canvas.hxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -68,7 +67,7 @@ namespace cairocanvas typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base; diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 9cf2dd978759..942e5edb06a6 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -56,6 +56,8 @@ #include #include #include +#include +#include #include #include @@ -73,6 +75,7 @@ #include "cairo_canvashelper.hxx" #include "cairo_canvasbitmap.hxx" +#include #include using namespace ::cairo; @@ -122,9 +125,29 @@ namespace cairocanvas mpCairo = pSurface->getCairo(); } + static void setColor( Cairo* pCairo, + const uno::Sequence& rColor ) + { + if( rColor.getLength() > 3 ) + { + const double alpha = rColor[3]; + + cairo_set_source_rgba( pCairo, + alpha*rColor[0], + alpha*rColor[1], + alpha*rColor[2], + alpha ); + } + else if( rColor.getLength() == 3 ) + cairo_set_source_rgb( pCairo, + rColor[0], + rColor[1], + rColor[2] ); + } + void CanvasHelper::useStates( const rendering::ViewState& viewState, const rendering::RenderState& renderState, - bool setColor ) + bool bSetColor ) { Matrix aViewMatrix; Matrix aRenderMatrix; @@ -158,19 +181,8 @@ namespace cairocanvas OSL_TRACE ("render clip END"); } - if( setColor ) { - if( renderState.DeviceColor.getLength() > 3 ) - cairo_set_source_rgba( mpCairo.get(), - renderState.DeviceColor [0], - renderState.DeviceColor [1], - renderState.DeviceColor [2], - renderState.DeviceColor [3] ); - else if (renderState.DeviceColor.getLength() == 3) - cairo_set_source_rgb( mpCairo.get(), - renderState.DeviceColor [0], - renderState.DeviceColor [1], - renderState.DeviceColor [2] ); - } + if( bSetColor ) + setColor(mpCairo.get(),renderState.DeviceColor); cairo_operator_t compositingMode( CAIRO_OPERATOR_OVER ); switch( renderState.CompositeOperation ) @@ -665,11 +677,33 @@ namespace cairocanvas double alpha = rColor[3]; // cairo expects premultiplied alpha cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0]*alpha, rColor[1]*alpha, rColor[2]*alpha, alpha ); - //cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0], rColor[1], rColor[2], alpha ); } } } + static uno::Sequence lerp(const uno::Sequence& rLeft, const uno::Sequence& rRight, double fAlpha) + { + if( rLeft.getLength() == 3 ) + { + uno::Sequence aRes(3); + aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha); + aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha); + aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha); + return aRes; + } + else if( rLeft.getLength() == 4 ) + { + uno::Sequence aRes(4); + aRes[0] = basegfx::tools::lerp(rLeft[0],rRight[0],fAlpha); + aRes[1] = basegfx::tools::lerp(rLeft[1],rRight[1],fAlpha); + aRes[2] = basegfx::tools::lerp(rLeft[2],rRight[2],fAlpha); + aRes[3] = basegfx::tools::lerp(rLeft[3],rRight[3],fAlpha); + return aRes; + } + + return uno::Sequence(); + } + static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon ) { Pattern* pPattern = NULL; @@ -678,7 +712,6 @@ namespace cairocanvas // undef macros from vclenum.hxx which conflicts with GradientType enum values #undef GRADIENT_LINEAR -#undef GRADIENT_AXIAL #undef GRADIENT_ELLIPTICAL switch( aValues.meType ) { @@ -691,26 +724,17 @@ namespace cairocanvas addColorStops( pPattern, aValues.maColors, aValues.maStops ); break; - // FIXME: NYI - case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR: - case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL: - x0 = 0; - y0 = 0; - x1 = 1; - y1 = 0; - pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 ); - addColorStops( pPattern, aValues.maColors, aValues.maStops ); - break; - case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL: - cx = 0.5; - cy = 0.5; + cx = 0; + cy = 0; r0 = 0; - r1 = 0.5; + r1 = 1; - pPattern = cairo_pattern_create_radial( cx, cy, r0, cx, cy, r1 ); + pPattern = cairo_pattern_create_radial( cx, cy, r0, cy, cy, r1 ); addColorStops( pPattern, aValues.maColors, aValues.maStops, true ); break; + default: + break; } return pPattern; @@ -719,7 +743,8 @@ namespace cairocanvas static void doOperation( Operation aOperation, Cairo* pCairo, const uno::Sequence< rendering::Texture >* pTextures, - const SurfaceProviderRef& pDevice ) + const SurfaceProviderRef& pDevice, + const basegfx::B2DRange& rBounds ) { switch( aOperation ) { case Fill: @@ -790,19 +815,70 @@ namespace cairocanvas cairo_matrix_init( &aTextureMatrix, aTransform.m00, aTransform.m10, aTransform.m01, aTransform.m11, aTransform.m02, aTransform.m12); - Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl ); + if( pPolyImpl->getValues().meType == canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR ) + { + // no general path gradient yet in cairo; emulate then + cairo_save( pCairo ); + cairo_clip( pCairo ); + + // fill bound rect with start color + cairo_rectangle( pCairo, rBounds.getMinX(), rBounds.getMinY(), + rBounds.getWidth(), rBounds.getHeight() ); + setColor(pCairo,pPolyImpl->getValues().maColors[0]); + cairo_fill(pCairo); + + cairo_transform( pCairo, &aTextureMatrix ); + + // longest line in gradient bound rect + const unsigned int nGradientSize( + static_cast( + ::basegfx::B2DVector(rBounds.getMinimum() - rBounds.getMaximum()).getLength() + 1.0 ) ); + + // typical number for pixel of the same color (strip size) + const unsigned int nStripSize( nGradientSize < 50 ? 2 : 4 ); + + // use at least three steps, and at utmost the number of color + // steps + const unsigned int nStepCount( + ::std::max( + 3U, + ::std::min( + nGradientSize / nStripSize, + 128U )) + 1 ); + + const uno::Sequence* pColors=&pPolyImpl->getValues().maColors[0]; + basegfx::tools::KeyStopLerp aLerper(pPolyImpl->getValues().maStops); + for( unsigned int i=1; i rv = uno::Reference< rendering::XCachedPrimitive >(NULL); - geometry::IntegerSize2D aBitmapSize = rSize; + geometry::IntegerSize2D aBitmapSize = rSize; if( mpCairo ) { cairo_save( mpCairo.get() ); @@ -1198,38 +1274,38 @@ namespace cairocanvas ::rtl::math::approxEqual( aMatrix.y0, 0 ) && basegfx::fround( rSize.Width * aMatrix.xx ) > 8 && basegfx::fround( rSize.Height* aMatrix.yy ) > 8 ) - { - double dWidth, dHeight; - - dWidth = basegfx::fround( rSize.Width * aMatrix.xx ); - dHeight = basegfx::fround( rSize.Height* aMatrix.yy ); - aBitmapSize.Width = static_cast( dWidth ); - aBitmapSize.Height = static_cast( dHeight ); - - SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface( - ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ), - bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR ); - CairoSharedPtr pCairo = pScaledSurface->getCairo(); - - cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE ); - // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders - cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height ); - cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 ); - cairo_paint( pCairo.get() ); - - pSurface = pScaledSurface; - - aMatrix.xx = aMatrix.yy = 1; - cairo_set_matrix( mpCairo.get(), &aMatrix ); - - rv = uno::Reference< rendering::XCachedPrimitive >( - new CachedBitmap( pSurface, viewState, renderState, - // cast away const, need to - // change refcount (as this is - // ~invisible to client code, - // still logically const) - const_cast< rendering::XCanvas* >(pCanvas)) ); - } + { + double dWidth, dHeight; + + dWidth = basegfx::fround( rSize.Width * aMatrix.xx ); + dHeight = basegfx::fround( rSize.Height* aMatrix.yy ); + aBitmapSize.Width = static_cast( dWidth ); + aBitmapSize.Height = static_cast( dHeight ); + + SurfaceSharedPtr pScaledSurface = mpSurfaceProvider->createSurface( + ::basegfx::B2ISize( aBitmapSize.Width, aBitmapSize.Height ), + bHasAlpha ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR ); + CairoSharedPtr pCairo = pScaledSurface->getCairo(); + + cairo_set_operator( pCairo.get(), CAIRO_OPERATOR_SOURCE ); + // add 0.5px to size to avoid rounding errors in cairo, leading sometimes to random data on the image right/bottom borders + cairo_scale( pCairo.get(), (dWidth+0.5)/rSize.Width, (dHeight+0.5)/rSize.Height ); + cairo_set_source_surface( pCairo.get(), pSurface->getCairoSurface().get(), 0, 0 ); + cairo_paint( pCairo.get() ); + + pSurface = pScaledSurface; + + aMatrix.xx = aMatrix.yy = 1; + cairo_set_matrix( mpCairo.get(), &aMatrix ); + + rv = uno::Reference< rendering::XCachedPrimitive >( + new CachedBitmap( pSurface, viewState, renderState, + // cast away const, need to + // change refcount (as this is + // ~invisible to client code, + // still logically const) + const_cast< rendering::XCanvas* >(pCanvas)) ); + } if( !bHasAlpha && mbHaveAlpha ) { @@ -1270,7 +1346,11 @@ namespace cairocanvas cairo_set_operator( mpCairo.get(), CAIRO_OPERATOR_SOURCE ); cairo_rectangle( mpCairo.get(), 0, 0, aBitmapSize.Width, aBitmapSize.Height ); cairo_clip( mpCairo.get() ); - cairo_paint( mpCairo.get() ); + + if( bModulateColors ) + cairo_paint_with_alpha( mpCairo.get(), renderState.DeviceColor[3] ); + else + cairo_paint( mpCairo.get() ); cairo_restore( mpCairo.get() ); } else OSL_TRACE ("CanvasHelper called after it was disposed"); @@ -1309,15 +1389,35 @@ namespace cairocanvas return rv; } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* , - const uno::Reference< rendering::XBitmap >& /*xBitmap*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/ ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas, + const uno::Reference< rendering::XBitmap >& xBitmap, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - // TODO(F3): Implement modulated bitmap! +#ifdef CAIRO_CANVAS_PERF_TRACE + struct timespec aTimer; + mxDevice->startPerfTrace( &aTimer ); +#endif - // TODO(P1): Provide caching here. - return uno::Reference< rendering::XCachedPrimitive >(NULL); + uno::Reference< rendering::XCachedPrimitive > rv; + unsigned char* data = NULL; + bool bHasAlpha = false; + SurfaceSharedPtr pSurface = surfaceFromXBitmap( xBitmap, mpSurfaceProvider, data, bHasAlpha ); + geometry::IntegerSize2D aSize = xBitmap->getSize(); + + if( pSurface ) { + rv = implDrawBitmapSurface( pCanvas, pSurface, viewState, renderState, aSize, true, bHasAlpha ); + + if( data ) + free( data ); + } else + rv = uno::Reference< rendering::XCachedPrimitive >(NULL); + +#ifdef CAIRO_CANVAS_PERF_TRACE + mxDevice->stopPerfTrace( &aTimer, "drawBitmap" ); +#endif + + return rv; } uno::Reference< rendering::XGraphicDevice > CanvasHelper::getDevice() diff --git a/canvas/source/cairo/cairo_spritecanvas.hxx b/canvas/source/cairo/cairo_spritecanvas.hxx index bdbb42c6da12..210908552d73 100644 --- a/canvas/source/cairo/cairo_spritecanvas.hxx +++ b/canvas/source/cairo/cairo_spritecanvas.hxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -66,7 +65,7 @@ namespace cairocanvas typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::rendering::XBufferController, ::com::sun::star::awt::XWindowListener, ::com::sun::star::util::XUpdatable, diff --git a/canvas/source/null/null_spritecanvas.hxx b/canvas/source/null/null_spritecanvas.hxx index 341f2a5a95a6..278bcd9a8e7c 100644 --- a/canvas/source/null/null_spritecanvas.hxx +++ b/canvas/source/null/null_spritecanvas.hxx @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include @@ -60,7 +60,7 @@ namespace nullcanvas typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::rendering::XBufferController, ::com::sun::star::awt::XWindowListener, ::com::sun::star::beans::XPropertySet, diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx index bfce116393d0..222b668a5fb0 100644 --- a/canvas/source/tools/parametricpolypolygon.cxx +++ b/canvas/source/tools/parametricpolypolygon.cxx @@ -53,68 +53,126 @@ using namespace ::com::sun::star; namespace canvas { - ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient( - const uno::Reference< rendering::XGraphicDevice >& rDevice, - const uno::Sequence< uno::Sequence< double > >& colors, - const uno::Sequence< double >& stops ) + uno::Sequence ParametricPolyPolygon::getAvailableServiceNames() { - // TODO(P2): hold gradient brush statically, and only setup - // the colors - return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops ); + uno::Sequence aRet(3); + aRet[0] = rtl::OUString::createFromAscii("LinearGradient"); + aRet[1] = rtl::OUString::createFromAscii("EllipticalGradient"); + aRet[2] = rtl::OUString::createFromAscii("RectangularGradient"); + + return aRet; + } + + ParametricPolyPolygon* ParametricPolyPolygon::create( + const uno::Reference< rendering::XGraphicDevice >& rDevice, + const ::rtl::OUString& rServiceName, + const uno::Sequence< uno::Any >& rArgs ) + { + uno::Sequence< uno::Sequence< double > > colorSequence(2); + uno::Sequence< double > colorStops(2); + double fAspectRatio=1.0; + + // defaults + uno::Sequence< rendering::RGBColor > rgbColors(1); + rgbColors[0] = rendering::RGBColor(0,0,0); + colorSequence[0] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors); + rgbColors[0] = rendering::RGBColor(1,1,1); + colorSequence[1] = rDevice->getDeviceColorSpace()->convertFromRGB(rgbColors); + colorStops[0] = 0; + colorStops[1] = 1; + + // extract args + for( sal_Int32 i=0; i>= aProp) ) + { + if( aProp.Name.equalsAscii("Colors") ) + { + aProp.Value >>= colorSequence; + } + else if( aProp.Name.equalsAscii("Stops") ) + { + aProp.Value >>= colorStops; + } + else if( aProp.Name.equalsAscii("AspectRatio") ) + { + aProp.Value >>= fAspectRatio; + } + } + } + + if( rServiceName.equalsAscii("LinearGradient") ) + { + return createLinearHorizontalGradient(rDevice, colorSequence, colorStops); + } + else if( rServiceName.equalsAscii("EllipticalGradient") ) + { + return createEllipticalGradient(rDevice, colorSequence, colorStops, fAspectRatio); + } + else if( rServiceName.equalsAscii("RectangularGradient") ) + { + return createRectangularGradient(rDevice, colorSequence, colorStops, fAspectRatio); + } + else if( rServiceName.equalsAscii("VerticalLineHatch") ) + { + // TODO: NYI + } + else if( rServiceName.equalsAscii("OrthogonalLinesHatch") ) + { + // TODO: NYI + } + else if( rServiceName.equalsAscii("ThreeCrossingLinesHatch") ) + { + // TODO: NYI + } + else if( rServiceName.equalsAscii("FourCrossingLinesHatch") ) + { + // TODO: NYI + } + + return NULL; } - ParametricPolyPolygon* ParametricPolyPolygon::createAxialHorizontalGradient( + ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice, const uno::Sequence< uno::Sequence< double > >& colors, const uno::Sequence< double >& stops ) { // TODO(P2): hold gradient brush statically, and only setup // the colors - return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, colors, stops ); - } - - namespace - { - double calcAspectRatio( const geometry::RealRectangle2D& rBoundRect ) - { - const double nWidth( rBoundRect.X2 - rBoundRect.X1 ); - const double nHeight( rBoundRect.Y2 - rBoundRect.Y1 ); - - return ::basegfx::fTools::equalZero( nHeight ) ? 1.0 : fabs( nWidth / nHeight ); - } + return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops ); } ParametricPolyPolygon* ParametricPolyPolygon::createEllipticalGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice, const uno::Sequence< uno::Sequence< double > >& colors, const uno::Sequence< double >& stops, - const geometry::RealRectangle2D& boundRect ) + double fAspectRatio ) { // TODO(P2): hold gradient polygon statically, and only setup // the colors return new ParametricPolyPolygon( rDevice, ::basegfx::tools::createPolygonFromCircle( - ::basegfx::B2DPoint( 0.5, 0.5), 0.5 ), + ::basegfx::B2DPoint(0,0), 1 ), GRADIENT_ELLIPTICAL, - colors, stops, - calcAspectRatio( boundRect ) ); + colors, stops, fAspectRatio ); } ParametricPolyPolygon* ParametricPolyPolygon::createRectangularGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice, const uno::Sequence< uno::Sequence< double > >& colors, const uno::Sequence< double >& stops, - const geometry::RealRectangle2D& boundRect ) + double fAspectRatio ) { // TODO(P2): hold gradient polygon statically, and only setup // the colors return new ParametricPolyPolygon( rDevice, ::basegfx::tools::createPolygonFromRect( - ::basegfx::B2DRectangle( 0.0, 0.0, 1.0, 1.0 ) ), + ::basegfx::B2DRectangle( -1, -1, 1, 1 ) ), GRADIENT_RECTANGULAR, - colors, stops, - calcAspectRatio( boundRect ) ); + colors, stops, fAspectRatio ); } void SAL_CALL ParametricPolyPolygon::disposing() diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx index 2279f817a406..c4e1a2853532 100644 --- a/canvas/source/vcl/canvas.hxx +++ b/canvas/source/vcl/canvas.hxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -63,7 +62,7 @@ namespace vclcanvas typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base; diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 571a8c4fc5a3..5219c6349186 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -57,6 +57,8 @@ #include #include #include +#include +#include #include #include @@ -65,6 +67,9 @@ #include #include +#include +#include + #include "spritecanvas.hxx" #include "canvashelper.hxx" #include "impltools.hxx" @@ -118,17 +123,13 @@ namespace vclcanvas Since most of the code for linear and axial gradients are the same, we've a unified method here */ - void fillGeneralLinearGradient( OutputDevice& rOutDev, - const ::basegfx::B2DHomMatrix& rTextureTransform, - const ::Rectangle& rBounds, - int nStepCount, - const ::Color& rColor1, - const ::Color& rColor2, - bool bFillNonOverlapping, - bool bAxialGradient ) + void fillLinearGradient( OutputDevice& rOutDev, + const ::basegfx::B2DHomMatrix& rTextureTransform, + const ::Rectangle& rBounds, + unsigned int nStepCount, + const ::canvas::ParametricPolyPolygon::Values& rValues, + const std::vector< ::Color >& rColors ) { - (void)bFillNonOverlapping; - // determine general position of gradient in relation to // the bound rect // ===================================================== @@ -207,36 +208,26 @@ namespace vclcanvas // iteratively render all other strips // ----------------------------------- - // ensure that nStepCount is odd, to have a well-defined - // middle index for axial gradients. - if( bAxialGradient && !(nStepCount % 2) ) + // ensure that nStepCount matches color stop parity, to + // have a well-defined middle color e.g. for axial + // gradients. + if( (rColors.size() % 2) != (nStepCount % 2) ) ++nStepCount; - const int nStepCountHalved( nStepCount / 2 ); + basegfx::tools::KeyStopLerp aLerper(rValues.maStops); // only iterate nStepCount-1 steps, as the last strip is // explicitely painted below - for( int i=0; i& rColors ) { const ::basegfx::B2DPolygon& rGradientPoly( rValues.maGradientPoly ); @@ -369,9 +319,6 @@ namespace vclcanvas // apply scaling (possibly anisotrophic) to inner polygon // ------------------------------------------------------ - // move center of scaling to origin - aInnerPolygonTransformMatrix.translate( -0.5, -0.5 ); - // scale inner polygon according to aspect ratio: for // wider-than-tall bounds (nAspectRatio > 1.0), the inner // polygon, representing the gradient focus, must have @@ -396,9 +343,6 @@ namespace vclcanvas aInnerPolygonTransformMatrix.scale( 0.0, 0.0 ); } - // move origin back to former center of polygon - aInnerPolygonTransformMatrix.translate( 0.5, 0.5 ); - // and finally, add texture transform to it. aInnerPolygonTransformMatrix *= rTextureTransform; @@ -406,8 +350,8 @@ namespace vclcanvas aInnerPoly.transform( aInnerPolygonTransformMatrix ); - const sal_Int32 nNumPoints( aOuterPoly.count() ); - ::Polygon aTempPoly( static_cast(nNumPoints+1) ); + const sal_uInt32 nNumPoints( aOuterPoly.count() ); + ::Polygon aTempPoly( static_cast(nNumPoints+1) ); // increase number of steps by one: polygonal gradients have // the outermost polygon rendered in rColor2, and the @@ -425,37 +369,42 @@ namespace vclcanvas // color). ++nStepCount; + basegfx::tools::KeyStopLerp aLerper(rValues.maStops); + if( !bFillNonOverlapping ) { // fill background - rOutDev.SetFillColor( rColor1 ); + rOutDev.SetFillColor( rColors.front() ); rOutDev.DrawRect( rBounds ); // render polygon // ============== - for( int i=1,p; i 0 if( i && !(i % 10) ) @@ -506,17 +461,14 @@ namespace vclcanvas // calculate the inner polygon, which is actually the // start of the _next_ color strip. Thus, i+1 - // calc interpolation parameter in [0,1] range - const double nT( (nStepCount-i-1)/double(nStepCount) ); - for( p=0; p& rColors, const ::basegfx::B2DHomMatrix& rTextureTransform, const ::Rectangle& rBounds, - int nStepCount, + unsigned int nStepCount, bool bFillNonOverlapping ) { switch( rValues.meType ) { case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR: fillLinearGradient( rOutDev, - rColor1, - rColor2, rTextureTransform, rBounds, nStepCount, - bFillNonOverlapping ); - break; - - case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL: - fillAxialGradient( rOutDev, - rColor1, - rColor2, - rTextureTransform, - rBounds, - nStepCount, - bFillNonOverlapping ); + rValues, + rColors ); break; case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL: // FALLTHROUGH intended case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR: fillPolygonalGradient( rOutDev, - rValues, - rColor1, - rColor2, rTextureTransform, rBounds, nStepCount, - bFillNonOverlapping ); + bFillNonOverlapping, + rValues, + rColors ); break; default: @@ -597,11 +536,19 @@ namespace vclcanvas } } + int numColorSteps( const ::Color& rColor1, const ::Color& rColor2 ) + { + return ::std::max( + labs( rColor1.GetRed() - rColor2.GetRed() ), + ::std::max( + labs( rColor1.GetGreen() - rColor2.GetGreen() ), + labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ); + } + bool gradientFill( OutputDevice& rOutDev, OutputDevice* p2ndOutDev, const ::canvas::ParametricPolyPolygon::Values& rValues, - const ::Color& rColor1, - const ::Color& rColor2, + const std::vector< ::Color >& rColors, const PolyPolygon& rPoly, const rendering::ViewState& viewState, const rendering::RenderState& renderState, @@ -646,12 +593,9 @@ namespace vclcanvas // calc step size // -------------- - const int nColorSteps( - ::std::max( - labs( rColor1.GetRed() - rColor2.GetRed() ), - ::std::max( - labs( rColor1.GetGreen() - rColor2.GetGreen() ), - labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ) ); + int nColorSteps = 0; + for( size_t i=0; iIntersectClipRegion( aPolygonDeviceRectOrig ); doGradientFill( *p2ndOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -723,8 +665,7 @@ namespace vclcanvas doGradientFill( rOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -737,8 +678,7 @@ namespace vclcanvas p2ndOutDev->SetClipRegion( aPolyClipRegion ); doGradientFill( *p2ndOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -753,8 +693,7 @@ namespace vclcanvas rOutDev.SetRasterOp( ROP_XOR ); doGradientFill( rOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -765,8 +704,7 @@ namespace vclcanvas rOutDev.SetRasterOp( ROP_XOR ); doGradientFill( rOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -779,8 +717,7 @@ namespace vclcanvas p2ndOutDev->SetRasterOp( ROP_XOR ); doGradientFill( *p2ndOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -791,8 +728,7 @@ namespace vclcanvas p2ndOutDev->SetRasterOp( ROP_XOR ); doGradientFill( *p2ndOutDev, rValues, - rColor1, - rColor2, + rColors, aTextureTransform, aPolygonDeviceRectOrig, nStepCount, @@ -855,33 +791,41 @@ namespace vclcanvas ::canvas::ParametricPolyPolygon* pGradient = dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() ); - if( pGradient ) + if( pGradient && pGradient->getValues().maColors.getLength() ) { // copy state from Gradient polypoly locally // (given object might change!) const ::canvas::ParametricPolyPolygon::Values& rValues( pGradient->getValues() ); - // TODO: use all the colors and place them on given positions/stops - const ::Color aColor1( - ::vcl::unotools::stdColorSpaceSequenceToColor( - rValues.maColors [0] ) ); - const ::Color aColor2( - ::vcl::unotools::stdColorSpaceSequenceToColor( - rValues.maColors [rValues.maColors.getLength () - 1] ) ); - - // TODO(E1): Return value - // TODO(F1): FillRule - gradientFill( mpOutDev->getOutDev(), - mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL, - rValues, - aColor1, - aColor2, - aPolyPoly, - viewState, - renderState, - textures[0], - nTransparency ); + if( rValues.maColors.getLength() < 2 ) + { + rendering::RenderState aTempState=renderState; + aTempState.DeviceColor = rValues.maColors[0]; + fillPolyPolygon(pCanvas, xPolyPolygon, viewState, aTempState); + } + else + { + std::vector< ::Color > aColors(rValues.maColors.getLength()); + std::transform(&rValues.maColors[0], + &rValues.maColors[0]+rValues.maColors.getLength(), + aColors.begin(), + boost::bind( + &vcl::unotools::stdColorSpaceSequenceToColor, + _1)); + + // TODO(E1): Return value + // TODO(F1): FillRule + gradientFill( mpOutDev->getOutDev(), + mp2ndOutDev.get() ? &mp2ndOutDev->getOutDev() : (OutputDevice*)NULL, + rValues, + aColors, + aPolyPoly, + viewState, + renderState, + textures[0], + nTransparency ); + } } else { diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx index 545eeeed4577..66762bcb65b7 100644 --- a/canvas/source/vcl/spritecanvas.hxx +++ b/canvas/source/vcl/spritecanvas.hxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -65,7 +64,7 @@ namespace vclcanvas typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::rendering::XBufferController, ::com::sun::star::awt::XWindowListener, ::com::sun::star::util::XUpdatable, diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index c6f9a295b332..daef89bf2905 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -61,6 +60,7 @@ #include #include +#include #include #include #include @@ -590,13 +590,12 @@ namespace cppcanvas // discernible difference should be visible. nSteps > 64 ) { - uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory( + uno::Reference< lang::XMultiServiceFactory> xFactory( rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() ); if( xFactory.is() ) { - ::basegfx::B2DHomMatrix aTextureTransformation; - rendering::Texture aTexture; + rendering::Texture aTexture; aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; @@ -631,242 +630,118 @@ namespace cppcanvas uno::Sequence< uno::Sequence < double > > aColors(2); uno::Sequence< double > aStops(2); - aStops[0] = 0.0; - aStops[1] = 1.0; + if( rGradient.GetStyle() == GRADIENT_AXIAL ) + { + aStops.realloc(3); + aColors.realloc(3); - aColors[0] = aStartColor; - aColors[1] = aEndColor; + aStops[0] = 0.0; + aStops[1] = 0.5; + aStops[2] = 1.0; + aColors[0] = aEndColor; + aColors[1] = aStartColor; + aColors[2] = aEndColor; + } + else + { + aStops[0] = 0.0; + aStops[1] = 1.0; - // Setup texture transformation - // ---------------------------- + aColors[0] = aStartColor; + aColors[1] = aEndColor; + } const ::basegfx::B2DRectangle aBounds( ::basegfx::tools::getRange(aDevicePoly) ); + const ::basegfx::B2DVector aOffset( + rGradient.GetOfsX() / 100.0, + rGradient.GetOfsY() / 100.0); + double fRotation( rGradient.GetAngle() * M_PI / 1800.0 ); + const double fBorder( rGradient.GetBorder() / 100.0 ); - // setup rotation angle. VCL rotates - // counter-clockwise, while canvas transformation - // rotates clockwise - double nRotation( -rGradient.GetAngle() * M_PI / 1800.0 ); + basegfx::B2DHomMatrix aRot90; + aRot90.rotate(M_PI_2); + basegfx::ODFGradientInfo aGradInfo; + rtl::OUString aGradientService; switch( rGradient.GetStyle() ) { case GRADIENT_LINEAR: - // FALLTHROUGH intended + basegfx::tools::createLinearODFGradientInfo(aGradInfo, + aBounds, + nSteps, + fBorder, + fRotation); + // map odf to svg gradient orientation - x + // instead of y direction + aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90; + aGradientService = rtl::OUString::createFromAscii("LinearGradient"); + break; + case GRADIENT_AXIAL: { - // standard orientation for VCL linear - // gradient is vertical, thus, rotate 90 - // degrees - nRotation += M_PI/2.0; - - const double nBorder( - ::basegfx::pruneScaleValue( - (1.0 - rGradient.GetBorder() / 100.0) ) ); - - // shrink texture, to account for border - // (only in x direction, linear gradient - // is constant in y direction, anyway) - aTextureTransformation.scale( nBorder, - 1.0 ); - - // linear gradients don't respect offsets - // (they are implicitely assumed to be - // 50%). linear gradients don't have - // border on both sides, only on the - // startColor side, axial gradients have - // border on both sides. As both gradients - // are invariant in y direction: leave y - // offset alone. - double nOffsetX( rGradient.GetBorder() / 200.0 ); - - // determine type of gradient (and necessary - // transformation matrix, should it be emulated by a - // generic gradient) - switch( rGradient.GetStyle() ) - { - case GRADIENT_LINEAR: - nOffsetX = rGradient.GetBorder() / 100.0; - aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors, - aStops ); - break; - - case GRADIENT_AXIAL: - // vcl considers center color as start color - ::std::swap(aColors[0],aColors[1]); - aTexture.Gradient = xFactory->createAxialHorizontalGradient( aColors, - aStops ); - break; - - default: // other cases can't happen - break; - } - - // apply border offset values - aTextureTransformation.translate( nOffsetX, - 0.0 ); - - // rotate texture according to gradient rotation - aTextureTransformation.translate( -0.5, -0.5 ); - aTextureTransformation.rotate( nRotation ); - - // to let the first strip of a rotated - // gradient start at the _edge_ of the - // bound rect (and not, due to rotation, - // slightly inside), slightly enlarge the - // gradient: - // - // y/2 sin(alpha) + x/2 cos(alpha) - // - // (values to change are not actual - // gradient scales, but original bound - // rect dimensions. Since we still want - // the border setting to apply after that, - // we multiply with that as above for - // nScaleX) - const double nScale( - ::basegfx::pruneScaleValue( - fabs( aBounds.getHeight()*sin(nRotation) ) + - fabs( aBounds.getWidth()*cos(nRotation) ))); - - aTextureTransformation.scale( nScale, nScale ); - - // translate back origin to center of - // primitive - aTextureTransformation.translate( 0.5*aBounds.getWidth(), - 0.5*aBounds.getHeight() ); + basegfx::tools::createLinearODFGradientInfo(aGradInfo, + aBounds, + nSteps, + fBorder, + fRotation); + // map odf to svg gradient orientation - x + // instead of y direction + aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aRot90; + + // map odf axial gradient to 3-stop linear + // gradient - shift left by 0.5 + basegfx::B2DHomMatrix aShift; + aShift.translate(-0.5,0); + aGradInfo.maTextureTransform = aGradInfo.maTextureTransform * aShift; + + aGradientService = rtl::OUString::createFromAscii("LinearGradient"); + break; } - break; case GRADIENT_RADIAL: - // FALLTHROUGH intended - case GRADIENT_ELLIPTICAL: - // FALLTHROUGH intended - case GRADIENT_SQUARE: - // FALLTHROUGH intended - case GRADIENT_RECT: - { - // determine scale factors for the gradient (must - // be scaled up from [0,1]x[0,1] rect to object - // bounds). Will potentially changed in switch - // statement below. - // Respect border value, while doing so, the VCL - // gradient's border will effectively shrink the - // resulting gradient. - double nScaleX( aBounds.getWidth() * (1.0 - rGradient.GetBorder() / 100.0) ); - double nScaleY( aBounds.getHeight()* (1.0 - rGradient.GetBorder() / 100.0) ); - - // determine offset values. Since the border is - // divided half-by-half to both sides of the - // gradient, divide translation offset by an - // additional 2. Also respect offset here, but - // since VCL gradients have their center at [0,0] - // for zero offset, but canvas gradients have - // their top, left edge aligned with the - // primitive, and offset of 50% effectively must - // yield zero shift. Both values will potentially - // be adapted in switch statement below. - double nOffsetX( aBounds.getWidth() * - (2.0 * rGradient.GetOfsX() - 100.0 + rGradient.GetBorder()) / 200.0 ); - double nOffsetY( aBounds.getHeight() * - (2.0 * rGradient.GetOfsY() - 100.0 + rGradient.GetBorder()) / 200.0 ); - - // determine type of gradient (and necessary - // transformation matrix, should it be emulated by a - // generic gradient) - switch( rGradient.GetStyle() ) - { - case GRADIENT_RADIAL: - { - // create isotrophic scaling - if( nScaleX > nScaleY ) - { - nOffsetY -= (nScaleX - nScaleY) * 0.5; - nScaleY = nScaleX; - } - else - { - nOffsetX -= (nScaleY - nScaleX) * 0.5; - nScaleX = nScaleY; - } - - // enlarge gradient to match bound rect diagonal - aTextureTransformation.translate( -0.5, -0.5 ); - const double nScale( hypot(aBounds.getWidth(), aBounds.getHeight()) / nScaleX ); - aTextureTransformation.scale( nScale, nScale ); - aTextureTransformation.translate( 0.5, 0.5 ); - - aTexture.Gradient = xFactory->createEllipticalGradient( aColors, - aStops, - geometry::RealRectangle2D(0.0,0.0, - 1.0,1.0) ); - } - break; - - case GRADIENT_ELLIPTICAL: - { - // enlarge gradient slightly - aTextureTransformation.translate( -0.5, -0.5 ); - const double nSqrt2( sqrt(2.0) ); - aTextureTransformation.scale( nSqrt2,nSqrt2 ); - aTextureTransformation.translate( 0.5, 0.5 ); - - aTexture.Gradient = xFactory->createEllipticalGradient( - aColors, - aStops, - ::basegfx::unotools::rectangle2DFromB2DRectangle( - aBounds )); - } - break; - - case GRADIENT_SQUARE: - // create isotrophic scaling - if( nScaleX > nScaleY ) - { - nOffsetY -= (nScaleX - nScaleY) * 0.5; - nScaleY = nScaleX; - } - else - { - nOffsetX -= (nScaleY - nScaleX) * 0.5; - nScaleX = nScaleY; - } - - aTexture.Gradient = xFactory->createRectangularGradient( aColors, - aStops, - geometry::RealRectangle2D(0.0,0.0, - 1.0,1.0) ); - break; - - case GRADIENT_RECT: - aTexture.Gradient = xFactory->createRectangularGradient( - aColors, - aStops, - ::basegfx::unotools::rectangle2DFromB2DRectangle( - aBounds ) ); - break; - - default: // other cases can't happen - break; - } - - nScaleX = ::basegfx::pruneScaleValue( nScaleX ); - nScaleY = ::basegfx::pruneScaleValue( nScaleY ); + basegfx::tools::createRadialODFGradientInfo(aGradInfo, + aBounds, + aOffset, + nSteps, + fBorder); + aGradientService = rtl::OUString::createFromAscii("EllipticalGradient"); + break; - aTextureTransformation.scale( nScaleX, nScaleY ); + case GRADIENT_ELLIPTICAL: + basegfx::tools::createEllipticalODFGradientInfo(aGradInfo, + aBounds, + aOffset, + nSteps, + fBorder, + fRotation); + aGradientService = rtl::OUString::createFromAscii("EllipticalGradient"); + break; - // rotate texture according to gradient rotation - aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY ); - aTextureTransformation.rotate( nRotation ); - aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY ); + case GRADIENT_SQUARE: + basegfx::tools::createSquareODFGradientInfo(aGradInfo, + aBounds, + aOffset, + nSteps, + fBorder, + fRotation); + aGradientService = rtl::OUString::createFromAscii("RectangularGradient"); + break; - aTextureTransformation.translate( nOffsetX, nOffsetY ); - } - break; + case GRADIENT_RECT: + basegfx::tools::createRectangularODFGradientInfo(aGradInfo, + aBounds, + aOffset, + nSteps, + fBorder, + fRotation); + aGradientService = rtl::OUString::createFromAscii("RectangularGradient"); + break; default: ENSURE_OR_THROW( false, - "ImplRenderer::createGradientAction(): Unexpected gradient type" ); + "ImplRenderer::createGradientAction(): Unexpected gradient type" ); break; } @@ -877,31 +752,49 @@ namespace cppcanvas // gradient will always display at the origin, and // not within the polygon bound (which might be // miles away from the origin). - aTextureTransformation.translate( aBounds.getMinX(), - aBounds.getMinY() ); - + aGradInfo.maTextureTransform.translate( aBounds.getMinX(), + aBounds.getMinY() ); ::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform, - aTextureTransformation ); + aGradInfo.maTextureTransform ); + + uno::Sequence args(3); + beans::PropertyValue aProp; + aProp.Name = rtl::OUString::createFromAscii("Colors"); + aProp.Value <<= aColors; + args[0] <<= aProp; + aProp.Name = rtl::OUString::createFromAscii("Stops"); + aProp.Value <<= aStops; + args[1] <<= aProp; + aProp.Name = rtl::OUString::createFromAscii("AspectRatio"); + aProp.Value <<= aGradInfo.mfAspectRatio; + args[2] <<= aProp; + + aTexture.Gradient.set( + xFactory->createInstanceWithArguments(aGradientService, + args), + uno::UNO_QUERY); + if( aTexture.Gradient.is() ) + { + ActionSharedPtr pPolyAction( + internal::PolyPolyActionFactory::createPolyPolyAction( + aDevicePoly, + rParms.mrCanvas, + getState( rParms.mrStates ), + aTexture ) ); - ActionSharedPtr pPolyAction( - internal::PolyPolyActionFactory::createPolyPolyAction( - aDevicePoly, - rParms.mrCanvas, - getState( rParms.mrStates ), - aTexture ) ); + if( pPolyAction ) + { + maActions.push_back( + MtfAction( + pPolyAction, + rParms.mrCurrActionIndex ) ); - if( pPolyAction ) - { - maActions.push_back( - MtfAction( - pPolyAction, - rParms.mrCurrActionIndex ) ); + rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; + } - rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; + // done, using native gradients + return; } - - // done, using native gradients - return; } } -- cgit From 44dfc8de1a248a4e62c3229adb7acf91f968d66e Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 16 Oct 2009 00:48:23 +0200 Subject: #i105938# Provides simplistic pool memory from a std::vector --- o3tl/inc/o3tl/vector_pool.hxx | 132 ++++++++++++++++++++++++++++++++++++++++++ o3tl/qa/makefile.mk | 1 + o3tl/qa/test-vector_pool.cxx | 73 +++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 o3tl/inc/o3tl/vector_pool.hxx create mode 100644 o3tl/qa/test-vector_pool.cxx diff --git a/o3tl/inc/o3tl/vector_pool.hxx b/o3tl/inc/o3tl/vector_pool.hxx new file mode 100644 index 000000000000..19fc3d6d74c4 --- /dev/null +++ b/o3tl/inc/o3tl/vector_pool.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: lazy_update.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 INCLUDED_O3TL_VECTOR_POOL_HXX +#define INCLUDED_O3TL_VECTOR_POOL_HXX + +#include +#include + +namespace o3tl +{ + namespace detail + { + template class simple_pool_impl : + public Container + { + typedef typename Container::value_type value_type; + std::ptrdiff_t mnFirstFreeIndex; + + public: + simple_pool_impl() : + mnFirstFreeIndex(-1) + {} + + std::ptrdiff_t alloc() + { + return store(ValueType()); + } + + std::ptrdiff_t store(const ValueType& rCopy) + { + if( mnFirstFreeIndex != -1 ) + { + std::ptrdiff_t nIdx=mnFirstFreeIndex; + mnFirstFreeIndex = this->at(mnFirstFreeIndex).nextFree; + this->at(nIdx).value = rCopy; + this->at(nIdx).nextFree = -1; + + return nIdx; + } + else + { + push_back(value_type(rCopy)); + return this->size()-1; + } + } + + void free( std::ptrdiff_t nIdx ) + { + this->at(nIdx).nextFree = mnFirstFreeIndex; + mnFirstFreeIndex = nIdx; + } + + const ValueType& get( std::ptrdiff_t nIdx ) const + { + return this->operator[](nIdx).value; + } + ValueType& get( std::ptrdiff_t nIdx ) + { + return this->operator[](nIdx).value; + } + }; + + template< typename ValueType > struct struct_from_value + { + struct type + { + type() : + value(), + nextFree(-1) + {} + explicit type( const ValueType& val ) : + value(val), + nextFree(-1) + {} + + ValueType value; + std::ptrdiff_t nextFree; + }; + }; + } + + /** Simple vector-based memory pool allocator + + This template can be used to provide simple pooled memory + allocation from a container class that adheres to the stl + random access container concept. Note that alloc/free works + with _indices_ into the container! + + @example +
+vector_pool myPool;
+int nIdx=myPool.alloc();
+myPool[nIdx] = myVal;
+ ... do stuff ...
+myPool.free(nIdx);
+        
+ */ + template struct vector_pool : + public detail::simple_pool_impl::type > > + {}; +} + +#endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */ diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 70fe224cf6a9..135428b07fb9 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -46,6 +46,7 @@ ENABLE_EXCEPTIONS=TRUE SHL1OBJS= \ $(SLO)$/cow_wrapper_clients.obj \ $(SLO)$/test-cow_wrapper.obj \ + $(SLO)$/test-vector_pool.obj \ $(SLO)$/test-heap_ptr.obj \ $(SLO)$/test-range.obj diff --git a/o3tl/qa/test-vector_pool.cxx b/o3tl/qa/test-vector_pool.cxx new file mode 100644 index 000000000000..4cbd1a78f0f6 --- /dev/null +++ b/o3tl/qa/test-vector_pool.cxx @@ -0,0 +1,73 @@ +// autogenerated file with codegen.pl + +#include + +#include + +using namespace ::o3tl; + +class vector_pool_test : public CppUnit::TestFixture +{ +public: + void testPoolBasics() + { + vector_pool aPool; + + std::ptrdiff_t nIdx1 = aPool.alloc(); + std::ptrdiff_t nIdx2 = aPool.alloc(); + std::ptrdiff_t nIdx3 = aPool.alloc(); + + CPPUNIT_ASSERT_MESSAGE("allocator idx order 1", nIdx1 < nIdx2 ); + CPPUNIT_ASSERT_MESSAGE("allocator idx order 2", nIdx2 < nIdx3 ); + + aPool.free(nIdx2); + aPool.free(nIdx3); + + nIdx2 = aPool.alloc(); + nIdx3 = aPool.alloc(); + + CPPUNIT_ASSERT_MESSAGE("allocator idx order 1 after fragmentation", nIdx1 < nIdx3 ); + CPPUNIT_ASSERT_MESSAGE("allocator idx order 2 after fragmentation", nIdx3 < nIdx2 ); + } + + void testPoolValueSemantics() + { + vector_pool aPool; + + std::ptrdiff_t nIdx1 = aPool.store(0); + CPPUNIT_ASSERT_MESSAGE("allocator value semantics 1", aPool.get(nIdx1) == 0 ); + + std::ptrdiff_t nIdx2 = aPool.store(1); + CPPUNIT_ASSERT_MESSAGE("allocator value semantics 2", aPool.get(nIdx2) == 1 ); + + std::ptrdiff_t nIdx3 = aPool.store(2); + CPPUNIT_ASSERT_MESSAGE("allocator value semantics 3", aPool.get(nIdx3) == 2 ); + + aPool.free(nIdx2); + aPool.free(nIdx3); + + nIdx2 = aPool.store(1); + CPPUNIT_ASSERT_MESSAGE("allocator value semantics 2 after fragmentation", aPool.get(nIdx2) == 1 ); + + nIdx3 = aPool.store(2); + CPPUNIT_ASSERT_MESSAGE("allocator value semantics 3 after fragmentation", aPool.get(nIdx3) == 2 ); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(vector_pool_test); + CPPUNIT_TEST(testPoolBasics); + CPPUNIT_TEST(testPoolValueSemantics); + CPPUNIT_TEST_SUITE_END(); +}; + +// ----------------------------------------------------------------------------- +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(vector_pool_test, "vector pool test"); + + +// ----------------------------------------------------------------------------- + +// NOADDITIONAL; + -- cgit From 8454c5ef5057d0d24e52fb9ed10483b598da98b0 Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 16 Oct 2009 00:53:07 +0200 Subject: #i105939# Adds special box clipping support to basegfx --- basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 10 +- basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx | 6 + basegfx/inc/basegfx/range/b2dmultirange.hxx | 117 --- basegfx/inc/basegfx/range/b2dpolyrange.hxx | 139 ++++ basegfx/inc/basegfx/range/b2drangeclipper.hxx | 53 ++ basegfx/qa/mkpolygons.pl | 344 +++++++++ basegfx/source/polygon/b2dpolygon.cxx | 98 ++- basegfx/source/polygon/b2dpolypolygon.cxx | 40 ++ basegfx/source/range/b2dmultirange.cxx | 282 -------- basegfx/source/range/b2dpolyrange.cxx | 371 ++++++++++ basegfx/source/range/b2drangeclipper.cxx | 950 +++++++++++++++++++++++++ basegfx/source/range/makefile.mk | 3 +- basegfx/test/basegfx2d.cxx | 248 +------ basegfx/test/boxclipper.cxx | 426 +++++++++++ basegfx/test/makefile.mk | 4 + 15 files changed, 2454 insertions(+), 637 deletions(-) delete mode 100644 basegfx/inc/basegfx/range/b2dmultirange.hxx create mode 100644 basegfx/inc/basegfx/range/b2dpolyrange.hxx create mode 100644 basegfx/inc/basegfx/range/b2drangeclipper.hxx create mode 100644 basegfx/qa/mkpolygons.pl delete mode 100644 basegfx/source/range/b2dmultirange.cxx create mode 100644 basegfx/source/range/b2dpolyrange.cxx create mode 100644 basegfx/source/range/b2drangeclipper.cxx create mode 100644 basegfx/test/boxclipper.cxx diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index ee12d55d460b..fb33a7d9b1fe 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -83,7 +83,7 @@ namespace basegfx sal_uInt32 count() const; /// Coordinate interface - basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const; + const basegfx::B2DPoint& getB2DPoint(sal_uInt32 nIndex) const; void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue); /// Coordinate insert/append @@ -201,7 +201,7 @@ namespace basegfx @return The outer range of the bezier curve/polygon */ - B2DRange getB2DRange() const; + const B2DRange& getB2DRange() const; /** insert other 2D polygons @@ -261,6 +261,12 @@ namespace basegfx /// apply transformation given in matrix form void transform(const basegfx::B2DHomMatrix& rMatrix); + + // point iterators + const B2DPoint* begin() const; + const B2DPoint* end() const; + B2DPoint* begin(); + B2DPoint* end(); }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx index 9c8724b8ee6d..7b8119c5e43f 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx @@ -128,6 +128,12 @@ namespace basegfx // apply transformation given in matrix form to the polygon void transform(const basegfx::B2DHomMatrix& rMatrix); + + // polygon iterators + const B2DPolygon* begin() const; + const B2DPolygon* end() const; + B2DPolygon* begin(); + B2DPolygon* end(); }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2dmultirange.hxx b/basegfx/inc/basegfx/range/b2dmultirange.hxx deleted file mode 100644 index d3a0259f0d27..000000000000 --- a/basegfx/inc/basegfx/range/b2dmultirange.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: b2dmultirange.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _BGFX_RANGE_B2DMULTIRANGE_HXX -#define _BGFX_RANGE_B2DMULTIRANGE_HXX - -#include -#include - - -namespace basegfx -{ - class B2DTuple; - class B2DRange; - class B2DPolyPolygon; - class ImplB2DMultiRange; - - /** Multiple ranges in one object. - - This class combines multiple ranges in one object, providing a - total, enclosing range for it. - - You can use this class e.g. when updating views containing - rectangular objects. Add each modified object to a - B2DMultiRange, then test each viewable object against - intersection with the multi range. - */ - class B2DMultiRange - { - public: - B2DMultiRange(); - ~B2DMultiRange(); - - /** Create a multi range with exactly one containing range - */ - explicit B2DMultiRange( const B2DRange& rRange ); - - B2DMultiRange( const B2DMultiRange& ); - B2DMultiRange& operator=( const B2DMultiRange& ); - - /** Check whether range is empty. - - @return true, if this object either contains no ranges at - all, or all contained ranges are empty. - */ - bool isEmpty() const; - - /** Reset to empty. - - After this call, the object will not contain any ranges, - and isEmpty() will return true. - */ - void reset(); - - /** Test whether given tuple is inside one or more of the - included ranges. - */ - bool isInside( const B2DTuple& rTuple ) const; - - /** Test whether given range is inside one or more of the - included ranges. - */ - bool isInside( const B2DRange& rRange ) const; - - /** Test whether given range overlaps one or more of the - included ranges. - */ - bool overlaps( const B2DRange& rRange ) const; - - /** Add given range to the number of contained ranges. - */ - void addRange( const B2DRange& rRange ); - - /** Get overall bound rect for all included ranges. - */ - B2DRange getBounds() const; - - /** Request poly-polygon representing the added ranges. - - This method creates a poly-polygon, consisting exactly out - of the contained ranges. - */ - B2DPolyPolygon getPolyPolygon() const; - - private: - o3tl::cow_wrapper< ImplB2DMultiRange > mpImpl; - }; -} - -#endif /* _BGFX_RANGE_B2DMULTIRANGE_HXX */ diff --git a/basegfx/inc/basegfx/range/b2dpolyrange.hxx b/basegfx/inc/basegfx/range/b2dpolyrange.hxx new file mode 100644 index 000000000000..f31f8319b159 --- /dev/null +++ b/basegfx/inc/basegfx/range/b2dpolyrange.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dmultirange.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _BGFX_RANGE_B2DPOLYRANGE_HXX +#define _BGFX_RANGE_B2DPOLYRANGE_HXX + +#include +#include +#include + +namespace basegfx +{ + class B2DTuple; + class B2DRange; + class B2DPolyPolygon; + class ImplB2DPolyRange; + + /** Multiple ranges in one object. + + This class combines multiple ranges in one object, providing a + total, enclosing range for it. + + You can use this class e.g. when updating views containing + rectangular objects. Add each modified object to a + B2DMultiRange, then test each viewable object against + intersection with the multi range. + + Similar in spirit to the poly-polygon vs. polygon relationship. + + Note that comparable to polygons, a poly-range can also + contain 'holes' - this is encoded via polygon orientation at + the poly-polygon, and via explicit flags for the poly-range. + */ + class B2DPolyRange + { + public: + typedef boost::tuple ElementType ; + + B2DPolyRange(); + ~B2DPolyRange(); + + /** Create a multi range with exactly one containing range + */ + explicit B2DPolyRange( const ElementType& rElement ); + B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ); + B2DPolyRange( const B2DPolyRange& ); + B2DPolyRange& operator=( const B2DPolyRange& ); + + /// unshare this poly-range with all internally shared instances + void makeUnique(); + + bool operator==(const B2DPolyRange&) const; + bool operator!=(const B2DPolyRange&) const; + + /// Number of included ranges + sal_uInt32 count() const; + + ElementType getElement(sal_uInt32 nIndex) const; + void setElement(sal_uInt32 nIndex, const ElementType& rElement ); + void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient ); + + // insert/append a single range + void insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount = 1); + void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1); + void appendElement(const ElementType& rElement, sal_uInt32 nCount = 1); + void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1); + + // insert/append multiple ranges + void insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange&); + void appendPolyRange(const B2DPolyRange&); + + void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1); + void clear(); + + // flip range orientations - converts holes to solids, and vice versa + void flip(); + + /** Get overall range + + @return + The union range of all contained ranges + */ + B2DRange getBounds() const; + + /** Test whether given tuple is inside one or more of the + included ranges. Does *not* use overall range, but checks + individually. + */ + bool isInside( const B2DTuple& rTuple ) const; + + /** Test whether given range is inside one or more of the + included ranges. Does *not* use overall range, but checks + individually. + */ + bool isInside( const B2DRange& rRange ) const; + + /** Test whether given range overlaps one or more of the + included ranges. Does *not* use overall range, but checks + individually. + */ + bool overlaps( const B2DRange& rRange ) const; + + /** Request a poly-polygon with solved cross-overs + */ + B2DPolyPolygon solveCrossovers() const; + + private: + o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl; + }; +} + +#endif /* _BGFX_RANGE_B2DPOLYRANGE_HXX */ diff --git a/basegfx/inc/basegfx/range/b2drangeclipper.hxx b/basegfx/inc/basegfx/range/b2drangeclipper.hxx new file mode 100644 index 000000000000..3285ffeaffe1 --- /dev/null +++ b/basegfx/inc/basegfx/range/b2drangeclipper.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dmultirange.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _BGFX_RANGE_B2DRANGECLIPPER_HXX +#define _BGFX_RANGE_B2DRANGECLIPPER_HXX + +#include +#include + +namespace basegfx +{ + namespace tools + { + /** Extract poly-polygon w/o self-intersections from poly-range + + Similar to the solveCrossovers(const B2DPolyPolygon&) + method, this one calculates a self-intersection-free + poly-polygon with the same topology, and encoding + inside/outsidedness via polygon orientation and layering. + */ + B2DPolyPolygon solveCrossovers(const std::vector& rRanges, + const std::vector& rOrientations); + } +} + +#endif /* _BGFX_RANGE_B2DRANGECLIPPER_HXX */ diff --git a/basegfx/qa/mkpolygons.pl b/basegfx/qa/mkpolygons.pl new file mode 100644 index 000000000000..b465a4f845ab --- /dev/null +++ b/basegfx/qa/mkpolygons.pl @@ -0,0 +1,344 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + +# +# 2009 Copyright Novell, Inc. & Sun Microsystems, Inc. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# + +use IO::File; +use Cwd; +use File::Spec; +use File::Spec::Functions; +use File::Temp; +use File::Path; + +$TempDir = ""; + + +# all the XML package generation is a blatant rip from AF's +# write-calc-doc.pl + + +############################################################################### +# Open a file with the given name. +# First it is checked if the temporary directory, in which all files for +# the document are gathered, is already present and create it if it is not. +# Then create the path to the file inside the temporary directory. +# Finally open the file and return a file handle to it. +# +sub open_file +{ + my $filename = pop @_; + + # Create base directory of temporary directory tree if not alreay + # present. + if ($TempDir eq "") + { + $TempDir = File::Temp::tempdir (CLEANUP => 1); + } + + # Create the path to the file. + my $fullname = File::Spec->catfile ($TempDir, $filename); + my ($volume,$directories,$file) = File::Spec->splitpath ($fullname); + mkpath (File::Spec->catpath ($volume,$directories,"")); + + # Open the file and return a file handle to it. + return new IO::File ($fullname, "w"); +} + + +############################################################################### +# Zip the files in the directory tree into the given file. +# +sub zip_dirtree +{ + my $filename = pop @_; + + my $cwd = getcwd; + my $zip_name = $filename; + + # We are about to change the directory. + # Therefore create an absolute pathname for the zip archive. + + # First transfer the drive from $cwd to $zip_name. This is a + # workaround for a bug in file_name_is_absolute which thinks + # the the path \bla is an absolute path under DOS. + my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name); + my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd); + $volume = $volume_cwd if ($volume eq ""); + $zip_name = File::Spec->catpath ($volume,$directories,$file); + + # Add the current working directory to a relative path. + if ( ! file_name_is_absolute ($zip_name)) + { + $zip_name = File::Spec->catfile ($cwd, $zip_name); + + # Try everything to clean up the name. + $zip_name = File::Spec->rel2abs ($filename); + $zip_name = File::Spec->canonpath ($zip_name); + + # Remove .. directories from the middle of the path. + while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//) + { + $zip_name = $` . "/" . $'; + } + } + + # Just in case the zip program gets confused by an existing file with the + # same name as the one to be written that file is removed first. + if ( -e $filename) + { + if (unlink ($filename) == 0) + { + print "Existing file $filename could not be deleted.\n"; + print "Please close the application that uses it, then try again.\n"; + return; + } + } + + # Finally create the zip file. First change into the temporary directory + # so that the resulting zip file contains only paths relative to it. + print "zipping [$ZipCmd $ZipFlags $zip_name *]\n"; + chdir ($TempDir); + system ("$ZipCmd $ZipFlags $zip_name *"); + chdir ($cwd); +} + + +sub writeHeader +{ + print $OUT qq~ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +~; + +} + +sub writeSlideHeader +{ + my $titleText = pop @_; + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Slide: $slideNum\n"; + print $OUT " Path: $titleText\n"; + print $OUT " \n"; +} + + +sub writeSlideFooter +{ + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeFooter +{ + print $OUT qq~ + + + +~; + +} + +sub writePath +{ + my $pathAry = pop @_; + my $path = $pathAry->[1]; + my $viewBox = $pathAry->[0]; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeManifest +{ + my $outFile = open_file("META-INF/manifest.xml"); + + print $outFile qq~ + + + + + +~; + + $outFile->close; +} + + +############################################################################### +# Print usage information. +# +sub usage () +{ + print <* [] + +output-file-name defaults to polygons.odp. + + -h Print this usage information. + -o output-file-name +END_OF_USAGE +} + +############################################################################### +# Process the command line. +# +sub process_command_line +{ + foreach (@ARGV) + { + if (/^-h/) + { + usage; + exit 0; + } + } + + $global_output_name = "polygons.odp"; + my $j = 0, $noMoreOptions = 0; + for (my $i=0; $i<$#ARGV; $i++) + { + if ( !$noMoreOptions and $ARGV[$i] eq "-o") + { + $i++; + $global_output_name = $ARGV[$i]; + } + elsif ( !$noMoreOptions and $ARGV[$i] eq "--") + { + $noMoreOptions = 1; + } + elsif ( !$noMoreOptions and $ARGV[$i] =~ /^-/) + { + print "Unknown option $ARGV[$i]\n"; + usage; + exit 1; + } + else + { + push(@paths, [$ARGV[$i],$ARGV[$i+1]]); + $i++; + } + } + + print "output to $global_output_name\n"; +} + +############################################################################### +# Main +############################################################################### + +$ZipCmd = $ENV{LOG_FILE_ZIP_CMD}; +$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS}; +# Provide default values for the zip command and it's flags. +if ( ! defined $ZipCmd) +{ + $ZipCmd = "zip" unless defined $ZipCmd; + $ZipFlags = "-r -q" unless defined $ZipFlags; +} + +process_command_line(); + +writeManifest(); + +$OUT = open_file( "content.xml" ); + +writeHeader(); + +$pathNum=0; +foreach $path (@paths) +{ + writeSlideHeader($pathNum, $path->[1]); + writePath($path); + writeSlideFooter(); + $pathNum++; +} + +writeFooter(); + +$OUT->close; + +zip_dirtree ($global_output_name); + diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 467a4b90f516..ccf45d31cbbc 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -44,38 +44,24 @@ ////////////////////////////////////////////////////////////////////////////// -class CoordinateData2D +struct CoordinateData2D : public basegfx::B2DPoint { - basegfx::B2DPoint maPoint; - public: - CoordinateData2D() - : maPoint() - {} + CoordinateData2D() {} explicit CoordinateData2D(const basegfx::B2DPoint& rData) - : maPoint(rData) + : B2DPoint(rData) {} - const basegfx::B2DPoint& getCoordinate() const - { - return maPoint; - } - - void setCoordinate(const basegfx::B2DPoint& rValue) - { - if(rValue != maPoint) - maPoint = rValue; - } - - bool operator==(const CoordinateData2D& rData ) const + CoordinateData2D& operator=(const basegfx::B2DPoint& rData) { - return (maPoint == rData.getCoordinate()); + B2DPoint::operator=(rData); + return *this; } void transform(const basegfx::B2DHomMatrix& rMatrix) { - maPoint *= rMatrix; + *this *= rMatrix; } }; @@ -115,12 +101,12 @@ public: const basegfx::B2DPoint& getCoordinate(sal_uInt32 nIndex) const { - return maVector[nIndex].getCoordinate(); + return maVector[nIndex]; } void setCoordinate(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue) { - maVector[nIndex].setCoordinate(rValue); + maVector[nIndex] = rValue; } void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount) @@ -221,6 +207,26 @@ public: aStart->transform(rMatrix); } } + + const basegfx::B2DPoint* begin() const + { + return &maVector.front(); + } + + const basegfx::B2DPoint* end() const + { + return &maVector[maVector.size()]; + } + + basegfx::B2DPoint* begin() + { + return &maVector.front(); + } + + basegfx::B2DPoint* end() + { + return &maVector[maVector.size()]; + } }; ////////////////////////////////////////////////////////////////////////////// @@ -1113,6 +1119,28 @@ public: maPoints.transform(rMatrix); } } + + const basegfx::B2DPoint* begin() const + { + return maPoints.begin(); + } + + const basegfx::B2DPoint* end() const + { + return maPoints.end(); + } + + basegfx::B2DPoint* begin() + { + mpBufferedData.reset(); + return maPoints.begin(); + } + + basegfx::B2DPoint* end() + { + mpBufferedData.reset(); + return maPoints.end(); + } }; ////////////////////////////////////////////////////////////////////////////// @@ -1173,7 +1201,7 @@ namespace basegfx return mpPolygon->count(); } - B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const + const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); @@ -1432,7 +1460,7 @@ namespace basegfx return mpPolygon->getDefaultAdaptiveSubdivision(*this); } - B2DRange B2DPolygon::getB2DRange() const + const B2DRange& B2DPolygon::getB2DRange() const { return mpPolygon->getB2DRange(*this); } @@ -1540,6 +1568,26 @@ namespace basegfx mpPolygon->transform(rMatrix); } } + + const B2DPoint* B2DPolygon::begin() const + { + return mpPolygon->begin(); + } + + const B2DPoint* B2DPolygon::end() const + { + return mpPolygon->end(); + } + + B2DPoint* B2DPolygon::begin() + { + return mpPolygon->begin(); + } + + B2DPoint* B2DPolygon::end() + { + return mpPolygon->end(); + } } // end of namespace basegfx ////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index 6467e7120c03..af63bbccf8d4 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -166,6 +166,26 @@ public: maPolygons.end(), std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique )); } + + const basegfx::B2DPolygon* begin() const + { + return &maPolygons.front(); + } + + const basegfx::B2DPolygon* end() const + { + return &maPolygons[maPolygons.size()]; + } + + basegfx::B2DPolygon* begin() + { + return &maPolygons.front(); + } + + basegfx::B2DPolygon* end() + { + return &maPolygons[maPolygons.size()]; + } }; ////////////////////////////////////////////////////////////////////////////// @@ -378,6 +398,26 @@ namespace basegfx mpPolyPolygon->transform(rMatrix); } } + + const B2DPolygon* B2DPolyPolygon::begin() const + { + return mpPolyPolygon->begin(); + } + + const B2DPolygon* B2DPolyPolygon::end() const + { + return mpPolyPolygon->end(); + } + + B2DPolygon* B2DPolyPolygon::begin() + { + return mpPolyPolygon->begin(); + } + + B2DPolygon* B2DPolyPolygon::end() + { + return mpPolyPolygon->end(); + } } // end of namespace basegfx // eof diff --git a/basegfx/source/range/b2dmultirange.cxx b/basegfx/source/range/b2dmultirange.cxx deleted file mode 100644 index 64c3cf5ab813..000000000000 --- a/basegfx/source/range/b2dmultirange.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: b2dmultirange.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace basegfx -{ - class ImplB2DMultiRange - { - public: - ImplB2DMultiRange() : - maBounds(), - maRanges() - { - } - - explicit ImplB2DMultiRange( const B2DRange& rRange ) : - maBounds(), - maRanges( 1, rRange ) - { - } - - bool isEmpty() const - { - // no ranges at all, or all ranges empty - return maRanges.empty() || - ::std::count_if( maRanges.begin(), - maRanges.end(), - ::boost::mem_fn( &B2DRange::isEmpty ) ) - == static_cast(maRanges.size()); - } - - void reset() - { - // swap in empty vector - VectorOfRanges aTmp; - maRanges.swap( aTmp ); - - maBounds.reset(); - } - - template< typename ValueType > bool isInside( const ValueType& rValue ) const - { - if( !maBounds.isInside( rValue ) ) - return false; - - // cannot use ::boost::bind here, since isInside is overloaded. - // It is currently not possible to resolve the overload - // by considering one of the other template arguments. - VectorOfRanges::const_iterator aCurr( maRanges.begin() ); - const VectorOfRanges::const_iterator aEnd ( maRanges.end() ); - while( aCurr != aEnd ) - if( aCurr->isInside( rValue ) ) - return true; - - return false; - } - - bool overlaps( const B2DRange& rRange ) const - { - if( !maBounds.overlaps( rRange ) ) - return false; - - const VectorOfRanges::const_iterator aEnd( maRanges.end() ); - return ::std::find_if( maRanges.begin(), - aEnd, - ::boost::bind( ::boost::mem_fn( &B2DRange::overlaps ), - _1, - rRange ) ) != aEnd; - } - - void addRange( const B2DRange& rRange ) - { - maRanges.push_back( rRange ); - maBounds.expand( rRange ); - } - - B2DRange getBounds() const - { - return maBounds; - } - - B2DPolyPolygon getPolyPolygon() const - { - B2DPolyPolygon aRes; - - // Make range vector unique ( have to avoid duplicate - // rectangles. The polygon clipper will return an empty - // result in this case). - VectorOfRanges aUniqueRanges; - aUniqueRanges.reserve( maRanges.size() ); - - VectorOfRanges::const_iterator aCurr( maRanges.begin() ); - const VectorOfRanges::const_iterator aEnd ( maRanges.end() ); - while( aCurr != aEnd ) - { - // TODO(F3): It's plain wasted resources to apply a - // general clipping algorithm to the problem at - // hand. Go for a dedicated, scan-line-based approach. - VectorOfRanges::const_iterator aCurrScan( aCurr+1 ); - VectorOfRanges::const_iterator aFound( aEnd ); - while( aCurrScan != aEnd ) - { - if( aCurrScan->equal( *aCurr ) || - aCurrScan->isInside( *aCurr ) ) - { - // current probe is equal to aCurr, or - // completely contains aCurr. Thus, stop - // searching, because aCurr is definitely not - // a member of the unique rect list - aFound = aCurrScan; - break; - } - - ++aCurrScan; - } - - if( aFound == aEnd ) - { - // check whether aCurr is fully contained in one - // of the already added rects. If yes, we can skip - // it. - bool bUnique( true ); - VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() ); - VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() ); - while( aCurrUnique != aEndUnique ) - { - if( aCurrUnique->isInside( *aCurr ) ) - { - // fully contained, no need to add - bUnique = false; - break; - } - - ++aCurrUnique; - } - - if( bUnique ) - aUniqueRanges.push_back( *aCurr ); - } - - ++aCurr; - } - - VectorOfRanges::const_iterator aCurrUnique( aUniqueRanges.begin() ); - const VectorOfRanges::const_iterator aEndUnique ( aUniqueRanges.end() ); - while( aCurrUnique != aEndUnique ) - { - // simply merge all unique parts (OR) - aRes.append( tools::createPolygonFromRect( *aCurrUnique++ ) ); - } - - // remove redundant intersections. Note: since all added - // rectangles are positively oriented, this method cannot - // generate any holes. - aRes = basegfx::tools::solveCrossovers(aRes); - aRes = basegfx::tools::stripNeutralPolygons(aRes); - aRes = basegfx::tools::stripDispensablePolygons(aRes, false); - - return aRes; - } - - private: - typedef ::std::vector< B2DRange > VectorOfRanges; - - B2DRange maBounds; - VectorOfRanges maRanges; - }; - - - // ==================================================================== - - - B2DMultiRange::B2DMultiRange() : - mpImpl() - { - } - - B2DMultiRange::B2DMultiRange( const B2DRange& rRange ) : - mpImpl( ImplB2DMultiRange( rRange ) ) - { - } - - B2DMultiRange::~B2DMultiRange() - { - // otherwise, ImplB2DMultiRange would be an incomplete type - } - - B2DMultiRange::B2DMultiRange( const B2DMultiRange& rSrc ) : - mpImpl( rSrc.mpImpl ) - { - } - - B2DMultiRange& B2DMultiRange::operator=( const B2DMultiRange& rSrc ) - { - mpImpl = rSrc.mpImpl; - return *this; - } - - bool B2DMultiRange::isEmpty() const - { - return mpImpl->isEmpty(); - } - - void B2DMultiRange::reset() - { - mpImpl->reset(); - } - - bool B2DMultiRange::isInside( const B2DTuple& rTuple ) const - { - return mpImpl->isInside( rTuple ); - } - - bool B2DMultiRange::isInside( const B2DRange& rRange ) const - { - return mpImpl->isInside( rRange ); - } - - bool B2DMultiRange::overlaps( const B2DRange& rRange ) const - { - return mpImpl->overlaps( rRange ); - } - - void B2DMultiRange::addRange( const B2DRange& rRange ) - { - mpImpl->addRange( rRange ); - } - - B2DRange B2DMultiRange::getBounds() const - { - return mpImpl->getBounds(); - } - - B2DPolyPolygon B2DMultiRange::getPolyPolygon() const - { - return mpImpl->getPolyPolygon(); - } - -} // end of namespace basegfx - -// eof diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx new file mode 100644 index 000000000000..c4969b38712c --- /dev/null +++ b/basegfx/source/range/b2dpolyrange.cxx @@ -0,0 +1,371 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dmultirange.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +static basegfx::B2VectorOrientation flipOrientation( + basegfx::B2VectorOrientation eOrient) +{ + return eOrient == basegfx::ORIENTATION_POSITIVE ? + basegfx::ORIENTATION_NEGATIVE : basegfx::ORIENTATION_POSITIVE; +} + +namespace basegfx +{ + class ImplB2DPolyRange + { + void updateBounds() + { + maBounds.reset(); + std::for_each(maRanges.begin(), + maRanges.end(), + boost::bind( + (void (B2DRange::*)(const B2DRange&))( + &B2DRange::expand), + boost::ref(maBounds), + _1)); + } + + public: + ImplB2DPolyRange() : + maBounds(), + maRanges(), + maOrient() + {} + + explicit ImplB2DPolyRange( const B2DPolyRange::ElementType& rElem ) : + maBounds( boost::get<0>(rElem) ), + maRanges( 1, boost::get<0>(rElem) ), + maOrient( 1, boost::get<1>(rElem) ) + {} + + explicit ImplB2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) : + maBounds( rRange ), + maRanges( 1, rRange ), + maOrient( 1, eOrient ) + {} + + bool operator==(const ImplB2DPolyRange& rRHS) const + { + return maRanges == rRHS.maRanges && maOrient == rRHS.maOrient; + } + + sal_uInt32 count() const + { + return maRanges.size(); + } + + B2DPolyRange::ElementType getElement(sal_uInt32 nIndex) const + { + return boost::make_tuple(maRanges[nIndex], + maOrient[nIndex]); + } + + void setElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement ) + { + maRanges[nIndex] = boost::get<0>(rElement); + maOrient[nIndex] = boost::get<1>(rElement); + updateBounds(); + } + + void setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient ) + { + maRanges[nIndex] = rRange; + maOrient[nIndex] = eOrient; + updateBounds(); + } + + void insertElement(sal_uInt32 nIndex, const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount) + { + maRanges.insert(maRanges.begin()+nIndex, nCount, boost::get<0>(rElement)); + maOrient.insert(maOrient.begin()+nIndex, nCount, boost::get<1>(rElement)); + maBounds.expand(boost::get<0>(rElement)); + } + + void insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount) + { + maRanges.insert(maRanges.begin()+nIndex, nCount, rRange); + maOrient.insert(maOrient.begin()+nIndex, nCount, eOrient); + maBounds.expand(rRange); + } + + void appendElement(const B2DPolyRange::ElementType& rElement, sal_uInt32 nCount) + { + maRanges.insert(maRanges.end(), nCount, boost::get<0>(rElement)); + maOrient.insert(maOrient.end(), nCount, boost::get<1>(rElement)); + maBounds.expand(boost::get<0>(rElement)); + } + + void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount) + { + maRanges.insert(maRanges.end(), nCount, rRange); + maOrient.insert(maOrient.end(), nCount, eOrient); + maBounds.expand(rRange); + } + + void insertPolyRange(sal_uInt32 nIndex, const ImplB2DPolyRange& rPolyRange) + { + maRanges.insert(maRanges.begin()+nIndex, rPolyRange.maRanges.begin(), rPolyRange.maRanges.end()); + maOrient.insert(maOrient.begin()+nIndex, rPolyRange.maOrient.begin(), rPolyRange.maOrient.end()); + updateBounds(); + } + + void appendPolyRange(const ImplB2DPolyRange& rPolyRange) + { + maRanges.insert(maRanges.end(), + rPolyRange.maRanges.begin(), + rPolyRange.maRanges.end()); + maOrient.insert(maOrient.end(), + rPolyRange.maOrient.begin(), + rPolyRange.maOrient.end()); + updateBounds(); + } + + void remove(sal_uInt32 nIndex, sal_uInt32 nCount) + { + maRanges.erase(maRanges.begin()+nIndex,maRanges.begin()+nIndex+nCount); + maOrient.erase(maOrient.begin()+nIndex,maOrient.begin()+nIndex+nCount); + updateBounds(); + } + + void clear() + { + std::vector aTmpRanges; + std::vector aTmpOrient; + + maRanges.swap(aTmpRanges); + maOrient.swap(aTmpOrient); + + maBounds.reset(); + } + + void flip() + { + std::for_each(maOrient.begin(), + maOrient.end(), + boost::bind( + &flipOrientation, + _1)); + } + + B2DRange getBounds() const + { + return maBounds; + } + + template< typename ValueType > bool isInside( const ValueType& rValue ) const + { + if( !maBounds.isInside( rValue ) ) + return false; + + // cannot use boost::bind here, since isInside is overloaded. + // It is currently not possible to resolve the overload + // by considering one of the other template arguments. + std::vector::const_iterator aCurr( maRanges.begin() ); + const std::vector::const_iterator aEnd ( maRanges.end() ); + while( aCurr != aEnd ) + if( aCurr->isInside( rValue ) ) + return true; + + return false; + } + + bool overlaps( const B2DRange& rRange ) const + { + if( !maBounds.overlaps( rRange ) ) + return false; + + const std::vector::const_iterator aEnd( maRanges.end() ); + return std::find_if( maRanges.begin(), + aEnd, + boost::bind( boost::mem_fn( &B2DRange::overlaps ), + _1, + boost::cref(rRange) ) ) != aEnd; + } + + B2DPolyPolygon solveCrossovers() const + { + return tools::solveCrossovers(maRanges,maOrient); + } + + private: + B2DRange maBounds; + std::vector maRanges; + std::vector maOrient; + }; + + B2DPolyRange::B2DPolyRange() : + mpImpl() + {} + + B2DPolyRange::~B2DPolyRange() + {} + + B2DPolyRange::B2DPolyRange( const ElementType& rElem ) : + mpImpl( ImplB2DPolyRange( rElem ) ) + {} + + B2DPolyRange::B2DPolyRange( const B2DRange& rRange, B2VectorOrientation eOrient ) : + mpImpl( ImplB2DPolyRange( rRange, eOrient ) ) + {} + + B2DPolyRange::B2DPolyRange( const B2DPolyRange& rRange ) : + mpImpl( rRange.mpImpl ) + {} + + B2DPolyRange& B2DPolyRange::operator=( const B2DPolyRange& rRange ) + { + mpImpl = rRange.mpImpl; + return *this; + } + + void B2DPolyRange::makeUnique() + { + mpImpl.make_unique(); + } + + bool B2DPolyRange::operator==(const B2DPolyRange& rRange) const + { + if(mpImpl.same_object(rRange.mpImpl)) + return true; + + return ((*mpImpl) == (*rRange.mpImpl)); + } + + bool B2DPolyRange::operator!=(const B2DPolyRange& rRange) const + { + return !(*this == rRange); + } + + sal_uInt32 B2DPolyRange::count() const + { + return mpImpl->count(); + } + + B2DPolyRange::ElementType B2DPolyRange::getElement(sal_uInt32 nIndex) const + { + return mpImpl->getElement(nIndex); + } + + void B2DPolyRange::setElement(sal_uInt32 nIndex, const ElementType& rElement ) + { + mpImpl->setElement(nIndex, rElement); + } + + void B2DPolyRange::setElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient ) + { + mpImpl->setElement(nIndex, rRange, eOrient ); + } + + void B2DPolyRange::insertElement(sal_uInt32 nIndex, const ElementType& rElement, sal_uInt32 nCount) + { + mpImpl->insertElement(nIndex, rElement, nCount ); + } + + void B2DPolyRange::insertElement(sal_uInt32 nIndex, const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount) + { + mpImpl->insertElement(nIndex, rRange, eOrient, nCount ); + } + + void B2DPolyRange::appendElement(const ElementType& rElement, sal_uInt32 nCount) + { + mpImpl->appendElement(rElement, nCount); + } + + void B2DPolyRange::appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount) + { + mpImpl->appendElement(rRange, eOrient, nCount ); + } + + void B2DPolyRange::insertPolyRange(sal_uInt32 nIndex, const B2DPolyRange& rRange) + { + mpImpl->insertPolyRange(nIndex, *rRange.mpImpl); + } + + void B2DPolyRange::appendPolyRange(const B2DPolyRange& rRange) + { + mpImpl->appendPolyRange(*rRange.mpImpl); + } + + void B2DPolyRange::remove(sal_uInt32 nIndex, sal_uInt32 nCount) + { + mpImpl->remove(nIndex, nCount); + } + + void B2DPolyRange::clear() + { + mpImpl->clear(); + } + + void B2DPolyRange::flip() + { + mpImpl->flip(); + } + + B2DRange B2DPolyRange::getBounds() const + { + return mpImpl->getBounds(); + } + + bool B2DPolyRange::isInside( const B2DTuple& rTuple ) const + { + return mpImpl->isInside(rTuple); + } + + bool B2DPolyRange::isInside( const B2DRange& rRange ) const + { + return mpImpl->isInside(rRange); + } + + bool B2DPolyRange::overlaps( const B2DRange& rRange ) const + { + return mpImpl->overlaps(rRange); + } + + B2DPolyPolygon B2DPolyRange::solveCrossovers() const + { + return mpImpl->solveCrossovers(); + } + +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx new file mode 100644 index 000000000000..524479b4fde0 --- /dev/null +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -0,0 +1,950 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dmultirange.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + + +namespace basegfx +{ + namespace + { + // Generating a poly-polygon from a bunch of rectangles + // + // Helper functionality for sweep-line algorithm + // ==================================================== + + typedef std::vector VectorOfRanges; + + class ImplPolygon; + typedef o3tl::vector_pool VectorOfPolygons; + + + /** This class represents an active edge + + As the sweep line traverses across the overall area, + rectangle edges parallel to it generate events, and + rectangle edges orthogonal to it generate active + edges. This class represents the latter. + */ + class ActiveEdge + { + public: + /** The two possible active rectangle edges differ by one + coordinate value - the upper edge has the lower, the + lower edge the higher value. + */ + enum EdgeType { + /// edge with lower coordinate value + UPPER=0, + /// edge with higher coordinate value + LOWER=1 + }; + + enum EdgeDirection { + /// edge proceeds to the left + PROCEED_LEFT=0, + /// edge proceeds to the right + PROCEED_RIGHT=1 + }; + + /** Create active edge + + @param rRect + Rectangle this edge is part of + + @param fInvariantCoord + The invariant ccordinate value of this edge + + @param eEdgeType + Is fInvariantCoord the lower or the higher value, for + this rect? + */ + ActiveEdge( const B2DRectangle& rRect, + const double& fInvariantCoord, + std::ptrdiff_t nPolyIdx, + EdgeType eEdgeType, + EdgeDirection eEdgeDirection ) : + mfInvariantCoord(fInvariantCoord), + mpAssociatedRect( &rRect ), + mnPolygonIdx( nPolyIdx ), + meEdgeType( eEdgeType ), + meEdgeDirection( eEdgeDirection ) + {} + + double getInvariantCoord() const { return mfInvariantCoord; } + const B2DRectangle& getRect() const { return *mpAssociatedRect; } + std::ptrdiff_t getTargetPolygonIndex() const { return mnPolygonIdx; } + void setTargetPolygonIndex( std::ptrdiff_t nIdx ) { mnPolygonIdx = nIdx; } + EdgeType getEdgeType() const { return meEdgeType; } + EdgeDirection getEdgeDirection() const { return meEdgeDirection; } + + /// For STL sort + bool operator<( const ActiveEdge& rRHS ) const { return mfInvariantCoord < rRHS.mfInvariantCoord; } + + private: + /** The invariant coordinate value of this edge (e.g. the + common y value, for a horizontal edge) + */ + double mfInvariantCoord; + + /** Associated rectangle + + This on the one hand saves some storage space (the + vector of rectangles is persistent, anyway), and on + the other hand provides an identifier to match active + edges and x events (see below) + + Ptr because class needs to be assignable + */ + const B2DRectangle* mpAssociatedRect; + + /** Index of the polygon this edge is currently involved + with. + + Note that this can change for some kinds of edge + intersection, as the algorithm tends to swap + associated polygons there. + + -1 denotes no assigned polygon + */ + std::ptrdiff_t mnPolygonIdx; + + /// 'upper' or 'lower' edge of original rectangle. + EdgeType meEdgeType; + + /// 'left' or 'right' + EdgeDirection meEdgeDirection; + }; + + // Needs to be list - various places hold ptrs to elements + typedef std::list< ActiveEdge > ListOfEdges; + + + /** Element of the sweep line event list + + As the sweep line traverses across the overall area, + rectangle edges parallel to it generate events, and + rectangle edges orthogonal to it generate active + edges. This class represents the former. + + The class defines an element of the sweep line list. The + sweep line's position jumps in steps defined by the + coordinates of the sorted SweepLineEvent entries. + */ + class SweepLineEvent + { + public: + /** The two possible sweep line rectangle edges differ by + one coordinate value - the starting edge has the + lower, the finishing edge the higher value. + */ + enum EdgeType { + /// edge with lower coordinate value + STARTING_EDGE=0, + /// edge with higher coordinate value + FINISHING_EDGE=1 + }; + + /** The two possible sweep line directions + */ + enum EdgeDirection { + PROCEED_UP=0, + PROCEED_DOWN=1 + }; + + /** Create sweep line event + + @param fPos + Coordinate position of the event + + @param rRect + Rectangle this event is generated for. + + @param eEdgeType + Is fPos the lower or the higher value, for the + rectangle this event is generated for? + */ + SweepLineEvent( double fPos, + const B2DRectangle& rRect, + EdgeType eEdgeType, + EdgeDirection eDirection) : + mfPos( fPos ), + mpAssociatedRect( &rRect ), + meEdgeType( eEdgeType ), + meEdgeDirection( eDirection ) + {} + + double getPos() const { return mfPos; } + const B2DRectangle& getRect() const { return *mpAssociatedRect; } + EdgeType getEdgeType() const { return meEdgeType; } + EdgeDirection getEdgeDirection() const { return meEdgeDirection; } + + /// For STL sort + bool operator<( const SweepLineEvent& rRHS ) const { return mfPos < rRHS.mfPos; } + + private: + /// position of the event, in the direction of the line sweep + double mfPos; + + /** Rectangle this event is generated for + + This on the one hand saves some storage space (the + vector of rectangles is persistent, anyway), and on + the other hand provides an identifier to match active + edges and events (see below) + + Ptr because class needs to be assignable + */ + const B2DRectangle* mpAssociatedRect; + + /// 'upper' or 'lower' edge of original rectangle. + EdgeType meEdgeType; + + /// 'up' or 'down' + EdgeDirection meEdgeDirection; + }; + + typedef std::vector< SweepLineEvent > VectorOfEvents; + + + /** Smart point container for B2DMultiRange::getPolyPolygon() + + This class provides methods needed only here, and is used + as a place to store some additional information per + polygon. Also, most of the intersection logic is + implemented here. + */ + class ImplPolygon + { + public: + /** Create polygon + */ + ImplPolygon() : + mpLeadingRightEdge(NULL), + mnIdx(-1), + maPoints(), + mbIsFinished(false) + { + // completely ad-hoc. but what the hell. + maPoints.reserve(11); + } + + void setPolygonPoolIndex( std::ptrdiff_t nIdx ) { mnIdx = nIdx; } + bool isFinished() const { return mbIsFinished; } + + /// Add point to the end of the existing points + void append( const B2DPoint& rPoint ) + { + OSL_PRECOND( maPoints.empty() || + maPoints.back().getX() == rPoint.getX() || + maPoints.back().getY() == rPoint.getY(), + "ImplPolygon::append(): added point violates 90 degree line angle constraint!" ); + + if( maPoints.empty() || + maPoints.back() != rPoint ) + { + // avoid duplicate points + maPoints.push_back( rPoint ); + } + } + + /** Perform the intersection of this polygon with an + active edge. + + @param rEvent + The vertical line event that generated the + intersection + + @param rActiveEdge + The active edge that generated the intersection + + @param rPolygonPool + Polygon pool, we sometimes need to allocate a new one + + @param bIsFinishingEdge + True, when this is hitting the last edge of the + vertical sweep - every vertical sweep starts and ends + with upper and lower edge of the _same_ rectangle. + + @return the new current polygon (that's the one + processing must proceed with, when going through the + list of upcoming active edges). + */ + std::ptrdiff_t intersect( SweepLineEvent& rEvent, + ActiveEdge& rActiveEdge, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes, + bool isFinishingEdge ) + { + OSL_PRECOND( !isFinished(), + "ImplPolygon::intersect(): called on already finished polygon!" ); + OSL_PRECOND( !isFinishingEdge + || (isFinishingEdge && &rEvent.getRect() == &rActiveEdge.getRect()), + "ImplPolygon::intersect(): inconsistent ending!" ); + + const B2DPoint aIntersectionPoint( rEvent.getPos(), + rActiveEdge.getInvariantCoord() ); + + // intersection point, goes to our polygon + // unconditionally + append(aIntersectionPoint); + + const bool isSweepLineEnteringRect( + rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE); + if( isFinishingEdge ) + { + if( isSweepLineEnteringRect ) + handleFinalOwnRightEdge(rActiveEdge); + else + handleFinalOwnLeftEdge(rActiveEdge, + rPolygonPool, + rRes); + + // we're done with this rect & sweep line + return -1; + } + else if( metOwnEdge(rEvent,rActiveEdge) ) + { + handleInitialOwnEdge(rEvent, rActiveEdge); + + // point already added, all init done, continue + // with same poly + return mnIdx; + } + else + { + OSL_ENSURE( rActiveEdge.getTargetPolygonIndex() != -1, + "ImplPolygon::intersect(): non-trivial intersection hit empty polygon!" ); + + const bool isHittingLeftEdge( + rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT); + + if( isHittingLeftEdge ) + return handleComplexLeftEdge(rActiveEdge, + aIntersectionPoint, + rPolygonPool, + rRes); + else + return handleComplexRightEdge(rActiveEdge, + aIntersectionPoint, + rPolygonPool); + } + } + + private: + std::ptrdiff_t getPolygonPoolIndex() const { return mnIdx; } + + void handleInitialOwnEdge(SweepLineEvent& rEvent, + ActiveEdge& rActiveEdge) + { + const bool isActiveEdgeProceedLeft( + rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT); + const bool isSweepLineEnteringRect( + rEvent.getEdgeType() == SweepLineEvent::STARTING_EDGE); + (void)isActiveEdgeProceedLeft; + (void)isSweepLineEnteringRect; + + OSL_ENSURE( isSweepLineEnteringRect == isActiveEdgeProceedLeft, + "ImplPolygon::intersect(): sweep initial own edge hit: wrong polygon order" ); + + OSL_ENSURE( isSweepLineEnteringRect || + mpLeadingRightEdge == &rActiveEdge, + "ImplPolygon::intersect(): sweep initial own edge hit: wrong leading edge" ); + } + + void handleFinalOwnRightEdge(ActiveEdge& rActiveEdge) + { + OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_RIGHT, + "ImplPolygon::handleInitialOwnRightEdge(): start edge wrong polygon order" ); + + rActiveEdge.setTargetPolygonIndex(mnIdx); + mpLeadingRightEdge = &rActiveEdge; + } + + void handleFinalOwnLeftEdge(ActiveEdge& rActiveEdge, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes) + { + OSL_ENSURE( rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT, + "ImplPolygon::handleFinalOwnLeftEdge(): end edge wrong polygon order" ); + + const bool isHittingOurTail( + rActiveEdge.getTargetPolygonIndex() == mnIdx); + + if( isHittingOurTail ) + finish(rRes); // just finish. no fuss. + else + { + // temp poly hits final left edge + const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex(); + ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx); + + // active edge's polygon has points + // already. ours need to go in front of them. + maPoints.insert(maPoints.end(), + rTmp.maPoints.begin(), + rTmp.maPoints.end()); + + // adjust leading edges, we're switching the polygon + ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge; + + mpLeadingRightEdge = pFarEdge; + pFarEdge->setTargetPolygonIndex(mnIdx); + + // nTmpIdx is an empty shell, get rid of it + rPolygonPool.free(nTmpIdx); + } + } + + std::ptrdiff_t handleComplexLeftEdge(ActiveEdge& rActiveEdge, + const B2DPoint& rIntersectionPoint, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes) + { + const bool isHittingOurTail( + rActiveEdge.getTargetPolygonIndex() == mnIdx); + if( isHittingOurTail ) + { + finish(rRes); + + // so "this" is done - need new polygon to collect + // further points + const std::ptrdiff_t nIdxNewPolygon=rPolygonPool.alloc(); + rPolygonPool.get(nIdxNewPolygon).setPolygonPoolIndex(nIdxNewPolygon); + rPolygonPool.get(nIdxNewPolygon).append(rIntersectionPoint); + + rActiveEdge.setTargetPolygonIndex(nIdxNewPolygon); + + return nIdxNewPolygon; + } + else + { + const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex(); + ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx); + + // active edge's polygon has points + // already. ours need to go in front of them. + maPoints.insert(maPoints.end(), + rTmp.maPoints.begin(), + rTmp.maPoints.end()); + + rTmp.maPoints.clear(); + rTmp.append(rIntersectionPoint); + + // adjust leading edges, we're switching the polygon + ActiveEdge* const pFarEdge=rTmp.mpLeadingRightEdge; + ActiveEdge* const pNearEdge=&rActiveEdge; + + rTmp.mpLeadingRightEdge = NULL; + pNearEdge->setTargetPolygonIndex(nTmpIdx); + + mpLeadingRightEdge = pFarEdge; + pFarEdge->setTargetPolygonIndex(mnIdx); + + return nTmpIdx; + } + } + + std::ptrdiff_t handleComplexRightEdge(ActiveEdge& rActiveEdge, + const B2DPoint& rIntersectionPoint, + VectorOfPolygons& rPolygonPool) + { + const std::ptrdiff_t nTmpIdx=rActiveEdge.getTargetPolygonIndex(); + ImplPolygon& rTmp=rPolygonPool.get(nTmpIdx); + + rTmp.append(rIntersectionPoint); + + rActiveEdge.setTargetPolygonIndex(mnIdx); + mpLeadingRightEdge = &rActiveEdge; + + rTmp.mpLeadingRightEdge = NULL; + + return nTmpIdx; + } + + /// True when sweep line hits our own active edge + bool metOwnEdge(const SweepLineEvent& rEvent, + ActiveEdge& rActiveEdge) + { + const bool bHitOwnEdge=&rEvent.getRect() == &rActiveEdge.getRect(); + return bHitOwnEdge; + } + + /// Retrieve B2DPolygon from this object + B2DPolygon getPolygon() const + { + B2DPolygon aRes; + std::for_each( maPoints.begin(), + maPoints.end(), + boost::bind( + &B2DPolygon::append, + boost::ref(aRes), + _1, + 1 ) ); + aRes.setClosed( true ); + return aRes; + } + + /** Finish this polygon, push to result set. + */ + void finish(B2DPolyPolygon& rRes) + { + OSL_PRECOND( maPoints.empty() || + maPoints.front().getX() == maPoints.back().getX() || + maPoints.front().getY() == maPoints.back().getY(), + "ImplPolygon::finish(): first and last point violate 90 degree line angle constraint!" ); + + mbIsFinished = true; + mpLeadingRightEdge = NULL; + + rRes.append(getPolygon()); + } + + /** Refers to the current leading edge element of this + polygon, or NULL. The leading edge denotes the 'front' + of the polygon vertex sequence, i.e. the coordinates + at the polygon's leading edge are returned from + maPoints.front() + */ + ActiveEdge* mpLeadingRightEdge; + + /// current index into vector pool + std::ptrdiff_t mnIdx; + + /// Container for the actual polygon points + std::vector maPoints; + + /// When true, this polygon is 'done', i.e. nothing must be added anymore. + bool mbIsFinished; + }; + + /** Init sweep line event list + + This method fills the event list with the sweep line + events generated from the input rectangles, and sorts them + with increasing x. + */ + void setupSweepLineEventListFromRanges( VectorOfEvents& o_rEventVector, + const std::vector& rRanges, + const std::vector& rOrientations ) + { + // we need exactly 2*rectVec.size() events: one for the + // left, and one for the right edge of each rectangle + o_rEventVector.clear(); + o_rEventVector.reserve( 2*rRanges.size() ); + + // generate events + // =============== + + // first pass: add all left edges in increasing order + std::vector::const_iterator aCurrRect=rRanges.begin(); + std::vector::const_iterator aCurrOrientation=rOrientations.begin(); + const std::vector::const_iterator aEnd=rRanges.end(); + const std::vector::const_iterator aEndOrientation=rOrientations.end(); + while( aCurrRect != aEnd && aCurrOrientation != aEndOrientation ) + { + const B2DRectangle& rCurrRect( *aCurrRect++ ); + + o_rEventVector.push_back( + SweepLineEvent( rCurrRect.getMinX(), + rCurrRect, + SweepLineEvent::STARTING_EDGE, + (*aCurrOrientation++) == ORIENTATION_POSITIVE ? + SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) ); + } + + // second pass: add all right edges in reversed order + std::vector::const_reverse_iterator aCurrRectR=rRanges.rbegin(); + std::vector::const_reverse_iterator aCurrOrientationR=rOrientations.rbegin(); + const std::vector::const_reverse_iterator aEndR=rRanges.rend(); + const std::vector::const_reverse_iterator aEndOrientationR=rOrientations.rend(); + while( aCurrRectR != aEndR ) + { + const B2DRectangle& rCurrRect( *aCurrRectR++ ); + + o_rEventVector.push_back( + SweepLineEvent( rCurrRect.getMaxX(), + rCurrRect, + SweepLineEvent::FINISHING_EDGE, + (*aCurrOrientationR++) == ORIENTATION_POSITIVE ? + SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) ); + } + + // sort events + // =========== + + // since we use stable_sort, the order of events with the + // same x value will not change. The elaborate two-pass + // add above thus ensures, that for each two rectangles + // with similar left and right x coordinates, the + // rectangle whose left event comes first will have its + // right event come last. This is advantageous for the + // clip algorithm below, see handleRightEdgeCrossing(). + + // TODO(P3): Use radix sort (from + // b2dpolypolygonrasterconverter, or have your own + // templatized version). + std::stable_sort( o_rEventVector.begin(), + o_rEventVector.end() ); + } + + /** Insert two active edge segments for the given rectangle. + + This method creates two active edge segments from the + given rect, and inserts them into the active edge list, + such that this stays sorted (if it was before). + + @param io_rEdgeList + Active edge list to insert into + + @param io_rPolygons + Vector of polygons. Each rectangle added creates one + tentative result polygon in this vector, and the edge list + entries holds a reference to that polygon (this _requires_ + that the polygon vector does not reallocate, i.e. it must + have at least the maximal number of rectangles reserved) + + @param o_CurrentPolygon + The then-current polygon when processing this sweep line + event + + @param rCurrEvent + The actual event that caused this call + */ + void createActiveEdgesFromStartEvent( ListOfEdges& io_rEdgeList, + VectorOfPolygons& io_rPolygonPool, + SweepLineEvent& rCurrEvent ) + { + ListOfEdges aNewEdges; + const B2DRectangle& rRect=rCurrEvent.getRect(); + const bool bGoesDown=rCurrEvent.getEdgeDirection() == SweepLineEvent::PROCEED_DOWN; + + // start event - new rect starts here, needs polygon to + // collect points into + const std::ptrdiff_t nIdxPolygon=io_rPolygonPool.alloc(); + io_rPolygonPool.get(nIdxPolygon).setPolygonPoolIndex(nIdxPolygon); + + // upper edge + aNewEdges.push_back( + ActiveEdge( + rRect, + rRect.getMinY(), + bGoesDown ? nIdxPolygon : -1, + ActiveEdge::UPPER, + bGoesDown ? ActiveEdge::PROCEED_LEFT : ActiveEdge::PROCEED_RIGHT) ); + // lower edge + aNewEdges.push_back( + ActiveEdge( + rRect, + rRect.getMaxY(), + bGoesDown ? -1 : nIdxPolygon, + ActiveEdge::LOWER, + bGoesDown ? ActiveEdge::PROCEED_RIGHT : ActiveEdge::PROCEED_LEFT ) ); + + // furthermore, have to respect a special tie-breaking + // rule here, for edges which share the same y value: + // newly added upper edges must be inserted _before_ any + // other edge with the same y value, and newly added lower + // edges must be _after_ all other edges with the same + // y. This ensures that the left vertical edge processing + // below encounters the upper edge of the current rect + // first, and the lower edge last, which automatically + // starts and finishes this rect correctly (as only then, + // the polygon will have their associated active edges + // set). + const double nMinY( rRect.getMinY() ); + const double nMaxY( rRect.getMaxY() ); + ListOfEdges::iterator aCurr( io_rEdgeList.begin() ); + const ListOfEdges::iterator aEnd ( io_rEdgeList.end() ); + while( aCurr != aEnd ) + { + const double nCurrY( aCurr->getInvariantCoord() ); + + if( nCurrY >= nMinY && + aNewEdges.size() == 2 ) // only add, if not yet done. + { + // insert upper edge _before_ aCurr. Thus, it will + // be the first entry for a range of equal y + // values. Using splice here, since we hold + // references to the moved list element! + io_rEdgeList.splice( aCurr, + aNewEdges, + aNewEdges.begin() ); + } + + if( nCurrY > nMaxY ) + { + // insert lower edge _before_ aCurr. Thus, it will + // be the last entry for a range of equal y values + // (aCurr is the first entry strictly larger than + // nMaxY). Using splice here, since we hold + // references to the moved list element! + io_rEdgeList.splice( aCurr, + aNewEdges, + aNewEdges.begin() ); + // done with insertion, can early-exit here. + return; + } + + ++aCurr; + } + + // append remainder of aNewList (might still contain 2 or + // 1 elements, depending of the contents of io_rEdgeList). + io_rEdgeList.splice( aCurr, + aNewEdges ); + } + + inline bool isSameRect(ActiveEdge& rEdge, + const basegfx::B2DRange& rRect) + { + return &rEdge.getRect() == &rRect; + } + + // wow what a hack. necessary because stl's list::erase does + // not eat reverse_iterator + template Iter eraseFromList(Cont&, Iter); + template<> inline ListOfEdges::iterator eraseFromList( + ListOfEdges& rList, ListOfEdges::iterator aIter) + { + return rList.erase(aIter); + } + template<> inline ListOfEdges::reverse_iterator eraseFromList( + ListOfEdges& rList, ListOfEdges::reverse_iterator aIter) + { + return ListOfEdges::reverse_iterator( + rList.erase(boost::prior(aIter.base()))); + } + + template inline void processActiveEdges( + Iterator first, + Iterator last, + ListOfEdges& rActiveEdgeList, + SweepLineEvent& rCurrEvent, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes ) + { + const basegfx::B2DRange& rCurrRect=rCurrEvent.getRect(); + + // fast-forward to rCurrEvent's first active edge (holds + // for both starting and finishing sweep line events, a + // rect is regarded _outside_ any rects whose events have + // started earlier + first = std::find_if(first, last, + boost::bind( + &isSameRect, + _1, + boost::cref(rCurrRect))); + + if(first == last) + return; + + int nCount=0; + std::ptrdiff_t nCurrPolyIdx=-1; + while(first != last) + { + if( nCurrPolyIdx == -1 ) + nCurrPolyIdx=first->getTargetPolygonIndex(); + + OSL_ASSERT(nCurrPolyIdx != -1); + + // second encounter of my rect -> second edge + // encountered, done + const bool bExit= + nCount && + isSameRect(*first, + rCurrRect); + + // deal with current active edge + nCurrPolyIdx = + rPolygonPool.get(nCurrPolyIdx).intersect( + rCurrEvent, + *first, + rPolygonPool, + rRes, + bExit); + + // prune upper & lower active edges, if requested + if( bPerformErase && (bExit || !nCount) ) + first = eraseFromList(rActiveEdgeList,first); + else + ++first; + + // delayed exit, had to prune first + if( bExit ) + return; + + ++nCount; + } + } + + template inline void processActiveEdgesTopDown( + SweepLineEvent& rCurrEvent, + ListOfEdges& rActiveEdgeList, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes ) + { + processActiveEdges( + rActiveEdgeList. begin(), + rActiveEdgeList. end(), + rActiveEdgeList, + rCurrEvent, + rPolygonPool, + rRes); + } + + template inline void processActiveEdgesBottomUp( + SweepLineEvent& rCurrEvent, + ListOfEdges& rActiveEdgeList, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes ) + { + processActiveEdges( + rActiveEdgeList. rbegin(), + rActiveEdgeList. rend(), + rActiveEdgeList, + rCurrEvent, + rPolygonPool, + rRes); + } + + enum{ NoErase=0, PerformErase=1 }; + + void handleStartingEdge( SweepLineEvent& rCurrEvent, + ListOfEdges& rActiveEdgeList, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes) + { + // inject two new active edges for rect + createActiveEdgesFromStartEvent( rActiveEdgeList, + rPolygonPool, + rCurrEvent ); + + if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() ) + processActiveEdgesTopDown( + rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); + else + processActiveEdgesBottomUp( + rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); + } + + void handleFinishingEdge( SweepLineEvent& rCurrEvent, + ListOfEdges& rActiveEdgeList, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes) + { + if( SweepLineEvent::PROCEED_DOWN == rCurrEvent.getEdgeDirection() ) + processActiveEdgesTopDown( + rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); + else + processActiveEdgesBottomUp( + rCurrEvent, rActiveEdgeList, rPolygonPool, rRes); + } + + inline void handleSweepLineEvent( SweepLineEvent& rCurrEvent, + ListOfEdges& rActiveEdgeList, + VectorOfPolygons& rPolygonPool, + B2DPolyPolygon& rRes) + { + if( SweepLineEvent::STARTING_EDGE == rCurrEvent.getEdgeType() ) + handleStartingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes); + else + handleFinishingEdge(rCurrEvent,rActiveEdgeList,rPolygonPool,rRes); + } + } + + namespace tools + { + B2DPolyPolygon solveCrossovers(const std::vector& rRanges, + const std::vector& rOrientations) + { + // sweep-line algorithm to generate a poly-polygon + // from a bunch of rectangles + // =============================================== + // + // This algorithm uses the well-known sweep line + // concept, explained in every good text book about + // computational geometry. + // + // We start with creating two structures for every + // rectangle, one representing the left x coordinate, + // one representing the right x coordinate (and both + // referencing the original rect). These structs are + // sorted with increasing x coordinates. + // + // Then, we start processing the resulting list from + // the beginning. Every entry in the list defines a + // point in time of the line sweeping from left to + // right across all rectangles. + VectorOfEvents aSweepLineEvents; + setupSweepLineEventListFromRanges( aSweepLineEvents, + rRanges, + rOrientations ); + + B2DPolyPolygon aRes; + VectorOfPolygons aPolygonPool; + ListOfEdges aActiveEdgeList; + + // sometimes not enough, but a usable compromise + aPolygonPool.reserve( rRanges.size() ); + + std::for_each( aSweepLineEvents.begin(), + aSweepLineEvents.end(), + boost::bind( + &handleSweepLineEvent, + _1, + boost::ref(aActiveEdgeList), + boost::ref(aPolygonPool), + boost::ref(aRes)) ); + + return aRes; + } + } +} + diff --git a/basegfx/source/range/makefile.mk b/basegfx/source/range/makefile.mk index 678bb16a9312..3dcf552fc420 100644 --- a/basegfx/source/range/makefile.mk +++ b/basegfx/source/range/makefile.mk @@ -47,7 +47,8 @@ SLOFILES= \ $(SLO)$/b1drange.obj \ $(SLO)$/b2drange.obj \ $(SLO)$/b2xrange.obj \ - $(SLO)$/b2dmultirange.obj \ + $(SLO)$/b2dpolyrange.obj \ + $(SLO)$/b2drangeclipper.obj \ $(SLO)$/b3drange.obj # --- Targets ---------------------------------- diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 4f0305df953f..32128b927049 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -41,7 +41,9 @@ #include #include #include -#include +#include +#include +#include #include #include #include @@ -56,214 +58,6 @@ using namespace ::basegfx; namespace basegfx2d { -/// Gets a random ordinal [0,n) -inline double getRandomOrdinal( const ::std::size_t n ) -{ - return double(n) * rand() / (RAND_MAX + 1.0); -} - -class b2dmultirange : public CppUnit::TestFixture -{ -private: - B2DMultiRange aDisjunctRanges; - B2DMultiRange aEqualRanges; - B2DMultiRange aIntersectionN; - B2DMultiRange aIntersectionE; - B2DMultiRange aIntersectionS; - B2DMultiRange aIntersectionW; - B2DMultiRange aIntersectionNE; - B2DMultiRange aIntersectionSE; - B2DMultiRange aIntersectionSW; - B2DMultiRange aIntersectionNW; - B2DMultiRange aRingIntersection; - B2DMultiRange aComplexIntersections; - B2DMultiRange aRandomIntersections; - -public: - // initialise your test code values here. - void setUp() - { - B2DRange aCenter(1.0, 1.0, -1.0, -1.0); - B2DRange aOffside(9.0, 9.0, 11.0, 11.0); - B2DRange aNorth(1.0, 0.0, -1.0, -2.0); - B2DRange aSouth(1.0, 2.0, -1.0, 0.0); - B2DRange aEast(0.0, 1.0, 2.0, -1.0); - B2DRange aWest(-2.0, 1.0, 0.0, -1.0); - B2DRange aNorthEast(0.0, 0.0, 2.0, -2.0); - B2DRange aSouthEast(0.0, 0.0, 2.0, 2.0); - B2DRange aSouthWest(0.0, 0.0, -2.0, 2.0); - B2DRange aNorthWest(0.0, 0.0, -2.0, -2.0); - - B2DRange aNorth2(-1.5, 0.5, 1.5, 3.5); - B2DRange aSouth2(-1.5, -0.5, 1.5, -3.5); - B2DRange aEast2 (0.5, -1.5, 3.5, 1.5); - B2DRange aWest2 (-0.5, -1.5,-3.5, 1.5); - - ::std::ofstream output("multirange_testcases.gnuplot"); - DebugPlotter aPlotter( "multirange testcases", - output ); - - aPlotter.plot( aCenter, "center" ); - aPlotter.plot( aOffside, "offside" ); - aPlotter.plot( aNorth, "north" ); - aPlotter.plot( aSouth, "south" ); - aPlotter.plot( aEast, "east" ); - aPlotter.plot( aWest, "west" ); - aPlotter.plot( aNorthEast, "northeast" ); - aPlotter.plot( aSouthEast, "southeast" ); - aPlotter.plot( aSouthWest, "southwest" ); - aPlotter.plot( aNorthWest, "northwest" ); - - aDisjunctRanges.addRange( aCenter ); - aDisjunctRanges.addRange( aOffside ); - - aEqualRanges.addRange( aCenter ); - aEqualRanges.addRange( aCenter ); - - aIntersectionN.addRange( aCenter ); - aIntersectionN.addRange( aNorth ); - - aIntersectionE.addRange( aCenter ); - aIntersectionE.addRange( aEast ); - - aIntersectionS.addRange( aCenter ); - aIntersectionS.addRange( aSouth ); - - aIntersectionW.addRange( aCenter ); - aIntersectionW.addRange( aWest ); - - aIntersectionNE.addRange( aCenter ); - aIntersectionNE.addRange( aNorthEast ); - - aIntersectionSE.addRange( aCenter ); - aIntersectionSE.addRange( aSouthEast ); - - aIntersectionSW.addRange( aCenter ); - aIntersectionSW.addRange( aSouthWest ); - - aIntersectionNW.addRange( aCenter ); - aIntersectionNW.addRange( aNorthWest ); - - aRingIntersection.addRange( aNorth2 ); - aRingIntersection.addRange( aEast2 ); - aRingIntersection.addRange( aSouth2 ); - aRingIntersection.addRange( aWest2 ); - - aComplexIntersections.addRange( aCenter ); - aComplexIntersections.addRange( aOffside ); - aComplexIntersections.addRange( aCenter ); - aComplexIntersections.addRange( aNorth ); - aComplexIntersections.addRange( aEast ); - aComplexIntersections.addRange( aSouth ); - aComplexIntersections.addRange( aWest ); - aComplexIntersections.addRange( aNorthEast ); - aComplexIntersections.addRange( aSouthEast ); - aComplexIntersections.addRange( aSouthWest ); - aComplexIntersections.addRange( aNorthWest ); - -/* - for( int i=0; i<10; ++i ) - { - B2DRange aRandomRange( - getRandomOrdinal( 10 ), - getRandomOrdinal( 10 ), - getRandomOrdinal( 10 ), - getRandomOrdinal( 10 ) ); - - aRandomIntersections.addRange( aRandomRange ); - } -*/ - } - - void tearDown() - { - } - - ::basegfx::B2DPolyPolygon shiftPoly( int nCount, - const ::basegfx::B2DPolyPolygon& rPoly ) - { - B2DHomMatrix aMatrix; - aMatrix.translate( nCount*4.0, - 10.0-nCount*2.0 ); - - ::basegfx::B2DPolyPolygon aRes( rPoly ); - aRes.transform( aMatrix ); - - return aRes; - } - - void getPolyPolygon() - { - ::std::ofstream output("multirange_getpolypolygon.gnuplot"); - DebugPlotter aPlotter( "multirange getPolyPolygon", - output ); - - B2DPolyPolygon result; - - aPlotter.plot( shiftPoly( - 0, - aDisjunctRanges.getPolyPolygon() ), - "disjunct" ); - aPlotter.plot( shiftPoly( - 1, - aEqualRanges.getPolyPolygon() ), - "equal" ); - aPlotter.plot( shiftPoly( - 2, - aIntersectionN.getPolyPolygon() ), - "intersectionN" ); - aPlotter.plot( shiftPoly( - 3, - aIntersectionE.getPolyPolygon() ), - "intersectionE" ); - aPlotter.plot( shiftPoly( - 4, - aIntersectionS.getPolyPolygon() ), - "intersectionS" ); - aPlotter.plot( shiftPoly( - 5, - aIntersectionW.getPolyPolygon() ), - "intersectionW" ); - aPlotter.plot( shiftPoly( - 6, - aIntersectionNE.getPolyPolygon() ), - "intersectionNE" ); - aPlotter.plot( shiftPoly( - 7, - aIntersectionSE.getPolyPolygon() ), - "intersectionSE" ); - aPlotter.plot( shiftPoly( - 8, - aIntersectionSW.getPolyPolygon() ), - "intersectionSW" ); - aPlotter.plot( shiftPoly( - 9, - aIntersectionNW.getPolyPolygon() ), - "intersectionNW" ); - aPlotter.plot( shiftPoly( - 10, - aRingIntersection.getPolyPolygon() ), - "intersection ring" ); - aPlotter.plot( shiftPoly( - 11, - aComplexIntersections.getPolyPolygon() ), - "intersection complex" ); - aPlotter.plot( shiftPoly( - 12, - aRandomIntersections.getPolyPolygon() ), - "intersection random" ); - - CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true ); - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(b2dmultirange); - CPPUNIT_TEST(getPolyPolygon); - CPPUNIT_TEST_SUITE_END(); -}; // class b2dmultirange class b2dsvgdimpex : public CppUnit::TestFixture { @@ -505,6 +299,39 @@ public: CPPUNIT_TEST_SUITE_END(); }; // class b2dsvgdimpex +class b2dpolyrange : public CppUnit::TestFixture +{ +private: +public: + void setUp() + {} + + void tearDown() + {} + + void check() + { + B2DPolyRange aRange; + aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE); + aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE); + + CPPUNIT_ASSERT_MESSAGE("simple poly range - count", + aRange.count() == 2); + CPPUNIT_ASSERT_MESSAGE("simple poly range - first element", + aRange.getElement(0).head == B2DRange(0,0,1,1)); + CPPUNIT_ASSERT_MESSAGE("simple poly range - second element", + aRange.getElement(1).head == B2DRange(2,2,3,3)); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(b2dpolyrange); + CPPUNIT_TEST(check); + CPPUNIT_TEST_SUITE_END(); +}; + class b2dbeziertools : public CppUnit::TestFixture { private: @@ -1618,8 +1445,9 @@ public: }; // class b2dvector // ----------------------------------------------------------------------------- -//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d"); + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d"); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolyrange, "basegfx2d"); //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix, "basegfx2d"); diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx new file mode 100644 index 000000000000..95086cb6a32d --- /dev/null +++ b/basegfx/test/boxclipper.cxx @@ -0,0 +1,426 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: basegfx2d.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +// autogenerated file with codegen.pl + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::basegfx; + + +namespace basegfx2d +{ +/// Gets a random ordinal [0,n) +inline double getRandomOrdinal( const ::std::size_t n ) +{ + // use this one when displaying polygons in OOo, which still sucks + // great rocks when trying to import non-integer svg:d attributes + // return sal_Int64(double(n) * rand() / (RAND_MAX + 1.0)); + return double(n) * rand() / (RAND_MAX + 1.0); +} + +inline bool compare(const B2DPoint& left, const B2DPoint& right) +{ + return left.getX() Date: Fri, 16 Oct 2009 00:57:35 +0200 Subject: #i105939# Adds clip state handling class to basegfx; makes use of that also from slideshow --- basegfx/inc/basegfx/range/b2dpolyrange.hxx | 6 + basegfx/inc/basegfx/tools/b2dclipstate.hxx | 119 ++++++ basegfx/prj/d.lst | 3 +- basegfx/source/range/b2dpolyrange.cxx | 40 ++ basegfx/source/tools/b2dclipstate.cxx | 662 +++++++++++++++++++++++++++++ basegfx/source/tools/makefile.mk | 3 +- basegfx/test/basegfx2d.cxx | 6 + basegfx/test/clipstate.cxx | 187 ++++++++ basegfx/test/genericclipper.cxx | 168 ++++++++ basegfx/test/makefile.mk | 11 +- 10 files changed, 1199 insertions(+), 6 deletions(-) create mode 100644 basegfx/inc/basegfx/tools/b2dclipstate.hxx create mode 100644 basegfx/source/tools/b2dclipstate.cxx create mode 100644 basegfx/test/clipstate.cxx create mode 100644 basegfx/test/genericclipper.cxx diff --git a/basegfx/inc/basegfx/range/b2dpolyrange.hxx b/basegfx/inc/basegfx/range/b2dpolyrange.hxx index f31f8319b159..bd10bc15b7b5 100644 --- a/basegfx/inc/basegfx/range/b2dpolyrange.hxx +++ b/basegfx/inc/basegfx/range/b2dpolyrange.hxx @@ -131,6 +131,12 @@ namespace basegfx */ B2DPolyPolygon solveCrossovers() const; + // element iterators + const B2DRange* begin() const; + const B2DRange* end() const; + B2DRange* begin(); + B2DRange* end(); + private: o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl; }; diff --git a/basegfx/inc/basegfx/tools/b2dclipstate.hxx b/basegfx/inc/basegfx/tools/b2dclipstate.hxx new file mode 100644 index 000000000000..7d336d8cb48e --- /dev/null +++ b/basegfx/inc/basegfx/tools/b2dclipstate.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rectcliptools.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _BGFX_TOOLS_CLIPSTATE_HXX +#define _BGFX_TOOLS_CLIPSTATE_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + class B2DRange; + class B2DPolyRange; + class B2DPolygon; + class B2DPolyPolygon; + + namespace tools + { + class ImplB2DClipState; + + /** This class provides an optimized, symbolic clip state for graphical output + + Having a current 'clip' state is a common attribute of + almost all graphic output APIs, most of which internally + represent it via a list of rectangular bands. In contrast, + this implementation purely uses symbolic clips, but in a + quite efficient manner, deferring actual evaluation until + a clip representation is requested, and using faster code + paths for common special cases (like all-rectangle clips) + */ + class B2DClipState + { + public: + typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType; + + private: + ImplType mpImpl; + + public: + /// Init clip, in 'cleared' state - everything is visible + B2DClipState(); + ~B2DClipState(); + B2DClipState( const B2DClipState& ); + explicit B2DClipState( const B2DRange& ); + explicit B2DClipState( const B2DPolygon& ); + explicit B2DClipState( const B2DPolyPolygon& ); + B2DClipState& operator=( const B2DClipState& ); + + /// unshare this poly-range with all internally shared instances + void makeUnique(); + + /// Set clip to 'null' - nothing is visible + void makeNull(); + /// returns true when clip is 'null' - nothing is visible + bool isNull() const; + + /// Set clip 'cleared' - everything is visible + void makeClear(); + /// returns true when clip is 'cleared' - everything is visible + bool isCleared() const; + + bool operator==(const B2DClipState&) const; + bool operator!=(const B2DClipState&) const; + + void unionRange(const B2DRange& ); + void unionPolygon(const B2DPolygon& ); + void unionPolyPolygon(const B2DPolyPolygon& ); + void unionClipState(const B2DClipState& ); + + void intersectRange(const B2DRange& ); + void intersectPolygon(const B2DPolygon& ); + void intersectPolyPolygon(const B2DPolyPolygon& ); + void intersectClipState(const B2DClipState& ); + + void subtractRange(const B2DRange& ); + void subtractPolygon(const B2DPolygon& ); + void subtractPolyPolygon(const B2DPolyPolygon& ); + void subtractClipState(const B2DClipState& ); + + void xorRange(const B2DRange& ); + void xorPolygon(const B2DPolygon& ); + void xorPolyPolygon(const B2DPolyPolygon& ); + void xorClipState(const B2DClipState& ); + + B2DPolyPolygon getClipPoly() const; + }; + } +} + +#endif // _BGFX_TOOLS_CLIPSTATE_HXX diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index 170796920945..86535375fb8c 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -27,7 +27,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\range ..\inc\basegfx\range\basicrange.hxx %_DEST%\inc%_EXT%\basegfx\range\basicrange.hxx ..\inc\basegfx\range\basicbox.hxx %_DEST%\inc%_EXT%\basegfx\range\basicbox.hxx ..\inc\basegfx\range\b1drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b1drange.hxx -..\inc\basegfx\range\b2dmultirange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dmultirange.hxx +..\inc\basegfx\range\b2dpolyrange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dpolyrange.hxx ..\inc\basegfx\range\b2drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drange.hxx ..\inc\basegfx\range\b2drectangle.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drectangle.hxx ..\inc\basegfx\range\b2dconnectedranges.hxx %_DEST%\inc%_EXT%\basegfx\range\b2dconnectedranges.hxx @@ -92,6 +92,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tools ..\inc\basegfx\tools\keystoplerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\keystoplerp.hxx ..\inc\basegfx\tools\lerp.hxx %_DEST%\inc%_EXT%\basegfx\tools\lerp.hxx ..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx +..\inc\basegfx\tools\b2dclipstate.hxx %_DEST%\inc%_EXT%\basegfx\tools\b2dclipstate.hxx ..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx ..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx ..\inc\basegfx\tools\gradienttools.hxx %_DEST%\inc%_EXT%\basegfx\tools\gradienttools.hxx diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx index c4969b38712c..d35af8f5dd0c 100644 --- a/basegfx/source/range/b2dpolyrange.cxx +++ b/basegfx/source/range/b2dpolyrange.cxx @@ -227,6 +227,26 @@ namespace basegfx return tools::solveCrossovers(maRanges,maOrient); } + const B2DRange* begin() const + { + return &maRanges.front(); + } + + const B2DRange* end() const + { + return &maRanges[maRanges.size()]; + } + + B2DRange* begin() + { + return &maRanges.front(); + } + + B2DRange* end() + { + return &maRanges[maRanges.size()]; + } + private: B2DRange maBounds; std::vector maRanges; @@ -366,6 +386,26 @@ namespace basegfx return mpImpl->solveCrossovers(); } + const B2DRange* B2DPolyRange::begin() const + { + return mpImpl->begin(); + } + + const B2DRange* B2DPolyRange::end() const + { + return mpImpl->end(); + } + + B2DRange* B2DPolyRange::begin() + { + return mpImpl->begin(); + } + + B2DRange* B2DPolyRange::end() + { + return mpImpl->end(); + } + } // end of namespace basegfx // eof diff --git a/basegfx/source/tools/b2dclipstate.cxx b/basegfx/source/tools/b2dclipstate.cxx new file mode 100644 index 000000000000..005dca1aa66a --- /dev/null +++ b/basegfx/source/tools/b2dclipstate.cxx @@ -0,0 +1,662 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dmultirange.cxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace basegfx +{ +namespace tools +{ + struct ImplB2DClipState + { + public: + enum Operation {UNION, INTERSECT, XOR, SUBTRACT}; + + ImplB2DClipState() : + maPendingPolygons(), + maPendingRanges(), + maClipPoly(), + mePendingOps(UNION) + {} + + explicit ImplB2DClipState( const B2DRange& rRange ) : + maPendingPolygons(), + maPendingRanges(), + maClipPoly( + tools::createPolygonFromRect(rRange)), + mePendingOps(UNION) + {} + + explicit ImplB2DClipState( const B2DPolygon& rPoly ) : + maPendingPolygons(), + maPendingRanges(), + maClipPoly(rPoly), + mePendingOps(UNION) + {} + + explicit ImplB2DClipState( const B2DPolyPolygon& rPoly ) : + maPendingPolygons(), + maPendingRanges(), + maClipPoly(rPoly), + mePendingOps(UNION) + {} + + bool isCleared() const + { + return !maClipPoly.count() + && !maPendingPolygons.count() + && !maPendingRanges.count(); + } + + void makeClear() + { + maPendingPolygons.clear(); + maPendingRanges.clear(); + maClipPoly.clear(); + mePendingOps = UNION; + } + + bool isNullClipPoly() const + { + return maClipPoly.count() == 1 + && !maClipPoly.getB2DPolygon(0).count(); + } + + bool isNull() const + { + return !maPendingPolygons.count() + && !maPendingRanges.count() + && isNullClipPoly(); + } + + void makeNull() + { + maPendingPolygons.clear(); + maPendingRanges.clear(); + maClipPoly.clear(); + maClipPoly.append(B2DPolygon()); + mePendingOps = UNION; + } + + bool operator==(const ImplB2DClipState& rRHS) const + { + return maPendingPolygons == rRHS.maPendingPolygons + && maPendingRanges == rRHS.maPendingRanges + && maClipPoly == rRHS.maClipPoly + && mePendingOps == rRHS.mePendingOps; + } + + void addRange(const B2DRange& rRange, Operation eOp) + { + if( rRange.isEmpty() ) + return; + + commitPendingPolygons(); + if( mePendingOps != eOp ) + commitPendingRanges(); + + mePendingOps = eOp; + maPendingRanges.appendElement( + rRange, + ORIENTATION_POSITIVE); + } + + void addPolygon(B2DPolygon aPoly, Operation eOp) + { + commitPendingRanges(); + if( mePendingOps != eOp ) + commitPendingPolygons(); + + mePendingOps = eOp; + maPendingPolygons.append(aPoly); + } + + void addPolyPolygon(B2DPolyPolygon aPoly, Operation eOp) + { + commitPendingRanges(); + if( mePendingOps != eOp ) + commitPendingPolygons(); + + mePendingOps = eOp; + maPendingPolygons.append(aPoly); + } + + void addClipState(const ImplB2DClipState& rOther, Operation eOp) + { + if( rOther.mePendingOps == mePendingOps + && !rOther.maClipPoly.count() + && !rOther.maPendingPolygons.count() ) + { + maPendingRanges.appendPolyRange( rOther.maPendingRanges ); + } + else + { + commitPendingRanges(); + commitPendingPolygons(); + rOther.commitPendingRanges(); + rOther.commitPendingPolygons(); + + maPendingPolygons = rOther.maClipPoly; + mePendingOps = eOp; + } + } + + void unionRange(const B2DRange& rRange) + { + if( isCleared() ) + return; + + addRange(rRange,UNION); + } + + void unionPolygon(const B2DPolygon& rPoly) + { + if( isCleared() ) + return; + + addPolygon(rPoly,UNION); + } + + void unionPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + if( isCleared() ) + return; + + addPolyPolygon(rPolyPoly,UNION); + } + + void unionClipState(const ImplB2DClipState& rOther) + { + if( isCleared() ) + return; + + addClipState(rOther, UNION); + } + + void intersectRange(const B2DRange& rRange) + { + if( isNull() ) + return; + + addRange(rRange,INTERSECT); + } + + void intersectPolygon(const B2DPolygon& rPoly) + { + if( isNull() ) + return; + + addPolygon(rPoly,INTERSECT); + } + + void intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + if( isNull() ) + return; + + addPolyPolygon(rPolyPoly,INTERSECT); + } + + void intersectClipState(const ImplB2DClipState& rOther) + { + if( isNull() ) + return; + + addClipState(rOther, INTERSECT); + } + + void subtractRange(const B2DRange& rRange ) + { + if( isNull() ) + return; + + addRange(rRange,SUBTRACT); + } + + void subtractPolygon(const B2DPolygon& rPoly) + { + if( isNull() ) + return; + + addPolygon(rPoly,SUBTRACT); + } + + void subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + if( isNull() ) + return; + + addPolyPolygon(rPolyPoly,SUBTRACT); + } + + void subtractClipState(const ImplB2DClipState& rOther) + { + if( isNull() ) + return; + + addClipState(rOther, SUBTRACT); + } + + void xorRange(const B2DRange& rRange) + { + addRange(rRange,XOR); + } + + void xorPolygon(const B2DPolygon& rPoly) + { + addPolygon(rPoly,XOR); + } + + void xorPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + addPolyPolygon(rPolyPoly,XOR); + } + + void xorClipState(const ImplB2DClipState& rOther) + { + addClipState(rOther, XOR); + } + + B2DPolyPolygon getClipPoly() const + { + commitPendingRanges(); + commitPendingPolygons(); + + return maClipPoly; + } + + private: + void commitPendingPolygons() const + { + if( !maPendingPolygons.count() ) + return; + + // assumption: maClipPoly has kept polygons prepared for + // clipping; i.e. no neutral polygons & correct + // orientation + maPendingPolygons = tools::prepareForPolygonOperation(maPendingPolygons); + const bool bIsEmpty=isNullClipPoly(); + const bool bIsCleared=!maClipPoly.count(); + switch(mePendingOps) + { + case UNION: + OSL_ASSERT( !bIsCleared ); + + if( bIsEmpty ) + maClipPoly = maPendingPolygons; + else + maClipPoly = tools::solvePolygonOperationOr( + maClipPoly, + maPendingPolygons); + break; + case INTERSECT: + OSL_ASSERT( !bIsEmpty ); + + if( bIsCleared ) + maClipPoly = maPendingPolygons; + else + maClipPoly = tools::solvePolygonOperationAnd( + maClipPoly, + maPendingPolygons); + break; + case XOR: + if( bIsEmpty ) + maClipPoly = maPendingPolygons; + else if( bIsCleared ) + { + // not representable, strictly speaking, + // using polygons with the common even/odd + // or nonzero winding number fill rule. If + // we'd want to represent it, fill rule + // would need to be "non-negative winding + // number" (and we then would return + // 'holes' here) + + // going for an ugly hack meanwhile + maClipPoly = tools::solvePolygonOperationXor( + B2DPolyPolygon( + tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))), + maPendingPolygons); + } + else + maClipPoly = tools::solvePolygonOperationXor( + maClipPoly, + maPendingPolygons); + break; + case SUBTRACT: + OSL_ASSERT( !bIsEmpty ); + + // first union all pending ones, subtract en bloc then + maPendingPolygons = solveCrossovers(maPendingPolygons); + maPendingPolygons = stripNeutralPolygons(maPendingPolygons); + maPendingPolygons = stripDispensablePolygons(maPendingPolygons, false); + + if( bIsCleared ) + { + // not representable, strictly speaking, + // using polygons with the common even/odd + // or nonzero winding number fill rule. If + // we'd want to represent it, fill rule + // would need to be "non-negative winding + // number" (and we then would return + // 'holes' here) + + // going for an ugly hack meanwhile + maClipPoly = tools::solvePolygonOperationDiff( + B2DPolyPolygon( + tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))), + maPendingPolygons); + } + else + maClipPoly = tools::solvePolygonOperationDiff( + maClipPoly, + maPendingPolygons); + break; + } + + maPendingPolygons.clear(); + mePendingOps = UNION; + } + + void commitPendingRanges() const + { + if( !maPendingRanges.count() ) + return; + + // use the specialized range clipper for the win + B2DPolyPolygon aCollectedRanges; + const bool bIsEmpty=isNullClipPoly(); + const bool bIsCleared=!maClipPoly.count(); + switch(mePendingOps) + { + case UNION: + OSL_ASSERT( !bIsCleared ); + + aCollectedRanges = maPendingRanges.solveCrossovers(); + aCollectedRanges = stripNeutralPolygons(aCollectedRanges); + aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false); + if( bIsEmpty ) + maClipPoly = aCollectedRanges; + else + maClipPoly = tools::solvePolygonOperationOr( + maClipPoly, + aCollectedRanges); + break; + case INTERSECT: + OSL_ASSERT( !bIsEmpty ); + + aCollectedRanges = maPendingRanges.solveCrossovers(); + aCollectedRanges = stripNeutralPolygons(aCollectedRanges); + if( maPendingRanges.count() > 1 ) + aCollectedRanges = stripDispensablePolygons(aCollectedRanges, true); + + if( bIsCleared ) + maClipPoly = aCollectedRanges; + else + maClipPoly = tools::solvePolygonOperationAnd( + maClipPoly, + aCollectedRanges); + break; + case XOR: + aCollectedRanges = maPendingRanges.solveCrossovers(); + aCollectedRanges = stripNeutralPolygons(aCollectedRanges); + aCollectedRanges = correctOrientations(aCollectedRanges); + + if( bIsEmpty ) + maClipPoly = aCollectedRanges; + else if( bIsCleared ) + { + // not representable, strictly speaking, + // using polygons with the common even/odd + // or nonzero winding number fill rule. If + // we'd want to represent it, fill rule + // would need to be "non-negative winding + // number" (and we then would return + // 'holes' here) + + // going for an ugly hack meanwhile + maClipPoly = tools::solvePolygonOperationXor( + B2DPolyPolygon( + tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))), + aCollectedRanges); + } + else + maClipPoly = tools::solvePolygonOperationXor( + maClipPoly, + aCollectedRanges); + break; + case SUBTRACT: + OSL_ASSERT( !bIsEmpty ); + + // first union all pending ranges, subtract en bloc then + aCollectedRanges = maPendingRanges.solveCrossovers(); + aCollectedRanges = stripNeutralPolygons(aCollectedRanges); + aCollectedRanges = stripDispensablePolygons(aCollectedRanges, false); + + if( bIsCleared ) + { + // not representable, strictly speaking, + // using polygons with the common even/odd + // or nonzero winding number fill rule. If + // we'd want to represent it, fill rule + // would need to be "non-negative winding + // number" (and we then would return + // 'holes' here) + + // going for an ugly hack meanwhile + maClipPoly = tools::solvePolygonOperationDiff( + B2DPolyPolygon( + tools::createPolygonFromRect(B2DRange(-1E20,-1E20,1E20,1E20))), + aCollectedRanges); + } + else + maClipPoly = tools::solvePolygonOperationDiff( + maClipPoly, + aCollectedRanges); + break; + } + + maPendingRanges.clear(); + mePendingOps = UNION; + } + + mutable B2DPolyPolygon maPendingPolygons; + mutable B2DPolyRange maPendingRanges; + mutable B2DPolyPolygon maClipPoly; + mutable Operation mePendingOps; + }; + + B2DClipState::B2DClipState() : + mpImpl() + {} + + B2DClipState::~B2DClipState() + {} + + B2DClipState::B2DClipState( const B2DClipState& rOrig ) : + mpImpl(rOrig.mpImpl) + {} + + B2DClipState::B2DClipState( const B2DRange& rRange ) : + mpImpl( ImplB2DClipState(rRange) ) + {} + + B2DClipState::B2DClipState( const B2DPolygon& rPoly ) : + mpImpl( ImplB2DClipState(rPoly) ) + {} + + B2DClipState::B2DClipState( const B2DPolyPolygon& rPolyPoly ) : + mpImpl( ImplB2DClipState(rPolyPoly) ) + {} + + B2DClipState& B2DClipState::operator=( const B2DClipState& rRHS ) + { + mpImpl = rRHS.mpImpl; + return *this; + } + + void B2DClipState::makeUnique() + { + mpImpl.make_unique(); + } + + void B2DClipState::makeNull() + { + mpImpl->makeNull(); + } + + bool B2DClipState::isNull() const + { + return mpImpl->isNull(); + } + + void B2DClipState::makeClear() + { + mpImpl->makeClear(); + } + + bool B2DClipState::isCleared() const + { + return mpImpl->isCleared(); + } + + bool B2DClipState::operator==(const B2DClipState& rRHS) const + { + if(mpImpl.same_object(rRHS.mpImpl)) + return true; + + return ((*mpImpl) == (*rRHS.mpImpl)); + } + + bool B2DClipState::operator!=(const B2DClipState& rRHS) const + { + return !(*this == rRHS); + } + + void B2DClipState::unionRange(const B2DRange& rRange) + { + mpImpl->unionRange(rRange); + } + + void B2DClipState::unionPolygon(const B2DPolygon& rPoly) + { + mpImpl->unionPolygon(rPoly); + } + + void B2DClipState::unionPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + mpImpl->unionPolyPolygon(rPolyPoly); + } + + void B2DClipState::unionClipState(const B2DClipState& rState) + { + mpImpl->unionClipState(*rState.mpImpl); + } + + void B2DClipState::intersectRange(const B2DRange& rRange) + { + mpImpl->intersectRange(rRange); + } + + void B2DClipState::intersectPolygon(const B2DPolygon& rPoly) + { + mpImpl->intersectPolygon(rPoly); + } + + void B2DClipState::intersectPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + mpImpl->intersectPolyPolygon(rPolyPoly); + } + + void B2DClipState::intersectClipState(const B2DClipState& rState) + { + mpImpl->intersectClipState(*rState.mpImpl); + } + + void B2DClipState::subtractRange(const B2DRange& rRange) + { + mpImpl->subtractRange(rRange); + } + + void B2DClipState::subtractPolygon(const B2DPolygon& rPoly) + { + mpImpl->subtractPolygon(rPoly); + } + + void B2DClipState::subtractPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + mpImpl->subtractPolyPolygon(rPolyPoly); + } + + void B2DClipState::subtractClipState(const B2DClipState& rState) + { + mpImpl->subtractClipState(*rState.mpImpl); + } + + void B2DClipState::xorRange(const B2DRange& rRange) + { + mpImpl->xorRange(rRange); + } + + void B2DClipState::xorPolygon(const B2DPolygon& rPoly) + { + mpImpl->xorPolygon(rPoly); + } + + void B2DClipState::xorPolyPolygon(const B2DPolyPolygon& rPolyPoly) + { + mpImpl->xorPolyPolygon(rPolyPoly); + } + + void B2DClipState::xorClipState(const B2DClipState& rState) + { + mpImpl->xorClipState(*rState.mpImpl); + } + + B2DPolyPolygon B2DClipState::getClipPoly() const + { + return mpImpl->getClipPoly(); + } + +} // end of namespace tools +} // end of namespace basegfx + +// eof diff --git a/basegfx/source/tools/makefile.mk b/basegfx/source/tools/makefile.mk index d55bbae12f8f..1b19505bd331 100755 --- a/basegfx/source/tools/makefile.mk +++ b/basegfx/source/tools/makefile.mk @@ -41,7 +41,8 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- -SLOFILES= $(SLO)$/canvastools.obj \ +SLOFILES= $(SLO)$/b2dclipstate.obj \ + $(SLO)$/canvastools.obj \ $(SLO)$/gradienttools.obj \ $(SLO)$/debugplotter.obj \ $(SLO)$/keystoplerp.obj \ diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 32128b927049..e30e6bf561c1 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -321,6 +321,12 @@ public: aRange.getElement(0).head == B2DRange(0,0,1,1)); CPPUNIT_ASSERT_MESSAGE("simple poly range - second element", aRange.getElement(1).head == B2DRange(2,2,3,3)); + + // B2DPolyRange relies on correctly orientated rects + const B2DRange aRect(0,0,1,1); + CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation", + tools::getOrientation( + tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE ); } // Change the following lines only, if you add, remove or rename diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx new file mode 100644 index 000000000000..38b18d57003f --- /dev/null +++ b/basegfx/test/clipstate.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: basegfx2d.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +// autogenerated file with codegen.pl + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::basegfx; + + +namespace basegfx2d +{ + +class clipstate : public CppUnit::TestFixture +{ +private: + tools::B2DClipState aUnion1; + tools::B2DClipState aUnion2; + tools::B2DClipState aIntersect; + tools::B2DClipState aXor; + tools::B2DClipState aSubtract; + +public: + void setUp() + { + B2DRange aCenter(100, 100, -100, -100); + B2DRange aNorth(-10, -110, 10, -90); + B2DRange aWest(-110, -10, -90, 10); + B2DRange aSouth(-10, 110, 10, 90); + B2DRange aEast(110, -10, 90, 10); + + aUnion1.unionRange(aCenter); + aUnion1.unionRange(aNorth); + aUnion1.unionRange(aWest); + aUnion1.unionRange(aSouth); + aUnion1.unionRange(aEast); + + aUnion2.makeNull(); + aUnion2.unionRange(aCenter); + aUnion2.unionRange(aNorth); + aUnion2.unionRange(aWest); + aUnion2.unionRange(aSouth); + aUnion2.unionRange(aEast); + + aIntersect.intersectRange(aCenter); + aIntersect.intersectRange(aNorth); + aIntersect.intersectRange(aWest); + aIntersect.intersectRange(aSouth); + aIntersect.intersectRange(aEast); + + aXor.makeNull(); + aXor.xorRange(aCenter); + aXor.xorRange(aNorth); + aXor.xorRange(aWest); + aXor.xorRange(aSouth); + aXor.xorRange(aEast); + + aSubtract.intersectRange(aCenter); + aSubtract.subtractRange(aNorth); + aSubtract.subtractRange(aWest); + aSubtract.subtractRange(aSouth); + aSubtract.subtractRange(aEast); + } + + void tearDown() + {} + + void verifyPoly(const char* sName, const char* sSvg, const tools::B2DClipState& toTest) + { +#if defined(VERBOSE) + fprintf(stderr, "%s - svg:d=\"%s\"\n", + sName, rtl::OUStringToOString( + basegfx::tools::exportToSvgD(toTest.getClipPoly()), + RTL_TEXTENCODING_UTF8).getStr() ); +#endif + + B2DPolyPolygon aTmp1; + CPPUNIT_ASSERT_MESSAGE(sName, + tools::importFromSvgD( + aTmp1, + rtl::OUString::createFromAscii(sSvg))); + + const rtl::OUString aSvg= + tools::exportToSvgD(toTest.getClipPoly()); + B2DPolyPolygon aTmp2; + CPPUNIT_ASSERT_MESSAGE(sName, + tools::importFromSvgD( + aTmp2, + aSvg)); + + CPPUNIT_ASSERT_MESSAGE( + sName, + aTmp2 == aTmp1); + } + + void verifySimpleRange() + { + const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; + const char* intersectSvg="m-100 10v-20h10v20zm80 90v-10h20v10zm-20-190v-10h20v10zm80 100v-20h10v20z"; + const char* xorSvg="m-100 10h10v-20h-10zm90 110h20v-10h-20zm0-180h20v-10h-20zm100 110h10v-20h-10zm10 20v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; + const char* subtractSvg="m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z"; + + CPPUNIT_ASSERT_MESSAGE("cleared clip stays empty under union operation", + aUnion1.isCleared()); + verifyPoly("union", unionSvg, aUnion2); + verifyPoly("intersect", intersectSvg, aIntersect); + verifyPoly("xor", xorSvg, aXor); + verifyPoly("subtract", subtractSvg, aSubtract); + } + + void verifyMixedClips() + { + tools::B2DClipState aMixedClip; + + const char* unionSvg="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; + + B2DPolyPolygon aTmp1; + tools::importFromSvgD( + aTmp1, + rtl::OUString::createFromAscii(unionSvg)); + + aMixedClip.intersectPolyPolygon(aTmp1); + aMixedClip.subtractRange(B2DRange(-20,-150,20,0)); + aMixedClip.subtractRange(B2DRange(-150,-20,0,20)); + aMixedClip.xorRange(B2DRange(-150,-150,150,150)); + + const char* mixedClipSvg="m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-40-20v-80h-80v80zm-50 170v-300h300v300z"; + verifyPoly("mixed clip", mixedClipSvg, aMixedClip); + } + + CPPUNIT_TEST_SUITE(clipstate); + CPPUNIT_TEST(verifySimpleRange); + CPPUNIT_TEST(verifyMixedClips); + CPPUNIT_TEST_SUITE_END(); +}; + +// ----------------------------------------------------------------------------- +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::clipstate, "clipstate"); +} // namespace basegfx2d + + +// ----------------------------------------------------------------------------- + +// this macro creates an empty function, which will called by the RegisterAllFunctions() +// to let the user the possibility to also register some functions by hand. +// NOADDITIONAL; + diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx new file mode 100644 index 000000000000..9ab903ca1541 --- /dev/null +++ b/basegfx/test/genericclipper.cxx @@ -0,0 +1,168 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: basegfx2d.cxx,v $ + * $Revision: 1.14 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_basegfx.hxx" +// autogenerated file with codegen.pl + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace ::basegfx; + + +namespace basegfx2d +{ + +class genericclipper : public CppUnit::TestFixture +{ +private: + B2DPolygon aSelfIntersecting; + B2DPolygon aShiftedRectangle; + +public: + // initialise your test code values here. + void setUp() + { + aSelfIntersecting.append(B2DPoint(0, 0)); + aSelfIntersecting.append(B2DPoint(0, 100)); + aSelfIntersecting.append(B2DPoint(75, 100)); + aSelfIntersecting.append(B2DPoint(75, 50)); + aSelfIntersecting.append(B2DPoint(25, 50)); + aSelfIntersecting.append(B2DPoint(25, 150)); + aSelfIntersecting.append(B2DPoint(100,150)); + aSelfIntersecting.append(B2DPoint(100,0)); + aSelfIntersecting.setClosed(true); + + aShiftedRectangle = tools::createPolygonFromRect( + B2DRange(0,90,20,150)); + } + + void tearDown() + {} + + void validate(const char* pName, + const char* pValidSvgD, + B2DPolyPolygon (*pFunc)(const B2DPolyPolygon&, const B2DPolyPolygon&)) + { + const B2DPolyPolygon aSelfIntersect( + tools::prepareForPolygonOperation(aSelfIntersecting)); + const B2DPolyPolygon aRect( + tools::prepareForPolygonOperation(aShiftedRectangle)); +#if defined(VERBOSE) + fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n", + pName, rtl::OUStringToOString( + basegfx::tools::exportToSvgD( + aSelfIntersect), + RTL_TEXTENCODING_UTF8).getStr() ); + fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n", + pName, rtl::OUStringToOString( + basegfx::tools::exportToSvgD( + aRect), + RTL_TEXTENCODING_UTF8).getStr() ); +#endif + + const B2DPolyPolygon aRes= + pFunc(aSelfIntersect, aRect); + +#if defined(VERBOSE) + fprintf(stderr, "%s - svg:d=\"%s\"\n", + pName, rtl::OUStringToOString( + basegfx::tools::exportToSvgD(aRes), + RTL_TEXTENCODING_UTF8).getStr() ); +#endif + + rtl::OUString aValid=rtl::OUString::createFromAscii(pValidSvgD); + + CPPUNIT_ASSERT_MESSAGE(pName, + basegfx::tools::exportToSvgD(aRes) == aValid); + } + + void validateOr() + { + const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 10v-50h-50v50z"; + validate("validateOr", pValid, &tools::solvePolygonOperationOr); + } + + void validateXor() + { + const char* pValid="m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 10h20v-10h-20zm75 10v-50h-50v50z"; + validate("validateXor", pValid, &tools::solvePolygonOperationXor); + } + + void validateAnd() + { + const char* pValid="m0 100v-10h20v10z"; + validate("validateAnd", pValid, &tools::solvePolygonOperationAnd); + } + + void validateDiff() + { + const char* pValid="m0 90v-90h100v150h-75v-50h-5v-10zm55 10v-50h-50v50z"; + validate("validateDiff", pValid, &tools::solvePolygonOperationDiff); + } + + // Change the following lines only, if you add, remove or rename + // member functions of the current class, + // because these macros are need by auto register mechanism. + + CPPUNIT_TEST_SUITE(genericclipper); + CPPUNIT_TEST(validateOr); + CPPUNIT_TEST(validateXor); + CPPUNIT_TEST(validateAnd); + CPPUNIT_TEST(validateDiff); + CPPUNIT_TEST_SUITE_END(); +}; + +// ----------------------------------------------------------------------------- +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::genericclipper, "genericclipper"); +} // namespace basegfx2d + + +// ----------------------------------------------------------------------------- + +// this macro creates an empty function, which will called by the RegisterAllFunctions() +// to let the user the possibility to also register some functions by hand. +// NOADDITIONAL; + diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index cf6c96d4d850..631eb32edc0e 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -43,10 +43,13 @@ ENABLE_EXCEPTIONS=TRUE # --- Common ---------------------------------------------------------- SHL1OBJS= \ - $(SLO)$/basegfx1d.obj \ - $(SLO)$/basegfx2d.obj \ - $(SLO)$/basegfx3d.obj \ - $(SLO)$/basegfxtools.obj \ + $(SLO)$/basegfx1d.obj \ + $(SLO)$/basegfx2d.obj \ + $(SLO)$/basegfx3d.obj \ + $(SLO)$/boxclipper.obj \ + $(SLO)$/basegfxtools.obj \ + $(SLO)$/clipstate.obj \ + $(SLO)$/genericclipper.obj \ $(SLO)$/testtools.obj # linking statically against basegfx parts -- cgit From d3356548cf6aa4c53cb4c17395df82e8bbdea88f Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 16 Oct 2009 00:59:42 +0200 Subject: #i105939# Side-tracked by extensive unit test slowness - fixed by properly using strbuf in svg exporter --- basegfx/source/polygon/b2dsvgpolypolygon.cxx | 51 +++++++++++++++------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 2247c237d90f..c18e6d5e5af8 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -67,10 +67,8 @@ namespace basegfx } } - inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true) + inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool bSignAllowed = true) { - const sal_Unicode aChar(rStr[nPos]); - const bool bPredicate( (sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar) || (bSignAllowed && sal_Unicode('+') == aChar) || (bSignAllowed && sal_Unicode('-') == aChar) ); @@ -78,6 +76,12 @@ namespace basegfx return bPredicate; } + inline bool lcl_isOnNumberChar(const ::rtl::OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true) + { + return lcl_isOnNumberChar(rStr[nPos], + bSignAllowed); + } + bool lcl_getDoubleChar(double& o_fRetval, sal_Int32& io_rPos, const ::rtl::OUString& rStr, @@ -233,16 +237,16 @@ namespace basegfx lcl_skipSpacesAndCommas(io_rPos, rStr, nLen); } - void lcl_putNumberChar( ::rtl::OUString& rStr, - double fValue ) + void lcl_putNumberChar( ::rtl::OUStringBuffer& rStr, + double fValue ) { - rStr += ::rtl::OUString::valueOf( fValue ); + rStr.append( fValue ); } - void lcl_putNumberCharWithSpace( ::rtl::OUString& rStr, - double fValue, - double fOldValue, - bool bUseRelativeCoordinates ) + void lcl_putNumberCharWithSpace( ::rtl::OUStringBuffer& rStr, + double fValue, + double fOldValue, + bool bUseRelativeCoordinates ) { if( bUseRelativeCoordinates ) fValue -= fOldValue; @@ -250,11 +254,10 @@ namespace basegfx const sal_Int32 aLen( rStr.getLength() ); if(aLen) { - if( lcl_isOnNumberChar(rStr, aLen - 1, false) && + if( lcl_isOnNumberChar(rStr.charAt(aLen - 1), false) && fValue >= 0.0 ) { - rStr += ::rtl::OUString::valueOf( - sal_Unicode(' ') ); + rStr.append( sal_Unicode(' ') ); } } @@ -879,7 +882,7 @@ namespace basegfx bool bDetectQuadraticBeziers) { const sal_uInt32 nCount(rPolyPolygon.count()); - ::rtl::OUString aResult; + ::rtl::OUStringBuffer aResult; B2DPoint aCurrentSVGPosition(0.0, 0.0); // SVG assumes (0,0) as the initial current point for(sal_uInt32 i(0); i < nCount; i++) @@ -896,7 +899,7 @@ namespace basegfx // handle polygon start point B2DPoint aEdgeStart(aPolygon.getB2DPoint(0)); - aResult += ::rtl::OUString::valueOf(lcl_getCommand('M', 'm', bUseRelativeCoordinates)); + aResult.append(lcl_getCommand('M', 'm', bUseRelativeCoordinates)); lcl_putNumberCharWithSpace(aResult, aEdgeStart.getX(), aCurrentSVGPosition.getX(), bUseRelativeCoordinates); lcl_putNumberCharWithSpace(aResult, aEdgeStart.getY(), aCurrentSVGPosition.getY(), bUseRelativeCoordinates); aLastSVGCommand = lcl_getCommand('L', 'l', bUseRelativeCoordinates); @@ -957,7 +960,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -972,7 +975,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -993,7 +996,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -1010,7 +1013,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -1049,7 +1052,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -1063,7 +1066,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -1077,7 +1080,7 @@ namespace basegfx if(aLastSVGCommand != aCommand) { - aResult += ::rtl::OUString::valueOf(aCommand); + aResult.append(aCommand); aLastSVGCommand = aCommand; } @@ -1095,12 +1098,12 @@ namespace basegfx // close path if closed poly (Z and z are equivalent here, but looks nicer when case is matched) if(aPolygon.isClosed()) { - aResult += ::rtl::OUString::valueOf(lcl_getCommand('Z', 'z', bUseRelativeCoordinates)); + aResult.append(lcl_getCommand('Z', 'z', bUseRelativeCoordinates)); } } } - return aResult; + return aResult.makeStringAndClear(); } } } -- cgit From 42c0c069b71db77b3a0f1617dac3c569df798625 Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 16 Oct 2009 22:58:23 +0200 Subject: #i105939# Decided returning by const ref was a bad idea, coupling- and in terms of unwanted side effects (think vector re-allocating the mem). Fixed iterator-to-ptr conversion for obvious oversights. --- basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 6 +++--- basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx | 2 +- basegfx/inc/basegfx/range/b2dpolyrange.hxx | 2 +- basegfx/source/polygon/b2dpolygon.cxx | 24 ++++++++++++++++++------ basegfx/source/polygon/b2dpolypolygon.cxx | 20 ++++++++++++++++---- basegfx/source/range/b2dpolyrange.cxx | 20 ++++++++++++++++---- 6 files changed, 55 insertions(+), 19 deletions(-) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index fb33a7d9b1fe..91544220f6ae 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -83,7 +83,7 @@ namespace basegfx sal_uInt32 count() const; /// Coordinate interface - const basegfx::B2DPoint& getB2DPoint(sal_uInt32 nIndex) const; + basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const; void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue); /// Coordinate insert/append @@ -201,7 +201,7 @@ namespace basegfx @return The outer range of the bezier curve/polygon */ - const B2DRange& getB2DRange() const; + B2DRange getB2DRange() const; /** insert other 2D polygons @@ -262,7 +262,7 @@ namespace basegfx /// apply transformation given in matrix form void transform(const basegfx::B2DHomMatrix& rMatrix); - // point iterators + // point iterators (same iterator validity conditions as for vector) const B2DPoint* begin() const; const B2DPoint* end() const; B2DPoint* begin(); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx index 7b8119c5e43f..cff356de6d02 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx @@ -129,7 +129,7 @@ namespace basegfx // apply transformation given in matrix form to the polygon void transform(const basegfx::B2DHomMatrix& rMatrix); - // polygon iterators + // polygon iterators (same iterator validity conditions as for vector) const B2DPolygon* begin() const; const B2DPolygon* end() const; B2DPolygon* begin(); diff --git a/basegfx/inc/basegfx/range/b2dpolyrange.hxx b/basegfx/inc/basegfx/range/b2dpolyrange.hxx index bd10bc15b7b5..2202869dc921 100644 --- a/basegfx/inc/basegfx/range/b2dpolyrange.hxx +++ b/basegfx/inc/basegfx/range/b2dpolyrange.hxx @@ -131,7 +131,7 @@ namespace basegfx */ B2DPolyPolygon solveCrossovers() const; - // element iterators + // element iterators (same iterator validity conditions as for vector) const B2DRange* begin() const; const B2DRange* end() const; B2DRange* begin(); diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index ccf45d31cbbc..0f70c7efafda 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -210,22 +210,34 @@ public: const basegfx::B2DPoint* begin() const { - return &maVector.front(); + if(maVector.empty()) + return 0; + else + return &maVector.front(); } const basegfx::B2DPoint* end() const { - return &maVector[maVector.size()]; + if(maVector.empty()) + return 0; + else + return (&maVector.back())+1; } basegfx::B2DPoint* begin() { - return &maVector.front(); + if(maVector.empty()) + return 0; + else + return &maVector.front(); } basegfx::B2DPoint* end() { - return &maVector[maVector.size()]; + if(maVector.empty()) + return 0; + else + return (&maVector.back())+1; } }; @@ -1201,7 +1213,7 @@ namespace basegfx return mpPolygon->count(); } - const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const + B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); @@ -1460,7 +1472,7 @@ namespace basegfx return mpPolygon->getDefaultAdaptiveSubdivision(*this); } - const B2DRange& B2DPolygon::getB2DRange() const + B2DRange B2DPolygon::getB2DRange() const { return mpPolygon->getB2DRange(*this); } diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index af63bbccf8d4..2acc1a31a369 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -169,22 +169,34 @@ public: const basegfx::B2DPolygon* begin() const { - return &maPolygons.front(); + if(maPolygons.empty()) + return 0; + else + return &maPolygons.front(); } const basegfx::B2DPolygon* end() const { - return &maPolygons[maPolygons.size()]; + if(maPolygons.empty()) + return 0; + else + return (&maPolygons.back())+1; } basegfx::B2DPolygon* begin() { - return &maPolygons.front(); + if(maPolygons.empty()) + return 0; + else + return &maPolygons.front(); } basegfx::B2DPolygon* end() { - return &maPolygons[maPolygons.size()]; + if(maPolygons.empty()) + return 0; + else + return &(maPolygons.back())+1; } }; diff --git a/basegfx/source/range/b2dpolyrange.cxx b/basegfx/source/range/b2dpolyrange.cxx index d35af8f5dd0c..e212e083ef55 100644 --- a/basegfx/source/range/b2dpolyrange.cxx +++ b/basegfx/source/range/b2dpolyrange.cxx @@ -229,22 +229,34 @@ namespace basegfx const B2DRange* begin() const { - return &maRanges.front(); + if(maRanges.empty()) + return 0; + else + return &maRanges.front(); } const B2DRange* end() const { - return &maRanges[maRanges.size()]; + if(maRanges.empty()) + return 0; + else + return (&maRanges.back())+1; } B2DRange* begin() { - return &maRanges.front(); + if(maRanges.empty()) + return 0; + else + return &maRanges.front(); } B2DRange* end() { - return &maRanges[maRanges.size()]; + if(maRanges.empty()) + return 0; + else + return (&maRanges.back())+1; } private: -- cgit From 975d4e7e486714b4111fb69f8c1fa43dad97ef1e Mon Sep 17 00:00:00 2001 From: Dirk Völzke Date: Wed, 4 Nov 2009 13:45:04 +0000 Subject: #i105452# Added Throbber to list of available service names of the dialog --- toolkit/source/controls/dialogcontrol.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 07d459a6111a..e15267d5b258 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -46,6 +46,9 @@ #include "toolkit/controls/tkscrollbar.hxx" #endif #include +#include +#include + #include #include #include @@ -456,6 +459,10 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt pNewModel = new OGeometryControlModel< UnoTreeModel >; else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 ) pNewModel = new OGeometryControlModel< UnoGridModel >; + else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoSimpleAnimationControlModel ) == 0 ) + pNewModel = new OGeometryControlModel< UnoSimpleAnimationControlModel >; + else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoThrobberControlModel ) == 0 ) + pNewModel = new OGeometryControlModel< UnoThrobberControlModel >; if ( !pNewModel ) { @@ -495,7 +502,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th static Sequence< ::rtl::OUString >* pNamesSeq = NULL; if ( !pNamesSeq ) { - pNamesSeq = new Sequence< ::rtl::OUString >( 21 ); + pNamesSeq = new Sequence< ::rtl::OUString >( 24 ); ::rtl::OUString* pNames = pNamesSeq->getArray(); pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ); pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ); @@ -518,8 +525,9 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel ); pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel ); pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel ); - pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel ); - + pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel ); + pNames[22] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel ); + pNames[23] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel ); } return *pNamesSeq; } -- cgit From f445cd28e4a7f67552b310db1a6a615e1989f01f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 16 Nov 2009 11:40:47 -0500 Subject: #i26826# #i46511# initial implementation of automatic decimal adjustment. Just applied patches from ooo-build. There still may be issues that need to be worked out. --- svtools/inc/svtools/zforlist.hxx | 7 +- svtools/inc/svtools/zformat.hxx | 7 ++ svtools/source/numbers/zforlist.cxx | 9 ++- svtools/source/numbers/zformat.cxx | 144 ++++++++++++++++++++++++++++-------- svtools/source/numbers/zforscan.cxx | 2 +- svtools/source/numbers/zforscan.hxx | 6 +- 6 files changed, 135 insertions(+), 40 deletions(-) diff --git a/svtools/inc/svtools/zforlist.hxx b/svtools/inc/svtools/zforlist.hxx index 814ca385d61a..51ff30738dc1 100644 --- a/svtools/inc/svtools/zforlist.hxx +++ b/svtools/inc/svtools/zforlist.hxx @@ -336,6 +336,11 @@ class SvNumberFormatterRegistry_Impl; class SVT_DLLPUBLIC SvNumberFormatter { public: + /** + * We can't technically have an "infinite" value, so we use an arbitrary + * upper precision threshold to represent the "unlimited" precision. + */ + static const sal_uInt16 UNLIMITED_PRECISION; /// Preferred ctor with service manager and language/country enum SvNumberFormatter( @@ -586,7 +591,7 @@ public: /// Return the reference date Date* GetNullDate(); /// Return the standard decimal precision - short GetStandardPrec(); + sal_uInt16 GetStandardPrec(); /// Return whether zero suppression is switched on BOOL GetNoZero() { return bNoZero; } /** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry), diff --git a/svtools/inc/svtools/zformat.hxx b/svtools/inc/svtools/zformat.hxx index ae7d961c0bc6..ef567acf32df 100644 --- a/svtools/inc/svtools/zformat.hxx +++ b/svtools/inc/svtools/zformat.hxx @@ -239,6 +239,12 @@ public: // in fact that could be any string used in number formats. static void LoadString( SvStream& rStream, String& rStr ); + /** + * Get output string from a numeric value that fits the number of + * characters specified. + */ + bool GetOutputString( double fNumber, sal_uInt16 nCharCount, String& rOutString ) const; + BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor ); BOOL GetOutputString( String& sString, String& OutString, Color** ppColor ); @@ -490,6 +496,7 @@ private: // standard number output SVT_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); + SVT_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const; // numbers in input line SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx index b76bf3226b50..4edc58fb4428 100644 --- a/svtools/source/numbers/zforlist.cxx +++ b/svtools/source/numbers/zforlist.cxx @@ -70,6 +70,7 @@ #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -192,6 +193,8 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* ); /***********************Funktionen SvNumberFormatter**************************/ +const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits::max(); + SvNumberFormatter::SvNumberFormatter( const Reference< XMultiServiceFactory >& xSMgr, LanguageType eLang ) @@ -352,7 +355,7 @@ void SvNumberFormatter::ChangeStandardPrec(short nPrec) pFormatScanner->ChangeStandardPrec(nPrec); } -short SvNumberFormatter::GetStandardPrec() +sal_uInt16 SvNumberFormatter::GetStandardPrec() { return pFormatScanner->GetStandardPrec(); } @@ -1508,7 +1511,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung % eType = NUMBERFORMAT_NUMBER; nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(300); // Merkwert + ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert } sal_uInt32 nKey = nFIndex; switch ( eType ) @@ -1529,7 +1532,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() ) { nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(300); // Merkwert + ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert } pFormat->GetOutputString(fOutNumber, sOutString, &pColor); } diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx index 0afbf3b4a3f5..915be3adaf74 100644 --- a/svtools/source/numbers/zformat.cxx +++ b/svtools/source/numbers/zformat.cxx @@ -57,6 +57,9 @@ #include "numhead.hxx" #include #include "nfsymbol.hxx" + +#include + using namespace svt; namespace { @@ -66,6 +69,9 @@ struct Gregorian return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian")); } }; + +const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary... + } const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0 @@ -1777,47 +1783,62 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString) { - USHORT nStandardPrec = rScan.GetStandardPrec(); + sal_uInt16 nStandardPrec = rScan.GetStandardPrec(); + if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16 + { + nStandardPrec = ::std::min(nStandardPrec, static_cast(14)); // limits to 14 decimals OutString = ::rtl::math::doubleToUString( fNumber, rtl_math_StringFormat_E, nStandardPrec /*2*/, GetFormatter().GetNumDecimalSep().GetChar(0)); + } else - { + ImpGetOutputStdToPrecision(fNumber, OutString, nStandardPrec); +} + +void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutString, sal_uInt16 nPrecision) const +{ + // Make sure the precision doesn't go over the maximum allowable precision. + nPrecision = ::std::min(UPPER_PRECISION, nPrecision); + #if 0 { - // debugger test case for ANSI standard correctness - ::rtl::OUString aTest; - // expect 0.00123 OK - aTest = ::rtl::math::doubleToUString( 0.001234567, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect 123 OK - aTest = ::rtl::math::doubleToUString( 123.4567, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect 123.5 OK - aTest = ::rtl::math::doubleToUString( 123.4567, - rtl_math_StringFormat_G, 4, '.', sal_True ); - // expect 1e+03 (as 999.6 rounded to 3 significant digits results in - // 1000 with an exponent equal to significant digits) - // Currently (24-Jan-2003) we do fail in this case and output 1000 - // instead, negligible. - aTest = ::rtl::math::doubleToUString( 999.6, - rtl_math_StringFormat_G, 3, '.', sal_True ); - // expect what? result is 1.2e+004 - aTest = ::rtl::math::doubleToUString( 12345.6789, - rtl_math_StringFormat_G, -3, '.', sal_True ); + // debugger test case for ANSI standard correctness + ::rtl::OUString aTest; + // expect 0.00123 OK + aTest = ::rtl::math::doubleToUString( 0.001234567, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect 123 OK + aTest = ::rtl::math::doubleToUString( 123.4567, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect 123.5 OK + aTest = ::rtl::math::doubleToUString( 123.4567, + rtl_math_StringFormat_G, 4, '.', sal_True ); + // expect 1e+03 (as 999.6 rounded to 3 significant digits results in + // 1000 with an exponent equal to significant digits) + // Currently (24-Jan-2003) we do fail in this case and output 1000 + // instead, negligible. + aTest = ::rtl::math::doubleToUString( 999.6, + rtl_math_StringFormat_G, 3, '.', sal_True ); + // expect what? result is 1.2e+004 + aTest = ::rtl::math::doubleToUString( 12345.6789, + rtl_math_StringFormat_G, -3, '.', sal_True ); } #endif - OutString = ::rtl::math::doubleToUString( fNumber, - rtl_math_StringFormat_F, nStandardPrec /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), sal_True ); - if (OutString.GetChar(0) == '-' && - OutString.GetTokenCount('0') == OutString.Len()) - OutString.EraseLeadingChars('-'); // nicht -0 - } - ImpTransliterate( OutString, NumFor[0].GetNatNum() ); - return; + // If truncating the value to desired precision alters the original value, + // we should show the trailing zeros, otherwise strip them. + double fRounded = ::rtl::math::round(rNumber, nPrecision); + bool bRemoveZeros = ::rtl::math::approxEqual(fRounded, rNumber); + + rOutString = ::rtl::math::doubleToUString( rNumber, + rtl_math_StringFormat_F, nPrecision /*2*/, + GetFormatter().GetNumDecimalSep().GetChar(0), bRemoveZeros ); + if (rOutString.GetChar(0) == '-' && + rOutString.GetTokenCount('0') == rOutString.Len()) + rOutString.EraseLeadingChars('-'); // nicht -0 + + ImpTransliterate( rOutString, NumFor[0].GetNatNum() ); } void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString) @@ -1958,6 +1979,65 @@ ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y) } } +namespace { + +void lcl_GetOutputStringScientific( + double fNumber, sal_uInt16 nCharCount, const SvNumberFormatter& rFormatter, String& rOutString) +{ + bool bSign = ::rtl::math::isSignBitSet(fNumber); + + // 1.000E+015 (one digit and the decimal point, and the five chars for the exponential part, totalling 7). + sal_uInt16 nPrec = nCharCount > 7 ? nCharCount - 7 : 0; + if (nPrec && bSign) + // Make room for the negative sign. + --nPrec; + + nPrec = ::std::min(nPrec, static_cast(14)); // limit to 14 decimals. + + rOutString = ::rtl::math::doubleToUString( + fNumber, rtl_math_StringFormat_E, nPrec, rFormatter.GetNumDecimalSep().GetChar(0)); +} + +} + +bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, String& rOutString) const +{ + using namespace std; + + if (eType != NUMBERFORMAT_NUMBER) + return false; + + double fTestNum = fNumber; + bool bSign = ::rtl::math::isSignBitSet(fTestNum); + if (bSign) + fTestNum = -fTestNum; + + double fExp = log10(fTestNum); + // Values < 1.0 always have one digit before the decimal point. + sal_uInt16 nDigitPre = fExp >= 0.0 ? static_cast(ceil(fExp)) : 1; + + if (nDigitPre > 15) + { + lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString); + return true; + } + + sal_uInt16 nPrec = nCharCount >= nDigitPre ? nCharCount - nDigitPre : 0; + if (nPrec && bSign) + // Subtract the negative sign. + --nPrec; + if (nPrec) + // Subtract the decimal point. + --nPrec; + + ImpGetOutputStdToPrecision(fNumber, rOutString, nPrec); + if (rOutString.Len() > nCharCount) + // String still wider than desired. Switch to scientific notation. + lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString); + + return true; +} + BOOL SvNumberformat::GetOutputString(double fNumber, String& OutString, Color** ppColor) @@ -1981,7 +2061,7 @@ BOOL SvNumberformat::GetOutputString(double fNumber, BOOL bHadStandard = FALSE; if (bStandard) // einzelne Standardformate { - if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine + if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) // alle Zahlformate InputLine { ImpGetOutputInputLine(fNumber, OutString); return FALSE; diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx index 77b33226559c..dcdae90ae8a2 100644 --- a/svtools/source/numbers/zforscan.cxx +++ b/svtools/source/numbers/zforscan.cxx @@ -468,7 +468,7 @@ void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nY pNullDate = new Date(nDay, nMonth, nYear); } -void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec) +void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec) { nStandardPrec = nPrec; } diff --git a/svtools/source/numbers/zforscan.hxx b/svtools/source/numbers/zforscan.hxx index bc19ac5b633f..e873e838f3f2 100644 --- a/svtools/source/numbers/zforscan.hxx +++ b/svtools/source/numbers/zforscan.hxx @@ -57,7 +57,7 @@ public: void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear); // tauscht Referenzdatum aus - void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus + void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse @@ -96,7 +96,7 @@ public: InitKeywords(); return sNameStandardFormat; } - short GetStandardPrec() const { return nStandardPrec; } + sal_uInt16 GetStandardPrec() const { return nStandardPrec; } const Color& GetRedColor() const { return StandardColor[4]; } Color* GetColor(String& sStr); // Setzt Hauptfarben oder // definierte Farben @@ -161,7 +161,7 @@ private: // ---- privater Teil // Array der Standardfarben Date* pNullDate; // 30Dec1899 String sNameStandardFormat; // "Standard" - short nStandardPrec; // default Precision fuer Standardformat (2) + sal_uInt16 nStandardPrec; // default Precision for Standardformat SvNumberFormatter* pFormatter; // Pointer auf die Formatliste String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole -- cgit From b5c61b525cca0d0dbec58273a5209cdc45b742e6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 25 Nov 2009 16:49:20 +0000 Subject: #i51258# thesaurus for right click context menu --- vcl/source/window/seleng.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index 136d8ad968b7..3b24b34855c8 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -203,7 +203,11 @@ void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL bMod1 ) BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) { nFlags &= (~SELENG_CMDEVT); - if ( !pFunctionSet || !pWin || rMEvt.GetClicks() > 1 || rMEvt.IsRight() ) + if ( !pFunctionSet || !pWin ) + return FALSE; + const bool bRightClickCursorPositioning = + rMEvt.IsRight() && rMEvt.GetClicks() == 1 && !IsInSelection(); + if ( (rMEvt.GetClicks() > 1 || rMEvt.IsRight()) && !bRightClickCursorPositioning ) return FALSE; USHORT nModifier = rMEvt.GetModifier() | nLockedMods; -- cgit From 0ce0dd5863208500d8d4658f1f68f34e254ab015 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 1 Dec 2009 16:58:07 -0500 Subject: #i46511# Fixed one bug where the standard percent format incorrectly got unlimited precision. --- svtools/inc/svtools/zforlist.hxx | 6 ++++++ svtools/source/numbers/zforlist.cxx | 17 +++++++++-------- svtools/source/numbers/zformat.cxx | 11 +++++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/svtools/inc/svtools/zforlist.hxx b/svtools/inc/svtools/zforlist.hxx index 51ff30738dc1..5fd4ee5478da 100644 --- a/svtools/inc/svtools/zforlist.hxx +++ b/svtools/inc/svtools/zforlist.hxx @@ -342,6 +342,12 @@ public: */ static const sal_uInt16 UNLIMITED_PRECISION; + /** + * Precision suitable for numbers displayed in input bar, for instance + * Calc's formula input bar. + */ + static const sal_uInt16 INPUTSTRING_PRECISION; + /// Preferred ctor with service manager and language/country enum SvNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr, diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx index 4edc58fb4428..bb15e0ece1d6 100644 --- a/svtools/source/numbers/zforlist.cxx +++ b/svtools/source/numbers/zforlist.cxx @@ -193,7 +193,8 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* ); /***********************Funktionen SvNumberFormatter**************************/ -const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits::max(); +const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits::max(); +const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits::max()-1; SvNumberFormatter::SvNumberFormatter( const Reference< XMultiServiceFactory >& xSMgr, @@ -1492,7 +1493,6 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, String& sOutString) { SvNumberformat* pFormat; - short nOldPrec; Color* pColor; pFormat = (SvNumberformat*) aFTable.Get(nFIndex); if (!pFormat) @@ -1502,7 +1502,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED; if (eType == 0) eType = NUMBERFORMAT_DEFINED; - nOldPrec = -1; + sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec(); + bool bPrecChanged = false; if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT || eType == NUMBERFORMAT_CURRENCY || eType == NUMBERFORMAT_SCIENTIFIC @@ -1510,8 +1511,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, { if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung % eType = NUMBERFORMAT_NUMBER; - nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert + ChangeStandardPrec(INPUTSTRING_PRECISION); + bPrecChanged = true; } sal_uInt32 nKey = nFIndex; switch ( eType ) @@ -1531,12 +1532,12 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber, { if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() ) { - nOldPrec = pFormatScanner->GetStandardPrec(); - ChangeStandardPrec(UNLIMITED_PRECISION); // Merkwert + ChangeStandardPrec(INPUTSTRING_PRECISION); + bPrecChanged = true; } pFormat->GetOutputString(fOutNumber, sOutString, &pColor); } - if (nOldPrec != -1) + if (bPrecChanged) ChangeStandardPrec(nOldPrec); } diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx index 915be3adaf74..b137016efcff 100644 --- a/svtools/source/numbers/zformat.cxx +++ b/svtools/source/numbers/zformat.cxx @@ -2061,16 +2061,23 @@ BOOL SvNumberformat::GetOutputString(double fNumber, BOOL bHadStandard = FALSE; if (bStandard) // einzelne Standardformate { - if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) // alle Zahlformate InputLine + if (rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION) // alle Zahlformate InputLine { ImpGetOutputInputLine(fNumber, OutString); - return FALSE; + return false; } switch (eType) { case NUMBERFORMAT_NUMBER: // Standardzahlformat + { + if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) + { + ImpGetOutputInputLine(fNumber, OutString); + return false; + } ImpGetOutputStandard(fNumber, OutString); bHadStandard = TRUE; + } break; case NUMBERFORMAT_DATE: bRes |= ImpGetDateOutput(fNumber, 0, OutString); -- cgit From 81d3e5624bf44c7226e7041de093805b272a0dca Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Sun, 6 Dec 2009 19:11:23 +0100 Subject: renaissance01: #i107213# ignore grip on mouse move --- vcl/source/window/dockmgr.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index c587b7ad8441..940f2423e696 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -518,6 +518,7 @@ private: ImplDockingWindowWrapper* mpDockingWin; BOOL mbHighlight; BOOL mbMoving; + bool mbTrackingEnabled; Point maDelta; Point maTearOffPosition; void ImplSetBorder(); @@ -550,6 +551,7 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* mpDockingWin = pDockingWin; mbHighlight = FALSE; mbMoving = FALSE; + mbTrackingEnabled = FALSE; ImplSetBorder(); } @@ -736,7 +738,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled { - if( rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) + if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) { // start window move mbMoving = TRUE; @@ -758,6 +760,7 @@ void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) void ImplPopupFloatWin::MouseButtonUp( const MouseEvent& rMEvt ) { + mbTrackingEnabled = false; FloatingWindow::MouseButtonUp( rMEvt ); } @@ -772,6 +775,11 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt ) ImplMirrorFramePos(aState.maPos); maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel(); maDelta = aState.maPos - maTearOffPosition; + mbTrackingEnabled = true; + } + else + { + mbTrackingEnabled = false; } } -- cgit From 18be96dc73c64d16f63fc6d3382d7d7d3a8fee24 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 11 Dec 2009 14:29:59 +0100 Subject: sb118: Replace (heavily modified) CppUnit 1.8.0 with (unmodified) latest 1.12.1. - Old modifications were necessary for testshl2, which has simply been excluded from the build for now. - Tests in basebmp, basegfx, o3tl (that are executed during build) have been converted from using modified CppUnit/testshl2 to using unmodified CppUnit. - CppUnit's DllPlugInTester has problems with OOo tests on Windows, see #i107562#, so for now a new cppunittester from sal is used instead. --- basebmp/test/basictest.cxx | 15 ++++++--------- basebmp/test/bmpmasktest.cxx | 6 ++++-- basebmp/test/bmptest.cxx | 6 ++++-- basebmp/test/cliptest.cxx | 6 ++++-- basebmp/test/export.map | 2 +- basebmp/test/filltest.cxx | 6 ++++-- basebmp/test/linetest.cxx | 6 ++++-- basebmp/test/makefile.mk | 3 +-- basebmp/test/masktest.cxx | 6 ++++-- basebmp/test/polytest.cxx | 6 ++++-- basegfx/prj/build.lst | 2 +- basegfx/test/basegfx1d.cxx | 16 ++++++---------- basegfx/test/basegfx2d.cxx | 42 ++++++++++++++++++------------------------ basegfx/test/basegfx3d.cxx | 22 +++++++++------------- basegfx/test/export.map | 2 +- basegfx/test/makefile.mk | 3 +-- basegfx/test/tests.txt | 20 -------------------- o3tl/prj/build.lst | 2 +- o3tl/qa/export.map | 2 +- o3tl/qa/makefile.mk | 3 +-- o3tl/qa/test-cow_wrapper.cxx | 18 ++++++------------ o3tl/qa/test-heap_ptr.cxx | 6 ++++-- o3tl/qa/test-range.cxx | 7 ++++--- 23 files changed, 89 insertions(+), 118 deletions(-) delete mode 100644 basegfx/test/tests.txt diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 15d2da39851a..52693a41f129 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -30,7 +30,10 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include #include @@ -294,13 +297,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BasicTest, "BasicTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(BasicTest); } - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx index afadcad3b3fb..9c622157ca8f 100644 --- a/basebmp/test/bmpmasktest.cxx +++ b/basebmp/test/bmpmasktest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -180,7 +182,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BmpMaskTest, "BmpMaskTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(BmpMaskTest); } diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 33ed58c25402..92d0c9b50f67 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -207,7 +209,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BmpTest, "BmpTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(BmpTest); } diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index 2172b0b667a7..89cd7ede6293 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -274,7 +276,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(ClipTest, "ClipTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(ClipTest); } diff --git a/basebmp/test/export.map b/basebmp/test/export.map index bfd13f454044..ac406a4096dd 100644 --- a/basebmp/test/export.map +++ b/basebmp/test/export.map @@ -31,7 +31,7 @@ UDK_3.1 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx index fcc4e5df5fa3..e2e5b32f7fed 100644 --- a/basebmp/test/filltest.cxx +++ b/basebmp/test/filltest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -268,7 +270,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(FillTest, "FillTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(FillTest); } diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index 1a424864f893..488c6cf7c91b 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -216,7 +218,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(LineTest, "LineTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(LineTest); } diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 3ea13868aeb4..7061a77a8e09 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -124,7 +124,6 @@ SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ .IF "$(L10N_framework)"=="" @@ -133,7 +132,7 @@ unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN) + $(CPPUNITTESTER) $(SHL1TARGETN) ALLTAR : unittest .ENDIF diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 61f329f094f2..f00ac66aff39 100644 --- a/basebmp/test/masktest.cxx +++ b/basebmp/test/masktest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -168,7 +170,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(MaskTest, "MaskTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(MaskTest); } diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx index e35c8c834bd9..c1e066eac562 100644 --- a/basebmp/test/polytest.cxx +++ b/basebmp/test/polytest.cxx @@ -30,7 +30,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -288,7 +290,7 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(PolyTest, "PolyTest"); +CPPUNIT_TEST_SUITE_REGISTRATION(PolyTest); } diff --git a/basegfx/prj/build.lst b/basegfx/prj/build.lst index 418b3822a7ee..e4122616e769 100644 --- a/basegfx/prj/build.lst +++ b/basegfx/prj/build.lst @@ -1,4 +1,4 @@ -fx basegfx : o3tl sal offuh cppuhelper cppu testshl2 NULL +fx basegfx : o3tl sal offuh cppuhelper cppu cppunit NULL fx basegfx usr1 - all fx_mkout NULL fx basegfx\inc nmake - all fx_inc NULL fx basegfx\prj get - all fx_prj NULL diff --git a/basegfx/test/basegfx1d.cxx b/basegfx/test/basegfx1d.cxx index f058b0034fa7..8a10f3a77102 100644 --- a/basegfx/test/basegfx1d.cxx +++ b/basegfx/test/basegfx1d.cxx @@ -33,7 +33,10 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" namespace basegfx1d { @@ -55,7 +58,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -68,13 +70,7 @@ public: }; // class b1drange // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx1d::b1drange, "basegfx1d"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx1d::b1drange); } // namespace basegfx1d - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 4f0305df953f..0e0159dfab08 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -33,7 +33,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -753,7 +755,6 @@ public: { // this is demonstration code // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1105,7 +1106,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1135,7 +1135,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1317,7 +1316,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1347,7 +1345,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1375,7 +1372,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1405,7 +1401,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1433,7 +1428,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -1618,21 +1612,21 @@ public: }; // class b2dvector // ----------------------------------------------------------------------------- -//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d"); -//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhompoint, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpoint, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygon, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygontools, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolypolygon, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dquadraticbezier, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2drange, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dtuple, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dvector, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::bcolor, "basegfx2d"); +//CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dmultirange); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dsvgdimpex); +//CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dbeziertools); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dcubicbezier); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dhommatrix); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dhompoint); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpoint); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygon); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygontools); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolypolygon); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dquadraticbezier); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2drange); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dtuple); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dvector); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::bcolor); } // namespace basegfx2d diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx index fc59ffbced4e..4272fd6a8615 100644 --- a/basegfx/test/basegfx3d.cxx +++ b/basegfx/test/basegfx3d.cxx @@ -33,7 +33,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" namespace basegfx3d { @@ -55,7 +57,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -83,7 +84,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -113,7 +113,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -141,7 +140,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -171,7 +169,6 @@ public: void EmptyMethod() { // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -199,7 +196,6 @@ public: // insert your test code here. void EmptyMethod() { - CPPUNIT_ASSERT_STUB(); } // Change the following lines only, if you add, remove or rename @@ -212,12 +208,12 @@ public: }; // class b3dvector // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dhommatrix, "basegfx3d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dhompoint, "basegfx3d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dpoint, "basegfx3d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3drange, "basegfx3d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dtuple, "basegfx3d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx3d::b3dvector, "basegfx3d"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhommatrix); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dhompoint); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dpoint); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3drange); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dtuple); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx3d::b3dvector); } // namespace basegfx3d diff --git a/basegfx/test/export.map b/basegfx/test/export.map index 37f3bf2c55d2..eef13a7090fb 100644 --- a/basegfx/test/export.map +++ b/basegfx/test/export.map @@ -31,7 +31,7 @@ UDK_3.1 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 1bd4d59b98d5..3685b2a50eda 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -82,7 +82,6 @@ SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk # --- Enable testshl2 execution in normal build ------------------------ @@ -90,7 +89,7 @@ $(MISC)$/unittest_succeeded : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - $(TESTSHL2) -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN) + $(CPPUNITTESTER) $(SHL1TARGETN) $(TOUCH) $@ ALLTAR : $(MISC)$/unittest_succeeded diff --git a/basegfx/test/tests.txt b/basegfx/test/tests.txt deleted file mode 100644 index fc2d33ab51d5..000000000000 --- a/basegfx/test/tests.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Jobfile -basegfx1d.b1drange -basegfx2d.b2dcubicbezier -basegfx2d.b2dhommatrix -basegfx2d.b2dhompoint -basegfx2d.b2dpoint -basegfx2d.b2dpolygon -basegfx2d.b2dpolygontools -basegfx2d.b2dpolypolygon -basegfx2d.b2dquadraticbezier -basegfx2d.b2drange -basegfx2d.b2dtuple -basegfx2d.b2dvector -basegfx3d.b3dhommatrix -basegfx3d.b3dhompoint -basegfx3d.b3dhompoint -basegfx3d.b3dpoint -basegfx3d.b3drange -basegfx3d.b3dtuple -basegfx3d.b3dvector diff --git a/o3tl/prj/build.lst b/o3tl/prj/build.lst index 98293257e4bd..fe6b53d1c732 100644 --- a/o3tl/prj/build.lst +++ b/o3tl/prj/build.lst @@ -1,4 +1,4 @@ -ot o3tl : sal testshl2 BOOST:boost NULL +ot o3tl : sal cppunit BOOST:boost NULL ot o3tl usr1 - all ot_mkout NULL ot o3tl\inc get - all ot_inc NULL ot o3tl\prj get - all ot_prj NULL diff --git a/o3tl/qa/export.map b/o3tl/qa/export.map index bfd13f454044..ac406a4096dd 100644 --- a/o3tl/qa/export.map +++ b/o3tl/qa/export.map @@ -31,7 +31,7 @@ UDK_3.1 { global: - registerAllTestFunction; + cppunitTestPlugIn; local: *; diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 70fe224cf6a9..778c24d6b9f2 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -68,7 +68,6 @@ SLOFILES=$(SHL1OBJS) .ENDIF # L10N_framework .INCLUDE : target.mk -.INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ .IF "$(L10N_framework)"=="" @@ -76,7 +75,7 @@ unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN) + $(CPPUNITTESTER) $(SHL1TARGETN) ALLTAR : unittest .ENDIF # L10N_framework diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx index 6bb169e951a4..84d615fca3db 100644 --- a/o3tl/qa/test-cow_wrapper.cxx +++ b/o3tl/qa/test-cow_wrapper.cxx @@ -1,6 +1,9 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" #include "cow_wrapper_clients.hxx" @@ -119,15 +122,6 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(cow_wrapper_test, "cow_wrapper_test"); - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -void RegisterAdditionalFunctions(FktRegFuncPtr ) -{ -} -// NOADDITIONAL; +CPPUNIT_TEST_SUITE_REGISTRATION(cow_wrapper_test); +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx index 5e247a8b9abc..3c50c68872d2 100644 --- a/o3tl/qa/test-heap_ptr.cxx +++ b/o3tl/qa/test-heap_ptr.cxx @@ -28,7 +28,9 @@ * ************************************************************************/ -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include @@ -163,4 +165,4 @@ class heap_ptr_test : public CppUnit::TestFixture }; // class heap_ptr_test // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(heap_ptr_test, "o3tltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(heap_ptr_test); diff --git a/o3tl/qa/test-range.cxx b/o3tl/qa/test-range.cxx index 626d9b6e3a90..326f8d4e06ef 100644 --- a/o3tl/qa/test-range.cxx +++ b/o3tl/qa/test-range.cxx @@ -28,8 +28,9 @@ * ************************************************************************/ - -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -233,4 +234,4 @@ public: }; // class range_test // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(range_test, "o3tltests"); +CPPUNIT_TEST_SUITE_REGISTRATION(range_test); -- cgit From 26bba85c9b3ad11a5d5728e0653ed199eb4793e8 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Fri, 18 Dec 2009 08:24:03 +0100 Subject: tkr33: #i107136# The UCB now considers configuration changes (new UCPs) of UCPs during runtime. --- ucbhelper/inc/ucbhelper/configureucb.hxx | 204 ------------------------------ ucbhelper/inc/ucbhelper/contentbroker.hxx | 2 +- ucbhelper/inc/ucbhelper/registerucb.hxx | 132 +++++++++++++++++++ ucbhelper/prj/d.lst | 2 +- ucbhelper/source/client/contentbroker.cxx | 16 ++- ucbhelper/source/provider/makefile.mk | 2 - ucbhelper/source/provider/registerucb.cxx | 40 +----- ucbhelper/source/provider/registerucb.hxx | 99 --------------- 8 files changed, 145 insertions(+), 352 deletions(-) delete mode 100644 ucbhelper/inc/ucbhelper/configureucb.hxx create mode 100644 ucbhelper/inc/ucbhelper/registerucb.hxx delete mode 100644 ucbhelper/source/provider/registerucb.hxx diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx deleted file mode 100644 index 479130c0624f..000000000000 --- a/ucbhelper/inc/ucbhelper/configureucb.hxx +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: configureucb.hxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _UCBHELPER_CONFIGUREUCB_HXX_ -#define _UCBHELPER_CONFIGUREUCB_HXX_ - -#include -#include -#include -#include - -#include -#include "ucbhelper/ucbhelperdllapi.h" - -namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } - namespace ucb { - class XContentProvider; - class XContentProviderManager; - } - namespace uno { class Any; } -} } } - -namespace ucbhelper { - -//============================================================================ -/** Information about a registered content provider, passed from - configureUcb to unconfigureUcb (and from - registerAtUcb to deregisterFromUcb). - */ -struct ContentProviderRegistrationInfo -{ - /** The registered content provider (or null if registration failed). - */ - com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > - m_xProvider; - - /** The arguments the content provider was instantiated with. - */ - rtl::OUString m_aArguments; - - /** The URL template the content provider is registered on. - */ - rtl::OUString m_aTemplate; -}; - //@@@ if registerucb.hxx were exported, too, this might better reside in - // there... - -typedef std::vector< ContentProviderRegistrationInfo > - ContentProviderRegistrationInfoList; - -//============================================================================ -/** Information about a content provider, passed to - configureUcb. - */ -struct ContentProviderData -{ - /** The UNO service name to use to instanciate the content provider. - */ - rtl::OUString ServiceName; - - /** The URL template to use to instanciate the content provider. - */ - rtl::OUString URLTemplate; - - /** The arguments to use to instanciate the content provider. - */ - rtl::OUString Arguments; - - ContentProviderData() {}; - ContentProviderData( const rtl::OUString & rService, - const rtl::OUString & rTemplate, - const rtl::OUString & rArgs ) - : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {} -}; - -typedef std::vector< ContentProviderData > ContentProviderDataList; - -//============================================================================ -/** Configure a (newly instantiated) Universal Content Broker. - - @descr This function tries to register at the given content provider - manager all the content provider services listed under a given key in the - configuration database. - - @param rManager A content provider manager (normally, this would be a - newly intantiated UCB). - - @param rServiceFactory A service factory through which to obtain the - various services required. - - @param rData A list containing the data for the content providers for - the UCB to configure. - - @pInfos If not null, an entry will be added to this vector for every - content provider that is registered (sucessfully or not). - - @return True if the UCB has successfuly been configured (though not all - content providers have necessarily been registered due to individual - problems). - */ -bool -configureUcb( - com::sun::star::uno::Reference< - com::sun::star::ucb::XContentProviderManager > const & - rManager, - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - rServiceFactory, - ContentProviderDataList const & rData, - ContentProviderRegistrationInfoList * pInfos) - throw (com::sun::star::uno::RuntimeException); - - -//============================================================================ -/** Configure a (newly instantiated) Universal Content Broker. - - @descr This function tries to register at the given content provider - manager all the content provider services listed under a given key in the - configuration database. - - @param rManager A content provider manager (normally, this would be a - newly intantiated UCB). - - @param rServiceFactory A service factory through which to obtain the - various services required. - - @param rArguments A sequence of at least two strings: the primary and - secondary key addressing a chosen UCB configuration in the configuration - database. The sequence can be longer, in which case the excess elements - must be strings that form key/value pairs. These key/value pairs will be - used to replace placeholders in the data from the configuration database - with (dynamic) values. This is a (rather unstructured) sequence of - Anys, since normally this parameter will simply be forwarded - by the UCB's initialize method, which has a parameter of - the same type. - - @pInfos If not null, an entry will be added to this vector for every - content provider that is registered (sucessfully or not). - - @return True if the UCB has successfuly been configured (though not all - content providers have necessarily been registered due to individual - problems). - */ -UCBHELPER_DLLPUBLIC bool -configureUcb( - com::sun::star::uno::Reference< - com::sun::star::ucb::XContentProviderManager > const & - rManager, - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - rServiceFactory, - com::sun::star::uno::Sequence< com::sun::star::uno::Any > const & - rArguments, - std::vector< ContentProviderRegistrationInfo > * pInfos) - throw (com::sun::star::uno::RuntimeException); - -//============================================================================ -/** Undo the configuration of a Universal Content Broker. - - @descr This function is the reverse of configureUcb. - - @param rManager A content provider manager. - - @param rInfos Information about all the registered content providers. - */ -void -unconfigureUcb( - com::sun::star::uno::Reference< - com::sun::star::ucb::XContentProviderManager > const & - rManager, - std::vector< ContentProviderRegistrationInfo > const & rInfos) - throw (com::sun::star::uno::RuntimeException); - -} - -#endif // _UCBHELPER_CONFIGUREUCB_HXX_ diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx index f119e9c61284..ee28333303cd 100644 --- a/ucbhelper/inc/ucbhelper/contentbroker.hxx +++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx @@ -44,7 +44,7 @@ namespace com { namespace sun { namespace star { namespace ucb { class XContentProviderManager; class XCommandProcessor; } } } } -#include +#include #include "ucbhelper/ucbhelperdllapi.h" namespace ucbhelper diff --git a/ucbhelper/inc/ucbhelper/registerucb.hxx b/ucbhelper/inc/ucbhelper/registerucb.hxx new file mode 100644 index 000000000000..4eca71c6f0cd --- /dev/null +++ b/ucbhelper/inc/ucbhelper/registerucb.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: registerucb.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _UCBHELPER_REGISTERUCB_HXX_ +#define _UCBHELPER_REGISTERUCB_HXX_ + +#include +#include +#include +#include +#include + +#include "ucbhelper/ucbhelperdllapi.h" + +namespace com { namespace sun { namespace star { + namespace lang { class XMultiServiceFactory; } +} } } + +namespace rtl { class OUString; } + +namespace ucbhelper { + +//============================================================================ +/** Information about a registered content provider. + */ +struct ContentProviderRegistrationInfo +{ + /** The registered content provider (or null if registration failed). + */ + com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider > + m_xProvider; + + /** The arguments the content provider was instantiated with. + */ + rtl::OUString m_aArguments; + + /** The URL template the content provider is registered on. + */ + rtl::OUString m_aTemplate; +}; + +typedef std::vector< ContentProviderRegistrationInfo > + ContentProviderRegistrationInfoList; + +//============================================================================ +/** Information about a content provider, passed to + configureUcb. + */ +struct ContentProviderData +{ + /** The UNO service name to use to instanciate the content provider. + */ + rtl::OUString ServiceName; + + /** The URL template to use to instanciate the content provider. + */ + rtl::OUString URLTemplate; + + /** The arguments to use to instanciate the content provider. + */ + rtl::OUString Arguments; + + ContentProviderData() {}; + ContentProviderData( const rtl::OUString & rService, + const rtl::OUString & rTemplate, + const rtl::OUString & rArgs ) + : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {} +}; + +typedef std::vector< ContentProviderData > ContentProviderDataList; +//============================================================================ +/** Register a content provider at a Universal Content Broker. + + @param rManager A content provider manager (normally, this would be a + UCB). May be null, which is only useful if the content provider is an + XParamterizedContentProviders. + + @param rServiceFactory A factory through which to obtain the required + services. + + @param rName The service name of the content provider. + + @param rArguments Any arguments to instantiate the content provider with. + + @param rTemplate The URL template to register the content provider on. + + @param pInfo If not null, this output parameter is filled with + information about the (atemptively) registered provider. + */ + +UCBHELPER_DLLPUBLIC bool registerAtUcb( + com::sun::star::uno::Reference< + com::sun::star::ucb::XContentProviderManager > const & + rManager, + com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > const & + rServiceFactory, + rtl::OUString const & rName, + rtl::OUString const & rArguments, + rtl::OUString const & rTemplate, + ContentProviderRegistrationInfo * pInfo) + throw (com::sun::star::uno::RuntimeException); + +} +#endif // _UCBHELPER_REGISTERUCB_HXX_ diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst index 64da268b6143..d11414525e8c 100644 --- a/ucbhelper/prj/d.lst +++ b/ucbhelper/prj/d.lst @@ -9,7 +9,7 @@ mkdir: %_DEST%\inc%_EXT%\ucbhelper ..\inc\ucbhelper\configurationkeys.hxx %_DEST%\inc%_EXT%\ucbhelper\configurationkeys.hxx -..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx +..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx ..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx ..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx ..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx index 43d1491d8507..cbd43c807073 100644 --- a/ucbhelper/source/client/contentbroker.cxx +++ b/ucbhelper/source/client/contentbroker.cxx @@ -301,14 +301,18 @@ bool ContentBroker_Impl::initialize() if ( m_xProviderMgr.is() ) { - if ( !configureUcb( m_xProviderMgr, - m_xSMgr, - m_aProvData, - 0 ) ) + ContentProviderDataList::const_iterator aEnd(m_aProvData.end()); + for (ContentProviderDataList::const_iterator aIt(m_aProvData.begin()); + aIt != aEnd; ++aIt) { - OSL_ENSURE( false, "Failed to configure UCB!" ); - return false; + registerAtUcb(m_xProviderMgr, + m_xSMgr, + aIt->ServiceName, + aIt->Arguments, + aIt->URLTemplate, + 0); } + } } } diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk index acb213ec201d..97d4616e4161 100644 --- a/ucbhelper/source/provider/makefile.mk +++ b/ucbhelper/source/provider/makefile.mk @@ -47,7 +47,6 @@ ENABLE_EXCEPTIONS=TRUE .IF "$(header)" == "" SLOFILES=\ - $(SLO)$/configureucb.obj \ $(SLO)$/contentidentifier.obj \ $(SLO)$/providerhelper.obj \ $(SLO)$/contenthelper.obj \ @@ -57,7 +56,6 @@ SLOFILES=\ $(SLO)$/resultsetmetadata.obj \ $(SLO)$/resultset.obj \ $(SLO)$/resultsethelper.obj \ - $(SLO)$/provconf.obj \ $(SLO)$/commandenvironmentproxy.obj \ $(SLO)$/interactionrequest.obj \ $(SLO)$/simpleinteractionrequest.obj \ diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx index 584aa21561e0..5aeaaec273ce 100644 --- a/ucbhelper/source/provider/registerucb.cxx +++ b/ucbhelper/source/provider/registerucb.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucbhelper.hxx" -#include +#include #include #include #include @@ -38,7 +38,6 @@ #include #include "osl/diagnose.h" -#include using namespace com::sun::star; @@ -165,41 +164,4 @@ registerAtUcb( return bSuccess; } -//============================================================================ -// -// deregisterFromUcb -// -//============================================================================ - -void -deregisterFromUcb( - uno::Reference< ucb::XContentProviderManager > const & rManager, - ContentProviderRegistrationInfo const & rInfo) - throw (uno::RuntimeException) -{ - uno::Reference< ucb::XContentProvider > - xProvider(rInfo.m_xProvider); - uno::Reference< ucb::XParameterizedContentProvider > - xParameterized(xProvider, uno::UNO_QUERY); - if (xParameterized.is()) - { - uno::Reference< ucb::XContentProvider > xInstance; - try - { - xInstance - = xParameterized->deregisterInstance(rInfo.m_aTemplate, - rInfo.m_aArguments); - } - catch (lang::IllegalArgumentException const &) {} - - if (xInstance.is()) - xProvider = xInstance; - } - - if (rManager.is()) - rManager->deregisterContentProvider(xProvider, rInfo.m_aTemplate); - //@@@ if this fails, a roll-back of deregisterInstance() is - // missing -} - } diff --git a/ucbhelper/source/provider/registerucb.hxx b/ucbhelper/source/provider/registerucb.hxx deleted file mode 100644 index f345d774dcfd..000000000000 --- a/ucbhelper/source/provider/registerucb.hxx +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: registerucb.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _UCBHELPER_REGISTERUCB_HXX_ -#define _UCBHELPER_REGISTERUCB_HXX_ - -#include -#include - -namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } - namespace ucb { class XContentProviderManager; } -} } } -namespace rtl { class OUString; } - -namespace ucbhelper { - -struct ContentProviderRegistrationInfo; - -//============================================================================ -/** Register a content provider at a Universal Content Broker. - - @param rManager A content provider manager (normally, this would be a - UCB). May be null, which is only useful if the content provider is an - XParamterizedContentProviders. - - @param rServiceFactory A factory through which to obtain the required - services. - - @param rName The service name of the content provider. - - @param rArguments Any arguments to instantiate the content provider with. - - @param rTemplate The URL template to register the content provider on. - - @param pInfo If not null, this output parameter is filled with - information about the (atemptively) registered provider. - */ -bool -registerAtUcb( - com::sun::star::uno::Reference< - com::sun::star::ucb::XContentProviderManager > const & - rManager, - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > const & - rServiceFactory, - rtl::OUString const & rName, - rtl::OUString const & rArguments, - rtl::OUString const & rTemplate, - ContentProviderRegistrationInfo * pInfo) - throw (com::sun::star::uno::RuntimeException); - -//============================================================================ -/** Deregister a content provider from a Universal Content Broker. - - @param rManager A content provider manager (normally, this would be a - UCB). May be null, which is only useful if the content provider is an - XParamterizedContentProviders. - - @param rInfo Information about the content provider to deregister. - */ -void -deregisterFromUcb( - com::sun::star::uno::Reference< - com::sun::star::ucb::XContentProviderManager > const & - rManager, - ContentProviderRegistrationInfo const & rInfo) - throw (com::sun::star::uno::RuntimeException); - -} - -#endif // _UCBHELPER_REGISTERUCB_HXX_ -- cgit From 7397e8c1bb3d3f5562590c07a535d9749dca4279 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 7 Jan 2010 11:18:02 +0100 Subject: sb118: make test libraries RPATH=NONE --- basebmp/test/makefile.mk | 2 ++ basegfx/test/makefile.mk | 1 + o3tl/qa/makefile.mk | 1 + 3 files changed, 4 insertions(+) diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 25cb06eb413d..94be97c81038 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -95,6 +95,8 @@ SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = export.map +SHL1RPATH = NONE + .ENDIF # END ------------------------------------------------------------------ diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 5165952a0e4b..fd9633ab6f2d 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -72,6 +72,7 @@ SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = export.map +SHL1RPATH = NONE # END ------------------------------------------------------------------ diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index a27c99a74df9..491c50ec2095 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -57,6 +57,7 @@ SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) SHL1VERSIONMAP = export.map +SHL1RPATH = NONE # END ------------------------------------------------------------------ -- cgit From b9af4e970fa589f901fb12366e6714054f77cdd2 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 11:29:14 +0100 Subject: cws tl74: case error in include statement fixed --- .../transliteration/transliteration_body.cxx | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index 0426f89b604d..d041a1d8f915 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -39,7 +39,7 @@ #include -#include "CharacterClassificationImpl.hxx" +#include "characterclassificationImpl.hxx" #include "breakiteratorImpl.hxx" #define TRANSLITERATION_ALL @@ -333,18 +333,18 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& /*offset*/ ) throw(RuntimeException) -{ - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - CharacterClassificationImpl aCharClassImpl( xMSF ); - - // possible problem: the locale is not exactly specific for each word in the text... - OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); - return aRes; -} +{ + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // possible problem: the locale is not exactly specific for each word in the text... + OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); + return aRes; +} Transliteration_sentencecase::Transliteration_sentencecase() { @@ -459,16 +459,16 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( // beginOfSentence does not work as expected with '.'. See comment below. // For the time being I will leave this code here as a from-scratch sample if the // breakiterator works better at some point... -rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, Sequence< sal_Int32 >& /*offset*/ ) throw(RuntimeException) -{ +{ OUString aRes( inStr.copy( nStartPos, nCount ) ); if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); BreakIteratorImpl brk( xMSF ); sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; @@ -476,8 +476,8 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( while (nPos >= nStartPos && nPos != -1) { // possible problem: the locale is not exactly specific for each sentence in the text, - // but it is the only one we have... - nOldSentenceStart = nSentenceStart; + // but it is the only one we have... + nOldSentenceStart = nSentenceStart; nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); // since the breakiterator completely ignores '.' characvters as end-of-sentence when @@ -510,8 +510,8 @@ rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( --nPos; } } - return aRes; -} + return aRes; +} #endif } } } } -- cgit From 949256f2a9f042e258478bdd5c0ef631e5e55b7b Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 11 Jan 2010 11:30:25 +0100 Subject: sb118: introduced AUGMENT_LIBRARY_PATH_LOCAL, used by CPPUNITTESTER so that tests within a module pick up shared libs from that module in the local output tree --- basebmp/test/makefile.mk | 12 +++--------- basegfx/test/makefile.mk | 14 +------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 94be97c81038..36b540231188 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -78,16 +78,10 @@ SHL1OBJS= \ $(SLO)$/linetest.obj \ $(SLO)$/masktest.obj \ $(SLO)$/polytest.obj \ - $(SLO)$/tools.obj \ - $(SLO)$/bitmapdevice.obj \ - $(SLO)$/debug.obj \ - $(SLO)$/polypolygonrenderer.obj -# last three objs are a bit of a hack: cannot link against LIBBASEBMP -# here, because not yet delivered. Need the functionality to test, so -# we're linking it in statically. Need to keep this in sync with -# source/makefile.mk + $(SLO)$/tools.obj SHL1TARGET= tests -SHL1STDLIBS= $(SALLIB) \ +SHL1STDLIBS= $(BASEBMPLIB) \ + $(SALLIB) \ $(CPPUNITLIB) \ $(BASEGFXLIB) diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index fd9633ab6f2d..be6e537ba25a 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -48,21 +48,9 @@ SHL1OBJS= \ $(SLO)$/basegfx3d.obj \ $(SLO)$/testtools.obj -# linking statically against basegfx parts -SHL1LIBS=\ - $(SLB)$/curve.lib \ - $(SLB)$/matrix.lib \ - $(SLB)$/numeric.lib \ - $(SLB)$/point.lib \ - $(SLB)$/polygon.lib \ - $(SLB)$/range.lib \ - $(SLB)$/tuple.lib \ - $(SLB)$/tools.lib \ - $(SLB)$/color.lib \ - $(SLB)$/vector.lib - SHL1TARGET= basegfx_tests SHL1STDLIBS= \ + $(BASEGFXLIB) \ $(SALLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ -- cgit From 70e22566b64a3cb76a7e5ed8187ee642e9ee9ace Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 12:02:18 +0100 Subject: cws tl74: warning-free code --- unotools/source/i18n/transliterationwrapper.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index 0ee160aaefa4..b93161b4f860 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -152,9 +152,9 @@ sal_Bool TransliterationWrapper::needLanguageForTheMode() const return TransliterationModules_UPPERCASE_LOWERCASE == nType || TransliterationModules_LOWERCASE_UPPERCASE == nType || TransliterationModules_IGNORE_CASE == nType || - TransliterationModulesExtra::SENTENCE_CASE == nType || - TransliterationModulesExtra::TITLE_CASE == nType || - TransliterationModulesExtra::TOGGLE_CASE == nType; + (sal_uInt32) TransliterationModulesExtra::SENTENCE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TITLE_CASE == (sal_uInt32) nType || + (sal_uInt32) TransliterationModulesExtra::TOGGLE_CASE == (sal_uInt32) nType; } -- cgit From 24532f08558415d3520500e80db65152da3a5a61 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 12 Jan 2010 18:49:59 +0100 Subject: sb118: #i108269# first step of removing tcsh support --- .../receditor/java/transex3/model/SdfString.java | 25 ---------- transex3/scripts/fast_merge.pl | 10 +--- transex3/scripts/localize.pl | 38 +++++---------- transex3/scripts/localize_old.pl | 56 ++-------------------- 4 files changed, 16 insertions(+), 113 deletions(-) diff --git a/transex3/java/receditor/java/transex3/model/SdfString.java b/transex3/java/receditor/java/transex3/model/SdfString.java index 7419aeb5578b..7eec2151b7c3 100644 --- a/transex3/java/receditor/java/transex3/model/SdfString.java +++ b/transex3/java/receditor/java/transex3/model/SdfString.java @@ -97,32 +97,7 @@ public class SdfString { public void setModuleName(String modulename) { this.modulename = modulename; } - /* - public String getRealFileName(){ - //String srcroot = "U:\\cws01\\l10ncleanup\\SRC680\\src.m213";//java.lang.System.getProperty( "SOLARSRC"); - //String isWindows = "4nt";//java.lang.System.getProperty( "USE_SHELL"); - String srcroot = java.lang.System.getProperty( "SOLARSRC" ); - String isWindows = java.lang.System.getProperty( "USE_SHELL" ); - //System.out.println("srcroot="+srcroot+" isWindows="+isWindows ); - //if( true ) return; - //String relpath = sourceString.getFileId().substring( sourceString.getFileId().lastIndexOf("\\") - // , sourceString.getFileId().length() ); - String filename; - if( isWindows != null && isWindows.compareTo( "4nt") == 0 ) - { - filename = srcroot + "\\" + //sourceString.getProject() + "\\" + - sourceString.getFileId() +".recommand"; - } - else - { - String filepart = sourceString.getFileId(); - filepart = filepart.replaceAll( "\\\\" , "/" ); - filename = srcroot + "/" + //sourceString.getProject() + "//" + - filepart +".recommand"; - } - return filename; - }*/ public String getRealFileName(){ String filepart = sourceString.getFileId(); filepart = filepart.replaceAll( "\\\\" , "_" ); diff --git a/transex3/scripts/fast_merge.pl b/transex3/scripts/fast_merge.pl index 7321a9a42911..d2505cf79dca 100644 --- a/transex3/scripts/fast_merge.pl +++ b/transex3/scripts/fast_merge.pl @@ -53,12 +53,8 @@ my $last_localize_file; my $first_run = "1"; my $sdf_filename; my $merge_dir; -my $WIN; my $state = "none"; -if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { $WIN = 'TRUE'; } -else { $WIN = ''; } - $SIG{INT} = 'inthandler'; $SIG{QUIT} = 'quithandler'; @@ -75,7 +71,6 @@ struct ( sdf_obj => parse_options(); my $lock_file = $merge_dir."/lock.mk"; -$lock_file =~ s/\//\\/g , if ( $WIN ) ; acquire_lock(); read_sdf_file_names(); init(); @@ -255,10 +250,9 @@ sub make_paths { my $localizeFile = $merge_dir."\\".$current[ 0 ]->module."\\".$current[ 0 ]->file; my $path = getDir( $localizeFile ); - if ( !$WIN ) { $path =~ s/\\/\//g; } + $path =~ s/\\/\//g; - $localizeFile = $path."\\localize.sdf"; - if ( !$WIN ) { $localizeFile =~ s/\\/\//g; } + $localizeFile = $path."/localize.sdf"; return ( $path , $localizeFile ); } diff --git a/transex3/scripts/localize.pl b/transex3/scripts/localize.pl index 10e8124027b1..9f733481a587 100755 --- a/transex3/scripts/localize.pl +++ b/transex3/scripts/localize.pl @@ -74,13 +74,11 @@ my $no_gsicheck = ''; my $mode = ''; my $bVerbose = "0"; my $srcpath = ''; -my $WIN; my $languages; #my %sl_modules; # Contains all modules where en-US and de is source language my $use_default_date = '0'; my %is_ooo_module; my %is_so_module; -my $DELIMITER; # ( leftpart ) ( rightpart ) # prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp @@ -94,23 +92,14 @@ my @sdfparticles; parse_options(); check_modules_scm(); -if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { - $WIN = 'TRUE'; - $DELIMITER = "\\"; -} - else { - $WIN = ''; - $DELIMITER = "/"; -} - my $binpath = ''; if( defined $ENV{UPDMINOREXT} ) { - $binpath = $ENV{SOLARVER}.$DELIMITER.$ENV{INPATH}.$DELIMITER."bin".$ENV{UPDMINOREXT}.$DELIMITER ; + $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin".$ENV{UPDMINOREXT}."/" ; } else { - $binpath = $ENV{SOLARVER}.$DELIMITER.$ENV{INPATH}.$DELIMITER."bin".$DELIMITER ; + $binpath = $ENV{SOLARVER}."/".$ENV{INPATH}."/bin/" ; } #%sl_modules = fetch_sourcelanguage_dirlist(); @@ -190,9 +179,8 @@ sub splitfile{ exit( -1 ); } my $src_root = $ENV{SRC_ROOT}; - #print $WIN eq "TRUE" ? $src_root."\\l10n_so\n" : $src_root."/l10n_so\n"; - my $so_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n_so\\source" : $src_root."/l10n_so/source"; - my $ooo_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n\\source" : $src_root."/l10n/source"; + my $so_l10n_path = $src_root."/l10n_so/source"; + my $ooo_l10n_path = $src_root."/l10n/source"; #print "$so_l10n_path\n"; #print "$ooo_l10n_path\n"; @@ -289,7 +277,7 @@ sub write_sdf my @sdf_file; # mkdir!!!! - my $current_l10n_file = $WIN eq "TRUE" ? $l10n_file."\\$lang\\localize.sdf" : $l10n_file."/$lang/localize.sdf"; + my $current_l10n_file = $l10n_file."/$lang/localize.sdf"; print "Writing '$current_l10n_file'\n"; if( open DESTFILE , "< $current_l10n_file" ){ @@ -439,17 +427,17 @@ sub add_paths { my $langhash_ref = shift; my $root_dir = $ENV{ SRC_ROOT }; - my $ooo_l10n_dir = "$root_dir"."$DELIMITER"."l10n"."$DELIMITER"."source"; - my $so_l10n_dir = "$root_dir"."$DELIMITER"."l10n_so"."$DELIMITER"."source"; + my $ooo_l10n_dir = "$root_dir/l10n/source"; + my $so_l10n_dir = "$root_dir/l10n_so/source"; if( -e $ooo_l10n_dir ) { foreach my $lang ( keys( %{ $langhash_ref } ) ) { - my $loc_file = "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf"; + my $loc_file = "$ooo_l10n_dir/$lang/localize.sdf"; if( -e $loc_file ) { - push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf"; + push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf"; } else { print "WARNING: $loc_file not found ....\n"; } } @@ -459,10 +447,10 @@ sub add_paths { foreach my $lang ( keys( %{ $langhash_ref } ) ) { - my $loc_file = "$so_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf"; + my $loc_file = "$so_l10n_dir/$lang/localize.sdf"; if( -e $loc_file ) { - push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf"; + push @sdfparticles , "$ooo_l10n_dir/$lang/localize.sdf"; } else { #print "WARNING: $loc_file not found ....\n"; } @@ -539,10 +527,6 @@ sub collectfiles{ } #foreach } # if } # if -# if ( !$bVerbose ){ -# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; } -# else { $args .= " >& $my_localize_log"; } -# } if ( $bVerbose ) { print STDOUT $command.$args."\n"; } my $rc = system( $command.$args ); diff --git a/transex3/scripts/localize_old.pl b/transex3/scripts/localize_old.pl index 151399d22002..68060200145c 100755 --- a/transex3/scripts/localize_old.pl +++ b/transex3/scripts/localize_old.pl @@ -67,7 +67,6 @@ my $outputfile = ''; my $mode = ''; my $bVerbose="0"; my $srcpath = ''; -my $WIN; my $languages; #my %sl_modules; # Contains all modules where en-US and de is source language my $use_default_date = '0'; @@ -82,13 +81,6 @@ my $default_date = "2002-02-02 02:02:02"; #### main #### parse_options(); -if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { - $WIN = 'TRUE'; -} - else { - $WIN = ''; -} - #%sl_modules = fetch_sourcelanguage_dirlist(); @@ -140,13 +132,11 @@ sub splitfile{ next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module chomp( $line ); $currentFile = $srcpath . '\\' . $prj . '\\' . $file; - if ( $WIN ) { $currentFile =~ s/\//\\/g; } - else { $currentFile =~ s/\\/\//g; } + $currentFile =~ s/\\/\//g; $cur_sdffile = $currentFile; #if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){ - if( $WIN ) { $cur_sdffile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } - else { $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; #} # Set default date @@ -186,41 +176,6 @@ sub splitfile{ } ######################################################### -#sub fetch_sourcelanguage_dirlist -#{ -# -# my $working_path = getcwd(); -# my %sl_dirlist; -# -# chdir $srcpath; -# my @all_dirs = csh_glob( "*" ); -# -# foreach my $file ( @all_dirs ) -# { -# if( -d $file ) -# { -# my $module = $file; -# $file .= "/prj/l10n"; -# $file =~ s/\//\\/ , if( $WIN ) ; -# -# if( -f $file ) # Test file /prj/l10n -# { -# $sl_dirlist{ $module } = 1; -# if( $bVerbose eq "1" ) { print STDOUT "$module: de and en-US source language detected\n"; } -# } -# } -# } -# -# chdir $working_path; -# -# return %sl_dirlist; -#} - -#sub has_two_sourcelanguages -#{ -# my $module = shift; -# return defined $sl_modules{ $module } ; -#} sub writesdf{ my $lastFile = shift; @@ -229,8 +184,7 @@ sub writesdf{ my %index=(); if( $localizeFile =~ /\.$file_types[\s]*$/ ){ - if( $WIN ) { $localizeFile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } - else { $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; }else { print STDERR "Strange filetype found '$localizeFile'\n"; return; @@ -481,10 +435,6 @@ sub collectfiles{ } #foreach } # if } # if -# if ( !$bVerbose ){ -# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; } -# else { $args .= " >& $my_localize_log"; } -# } if ( $bVerbose ) { print STDOUT $command.$args."\n"; } my $rc = system( $command.$args ); -- cgit From ce5247d0b7f664db13622b6a603b86372309cfe0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:09:00 +0100 Subject: dba33f: remove BROWSER_HIGHLIGHT_AUTO/MANU - they're not used at all --- svtools/inc/svtools/brwbox.hxx | 2 -- svtools/source/brwbox/brwbox1.cxx | 5 ----- svtools/source/brwbox/brwbox2.cxx | 15 +++++---------- svtools/source/brwbox/datwin.hxx | 1 - 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx index 8296c9f994f6..252087b02876 100644 --- a/svtools/inc/svtools/brwbox.hxx +++ b/svtools/inc/svtools/brwbox.hxx @@ -99,8 +99,6 @@ typedef ULONG BrowserMode; #define BROWSER_HIGHLIGHT_NONE 0x0100 // == BROWSER_HIDESELECT #define BROWSER_HIGHLIGHT_TOGGLE 0x00000000 // old default => NULL, dont use! -#define BROWSER_HIGHLIGHT_AUTO 0x00010000 -#define BROWSER_HIGHLIGHT_MANU 0x00020000 #define BROWSER_HEADERBAR_NEW 0x00040000 #define BROWSER_AUTOSIZE_LASTCOL 0x00080000 diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 4ebed0d70f3f..1b2bb5ffe9d1 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -2449,8 +2449,6 @@ void BrowseBox::SetMode( BrowserMode nMode ) BROWSER_AUTO_HSCROLL | BROWSER_TRACKING_TIPS | // BROWSER_HIGHLIGHT_NONE | - BROWSER_HIGHLIGHT_AUTO | -// BROWSER_HIGHLIGHT_MANU | BROWSER_HEADERBAR_NEW | // BROWSER_AUTOSIZE_LASTCOL | 0; @@ -2520,9 +2518,6 @@ void BrowseBox::SetMode( BrowserMode nMode ) pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) ); pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) ); - getDataWindow()->bHighlightAuto = - BROWSER_HIGHLIGHT_AUTO == ( nMode & BROWSER_HIGHLIGHT_AUTO ) || - BROWSER_HIGHLIGHT_MANU != ( nMode & BROWSER_HIGHLIGHT_MANU ); getDataWindow()->bAutoSizeLastCol = BROWSER_AUTOSIZE_LASTCOL == ( nMode & BROWSER_AUTOSIZE_LASTCOL ); getDataWindow()->bOwnDataChangedHdl = diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index daf8d080dac2..aee7483451cd 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -343,10 +343,6 @@ void BrowseBox::ToggleSelection( BOOL bForce ) if ( !bForce && ( bNotToggleSel || !IsUpdateMode() || !bSelectionIsVisible ) ) return; -//MI, 28.01.98 -// if ( !getDataWindow()->bHighlightToggle && -// !getDataWindow()->bHighlightAuto ) -// return; // only highlight painted areas! bNotToggleSel = TRUE; @@ -987,11 +983,10 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL Size( _rRect.GetSize().Width(), nDataRowHeigt ) ); PaintRow( _rOut, aRowRect ); - BOOL bRowAutoHighlight = _bDrawSelections - && !bHideSelect - && ((BrowserDataWin&)GetDataWindow()).bHighlightAuto - && IsRowSelected( nRow ); - if ( bRowAutoHighlight ) + BOOL bRowSelected = _bDrawSelections + && !bHideSelect + && IsRowSelected( nRow ); + if ( bRowSelected ) { _rOut.SetTextColor( rHighlightTextColor ); _rOut.SetFillColor( rHighlightFillColor ); @@ -1085,7 +1080,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL bRetouching = TRUE; // reset auto-highlight - if ( bRowAutoHighlight ) + if ( bRowSelected ) { _rOut.SetTextColor( aOldTextColor ); _rOut.SetFillColor( aOldFillColor ); diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx index b01c39832a32..0c2c48d73a0d 100644 --- a/svtools/source/brwbox/datwin.hxx +++ b/svtools/source/brwbox/datwin.hxx @@ -145,7 +145,6 @@ public: FASTBOOL bAutoVScroll; // autohide horizontaler Scrollbar FASTBOOL bUpdateMode; // nicht SV-UpdateMode wegen Invalidate() FASTBOOL bAutoSizeLastCol;// last column always fills up window - FASTBOOL bHighlightAuto; // new auto-highlight by SetFont() etc. FASTBOOL bResizeOnPaint; // outstanding resize-event FASTBOOL bUpdateOnUnlock; // Update() while locked FASTBOOL bInUpdateScrollbars; // Rekursionsschutz -- cgit From f6e36c08bdc8eb75531695a884aa92eef309ca02 Mon Sep 17 00:00:00 2001 From: Tobias Krause Date: Wed, 13 Jan 2010 09:50:13 +0100 Subject: tkr33: #107136# deliver the right header file to solver --- ucbhelper/prj/d.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst index d11414525e8c..21a46483789b 100644 --- a/ucbhelper/prj/d.lst +++ b/ucbhelper/prj/d.lst @@ -9,7 +9,7 @@ mkdir: %_DEST%\inc%_EXT%\ucbhelper ..\inc\ucbhelper\configurationkeys.hxx %_DEST%\inc%_EXT%\ucbhelper\configurationkeys.hxx -..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx +..\inc\ucbhelper\registerucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx ..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx ..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx ..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx -- cgit From 0b390e311d5f19864d853d887c608359dfbbccf3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 13 Jan 2010 10:41:38 +0100 Subject: dba33f: include typeinfo, not typeinfo.h --- comphelper/source/property/property.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index 17949b9889dd..0ccc28d4238b 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.cxx @@ -42,7 +42,7 @@ #include #include #include - #include + #include #endif #include #include -- cgit From ec0f00417aaabc0676757e310b99d3202667a37c Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 13 Jan 2010 16:04:40 +0100 Subject: sb118: fixed aqua_clipboard mutex lock scope --- vcl/aqua/source/dtrans/aqua_clipboard.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx index 27bf308dce9b..386be4b508b4 100644 --- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx +++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx @@ -192,6 +192,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference& xTransf const Reference& xClipboardOwner) throw( RuntimeException ) { + NSArray* types = xTransferable.is() ? + mpDataFlavorMapper->flavorSequenceToTypesArray(xTransferable->getTransferDataFlavors()) : + [NSArray array]; + ClearableMutexGuard aGuard(m_aMutex); Reference oldOwner(mXClipboardOwner); @@ -200,11 +204,10 @@ void SAL_CALL AquaClipboard::setContents(const Reference& xTransf Reference oldContent(mXClipboardContent); mXClipboardContent = xTransferable; - NSArray* types = mXClipboardContent.is() ? - mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()) : - [NSArray array]; mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener]; + aGuard.clear(); + // if we are already the owner of the clipboard // then fire lost ownership event if (oldOwner.is()) @@ -256,7 +259,7 @@ void SAL_CALL AquaClipboard::removeClipboardListener(const Reference< XClipboard void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification) { - MutexGuard aGuard(m_aMutex); + ClearableMutexGuard aGuard(m_aMutex); int currentPboardChgCount = [mPasteboard changeCount]; @@ -273,6 +276,8 @@ void AquaClipboard::applicationDidBecomeActive(NSNotification* aNotification) Reference oldContent(mXClipboardContent); mXClipboardContent = Reference(); + aGuard.clear(); + if (oldOwner.is()) { fireLostClipboardOwnershipEvent(oldOwner, oldContent); -- cgit From e6fd0d7630e8cb0f834166ee6cc6fbb871482b51 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 13 Jan 2010 18:56:34 +0100 Subject: sb118: adapted cppunit.mk to cppunittester and no longer require "dmake test" to run tests; changed places back to include _cppunit.mk where it had been taken out before --- basebmp/test/makefile.mk | 9 +-------- basegfx/test/makefile.mk | 12 +----------- o3tl/qa/makefile.mk | 8 +------- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 36b540231188..82eacd4ebbd6 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -123,12 +123,5 @@ SLOFILES=$(SHL1OBJS) # --- Enable test execution in normal build ------------------------ .IF "$(L10N_framework)"=="" - -unittest : $(SHL1TARGETN) - @echo ---------------------------------------------------------- - @echo - start unit test on library $(SHL1TARGETN) - @echo ---------------------------------------------------------- - $(CPPUNITTESTER) $(SHL1TARGETN) - -ALLTAR : unittest +.INCLUDE : _cppunit.mk .ENDIF diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index be6e537ba25a..60a7706450ab 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -71,14 +71,4 @@ SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - -# --- Enable testshl2 execution in normal build ------------------------ - -$(MISC)$/unittest_succeeded : $(SHL1TARGETN) - @echo ---------------------------------------------------------- - @echo - start unit test on library $(SHL1TARGETN) - @echo ---------------------------------------------------------- - $(CPPUNITTESTER) $(SHL1TARGETN) - $(TOUCH) $@ - -ALLTAR : $(MISC)$/unittest_succeeded +.INCLUDE : _cppunit.mk diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 491c50ec2095..df90c0f3fa23 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -72,12 +72,6 @@ SLOFILES=$(SHL1OBJS) # --- Enable test execution in normal build ------------------------ .IF "$(L10N_framework)"=="" -unittest : $(SHL1TARGETN) - @echo ---------------------------------------------------------- - @echo - start unit test on library $(SHL1TARGETN) - @echo ---------------------------------------------------------- - $(CPPUNITTESTER) $(SHL1TARGETN) - -ALLTAR : unittest +.INCLUDE : _cppunit.mk .ENDIF # L10N_framework -- cgit From a3de1ad361232a4ebe7edbd0817bcf0b2c59e56e Mon Sep 17 00:00:00 2001 From: thb Date: Sat, 16 Jan 2010 02:20:50 +0100 Subject: #i105937# Fixed a few remaining gradient glitches * linear/axial gradient were f*cked up when border and rotation was given * found another place where drawinglayer was generating helper polygons for gradients (vclgradienthelper.cxx), adapted to new value ranges * fixed build breakage in debug build in oox * fixed order of gradient color generation --- basegfx/source/tools/gradienttools.cxx | 29 ++++++++++++----------------- canvas/prj/build.lst | 1 - 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 337f9bd8e52b..447eac056c55 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -72,31 +72,28 @@ namespace basegfx fTargetSizeY = fNewY; } - double fSizeWithoutBorder=0; - double fTranslateY=0; + const double fSizeWithoutBorder=1.0 - fBorder; if( bAxial ) { - fSizeWithoutBorder = (1.0 - fBorder) * 0.5; - fTranslateY = 0.5; + o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder * .5); + o_rGradientInfo.maTextureTransform.translate(0.0, 0.5); } else { - fSizeWithoutBorder = 1.0 - fBorder; - fTranslateY = fBorder; + if(!fTools::equal(fSizeWithoutBorder, 1.0)) + { + o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder); + o_rGradientInfo.maTextureTransform.translate(0.0, fBorder); + } } - if(!fTools::equal(fSizeWithoutBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(1.0, fSizeWithoutBorder); - - o_rGradientInfo.maTextureTransform.translate(0.0, fTranslateY); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); // add texture rotate after scale to keep perpendicular angles if(0.0 != fAngle) { - B2DPoint aCenter(0.5, 0.5); - aCenter *= o_rGradientInfo.maTextureTransform; - + const B2DPoint aCenter(0.5*fTargetSizeX, + 0.5*fTargetSizeY); o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); o_rGradientInfo.maTextureTransform.rotate(fAngle); o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); @@ -153,8 +150,7 @@ namespace basegfx } const double fHalfBorder((1.0 - fBorder) * 0.5); - if(!fTools::equal(fHalfBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); @@ -226,8 +222,7 @@ namespace basegfx } const double fHalfBorder((1.0 - fBorder) * 0.5); - if(!fTools::equal(fHalfBorder, 0.0)) - o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); + o_rGradientInfo.maTextureTransform.scale(fHalfBorder, fHalfBorder); o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst index df1f8e9f31d3..76cf17f3af7b 100644 --- a/canvas/prj/build.lst +++ b/canvas/prj/build.lst @@ -7,5 +7,4 @@ cv canvas\source\simplecanvas nmake - all cv_simplecanvas cv_tools cv_inc cv canvas\source\cairo nmake - all cv_cairo cv_tools cv_inc NULL cv canvas\source\directx nmake - w cv_directx cv_tools cv_inc NULL cv canvas\source\null nmake - all cv_null cv_tools cv_inc NULL -cv canvas\source\java nmake - all cv_java cv_inc NULL cv canvas\source\factory nmake - all cv_factory cv_inc NULL -- cgit From 0750c39411ea0d9dfcfe3d760b175958987aff97 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Sun, 17 Jan 2010 18:15:22 +0100 Subject: added DockingManager::EndPopupMode( const Window *pWin ) --- vcl/inc/vcl/dockwin.hxx | 1 + vcl/source/window/dockmgr.cxx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx index 376308a8b27b..982180e945fd 100644 --- a/vcl/inc/vcl/dockwin.hxx +++ b/vcl/inc/vcl/dockwin.hxx @@ -238,6 +238,7 @@ public: void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin ); BOOL IsInPopupMode( const Window *pWin ); + void EndPopupMode( const Window *pWin ); // required because those methods are not virtual in Window (!!!) and must // be availbale from the toolkit diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 940f2423e696..24b2da8e85bf 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -445,6 +445,17 @@ BOOL DockingManager::IsInPopupMode( const Window *pWindow ) return FALSE; } +// ----------------------------------------------------------------------- + +void DockingManager::EndPopupMode( const Window *pWin ) +{ + ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin ); + if( pWrapper && pWrapper->GetFloatingWindow() && pWrapper->GetFloatingWindow()->IsInPopupMode() ) + pWrapper->GetFloatingWindow()->EndPopupMode(); +} + +// ----------------------------------------------------------------------- + void DockingManager::AddWindow( const Window *pWindow ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); @@ -1350,7 +1361,7 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) aSettings.SetStyleSettings( aStyleSettings ); pWin->SetSettings( aSettings );*/ - mpFloatWin = pWin; +// mpFloatWin = pWin; GetWindow()->mpWindowImpl->mpBorderWindow = NULL; @@ -1385,6 +1396,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( BOOL bFloatMode ) pWin->SetMinOutputSizePixel( maMinOutSize ); pWin->SetMaxOutputSizePixel( maMaxOutSize ); + mpFloatWin = pWin; + if ( bVisible ) GetWindow()->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); -- cgit From 1737f4d2fdba50a590f76631cd7ca7e762d18c35 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 00:37:41 +0100 Subject: #i52325# #i108250# removed B3DGeometry, fixed gradient/fill bitmap * removed unused & broken B3DGeometry class * fixed bug in basegfx::tools::isRectangle for polygons with curves * fixed cairocanvas gradient and bitmap fill rendering * fixed vclcanvas bitmap fill rendering (not clipping properly) * added TextureMode::NONE, adapted all client code * fixed snafu in XGraphicDevice.idl, with missing include --- basegfx/inc/basegfx/polygon/b3dgeometry.hxx | 74 -------------- basegfx/source/polygon/b2dpolygontools.cxx | 3 +- basegfx/source/polygon/b3dgeometry.cxx | 59 ----------- basegfx/test/basegfx2d.cxx | 10 ++ canvas/source/cairo/cairo_canvashelper.cxx | 13 +++ .../source/directx/dx_canvashelper_texturefill.cxx | 4 +- canvas/source/tools/verifyinput.cxx | 4 +- canvas/source/vcl/canvashelper_texturefill.cxx | 113 +++------------------ cppcanvas/source/mtfrenderer/implrenderer.cxx | 20 ++-- 9 files changed, 52 insertions(+), 248 deletions(-) delete mode 100644 basegfx/inc/basegfx/polygon/b3dgeometry.hxx delete mode 100644 basegfx/source/polygon/b3dgeometry.cxx diff --git a/basegfx/inc/basegfx/polygon/b3dgeometry.hxx b/basegfx/inc/basegfx/polygon/b3dgeometry.hxx deleted file mode 100644 index 024c7e695b68..000000000000 --- a/basegfx/inc/basegfx/polygon/b3dgeometry.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: b3dgeometry.hxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _BGFX_POLYGON_B3DGEOMETRY_HXX -#define _BGFX_POLYGON_B3DGEOMETRY_HXX - -////////////////////////////////////////////////////////////////////////////// -// predeclarations - -namespace basegfx -{ -} // end of namespace basegfx - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - class B3DGeometry - { - private: - B2DPolyPolygon maPolyPolygon; // the PolyPolygon geometry data, defines point number - B3DHomMatrix maPolygonTo3D; // transformation to create 3D PolyPolygon - B3DPolyPolygon maPolyNormal; // normal for each point or empty -> unified normal - B2DPolyPolygon maPolyTexture; // texture coordinate for each point or empty -> unified coordinate - B3DVector maUnifiedVector; // used when maNormal is empty - - // bitfield - unsigned mbUnifiedVectorValid : 1; // flag to know if uvec is calculated yet - - public: - B3DGeometry(); - ~B3DGeometry(); - - // compare operators - bool operator==(const B3DGeometry& rGeometry) const; - bool operator!=(const B3DGeometry& rGeometry) const { return (!operator==(rGeometry)); } - - // member count - sal_uInt32 count() const { return maPolyPolygon.count(); } - }; -} // end of namespace basegfx - -////////////////////////////////////////////////////////////////////////////// - - -#endif /* _BGFX_POLYGON_B3DPOLYGON_HXX */ diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index c1e5dc80d8c4..a866eb5ef545 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2353,7 +2353,8 @@ namespace basegfx // polygon must be closed to resemble a rect, and contain // at least four points. if( !rPoly.isClosed() || - rPoly.count() < 4 ) + rPoly.count() < 4 || + rPoly.areControlPointsUsed() ) { return false; } diff --git a/basegfx/source/polygon/b3dgeometry.cxx b/basegfx/source/polygon/b3dgeometry.cxx deleted file mode 100644 index 38b93b931f53..000000000000 --- a/basegfx/source/polygon/b3dgeometry.cxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: b3dgeometry.cxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - B3DGeometry::B3DGeometry() - : mbUnifiedVectorValid(false) - { - } - - B3DGeometry::~B3DGeometry() - { - } - - bool B3DGeometry::operator==(const B3DGeometry& rGeometry) const - { - return (maPolyPolygon == maPolyPolygon - && maPolygonTo3D == maPolygonTo3D - && maPolyNormal == maPolyNormal - && maPolyTexture == maPolyTexture - } - -} // end of namespace basegfx - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index e30e6bf561c1..e332856a6d96 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -1111,6 +1111,14 @@ public: aNonRect4.append( B2DPoint(1,1) ); aNonRect4.append( B2DPoint(0,1) ); + B2DPolygon aNonRect5; + aNonRect5.append( B2DPoint(0,0) ); + aNonRect5.append( B2DPoint(1,0) ); + aNonRect5.append( B2DPoint(1,1) ); + aNonRect5.append( B2DPoint(0,1) ); + aNonRect5.setControlPoints(1,B2DPoint(1,0),B2DPoint(-11,0)); + aNonRect5.setClosed(true); + CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1", tools::isRectangle( aRect1 )); CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 2", @@ -1123,6 +1131,8 @@ public: !tools::isRectangle( aNonRect3 )); CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 4", !tools::isRectangle( aNonRect4 )); + CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 5", + !tools::isRectangle( aNonRect5 )); } // Change the following lines only, if you add, remove or rename diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 942e5edb06a6..7e373d3bfe1d 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -779,7 +779,20 @@ namespace cairocanvas if( aTexture.RepeatModeX == rendering::TexturingMode::REPEAT && aTexture.RepeatModeY == rendering::TexturingMode::REPEAT ) + { cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_REPEAT ); + } + else if ( aTexture.RepeatModeX == rendering::TexturingMode::NONE && + aTexture.RepeatModeY == rendering::TexturingMode::NONE ) + { + cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_NONE ); + } + else if ( aTexture.RepeatModeX == rendering::TexturingMode::CLAMP && + aTexture.RepeatModeY == rendering::TexturingMode::CLAMP ) + { + cairo_pattern_set_extend( pPattern, CAIRO_EXTEND_PAD ); + } + aScaledTextureMatrix.x0 = basegfx::fround( aScaledTextureMatrix.x0 ); aScaledTextureMatrix.y0 = basegfx::fround( aScaledTextureMatrix.y0 ); cairo_pattern_set_matrix( pPattern, &aScaledTextureMatrix ); diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index f291d197c4de..6fc257d92c9f 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -609,8 +609,8 @@ namespace dxcanvas rTexture.RepeatModeY, "CanvasHelper::fillBitmap(): GDI+ cannot handle differing X/Y repeat mode." ); - const bool bClamp( rTexture.RepeatModeX == rendering::TexturingMode::CLAMP && - rTexture.RepeatModeY == rendering::TexturingMode::CLAMP ); + const bool bClamp( rTexture.RepeatModeX == rendering::TexturingMode::NONE && + rTexture.RepeatModeY == rendering::TexturingMode::NONE ); const geometry::IntegerSize2D aBmpSize( xBitmap->getSize() ); ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 && diff --git a/canvas/source/tools/verifyinput.cxx b/canvas/source/tools/verifyinput.cxx index a270f6158979..37a0ef687df1 100644 --- a/canvas/source/tools/verifyinput.cxx +++ b/canvas/source/tools/verifyinput.cxx @@ -429,7 +429,7 @@ namespace canvas #endif } - if( texture.RepeatModeX < rendering::TexturingMode::CLAMP || + if( texture.RepeatModeX < rendering::TexturingMode::NONE || texture.RepeatModeX > rendering::TexturingMode::REPEAT ) { #if OSL_DEBUG_LEVEL > 0 @@ -445,7 +445,7 @@ namespace canvas #endif } - if( texture.RepeatModeY < rendering::TexturingMode::CLAMP || + if( texture.RepeatModeY < rendering::TexturingMode::NONE || texture.RepeatModeY > rendering::TexturingMode::REPEAT ) { #if OSL_DEBUG_LEVEL > 0 diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 5219c6349186..9f8118e8a8f8 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -836,10 +836,6 @@ namespace vclcanvas } else if( textures[0].Bitmap.is() ) { -// OSL_ENSURE( textures[0].RepeatModeX == rendering::TexturingMode::REPEAT && -// textures[0].RepeatModeY == rendering::TexturingMode::REPEAT, -// "CanvasHelper::fillTexturedPolyPolygon(): VCL canvas cannot currently clamp textures." ); - const geometry::IntegerSize2D aBmpSize( textures[0].Bitmap->getSize() ); ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 && @@ -914,23 +910,6 @@ namespace vclcanvas aLocalState ); } } - else if ( textures[0].RepeatModeX == rendering::TexturingMode::CLAMP && - textures[0].RepeatModeY == rendering::TexturingMode::CLAMP ) - { - rendering::RenderState aLocalState( renderState ); - ::canvas::tools::appendToRenderState(aLocalState, - aTextureTransform); - ::basegfx::B2DHomMatrix aScaleCorrection; - aScaleCorrection.scale( 1.0/aBmpSize.Width, - 1.0/aBmpSize.Height ); - ::canvas::tools::appendToRenderState(aLocalState, - aScaleCorrection); - - return drawBitmap( pCanvas, - textures[0].Bitmap, - viewState, - aLocalState ); - } else { // No easy mapping to drawBitmap() - calculate @@ -1064,15 +1043,21 @@ namespace vclcanvas aSingleTextureRect, aPureTotalTransform ); - const ::Point aPt( ::vcl::unotools::pointFromB2DPoint( - aSingleDeviceTextureRect.getMinimum() ) ); + const ::Point aPtRepeat( ::vcl::unotools::pointFromB2DPoint( + aSingleDeviceTextureRect.getMinimum() ) ); const ::Size aSz( ::basegfx::fround( aScale.getX() * aBmpSize.Width ), ::basegfx::fround( aScale.getY() * aBmpSize.Height ) ); const ::Size aIntegerNextTileX( ::vcl::unotools::sizeFromB2DSize(aNextTileX) ); const ::Size aIntegerNextTileY( ::vcl::unotools::sizeFromB2DSize(aNextTileY) ); - const sal_Int32 nTilesX( nX2 - nX1 ); - const sal_Int32 nTilesY( nY2 - nY1 ); + const ::Point aPt( textures[0].RepeatModeX == rendering::TexturingMode::NONE ? + ::basegfx::fround( aOutputPos.getX() ) : aPtRepeat.X(), + textures[0].RepeatModeY == rendering::TexturingMode::NONE ? + ::basegfx::fround( aOutputPos.getY() ) : aPtRepeat.Y() ); + const sal_Int32 nTilesX( textures[0].RepeatModeX == rendering::TexturingMode::NONE ? + 1 : nX2 - nX1 ); + const sal_Int32 nTilesY( textures[0].RepeatModeX == rendering::TexturingMode::NONE ? + 1 : nY2 - nY1 ); OutputDevice& rOutDev( mpOutDev->getOutDev() ); @@ -1153,20 +1138,9 @@ namespace vclcanvas aPolyPoly.Translate( ::Point( -aPolygonDeviceRect.Left(), -aPolygonDeviceRect.Top() ) ); - aVDev.SetRasterOp( ROP_XOR ); - textureFill( aVDev, - *pGrfObj, - aOutPos, - aIntegerNextTileX, - aIntegerNextTileY, - nTilesX, - nTilesY, - aSz, - aGrfAttr ); - aVDev.SetFillColor( COL_BLACK ); - aVDev.SetRasterOp( ROP_0 ); - aVDev.DrawPolyPolygon( aPolyPoly ); - aVDev.SetRasterOp( ROP_XOR ); + const Region aPolyClipRegion( aPolyPoly ); + + aVDev.SetClipRegion( aPolyClipRegion ); textureFill( aVDev, *pGrfObj, aOutPos, @@ -1198,7 +1172,6 @@ namespace vclcanvas aOutputBmpEx ); } else -#if defined(QUARTZ) // TODO: other ports should avoid the XOR-trick too (implementation vs. interface!) { const Region aPolyClipRegion( aPolyPoly ); @@ -1234,66 +1207,6 @@ namespace vclcanvas r2ndOutDev.Pop(); } } -#else // TODO: remove once doing the XOR-trick in the canvas-layer becomes redundant - { - // output via repeated XORing - rOutDev.Push( PUSH_RASTEROP ); - rOutDev.SetRasterOp( ROP_XOR ); - textureFill( rOutDev, - *pGrfObj, - aPt, - aIntegerNextTileX, - aIntegerNextTileY, - nTilesX, - nTilesY, - aSz, - aGrfAttr ); - rOutDev.SetFillColor( COL_BLACK ); - rOutDev.SetRasterOp( ROP_0 ); - rOutDev.DrawPolyPolygon( aPolyPoly ); - rOutDev.SetRasterOp( ROP_XOR ); - textureFill( rOutDev, - *pGrfObj, - aPt, - aIntegerNextTileX, - aIntegerNextTileY, - nTilesX, - nTilesY, - aSz, - aGrfAttr ); - rOutDev.Pop(); - - if( mp2ndOutDev ) - { - OutputDevice& r2ndOutDev( mp2ndOutDev->getOutDev() ); - r2ndOutDev.Push( PUSH_RASTEROP ); - r2ndOutDev.SetRasterOp( ROP_XOR ); - textureFill( r2ndOutDev, - *pGrfObj, - aPt, - aIntegerNextTileX, - aIntegerNextTileY, - nTilesX, - nTilesY, - aSz, - aGrfAttr ); - r2ndOutDev.SetFillColor( COL_BLACK ); - r2ndOutDev.SetRasterOp( ROP_0 ); - r2ndOutDev.DrawPolyPolygon( aPolyPoly ); - r2ndOutDev.SetRasterOp( ROP_XOR ); - textureFill( r2ndOutDev, - *pGrfObj, - aPt, - aIntegerNextTileX, - aIntegerNextTileY, - nTilesX, - nTilesY, - aSz, - aGrfAttr ); - r2ndOutDev.Pop(); - } - } -#endif // complex-clipping vs. XOR-trick } } } diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index daef89bf2905..2435cf0e77ec 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1767,16 +1767,16 @@ namespace cppcanvas ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(), aBmpEx ); - if( aFill.isTiling() ) - { - aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; - aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; - } - else - { - aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; - aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; - } + if( aFill.isTiling() ) + { + aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; + aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; + } + else + { + aTexture.RepeatModeX = rendering::TexturingMode::NONE; + aTexture.RepeatModeY = rendering::TexturingMode::NONE; + } ::PolyPolygon aPath; aFill.getPath( aPath ); -- cgit From 58ed75fad4347e87825e8783d37656ad91f1a4f4 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 16:10:01 +0100 Subject: #i108160# #i10000# backport cairocanvas build fix & more build fixes * adapted tests to use new testshl include dir * took P1 masterfix also for this cws * more tweaks to get build done --- basegfx/test/basegfxtools.cxx | 2 +- basegfx/test/boxclipper.cxx | 2 +- basegfx/test/clipstate.cxx | 2 +- basegfx/test/genericclipper.cxx | 2 +- canvas/source/cairo/cairo_canvashelper.cxx | 11 ++++++----- o3tl/qa/test-vector_pool.cxx | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/basegfx/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx index 6ace65c5894d..4daf0a351d77 100644 --- a/basegfx/test/basegfxtools.cxx +++ b/basegfx/test/basegfxtools.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index 95086cb6a32d..4f18741c7a34 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index 38b18d57003f..45d542d91b46 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx index 9ab903ca1541..ed77ca1f693f 100644 --- a/basegfx/test/genericclipper.cxx +++ b/basegfx/test/genericclipper.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include #include #include diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index f0ba4067f899..831655f1256f 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -1072,14 +1072,15 @@ namespace cairocanvas aEdge.append(aCandidate.getB2DPoint(0)); aEdge.append(basegfx::B2DPoint(0.0, 0.0)); - for(sal_uInt32 a(0); a < nEdgeCount; a++) + for(sal_uInt32 b(0); b < nEdgeCount; b++) { - const sal_uInt32 nNextIndex((a + 1) % nPointCount); + const sal_uInt32 nNextIndex((b + 1) % nPointCount); aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex)); - aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a)); + aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(b)); aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex)); - doPolyPolygonImplementation( aEdge, aOperation, + doPolyPolygonImplementation( basegfx::B2DPolyPolygon(aEdge), + aOperation, pCairo, pTextures, mpSurfaceProvider, xPolyPolygon->getFillRule() ); @@ -1276,7 +1277,7 @@ namespace cairocanvas cairo_save( mpCairo.get() ); useStates( viewState, renderState, true ); - doPolyPolygonPath( xPolyPolygon, Fill, &textures ); + doPolyPolygonPath( xPolyPolygon, Fill, false, &textures ); cairo_restore( mpCairo.get() ); } diff --git a/o3tl/qa/test-vector_pool.cxx b/o3tl/qa/test-vector_pool.cxx index 4cbd1a78f0f6..749859f4b995 100644 --- a/o3tl/qa/test-vector_pool.cxx +++ b/o3tl/qa/test-vector_pool.cxx @@ -1,6 +1,6 @@ // autogenerated file with codegen.pl -#include +#include #include -- cgit From 04e61ab1857ee1b660a3d2ef56a0fa6172d9804a Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 18:48:06 +0100 Subject: #i107271# need that here, too, office crashes otherwise --- vcl/unx/source/gdi/salgdi.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 5fe2295a8fed..386be14f04d7 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1428,14 +1428,17 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // unless it splits another trapezoid that is still active bool bSplit = false; ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin(); - for(; aActiveTrapsIt != aActiveTraps.end(); ++aActiveTrapsIt ) + while(aActiveTrapsIt != aActiveTraps.end()) { XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ]; // skip until first overlap candidate // TODO: use stl::*er_bound() instead if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) ) + { + ++aActiveTrapsIt; continue; + } // in the ActiveTrapSet there are still trapezoids where // a vertical overlap with new trapezoids is no longer possible @@ -1446,15 +1449,26 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly { ActiveTrapSet::iterator it = aActiveTrapsIt; if( aActiveTrapsIt != aActiveTraps.begin() ) + { --aActiveTrapsIt; - aActiveTraps.erase( it ); + aActiveTraps.erase( it ); + ++aActiveTrapsIt; + } + else + { + aActiveTraps.erase( it ); + aActiveTrapsIt = aActiveTraps.begin(); + } continue; } // check if there is horizontal overlap // aTrapezoid.left==rLeftTrap.right is allowed though if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) ) + { + ++aActiveTrapsIt; continue; + } // prepare to split the old trapezoid and keep its upper part // find the old trapezoids entry in the VerticalTrapSet and remove it -- cgit From 4338fe5d7d67224771e2f1dae26d281b63c50595 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 18:58:26 +0100 Subject: #i105937# Post-merge fixes * nicer gradient poly setup, made code more self-explanatory * corrected order of rotation matrix multiplication * fixed build breakage in presenter screen, type only implicitely included --- basegfx/source/tools/gradienttools.cxx | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 8a2d38f44c6f..69dbf9e5ae28 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -94,9 +94,8 @@ namespace basegfx { const B2DPoint aCenter(0.5*fTargetSizeX, 0.5*fTargetSizeY); - o_rGradientInfo.maTextureTransform = - o_rGradientInfo.maTextureTransform - * basegfx::tools::createRotateAroundPoint(aCenter, fAngle); + o_rGradientInfo.maTextureTransform *= + basegfx::tools::createRotateAroundPoint(aCenter, fAngle); } // add object translate @@ -155,17 +154,13 @@ namespace basegfx o_rGradientInfo.maTextureTransform.translate(0.5, 0.5); o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); - if( !bCircular ) + // add texture rotate after scale to keep perpendicular angles + if( !bCircular && 0.0 != fAngle) { - // add texture rotate after scale to keep perpendicular angles - if(0.0 != fAngle) - { - const B2DPoint aCenter(0.5*fTargetSizeX, - 0.5*fTargetSizeY); - o_rGradientInfo.maTextureTransform = - o_rGradientInfo.maTextureTransform - * basegfx::tools::createRotateAroundPoint(aCenter, fAngle); - } + const B2DPoint aCenter(0.5*fTargetSizeX, + 0.5*fTargetSizeY); + o_rGradientInfo.maTextureTransform *= + basegfx::tools::createRotateAroundPoint(aCenter, fAngle); } // add defined offsets after rotation @@ -232,9 +227,8 @@ namespace basegfx { const B2DPoint aCenter(0.5*fTargetSizeX, 0.5*fTargetSizeY); - o_rGradientInfo.maTextureTransform = - o_rGradientInfo.maTextureTransform - * basegfx::tools::createRotateAroundPoint(aCenter, fAngle); + o_rGradientInfo.maTextureTransform *= + basegfx::tools::createRotateAroundPoint(aCenter, fAngle); } // add defined offsets after rotation -- cgit From fbb946815b14c1eb50791a9338950ff29ebe8479 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 18 Jan 2010 20:46:53 +0100 Subject: put drag grip at the bottom --- vcl/source/window/dockmgr.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 24b2da8e85bf..5b028e511e24 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -532,6 +532,7 @@ private: bool mbTrackingEnabled; Point maDelta; Point maTearOffPosition; + bool mbGripAtBottom; void ImplSetBorder(); public: @@ -563,6 +564,7 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* mbHighlight = FALSE; mbMoving = FALSE; mbTrackingEnabled = FALSE; + mbGripAtBottom = TRUE; ImplSetBorder(); } @@ -612,13 +614,22 @@ void ImplPopupFloatWin::Resize() Rectangle ImplPopupFloatWin::GetDragRect() const { - return Rectangle( 1, 1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); + Rectangle aRect( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); + if( mbGripAtBottom ) + { + int height = GetOutputSizePixel().Height(); + aRect.Top() = height - 3 - POPUP_DRAGHEIGHT; + aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT; + } + + return aRect; } Point ImplPopupFloatWin::GetToolboxPosition() const { // return inner position where a toolbox could be placed - Point aPt( 1, 1+GetDragRect().getHeight() ); // grip + border + Point aPt( 1, 1 + (mbGripAtBottom ? 0 : GetDragRect().getHeight()) ); // grip + border + return aPt; } -- cgit From d0427d82613f5ce881b86098fce3c8a1b1bbdfdc Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 20:50:28 +0100 Subject: #i10000# buildbots fretted out another breakage - no axial grads --- canvas/source/tools/image.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canvas/source/tools/image.cxx b/canvas/source/tools/image.cxx index 49d1e7daa672..59f7cec04f9d 100644 --- a/canvas/source/tools/image.cxx +++ b/canvas/source/tools/image.cxx @@ -1515,7 +1515,7 @@ void Image::fillGradientImpl( const ParametricPolyPolygon::Values& rValues, typedef color_generator_adaptor color_generator_type; unsigned int dwNumSteps = static_cast(rBounds.getWidth()); color_generator_type colors(color1,color2,dwNumSteps); - colors.set_linear(rValues.meType != ParametricPolyPolygon::GRADIENT_AXIAL); + colors.set_linear(true); // color = f(x,y) gradient_polymorphic_wrapper gf_x; -- cgit From 80e02df062b8e91202d3cd4c420edbe33efcfc7a Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 20:58:27 +0100 Subject: #i105834# Fix cairo link flags * applied patch, kudos to Petr for the fix --- canvas/source/cairo/makefile.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk index 27a1aeb6dcd7..95ad047ea434 100644 --- a/canvas/source/cairo/makefile.mk +++ b/canvas/source/cairo/makefile.mk @@ -91,7 +91,7 @@ SHL1STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CPPUHELP .IF "$(SYSTEM_CAIRO)" == "YES" SHL1STDLIBS+= $(CAIRO_LIBS) .ELSE -SHL1STDLIBS+= -lcairo +SHL1STDLIBS+= -lcairo -lpixman-1 .ENDIF .IF "$(GUIBASE)"=="aqua" @@ -102,7 +102,7 @@ CFLAGSCXX+=$(OBJCXXFLAGS) # Xlib SLOFILES+= $(SLO)$/cairo_xlib_cairo.obj -SHL1STDLIBS+= -lfontconfig -lX11 -lXrender -lpixman-1 $(FREETYPE_LIBS) +SHL1STDLIBS+= -lfontconfig -lX11 -lXrender $(FREETYPE_LIBS) CFLAGS+=$(FREETYPE_CFLAGS) .ENDIF # "$(GUIBASE)"=="aqua" -- cgit From 9fb80cbeeebce009d0b437f36c8d0ba124463a27 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 18 Jan 2010 21:01:43 +0100 Subject: #i107137# fix wrong colorspace calculations * applied patch from i107137 --- canvas/source/cairo/cairo_canvashelper.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 831655f1256f..64f246afc1a4 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -1794,12 +1794,12 @@ namespace cairocanvas rendering::RGBColor* pOut( aRes.getArray() ); for( sal_Size i=0; i Date: Tue, 19 Jan 2010 12:49:10 +0100 Subject: #161490# removed scheme vnd.sun.star.wfs --- svl/source/misc/urihelper.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 5473bf1c995d..0ae0cd0ebf80 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -126,8 +126,7 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef, eStyle); if (bCheckFileExists && !bWasAbsolute - && (aAbsURIRef.GetProtocol() == INET_PROT_FILE - || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS)) + && (aAbsURIRef.GetProtocol() == INET_PROT_FILE)) { INetURLObject aNonFileURIRef; aNonFileURIRef.SetSmartURL(rTheRelURIRef, -- cgit From 60ce6ed678ccf1e2a78c316bc35771cb945cb18d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Mar 2010 12:24:29 +0100 Subject: slidecopy: silenced GCC compiler warnings --- svtools/source/toolpanel/paneltabbar.cxx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 894c53d16db4..fdc5f3f23ee3 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -215,6 +215,7 @@ namespace svt // aControlValue, ::rtl::OUString(), // aBoundingRegion, aContentRegion // ); + (void)i_nItemFlags; return Rectangle( Point( i_rContentArea.Left() - 1, i_rContentArea.Top() - 1 ), Size( i_rContentArea.GetWidth() + 2, i_rContentArea.GetHeight() + 2 ) @@ -472,24 +473,6 @@ namespace svt private: OutputDevice& m_rDevice; }; - - //-------------------------------------------------------------------------------------------------------------- - static void lcl_deflateRect( Rectangle& io_rArea, const Inset& i_rInset ) - { - io_rArea.Left() += i_rInset.nLeft; - io_rArea.Top() += i_rInset.nTop; - io_rArea.Right() -= i_rInset.nRight; - io_rArea.Bottom() -= i_rInset.nBottom; - } - - //-------------------------------------------------------------------------------------------------------------- - static void lcl_inflateRect( Rectangle& io_rArea, const Inset& i_rInset ) - { - io_rArea.Left() -= i_rInset.nLeft; - io_rArea.Top() -= i_rInset.nTop; - io_rArea.Right() += i_rInset.nRight; - io_rArea.Bottom() += i_rInset.nBottom; - } } //================================================================================================================== -- cgit From 5ca62ea8ae6580684d6f177990aeb406a93f64d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:49:42 +0100 Subject: autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value --- canvas/source/directx/dx_5rm.cxx | 2 +- canvas/source/directx/dx_9rm.cxx | 2 +- .../source/directx/dx_canvashelper_texturefill.cxx | 2 +- canvas/source/vcl/canvashelper.cxx | 2 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 30 +++++++++++----------- tools/inc/tools/diagnose_ex.h | 12 ++++++--- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/canvas/source/directx/dx_5rm.cxx b/canvas/source/directx/dx_5rm.cxx index 4937934732cd..71c65feb3b6f 100755 --- a/canvas/source/directx/dx_5rm.cxx +++ b/canvas/source/directx/dx_5rm.cxx @@ -1008,7 +1008,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index acef323ddc1b..a50d0d5abeb7 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -544,7 +544,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 73a2d49bfb62..f5836e56d668 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -345,7 +345,7 @@ namespace dxcanvas GraphicsPathSharedPtr pGradientPath( tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); - ENSURE_OR_RETURN( pGradientPath.get(), + ENSURE_OR_RETURN_FALSE( pGradientPath.get(), "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); PathGradientBrushSharedPtr pGradientBrush; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 20b489144d0e..144a41fb0212 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1390,7 +1390,7 @@ namespace vclcanvas const ::Size& rSz, const GraphicAttr& rAttr ) const { - ENSURE_OR_RETURN( rGrf, + ENSURE_OR_RETURN_FALSE( rGrf, "Invalid Graphic" ); if( !mpOutDev ) diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8ea2ae453a97..0f51216b190e 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1876,16 +1876,16 @@ namespace cppcanvas ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(), aBmpEx ); - if( aFill.isTiling() ) - { - aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; - aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; - } - else - { - aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; - aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; - } + if( aFill.isTiling() ) + { + aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; + aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; + } + else + { + aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; + aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; + } ::PolyPolygon aPath; aFill.getPath( aPath ); @@ -2877,7 +2877,7 @@ namespace cppcanvas aSubset.mnSubsetEnd = ::std::min( aRangeBegin->mpAction->getActionCount(), nEndIndex - aRangeBegin->mnOrigIndex ); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2893,7 +2893,7 @@ namespace cppcanvas nStartIndex - aRangeBegin->mnOrigIndex ); aSubset.mnSubsetEnd = aRangeBegin->mpAction->getActionCount(); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2922,7 +2922,7 @@ namespace cppcanvas aSubset.mnSubsetBegin = 0; aSubset.mnSubsetEnd = nEndIndex - aRangeEnd->mnOrigIndex; - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeEnd, aSubset ); @@ -2937,10 +2937,10 @@ namespace cppcanvas ActionVector::const_iterator& o_rRangeBegin, ActionVector::const_iterator& o_rRangeEnd ) const { - ENSURE_OR_RETURN( io_rStartIndex<=io_rEndIndex, + ENSURE_OR_RETURN_FALSE( io_rStartIndex<=io_rEndIndex, "ImplRenderer::getSubsetIndices(): invalid action range" ); - ENSURE_OR_RETURN( !maActions.empty(), + ENSURE_OR_RETURN_FALSE( !maActions.empty(), "ImplRenderer::getSubsetIndices(): no actions to render" ); const sal_Int32 nMinActionIndex( maActions.front().mnOrigIndex ); diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 5ca7a71cf62c..eee965fcfd76 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -121,11 +121,17 @@ ifc ); } /** This macro asserts the given condition (in debug mode), and - returns false afterwards. + returns the given value afterwards. */ -#define ENSURE_OR_RETURN(c, m) if( !(c) ) { \ +#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \ OSL_ENSURE(c, m); \ - return false; } + return r; } + +/** This macro asserts the given condition (in debug mode), and + returns false afterwards. + */ +#define ENSURE_OR_RETURN_FALSE(c, m) \ + ENSURE_OR_RETURN(c, m, false) -- cgit From e786c55dfdaf2f4fede00113ab0b32c867c13437 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 26 Feb 2010 22:25:32 +0100 Subject: slidecopy: initial, rudimentary implementation of a ToolPanelDeck, along with a small test program --- svtools/inc/svtools/toolpanel/decklayouter.hxx | 66 ++++++ svtools/inc/svtools/toolpanel/tablayouter.hxx | 66 ++++++ svtools/inc/svtools/toolpanel/toolpanel.hxx | 65 ++++++ .../inc/svtools/toolpanel/toolpanelcollection.hxx | 63 ++++++ svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 76 +++++++ svtools/prj/build.lst | 4 +- svtools/source/toolpanel/dummypanel.cxx | 66 ++++++ svtools/source/toolpanel/dummypanel.hxx | 57 ++++++ svtools/source/toolpanel/makefile.mk | 57 ++++++ svtools/source/toolpanel/tablayouter.cxx | 70 +++++++ svtools/source/toolpanel/toolpanelcollection.cxx | 94 +++++++++ svtools/source/toolpanel/toolpaneldeck.cxx | 222 ++++++++++++++++++++ svtools/workben/toolpanel/makefile.mk | 107 ++++++++++ svtools/workben/toolpanel/toolpaneltest.cxx | 225 +++++++++++++++++++++ 14 files changed, 1237 insertions(+), 1 deletion(-) create mode 100644 svtools/inc/svtools/toolpanel/decklayouter.hxx create mode 100644 svtools/inc/svtools/toolpanel/tablayouter.hxx create mode 100644 svtools/inc/svtools/toolpanel/toolpanel.hxx create mode 100644 svtools/inc/svtools/toolpanel/toolpanelcollection.hxx create mode 100644 svtools/inc/svtools/toolpanel/toolpaneldeck.hxx create mode 100644 svtools/source/toolpanel/dummypanel.cxx create mode 100644 svtools/source/toolpanel/dummypanel.hxx create mode 100644 svtools/source/toolpanel/makefile.mk create mode 100644 svtools/source/toolpanel/tablayouter.cxx create mode 100644 svtools/source/toolpanel/toolpanelcollection.cxx create mode 100644 svtools/source/toolpanel/toolpaneldeck.cxx create mode 100644 svtools/workben/toolpanel/makefile.mk create mode 100644 svtools/workben/toolpanel/toolpaneltest.cxx diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx new file mode 100644 index 000000000000..b6e27162a29c --- /dev/null +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 DECKLAYOUTER_HXX +#define DECKLAYOUTER_HXX + +#include + +class Rectangle; + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= IDeckLayouter + //==================================================================== + class IDeckLayouter + { + public: + /** re-arranges the elements of the tool deck, taking into account the + available space for the complete deck. + + @param i_rDeckPlayground + the playground for the complete tool panel deck + @return + the content area for the single tool panels + */ + virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) = 0; + + virtual ~IDeckLayouter() + { + } + }; + + typedef ::boost::shared_ptr< IDeckLayouter > PDeckLayouter; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // DECKLAYOUTER_HXX diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx new file mode 100644 index 000000000000..ff66fe367e3b --- /dev/null +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 TABLAYOUTER_HXX +#define TABLAYOUTER_HXX + +#include "svtools/toolpanel/decklayouter.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + enum TabAlignment + { + TABS_RIGHT + }; + + struct TabDeckLayouter_Data; + + //==================================================================== + //= TabDeckLayouter + //==================================================================== + class TabDeckLayouter : public IDeckLayouter + { + public: + TabDeckLayouter( const TabAlignment i_eAlignment ); + ~TabDeckLayouter(); + + // IDeckLayouter + virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); + + private: + ::std::auto_ptr< TabDeckLayouter_Data > m_pData; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TABLAYOUTER_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx new file mode 100644 index 000000000000..4b7227f52cbd --- /dev/null +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TOOLPANEL_HXX +#define TOOLPANEL_HXX + +#include + +class Rectangle; + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= IToolPanel + //==================================================================== + /** abstract interface for a single tool panel + */ + class IToolPanel + { + public: + /// shows the panel + virtual void Show() = 0; + /// hides the panel + virtual void Hide() = 0; + /// sets the position of the panel + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ) = 0; + + virtual ~IToolPanel() + { + } + }; + + typedef ::boost::shared_ptr< IToolPanel > PToolPanel; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TOOLPANEL_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx b/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx new file mode 100644 index 000000000000..a0257fc5c91e --- /dev/null +++ b/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TOOLPANELCOLLECTION_HXX +#define TOOLPANELCOLLECTION_HXX + +#include "svtools/toolpanel/toolpanel.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + struct ToolPanelCollection_Data; + + //==================================================================== + //= ToolPanelCollection + //==================================================================== + class ToolPanelCollection + { + public: + ToolPanelCollection(); + ~ToolPanelCollection(); + + // panel access + size_t GetPanelCount() const; + PToolPanel GetPanel( const size_t i_nPos ) const; + size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ); + + private: + ::std::auto_ptr< ToolPanelCollection_Data > m_pData; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TOOLPANELCOLLECTION_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx new file mode 100644 index 000000000000..2efde1f29e8b --- /dev/null +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 TOOLPANELDECK_HXX +#define TOOLPANELDECK_HXX + +#include "svtools/toolpanel/decklayouter.hxx" +#include "svtools/toolpanel/toolpanelcollection.hxx" + +#include + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + class ToolPanelCollection; + class ToolPanelDeck_Impl; + + //==================================================================== + //= ToolPanelDeck + //==================================================================== + class ToolPanelDeck : public Control + { + public: + ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle ); + ~ToolPanelDeck(); + + // attributes + PDeckLayouter GetLayouter() const; + void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + + size_t GetActivePanel() const; + void ActivatePanel( const size_t i_nPanel ); + + const ToolPanelCollection& GetPanels() const; + ToolPanelCollection& GetPanels(); + + protected: + // Window overridables + virtual void Resize(); + + private: + ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TOOLPANELDECK_HXX diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 5a67b9414181..a71d30487bb4 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -20,9 +20,11 @@ st svtools\source\plugapp nmake - all st_papp st_inc NULL st svtools\source\svhtml nmake - all st_html st_inc NULL st svtools\source\svrtf nmake - all st_rtf st_inc NULL st svtools\source\table nmake - all st_table st_inc NULL +st svtools\source\toolpanel nmake - all st_toolpanel st_inc NULL st svtools\source\uno nmake - all st_uno st_inc NULL st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\util nmake - all st_util st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL +st svtools\util nmake - all st_util st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_toolpanel st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL +st svtools\workben\toolpanel nmake - all st_workben_toolpanel st_toolpanel NULL diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx new file mode 100644 index 000000000000..52c89be24b99 --- /dev/null +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -0,0 +1,66 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "dummypanel.hxx" + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= DummyPanel + //==================================================================== + //-------------------------------------------------------------------- + DummyPanel::DummyPanel() + { + } + + //-------------------------------------------------------------------- + DummyPanel::~DummyPanel() + { + } + + //-------------------------------------------------------------------- + void DummyPanel::Show() + { + } + + //-------------------------------------------------------------------- + void DummyPanel::Hide() + { + } + + //-------------------------------------------------------------------- + void DummyPanel::SetPosSizePixel( const Rectangle& /*i_rPanelPlayground*/ ) + { + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx new file mode 100644 index 000000000000..425467641077 --- /dev/null +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef DUMMYPANEL_HXX +#define DUMMYPANEL_HXX + +#include "svtools/toolpanel/toolpanel.hxx" + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= DummyPanel + //==================================================================== + /// is a dummy implementation of the IToolPanel interface + class DummyPanel : public IToolPanel + { + public: + DummyPanel(); + ~DummyPanel(); + + // IToolPanel + virtual void Show(); + virtual void Hide(); + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // DUMMYPANEL_HXX diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk new file mode 100644 index 000000000000..23a3186bdcef --- /dev/null +++ b/svtools/source/toolpanel/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.16 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=toolpanel + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES=\ + $(SLO)$/dummypanel.obj \ + $(SLO)$/tablayouter.obj \ + $(SLO)$/toolpanelcollection.obj \ + $(SLO)$/toolpaneldeck.obj \ + +#LIB1TARGET= $(SLB)$/$(TARGET).lib +#LIB1OBJFILES= $(SLOFILES) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx new file mode 100644 index 000000000000..3f6f57453356 --- /dev/null +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -0,0 +1,70 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "svtools/toolpanel/tablayouter.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= TabDeckLayouter_Data + //==================================================================== + struct TabDeckLayouter_Data + { + TabAlignment eAlignment; + }; + + //==================================================================== + //= TabDeckLayouter + //==================================================================== + //-------------------------------------------------------------------- + TabDeckLayouter::TabDeckLayouter( const TabAlignment i_eAlignment ) + :m_pData( new TabDeckLayouter_Data ) + { + m_pData->eAlignment = i_eAlignment; + } + + //-------------------------------------------------------------------- + TabDeckLayouter::~TabDeckLayouter() + { + } + + //-------------------------------------------------------------------- + Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) + { + // TODO + return i_rDeckPlayground; + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx new file mode 100644 index 000000000000..ff274075f108 --- /dev/null +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -0,0 +1,94 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "svtools/toolpanel/toolpanelcollection.hxx" + +#include + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= ToolPanelCollection_Data + //==================================================================== + struct ToolPanelCollection_Data + { + ::std::vector< PToolPanel > aPanels; + }; + + //==================================================================== + //= ToolPanelCollection + //==================================================================== + //-------------------------------------------------------------------- + ToolPanelCollection::ToolPanelCollection() + :m_pData( new ToolPanelCollection_Data ) + { + } + + //-------------------------------------------------------------------- + ToolPanelCollection::~ToolPanelCollection() + { + } + + //-------------------------------------------------------------------- + size_t ToolPanelCollection::GetPanelCount() const + { + return m_pData->aPanels.size(); + } + + //-------------------------------------------------------------------- + PToolPanel ToolPanelCollection::GetPanel( const size_t i_nPos ) const + { + OSL_ENSURE( i_nPos < m_pData->aPanels.size(), "ToolPanelCollection::GetPanel: illegal position!" ); + if ( i_nPos >= m_pData->aPanels.size() ) + return PToolPanel(); + return m_pData->aPanels[ i_nPos ]; + } + + //-------------------------------------------------------------------- + size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ) + { + OSL_ENSURE( i_pPanel.get(), "ToolPanelCollection::InsertPanel: illegal panel!" ); + if ( !i_pPanel.get() ) + return 0; + + const size_t position = i_pPosition < m_pData->aPanels.size() ? i_pPosition : m_pData->aPanels.size(); + m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel ); + + // TODO: notification. The tool panel deck which owns us is certainly interested in this event ... + + return position; + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx new file mode 100644 index 000000000000..12f85794576e --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "dummypanel.hxx" + +#include "svtools/toolpanel/toolpaneldeck.hxx" +#include "svtools/toolpanel/tablayouter.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= ToolPanelDeck_Impl + //==================================================================== + class ToolPanelDeck_Impl + { + public: + ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) + :m_rDeck( i_rDeck ) + ,m_aPanels() + ,m_pDummyPanel( new DummyPanel ) + ,m_aActivePanel() + ,m_pLayouter() + ,m_aPanelPlayground() + { + // use a default layouter + m_pLayouter.reset( new TabDeckLayouter( TABS_RIGHT ) ); + + // add as listener to the panels collection - we're interested in panels + // being added and removed + // TODO + } + + const ToolPanelCollection& GetPanels() const { return m_aPanels; } + ToolPanelCollection& GetPanels() { return m_aPanels; } + + size_t GetActivePanel() const; + void ActivatePanel( const size_t i_nPanel ); + + PDeckLayouter GetLayouter() const { return m_pLayouter; } + void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + + /// re-layouts everything + void LayoutAll() { ImplDoLayout(); } + + private: + void ImplDoLayout(); + + private: + PToolPanel GetActiveOrDummyPanel_Impl(); + + private: + ToolPanelDeck& m_rDeck; + + ToolPanelCollection m_aPanels; + PToolPanel m_pDummyPanel; + ::boost::optional< size_t > + m_aActivePanel; + + PDeckLayouter m_pLayouter; + Rectangle m_aPanelPlayground; + }; + + //-------------------------------------------------------------------- + PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl() + { + if ( !m_aActivePanel ) + return m_pDummyPanel; + return m_aPanels.GetPanel( *m_aActivePanel ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter ) + { + OSL_ENSURE( i_pNewLayouter.get(), "ToolPanelDeck_Impl::SetLayouter: invalid layouter!" ); + if ( !i_pNewLayouter.get() ) + return; + m_pLayouter = i_pNewLayouter; + + ImplDoLayout(); + } + + //-------------------------------------------------------------------- + size_t ToolPanelDeck_Impl::GetActivePanel() const + { + OSL_PRECOND( !!m_aActivePanel, "ToolPanelDeck_Impl::GetActivePanel: no active panel (yet)!" ); + if ( !m_aActivePanel ) + return 0; + return *m_aActivePanel; + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel ) + { + OSL_ENSURE( i_nPanel < m_aPanels.GetPanelCount(), "ToolPanelDeck_Impl::ActivatePanel: illegal panel no.!" ); + if ( i_nPanel >= m_aPanels.GetPanelCount() ) + return; + + if ( !!m_aActivePanel && ( *m_aActivePanel == i_nPanel ) ) + return; + + // hide the old panel + const PToolPanel pOldActive( GetActiveOrDummyPanel_Impl() ); + pOldActive->Hide(); + + m_aActivePanel = i_nPanel; + + // position and show the new panel + const PToolPanel pNewActive( GetActiveOrDummyPanel_Impl() ); + pNewActive->SetPosSizePixel( m_aPanelPlayground ); + pNewActive->Show(); + + // tell the layouter - it might need to adjust its visuals to the new situation + // TODO + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::ImplDoLayout() + { + const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() ); + + // let the layouter do the main work + m_aPanelPlayground = aDeckPlayground; + OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" ); + if ( m_pLayouter.get() ) + m_aPanelPlayground = m_pLayouter->Layout( aDeckPlayground ); + + // and position the active panel + const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); + pActive->SetPosSizePixel( m_aPanelPlayground ); + } + + //==================================================================== + //= ToolPanelDeck + //==================================================================== + //-------------------------------------------------------------------- + ToolPanelDeck::ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle ) + :Control( &i_rParent, i_nStyle ) + ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) + { + } + + //-------------------------------------------------------------------- + ToolPanelDeck::~ToolPanelDeck() + { + } + + //-------------------------------------------------------------------- + size_t ToolPanelDeck::GetActivePanel() const + { + return m_pImpl->GetActivePanel(); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck::ActivatePanel( const size_t i_nPanel ) + { + m_pImpl->ActivatePanel( i_nPanel ); + } + + //-------------------------------------------------------------------- + PDeckLayouter ToolPanelDeck::GetLayouter() const + { + return m_pImpl->GetLayouter(); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter ) + { + return m_pImpl->SetLayouter( i_pNewLayouter ); + } + + //-------------------------------------------------------------------- + const ToolPanelCollection& ToolPanelDeck::GetPanels() const + { + return m_pImpl->GetPanels(); + } + + //-------------------------------------------------------------------- + ToolPanelCollection& ToolPanelDeck::GetPanels() + { + return m_pImpl->GetPanels(); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck::Resize() + { + Control::Resize(); + m_pImpl->LayoutAll(); + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk new file mode 100644 index 000000000000..8572ccaa3607 --- /dev/null +++ b/svtools/workben/toolpanel/makefile.mk @@ -0,0 +1,107 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.16 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svtools +TARGET=toolpaneltest +TARGETTYPE=GUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +CXXFILES= toolpaneltest.cxx + +OBJFILES= $(OBJ)$/toolpaneltest.obj + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJFILES) +APP1LIBS= $(SLB)/toolpanel.lib +APP1STDLIBS=\ + $(VCLLIB) \ + $(SALLIB) \ + $(TOOLSLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + + +.IF "$(GUI)"!="UNX" +APP1DEF= $(MISC)$/$(TARGET).def +.ENDIF + +.IF "$(COM)"=="GCC" +ADDOPTFILES=$(OBJ)$/toolpaneltest.obj +add_cflagscxx="-frtti -fexceptions" +.ENDIF + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + +# ------------------------------------------------------------------ +# MAC +# ------------------------------------------------------------------ + +.IF "$(GUI)" == "MAC" + +$(MISC)$/$(TARGET).def: makefile + echo Kein Def-File fuer Applikationen auf Mac +.ENDIF + + +# ------------------------------------------------------------------ +# Windows +# ------------------------------------------------------------------ + +.IF "$(GUI)" == "WIN" + +$(MISC)$/$(TARGET).def: makefile + echo NAME $(TARGET) >$@ + echo DESCRIPTION 'ToolPanel - Testprogramm' >>$@ + echo EXETYPE WINDOWS >>$@ + echo STUB 'winSTUB.EXE' >>$@ + echo PROTMODE >>$@ + echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@ + echo DATA PRELOAD MOVEABLE MULTIPLE >>$@ + echo HEAPSIZE 8192 >>$@ + echo STACKSIZE 32768 >>$@ + +.ENDIF + diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx new file mode 100644 index 000000000000..6b02208fbdfe --- /dev/null +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -0,0 +1,225 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied 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_svtools.hxx" + +#include "svtools/toolpanel/toolpaneldeck.hxx" + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace svt { namespace toolpanel +{ + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::uno::XComponentContext; + +//============================================================================= +//= PanelDemo +//============================================================================= +class PanelDemo : public Application +{ +public: + virtual void Main(); + +private: + static Reference< XMultiServiceFactory > createApplicationServiceManager(); +}; + +//============================================================================= +//= ColoredPanelWindow +//============================================================================= +class ColoredPanelWindow : public Window +{ +public: + ColoredPanelWindow( Window& i_rParent, const Color& i_rColor ) + :Window( &i_rParent ) + { + SetLineColor(); + SetFillColor( i_rColor ); + } + + virtual void Paint( const Rectangle& i_rRect ) + { + DrawRect( i_rRect ); + } +}; + +//============================================================================= +//= ColoredPanel +//============================================================================= +class ColoredPanel : public IToolPanel +{ +public: + ColoredPanel( Window& i_rParent, const Color& i_rColor ); + ~ColoredPanel(); + + // IToolPanel + virtual void Show(); + virtual void Hide(); + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + +private: + ColoredPanelWindow m_aWindow; +}; + +//============================================================================= +//= ColoredPanel +//============================================================================= +//----------------------------------------------------------------------------- +ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor ) + :m_aWindow( i_rParent, i_rColor ) +{ +} + +//----------------------------------------------------------------------------- +ColoredPanel::~ColoredPanel() +{ +} + +//----------------------------------------------------------------------------- +void ColoredPanel::Show() +{ + m_aWindow.Show(); +} + +//----------------------------------------------------------------------------- +void ColoredPanel::Hide() +{ + m_aWindow.Hide(); +} + +//----------------------------------------------------------------------------- +void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) +{ + m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); +} + +//============================================================================= +//= PanelDemoMainWindow +//============================================================================= +class PanelDemoMainWindow : public WorkWindow +{ +private: + ToolPanelDeck m_aToolPanelDeck; + +protected: + virtual void GetFocus(); + +public: + PanelDemoMainWindow(); + ~PanelDemoMainWindow(); + + virtual void Resize(); +}; + +//============================================================================= +//= PanelDemoMainWindow +//============================================================================= +//----------------------------------------------------------------------------- +PanelDemoMainWindow::PanelDemoMainWindow() + :WorkWindow( NULL, WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) + ,m_aToolPanelDeck( *this, WB_BORDER ) +{ + m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); + m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); + + ToolPanelCollection& rPanels = m_aToolPanelDeck.GetPanels(); + const size_t nFirstPanelPosition = rPanels.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ) ) ), rPanels.GetPanelCount() ); + m_aToolPanelDeck.ActivatePanel( nFirstPanelPosition ); + + m_aToolPanelDeck.Show(); + + SetBackground( Color( COL_LIGHTGRAY ) ); + + SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); + Show(); +} + +//----------------------------------------------------------------------------- +PanelDemoMainWindow::~PanelDemoMainWindow() +{ +} + +//----------------------------------------------------------------------------- +void PanelDemoMainWindow::GetFocus() +{ + WorkWindow::GetFocus(); + m_aToolPanelDeck.GrabFocus(); +} + +//----------------------------------------------------------------------------- +void PanelDemoMainWindow::Resize() +{ + WorkWindow::Resize(); + Size aSize( GetOutputSizePixel() ); + aSize.Width() -= 40; + aSize.Height() -= 40; + m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize ); +} + +//============================================================================= +//= PanelDemo +//============================================================================= +//----------------------------------------------------------------------------- +Reference< XMultiServiceFactory > PanelDemo::createApplicationServiceManager() +{ + Reference< XMultiServiceFactory > xMS; + try + { + Reference< XComponentContext > xComponentContext = ::cppu::defaultBootstrap_InitialComponentContext(); + if ( xComponentContext.is() ) + xMS = xMS.query( xComponentContext->getServiceManager() ); + } + catch( const ::com::sun::star::uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return xMS; +} + +//----------------------------------------------------------------------------- +void __EXPORT PanelDemo::Main() +{ + Reference< XMultiServiceFactory > xSMgr = createApplicationServiceManager(); + ::comphelper::setProcessServiceFactory( xSMgr ); + + PanelDemoMainWindow aWindow; + Execute(); +} + +PanelDemo aTheApplication; + +} } // namespace ::svt::toolpanel -- cgit From d648e087014684dd4a930f9f49becb28d28f0560 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Mar 2010 13:23:12 +0100 Subject: slidecopy: initial version of the tab bar layout still quite some work ahead, but we have a tab bar now, and can click the tabs to select panes --- svtools/inc/svtools/toolpanel/decklayouter.hxx | 17 +- svtools/inc/svtools/toolpanel/tablayouter.hxx | 24 +- svtools/inc/svtools/toolpanel/toolpanel.hxx | 13 +- .../inc/svtools/toolpanel/toolpanelcollection.hxx | 63 --- .../inc/svtools/toolpanel/toolpanelcontainer.hxx | 85 +++ svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 27 +- svtools/source/toolpanel/dummypanel.cxx | 15 + svtools/source/toolpanel/dummypanel.hxx | 8 +- svtools/source/toolpanel/makefile.mk | 5 +- svtools/source/toolpanel/paneltabbar.cxx | 595 +++++++++++++++++++++ svtools/source/toolpanel/paneltabbar.hxx | 75 +++ svtools/source/toolpanel/refbase.cxx | 56 ++ svtools/source/toolpanel/refbase.hxx | 78 +++ svtools/source/toolpanel/tablayouter.cxx | 77 ++- svtools/source/toolpanel/toolpanelcollection.cxx | 43 +- svtools/source/toolpanel/toolpanelcollection.hxx | 70 +++ svtools/source/toolpanel/toolpaneldeck.cxx | 86 ++- svtools/workben/toolpanel/toolpaneltest.cxx | 59 +- 18 files changed, 1273 insertions(+), 123 deletions(-) delete mode 100644 svtools/inc/svtools/toolpanel/toolpanelcollection.hxx create mode 100644 svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx create mode 100644 svtools/source/toolpanel/paneltabbar.cxx create mode 100644 svtools/source/toolpanel/paneltabbar.hxx create mode 100644 svtools/source/toolpanel/refbase.cxx create mode 100644 svtools/source/toolpanel/refbase.hxx create mode 100644 svtools/source/toolpanel/toolpanelcollection.hxx diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx index b6e27162a29c..6ee858e482c6 100644 --- a/svtools/inc/svtools/toolpanel/decklayouter.hxx +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -27,7 +27,7 @@ #ifndef DECKLAYOUTER_HXX #define DECKLAYOUTER_HXX -#include +#include class Rectangle; @@ -39,7 +39,7 @@ namespace svt //==================================================================== //= IDeckLayouter //==================================================================== - class IDeckLayouter + class IDeckLayouter : public ::rtl::IReference { public: /** re-arranges the elements of the tool deck, taking into account the @@ -48,16 +48,25 @@ namespace svt @param i_rDeckPlayground the playground for the complete tool panel deck @return - the content area for the single tool panels + the content area for a single tool panel */ virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) = 0; + /** destroys the instance + + Since the layouter is ref-counted, but might keep references to non-ref-counted objects + (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted), + Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards, + but non-functioal. + */ + virtual void Destroy() = 0; + virtual ~IDeckLayouter() { } }; - typedef ::boost::shared_ptr< IDeckLayouter > PDeckLayouter; + typedef ::rtl::Reference< IDeckLayouter > PDeckLayouter; //........................................................................ } // namespace svt diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index ff66fe367e3b..e2d46ff8b42d 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -28,6 +28,8 @@ #define TABLAYOUTER_HXX #include "svtools/toolpanel/decklayouter.hxx" +#include "svtools/toolpanel/toolpanelcontainer.hxx" +#include "refbase.hxx" #include @@ -36,9 +38,12 @@ namespace svt { //........................................................................ + class ToolPanelDeck; + enum TabAlignment { - TABS_RIGHT + TABS_RIGHT, + TABS_LEFT }; struct TabDeckLayouter_Data; @@ -46,14 +51,27 @@ namespace svt //==================================================================== //= TabDeckLayouter //==================================================================== - class TabDeckLayouter : public IDeckLayouter + class TabDeckLayouter :public RefBase + ,public IDeckLayouter { public: - TabDeckLayouter( const TabAlignment i_eAlignment ); + /** creates a new layouter + @param i_eAlignment + specifies the alignment of the panel selector + @param i_rPanelDeck + the panel deck which the layouter is responsible for. Provides access to the panels + container, and can and should be used as parent for any other windows which the layouter + needs to create. + */ + TabDeckLayouter( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ); ~TabDeckLayouter(); // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); + virtual void Destroy(); + + // IReference + DECLARE_IREFERENCE() private: ::std::auto_ptr< TabDeckLayouter_Data > m_pData; diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index 4b7227f52cbd..24a166be362d 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -27,7 +27,10 @@ #ifndef TOOLPANEL_HXX #define TOOLPANEL_HXX -#include +#include +#include + +#include class Rectangle; @@ -41,7 +44,7 @@ namespace svt //==================================================================== /** abstract interface for a single tool panel */ - class IToolPanel + class IToolPanel : public ::rtl::IReference { public: /// shows the panel @@ -50,13 +53,17 @@ namespace svt virtual void Hide() = 0; /// sets the position of the panel virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ) = 0; + /// retrieves the display name of the panel + virtual ::rtl::OUString GetDisplayName() const = 0; + /// retrieves the image associated with the panel, if any + virtual Image GetImage() const = 0; virtual ~IToolPanel() { } }; - typedef ::boost::shared_ptr< IToolPanel > PToolPanel; + typedef ::rtl::Reference< IToolPanel > PToolPanel; //........................................................................ } // namespace svt diff --git a/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx b/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx deleted file mode 100644 index a0257fc5c91e..000000000000 --- a/svtools/inc/svtools/toolpanel/toolpanelcollection.hxx +++ /dev/null @@ -1,63 +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 TOOLPANELCOLLECTION_HXX -#define TOOLPANELCOLLECTION_HXX - -#include "svtools/toolpanel/toolpanel.hxx" - -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - struct ToolPanelCollection_Data; - - //==================================================================== - //= ToolPanelCollection - //==================================================================== - class ToolPanelCollection - { - public: - ToolPanelCollection(); - ~ToolPanelCollection(); - - // panel access - size_t GetPanelCount() const; - PToolPanel GetPanel( const size_t i_nPos ) const; - size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ); - - private: - ::std::auto_ptr< ToolPanelCollection_Data > m_pData; - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // TOOLPANELCOLLECTION_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx b/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx new file mode 100644 index 000000000000..c57e80e614d7 --- /dev/null +++ b/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TOOLPANELCONTAINER_HXX +#define TOOLPANELCONTAINER_HXX + +#include "svtools/toolpanel/toolpanel.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= IToolPanelContainerListener + //==================================================================== + class SAL_NO_VTABLE IToolPanelContainerListener + { + public: + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + }; + + //==================================================================== + //= IToolPanelContainer + //==================================================================== + class IToolPanelContainer : public ::rtl::IReference + { + public: + /** returns the number of panels in the container + */ + virtual size_t GetPanelCount() const = 0; + + /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the + non-product version, and silently ignored in the product version, with a NULL panel being returned. + */ + virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0; + + /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the + current panel count. Violations of this will be reported via an assertion in the non-product version, and + silently ignored in the product version. + */ + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + + /** adds a new listener to be notified when the container content changes. The caller is responsible + for life time control, i.e. removing the listener before it actually dies. + */ + virtual void AddListener( IToolPanelContainerListener& i_rListener ) = 0; + + /** removes a container listener previously added via addListener. + */ + virtual void RemoveListener( IToolPanelContainerListener& i_rListener ) = 0; + }; + + typedef ::rtl::Reference< IToolPanelContainer > PToolPanelContainer; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TOOLPANELCONTAINER_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 2efde1f29e8b..42045c36b71a 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -28,10 +28,11 @@ #define TOOLPANELDECK_HXX #include "svtools/toolpanel/decklayouter.hxx" -#include "svtools/toolpanel/toolpanelcollection.hxx" +#include "svtools/toolpanel/toolpanelcontainer.hxx" #include +#include #include //........................................................................ @@ -42,6 +43,15 @@ namespace svt class ToolPanelCollection; class ToolPanelDeck_Impl; + //==================================================================== + //= IToolPanelDeckListener + //==================================================================== + class SAL_NO_VTABLE IToolPanelDeckListener + { + public: + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) = 0; + }; + //==================================================================== //= ToolPanelDeck //==================================================================== @@ -52,14 +62,17 @@ namespace svt ~ToolPanelDeck(); // attributes - PDeckLayouter GetLayouter() const; - void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + PDeckLayouter GetLayouter() const; + void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + + PToolPanelContainer GetPanels() const; - size_t GetActivePanel() const; - void ActivatePanel( const size_t i_nPanel ); + size_t GetActivePanel() const; + void ActivatePanel( const size_t i_nPanel ); - const ToolPanelCollection& GetPanels() const; - ToolPanelCollection& GetPanels(); + // listeners + void AddListener( IToolPanelDeckListener& i_rListener ); + void RemoveListener( IToolPanelDeckListener& i_rListener ); protected: // Window overridables diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index 52c89be24b99..405f103d9713 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -46,6 +46,9 @@ namespace svt { } + //-------------------------------------------------------------------- + IMPLEMENT_IREFERENCE( DummyPanel ) + //-------------------------------------------------------------------- void DummyPanel::Show() { @@ -61,6 +64,18 @@ namespace svt { } + //-------------------------------------------------------------------- + ::rtl::OUString DummyPanel::GetDisplayName() const + { + return ::rtl::OUString(); + } + + //-------------------------------------------------------------------- + Image DummyPanel::GetImage() const + { + return Image(); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index 425467641077..46b1218abe93 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -28,6 +28,7 @@ #define DUMMYPANEL_HXX #include "svtools/toolpanel/toolpanel.hxx" +#include "refbase.hxx" //........................................................................ namespace svt @@ -38,7 +39,8 @@ namespace svt //= DummyPanel //==================================================================== /// is a dummy implementation of the IToolPanel interface - class DummyPanel : public IToolPanel + class DummyPanel :public RefBase + ,public IToolPanel { public: DummyPanel(); @@ -48,6 +50,10 @@ namespace svt virtual void Show(); virtual void Hide(); virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + + DECLARE_IREFERENCE() }; //........................................................................ diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 23a3186bdcef..576db7c84ee5 100644 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -45,13 +45,12 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES=\ $(SLO)$/dummypanel.obj \ + $(SLO)$/paneltabbar.obj \ + $(SLO)$/refbase.obj \ $(SLO)$/tablayouter.obj \ $(SLO)$/toolpanelcollection.obj \ $(SLO)$/toolpaneldeck.obj \ -#LIB1TARGET= $(SLB)$/$(TARGET).lib -#LIB1OBJFILES= $(SLOFILES) - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx new file mode 100644 index 000000000000..0229ce664560 --- /dev/null +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -0,0 +1,595 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "svtools/toolpanel/toolpaneldeck.hxx" +#include "paneltabbar.hxx" + +#include + +#include +#include + +// space around an item +#define ITEM_OUTER_SPACE 2 * 3 +// distance between two items +#define ITEM_DISTANCE_PIXEL 2 +// space between item icon and icon text +#define ITEM_ICON_TEXT_DISTANCE 4 +// outer space (aka margin) of the complete tab bar control +#define TAB_BAR_OUTER_SPACE 2 + +//........................................................................ +namespace svt +{ +//........................................................................ + + typedef sal_uInt16 ItemFlags; + + #define ITEM_STATE_NORMAL 0x00 + #define ITEM_STATE_ACTIVE 0x01 + #define ITEM_STATE_HOVERED 0x02 + + //================================================================================================================== + //= IItemsLayout + //================================================================================================================== + class IItemsLayout + { + public: + /** calculates the size of the area occupied by the item representing the given tool panel + */ + virtual Size CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const = 0; + + /** returns the position where the next item should start, assuming the previous item occupies a given area + */ + virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const = 0; + + /** draws the item onto the given device, in the givem area + @param i_pPanel + the panel whose item representation is to be drawn + @param i_rTargetWindow + the window onto which to drawa + @param i_rItemRect + the area to paint the item into. The caller is responsible for ensuring that is has a size sufficient to + hold the item (which can be determined by calling CalculateItemSize beforehand). + @param i_nItemFlags + defines in which state to draw the item + @param i_bDrawMinimal + defines whether the minimal version of the item should be drawn + */ + virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, + const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) = 0; + }; + + typedef ::boost::shared_ptr< IItemsLayout > PItemsLayout; + + //================================================================================================================== + //= VerticalItemLayout + //================================================================================================================== + class VerticalItemLayout : public IItemsLayout + { + public: + VerticalItemLayout() + { + } + + // IItemsLayout overridables + virtual Size CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const; + virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const; + virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, + const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ); + }; + + //------------------------------------------------------------------------------------------------------------------ + Size VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const + { + const Image aImage( i_pPanel->GetImage() ); + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + + // for the moment, we display the icons only + Size aItemSize; + if ( !!aImage ) + { + aItemSize = aImage.GetSizePixel(); + } + + if ( !i_bMinimum && sItemText.getLength() ) + { + if ( !!aImage ) + aItemSize.Height() += ITEM_ICON_TEXT_DISTANCE; + + // add space for vertical text + const Size aTextSize( i_rReferenceDevice.GetCtrlTextWidth( sItemText ), i_rReferenceDevice.GetTextHeight() ); + aItemSize.Height() += aTextSize.Width(); + aItemSize.Width() = ::std::max( aItemSize.Width(), aTextSize.Height() ); + } + + aItemSize.Width() += 2 * ITEM_OUTER_SPACE; + aItemSize.Height() += 2 * ITEM_OUTER_SPACE; + + return aItemSize; + } + + //------------------------------------------------------------------------------------------------------------------ + Point VerticalItemLayout::GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const + { + Point aNewPos( i_rPreviousItemArea.BottomLeft() ); + aNewPos.Y() += ITEM_DISTANCE_PIXEL; + return aNewPos; + } + + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, + const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) + { + const Size aItemSize( CalculateItemSize( i_pPanel, i_rTargetWindow, i_bDrawMinimal ) ); + + Point aDrawPos( i_rItemRect.TopLeft() ); + aDrawPos.Y() += ITEM_OUTER_SPACE; + + // draw the image + const Image aItemImage( i_pPanel->GetImage() ); + if ( !!aItemImage ) + { + const Size aImageSize( aItemImage.GetSizePixel() ); + i_rTargetWindow.DrawImage( + Point( aDrawPos.X() + ( aItemSize.Width() - aImageSize.Width() ) / 2, aDrawPos.Y() ), + aItemImage + ); + aDrawPos.Y() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; + } + + if ( !i_bDrawMinimal ) + { + // draw the text + i_rTargetWindow.Push( PUSH_FONT ); + + Font aFont( i_rTargetWindow.GetFont() ); + aFont.SetOrientation( 2700 ); + aFont.SetVertical( TRUE ); + i_rTargetWindow.SetFont( aFont ); + + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const Size aTextSize( i_rTargetWindow.GetCtrlTextWidth( sItemText ), i_rTargetWindow.GetTextHeight() ); + + Point aTextPos( aDrawPos ); + aTextPos.X() += aTextSize.Height(); + aTextPos.X() += ( i_rItemRect.GetWidth() - aTextSize.Height() ) / 2; + + i_rTargetWindow.DrawText( aTextPos, sItemText ); + + i_rTargetWindow.Pop(); + } + + const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); + const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); + if ( bActive || bHovered ) + { + Rectangle aSelectionRect( i_rItemRect ); + aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; + aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; + i_rTargetWindow.DrawSelectionBackground( + aSelectionRect, + bHovered ? ( bActive ? 1 : 2 ) : 0 /* hilight */, + FALSE /* check */, + TRUE /* border */, + FALSE /* ext border only */, + 0 /* corner radius */, + NULL, + NULL + ); + } + } + + //================================================================================================================== + //= ItemDescriptor + //================================================================================================================== + struct ItemDescriptor + { + PToolPanel pPanel; + Rectangle aMinArea; + Rectangle aPrefArea; + bool bUseMinimal; + + ItemDescriptor() + :pPanel() + ,aMinArea() + ,aPrefArea() + ,bUseMinimal( false ) + { + } + + const Rectangle& GetCurrentRect() const + { + return bUseMinimal ? aMinArea : aPrefArea; + } + }; + + typedef ::std::vector< ItemDescriptor > ItemDescriptors; + + //================================================================================================================== + //= PanelTabBar_Data + //================================================================================================================== + class PanelTabBar_Data :public IToolPanelContainerListener + ,public IToolPanelDeckListener + { + public: + PanelTabBar_Data( PanelTabBar& i_rTabBar ) + :rTabBar( i_rTabBar ) + ,rPanelDeck( dynamic_cast< ToolPanelDeck& >( *i_rTabBar.GetParent() ) ) + ,pLayout( new VerticalItemLayout ) + ,aHoveredItem() + ,bMouseButtonDown( false ) + ,aItems() + ,bItemsDirty( true ) + { + rPanelDeck.AddListener( *this ); + rPanelDeck.GetPanels()->AddListener( *this ); + } + + ~PanelTabBar_Data() + { + rPanelDeck.GetPanels()->RemoveListener( *this ); + rPanelDeck.RemoveListener( *this ); + } + + // IToolPanelContainerListener + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) + { + bItemsDirty = true; + } + + // IToolPanelDeckListener + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + + public: + PanelTabBar& rTabBar; + ToolPanelDeck& rPanelDeck; + const PItemsLayout pLayout; + ::boost::optional< size_t > aHoveredItem; + bool bMouseButtonDown; + + ItemDescriptors aItems; + bool bItemsDirty; + }; + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + #if OSL_DEBUG_LEVEL > 0 + static void lcl_checkConsistency( const PanelTabBar_Data& i_rData ) + { + if ( !i_rData.rPanelDeck.GetPanels().get() ) + { + OSL_ENSURE( false, "lcl_checkConsistency: NULL panels?!" ); + return; + } + if ( !i_rData.bItemsDirty ) + { + if ( i_rData.rPanelDeck.GetPanels()->GetPanelCount() != i_rData.aItems.size() ) + { + OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" ); + return; + } + for ( size_t i = 0; i < i_rData.rPanelDeck.GetPanels()->GetPanelCount(); ++i ) + { + if ( i_rData.rPanelDeck.GetPanels()->GetPanel( i ).get() != i_rData.aItems[i].pPanel.get() ) + { + OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" ); + return; + } + } + } + } + + #define DBG_CHECK( data ) \ + lcl_checkConsistency( data ); + #else + #define DBG_CHECK( data ) \ + (void)data; + #endif + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_calcItemRects( PanelTabBar_Data& io_rData, const OutputDevice& i_rReferenceDevice ) + { + io_rData.aItems.resize(0); + + Point aMinItemPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + Point aPrefItemPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + + for ( size_t i = 0; + i < io_rData.rPanelDeck.GetPanels()->GetPanelCount(); + ++i + ) + { + PToolPanel pPanel( io_rData.rPanelDeck.GetPanels()->GetPanel( i ) ); + + ItemDescriptor aItem; + aItem.pPanel = pPanel; + + const Size aMinItemSize = io_rData.pLayout->CalculateItemSize( pPanel, i_rReferenceDevice, true ); + const Size aPrefItemSize = io_rData.pLayout->CalculateItemSize( pPanel, i_rReferenceDevice, false ); + // TODO: have one method calculating both sizes + + aItem.aMinArea = Rectangle( aMinItemPos, aMinItemSize ); + aItem.aPrefArea = Rectangle( aPrefItemPos, aPrefItemSize ); + + io_rData.aItems.push_back( aItem ); + + aMinItemPos = io_rData.pLayout->GetNextItemPosition( aItem.aMinArea ); + aPrefItemPos = io_rData.pLayout->GetNextItemPosition( aItem.aPrefArea ); + } + + io_rData.bItemsDirty = false; + } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_ensureItemsCache( PanelTabBar_Data& io_rData, const OutputDevice& i_rReferenceDevice ) + { + if ( io_rData.bItemsDirty == false ) + { + DBG_CHECK( io_rData ); + return; + } + lcl_calcItemRects( io_rData, i_rReferenceDevice ); + OSL_POSTCOND( io_rData.bItemsDirty == false, "lcl_ensureItemsCache: cache still dirty!" ); + DBG_CHECK( io_rData ); + } + + //-------------------------------------------------------------------------------------------------------------- + static ::boost::optional< size_t > lcl_findItemForPoint( const PanelTabBar_Data& i_rData, const Point& i_rPoint ) + { + size_t i=0; + for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); + item != i_rData.aItems.end(); + ++item, ++i + ) + { + const Rectangle& rItemRect( item->GetCurrentRect() ); + if ( rItemRect.IsInside( i_rPoint ) ) + { + return ::boost::optional< size_t >( i ); + } + } + return ::boost::optional< size_t >(); + } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_drawItem( const PanelTabBar_Data& i_rData, const size_t i_nItemIndex ) + { + const ItemDescriptor& rItem( i_rData.aItems[ i_nItemIndex ] ); + + ItemFlags nItemFlags( ITEM_STATE_NORMAL ); + if ( i_rData.aHoveredItem == i_nItemIndex ) + { + nItemFlags |= ITEM_STATE_HOVERED; + if ( i_rData.bMouseButtonDown ) + nItemFlags |= ITEM_STATE_ACTIVE; + } + + if ( i_rData.rPanelDeck.GetActivePanel() == i_nItemIndex ) + nItemFlags |= ITEM_STATE_ACTIVE; + + i_rData.rTabBar.DrawRect( rItem.GetCurrentRect() ); + i_rData.pLayout->DrawItem( rItem.pPanel, i_rData.rTabBar, rItem.GetCurrentRect(), nItemFlags, rItem.bUseMinimal ); + } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_drawItems( const PanelTabBar_Data& i_rData, PanelTabBar& i_rTabBar, const Rectangle& i_rTargetArea ) + { + size_t i=0; + for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); + item != i_rData.aItems.end(); + ++item, ++i + ) + { + const Rectangle& rItemRect( item->GetCurrentRect() ); + if ( rItemRect.IsOver( i_rTargetArea ) ) + { + lcl_drawItem( i_rData, i ); + } + } + } + } + + //================================================================================================================== + //= PanelTabBar_Data + //================================================================================================================== + void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + { + lcl_ensureItemsCache( *this, rTabBar ); + + if ( !!i_rOldActive ) + lcl_drawItem( *this, *i_rOldActive ); + lcl_drawItem( *this, i_nNewActive ); + } + + //================================================================================================================== + //= PanelTabBar + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck ) + :Control( &i_rPanelDeck, 0 ) + ,m_pData( new PanelTabBar_Data( *this ) ) + { + DBG_CHECK( *m_pData ); + + SetLineColor(); + SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + } + + //------------------------------------------------------------------------------------------------------------------ + PanelTabBar::~PanelTabBar() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const + { + lcl_ensureItemsCache( *m_pData, *this ); + + if ( m_pData->aItems.empty() ) + return Size( 2 * TAB_BAR_OUTER_SPACE, 2 * TAB_BAR_OUTER_SPACE ); + + const bool nMinimalSize = ( i_eType == WINDOWSIZE_MINIMUM ); + // the rect of the last item + const Rectangle& rLastItemRect( nMinimalSize ? m_pData->aItems.rbegin()->aMinArea : m_pData->aItems.rbegin()->aPrefArea ); + const Point aBottomRight( rLastItemRect.BottomRight() ); + return Size( aBottomRight.X() + TAB_BAR_OUTER_SPACE, aBottomRight.Y() + TAB_BAR_OUTER_SPACE ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::Resize() + { + Control::Resize(); + + // decide whether we should use the minimal or the prefered version of the items + const Size aPreferredSize( GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + const Size aOutputSize( GetOutputSizePixel() ); + const bool bDrawMinimal( aPreferredSize.Height() >= aOutputSize.Height() ); + + for ( ItemDescriptors::iterator item = m_pData->aItems.begin(); + item != m_pData->aItems.end(); + ++item + ) + { + item->bUseMinimal = bDrawMinimal; + } + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::Paint( const Rectangle& i_rRect ) + { + lcl_ensureItemsCache( *m_pData, *this ); + + // background + DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); + + // items + lcl_drawItems( *m_pData, *this, i_rRect ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent ) + { + lcl_ensureItemsCache( *m_pData, *this ); + + ::boost::optional< size_t > aOldItem( m_pData->aHoveredItem ); + ::boost::optional< size_t > aNewItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + + if ( i_rMouseEvent.IsLeaveWindow() ) + aNewItem.reset(); + + if ( aOldItem != aNewItem ) + { + m_pData->aHoveredItem = aNewItem; + + if ( !!aOldItem ) + { + lcl_drawItem( *m_pData, *aOldItem ); + } + + if ( !!aNewItem ) + { + lcl_drawItem( *m_pData, *aNewItem ); + } + } + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::MouseButtonDown( const MouseEvent& i_rMouseEvent ) + { + Control::MouseButtonDown( i_rMouseEvent ); + + if ( !i_rMouseEvent.IsLeft() ) + return; + + lcl_ensureItemsCache( *m_pData, *this ); + + ::boost::optional< size_t > aHitItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + if ( !aHitItem ) + return; + + CaptureMouse(); + m_pData->bMouseButtonDown = true; + + lcl_drawItem( *m_pData, *aHitItem ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::MouseButtonUp( const MouseEvent& i_rMouseEvent ) + { + Control::MouseButtonUp( i_rMouseEvent ); + + if ( m_pData->bMouseButtonDown ) + { + OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); + if ( IsMouseCaptured() ) + ReleaseMouse(); + m_pData->bMouseButtonDown = false; + + ::boost::optional< size_t > aHitItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + if ( !!aHitItem ) + { + // re-draw that item now that we're not in mouse-down mode anymore + lcl_drawItem( *m_pData, *aHitItem ); + // activate the respective panel + m_pData->rPanelDeck.ActivatePanel( *aHitItem ); + } + } + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent ) + { + lcl_ensureItemsCache( *m_pData, *this ); + + ::boost::optional< size_t > aHelpItem( lcl_findItemForPoint( *m_pData, ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) ); + if ( !aHelpItem ) + return; + + const ItemDescriptor& rItem( m_pData->aItems[ *aHelpItem ] ); + if ( !rItem.bUseMinimal ) + // if we do not use the minimal representation of the item, then the text is completely drawn - no + // need to show it as tooltip, too + return; + + const ::rtl::OUString sItemText( rItem.pPanel->GetDisplayName() ); + if ( i_rHelpEvent.GetMode() == HELPMODE_BALLOON ) + Help::ShowBalloon( this, OutputToScreenPixel( rItem.GetCurrentRect().Center() ), rItem.GetCurrentRect(), sItemText ); + else + Help::ShowQuickHelp( this, rItem.GetCurrentRect(), sItemText ); + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx new file mode 100644 index 000000000000..abbc82173c57 --- /dev/null +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ +#ifndef PANELTABBAR_HXX +#define PANELTABBAR_HXX + +#include "svtools/toolpanel/toolpanelcontainer.hxx" + +#include + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + class ToolPanelDeck; + class PanelTabBar_Data; + + //==================================================================== + //= PanelTabBar + //==================================================================== + /** a tab bar for selecting panels + + At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal + layout in the future. + */ + class PanelTabBar : public Control + { + public: + PanelTabBar( ToolPanelDeck& i_rParent ); + ~PanelTabBar(); + + // Window overridables + virtual Size GetOptimalSize( WindowSizeType i_eType ) const; + virtual void Paint( const Rectangle& i_rRect ); + virtual void Resize(); + virtual void MouseMove( const MouseEvent& i_rMouseEvent ); + virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); + virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent ); + virtual void RequestHelp( const HelpEvent& i_rHelpEvent ); + + private: + ::std::auto_ptr< PanelTabBar_Data > m_pData; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // PANELTABBAR_HXX + diff --git a/svtools/source/toolpanel/refbase.cxx b/svtools/source/toolpanel/refbase.cxx new file mode 100644 index 000000000000..cd4433045b33 --- /dev/null +++ b/svtools/source/toolpanel/refbase.cxx @@ -0,0 +1,56 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "refbase.hxx" + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= RefBase + //==================================================================== + //-------------------------------------------------------------------- + oslInterlockedCount SAL_CALL RefBase::acquire() + { + return osl_incrementInterlockedCount( &m_refCount ); + } + + //-------------------------------------------------------------------- + oslInterlockedCount SAL_CALL RefBase::release() + { + oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount ); + if ( 0 == newCount ) + delete this; + return newCount; + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/refbase.hxx b/svtools/source/toolpanel/refbase.hxx new file mode 100644 index 000000000000..4cbcc41ffd2a --- /dev/null +++ b/svtools/source/toolpanel/refbase.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 REFBASE_HXX +#define REFBASE_HXX + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= RefBase + //==================================================================== + class RefBase + { + protected: + RefBase() + :m_refCount( 0 ) + { + } + + virtual ~RefBase() + { + } + + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); + + private: + oslInterlockedCount m_refCount; + }; + +#define DECLARE_IREFERENCE() \ + virtual oslInterlockedCount SAL_CALL acquire(); \ + virtual oslInterlockedCount SAL_CALL release(); + + +#define IMPLEMENT_IREFERENCE( classname ) \ + oslInterlockedCount classname::acquire() \ + { \ + return RefBase::acquire(); \ + } \ + oslInterlockedCount classname::release() \ + { \ + return RefBase::release(); \ + } + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // REFBASE_HXX diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 3f6f57453356..7b237e8f09f6 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -27,6 +27,8 @@ #include "precompiled_svtools.hxx" #include "svtools/toolpanel/tablayouter.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" +#include "paneltabbar.hxx" #include @@ -40,17 +42,39 @@ namespace svt //==================================================================== struct TabDeckLayouter_Data { - TabAlignment eAlignment; + TabAlignment eAlignment; + PToolPanelContainer pPanels; + ::std::auto_ptr< PanelTabBar > + pTabBar; + + TabDeckLayouter_Data( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ) + :eAlignment( i_eAlignment ) + ,pPanels( i_rPanelDeck.GetPanels() ) + ,pTabBar( new PanelTabBar( i_rPanelDeck ) ) + { + pTabBar->Show(); + } }; + //==================================================================== + //= helper + //==================================================================== + namespace + { + static bool lcl_isVerticalTabBar( const TabAlignment i_eAlignment ) + { + return ( i_eAlignment == TABS_RIGHT ) + || ( i_eAlignment == TABS_LEFT ); + } + } + //==================================================================== //= TabDeckLayouter //==================================================================== //-------------------------------------------------------------------- - TabDeckLayouter::TabDeckLayouter( const TabAlignment i_eAlignment ) - :m_pData( new TabDeckLayouter_Data ) + TabDeckLayouter::TabDeckLayouter( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ) + :m_pData( new TabDeckLayouter_Data( i_eAlignment, i_rPanelDeck ) ) { - m_pData->eAlignment = i_eAlignment; } //-------------------------------------------------------------------- @@ -58,13 +82,56 @@ namespace svt { } + //-------------------------------------------------------------------- + IMPLEMENT_IREFERENCE( TabDeckLayouter ) + //-------------------------------------------------------------------- Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) { - // TODO + if ( !m_pData->pTabBar.get() ) + { + OSL_ENSURE( false, "TabDeckLayouter::Layout: disposed!" ); + return i_rDeckPlayground; + } + + if ( lcl_isVerticalTabBar( m_pData->eAlignment ) ) + { + const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aTabBarSize = ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() ) + ? aPreferredSize + : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM ); + aTabBarSize.Height() = i_rDeckPlayground.GetHeight(); + + Rectangle aPanelRect( i_rDeckPlayground ); + if ( m_pData->eAlignment == TABS_RIGHT ) + { + aPanelRect.Right() -= aTabBarSize.Width(); + Point aTabBarTopLeft( aPanelRect.TopRight() ); + aTabBarTopLeft.X() += 1; + m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize ); + } + else + { + m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize ); + aPanelRect.Left() += aTabBarSize.Width(); + } + if ( aPanelRect.Left() >= aPanelRect.Right() ) + aPanelRect = Rectangle(); + + return aPanelRect; + } + + OSL_ENSURE( false, "TabDeckLayouter::Layout: unreachable!" ); + // currently there do not even exist enum values for other alignments ... return i_rDeckPlayground; } + //-------------------------------------------------------------------- + void TabDeckLayouter::Destroy() + { + m_pData->pTabBar.reset(); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index ff274075f108..b0a2571fc71e 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -26,7 +26,7 @@ #include "precompiled_svtools.hxx" -#include "svtools/toolpanel/toolpanelcollection.hxx" +#include "toolpanelcollection.hxx" #include @@ -42,7 +42,8 @@ namespace svt //==================================================================== struct ToolPanelCollection_Data { - ::std::vector< PToolPanel > aPanels; + ::std::vector< PToolPanel > aPanels; + ::std::vector< IToolPanelContainerListener* > aListeners; }; //==================================================================== @@ -59,6 +60,9 @@ namespace svt { } + //-------------------------------------------------------------------- + IMPLEMENT_IREFERENCE( ToolPanelCollection ) + //-------------------------------------------------------------------- size_t ToolPanelCollection::GetPanelCount() const { @@ -75,20 +79,49 @@ namespace svt } //-------------------------------------------------------------------- - size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ) + size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) { OSL_ENSURE( i_pPanel.get(), "ToolPanelCollection::InsertPanel: illegal panel!" ); if ( !i_pPanel.get() ) return 0; - const size_t position = i_pPosition < m_pData->aPanels.size() ? i_pPosition : m_pData->aPanels.size(); + const size_t position = i_nPosition < m_pData->aPanels.size() ? i_nPosition : m_pData->aPanels.size(); m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel ); - // TODO: notification. The tool panel deck which owns us is certainly interested in this event ... + // notifications + for ( ::std::vector< IToolPanelContainerListener* >::const_iterator loop = m_pData->aListeners.begin(); + loop != m_pData->aListeners.end(); + ++loop + ) + { + (*loop)->PanelInserted( i_pPanel, i_nPosition ); + } return position; } + //-------------------------------------------------------------------- + void ToolPanelCollection::AddListener( IToolPanelContainerListener& i_rListener ) + { + m_pData->aListeners.push_back( &i_rListener ); + } + + //-------------------------------------------------------------------- + void ToolPanelCollection::RemoveListener( IToolPanelContainerListener& i_rListener ) + { + for ( ::std::vector< IToolPanelContainerListener* >::iterator lookup = m_pData->aListeners.begin(); + lookup != m_pData->aListeners.end(); + ++lookup + ) + { + if ( *lookup == &i_rListener ) + { + m_pData->aListeners.erase( lookup ); + return; + } + } + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx new file mode 100644 index 000000000000..3eb5ea7fb44e --- /dev/null +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TOOLPANELCOLLECTION_HXX +#define TOOLPANELCOLLECTION_HXX + +#include "svtools/toolpanel/toolpanelcontainer.hxx" +#include "refbase.hxx" + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + struct ToolPanelCollection_Data; + + //==================================================================== + //= ToolPanelCollection + //==================================================================== + class ToolPanelCollection :public RefBase + ,public IToolPanelContainer + { + public: + ToolPanelCollection(); + ~ToolPanelCollection(); + + // IToolPanelContainer + virtual size_t GetPanelCount() const; + virtual PToolPanel GetPanel( const size_t i_nPos ) const; + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ); + virtual void AddListener( IToolPanelContainerListener& i_rListener ); + virtual void RemoveListener( IToolPanelContainerListener& i_rListener ); + + // IReference + DECLARE_IREFERENCE() + + private: + ::std::auto_ptr< ToolPanelCollection_Data > m_pData; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TOOLPANELCOLLECTION_HXX diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 12f85794576e..8bd521689a8a 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -27,6 +27,7 @@ #include "precompiled_svtools.hxx" #include "dummypanel.hxx" +#include "toolpanelcollection.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" @@ -46,28 +47,26 @@ namespace svt public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) - ,m_aPanels() + ,m_pPanels( new( ToolPanelCollection ) ) ,m_pDummyPanel( new DummyPanel ) ,m_aActivePanel() ,m_pLayouter() ,m_aPanelPlayground() { - // use a default layouter - m_pLayouter.reset( new TabDeckLayouter( TABS_RIGHT ) ); - - // add as listener to the panels collection - we're interested in panels - // being added and removed - // TODO + // TODO: add as listener to the panels collection - we're interested in panels + // being added and removed, as we need to re-layout then } - const ToolPanelCollection& GetPanels() const { return m_aPanels; } - ToolPanelCollection& GetPanels() { return m_aPanels; } + PToolPanelContainer GetPanels() const { return m_pPanels; } + + size_t GetActivePanel() const; + void ActivatePanel( const size_t i_nPanel ); - size_t GetActivePanel() const; - void ActivatePanel( const size_t i_nPanel ); + PDeckLayouter GetLayouter() const { return m_pLayouter; } + void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - PDeckLayouter GetLayouter() const { return m_pLayouter; } - void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + void AddListener( IToolPanelDeckListener& i_rListener ); + void RemoveListener( IToolPanelDeckListener& i_rListener ); /// re-layouts everything void LayoutAll() { ImplDoLayout(); } @@ -81,13 +80,16 @@ namespace svt private: ToolPanelDeck& m_rDeck; - ToolPanelCollection m_aPanels; + PToolPanelContainer m_pPanels; PToolPanel m_pDummyPanel; ::boost::optional< size_t > m_aActivePanel; PDeckLayouter m_pLayouter; Rectangle m_aPanelPlayground; + + ::std::vector< IToolPanelDeckListener* > + m_aListeners; }; //-------------------------------------------------------------------- @@ -95,7 +97,7 @@ namespace svt { if ( !m_aActivePanel ) return m_pDummyPanel; - return m_aPanels.GetPanel( *m_aActivePanel ); + return m_pPanels->GetPanel( *m_aActivePanel ); } //-------------------------------------------------------------------- @@ -121,17 +123,18 @@ namespace svt //-------------------------------------------------------------------- void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel ) { - OSL_ENSURE( i_nPanel < m_aPanels.GetPanelCount(), "ToolPanelDeck_Impl::ActivatePanel: illegal panel no.!" ); - if ( i_nPanel >= m_aPanels.GetPanelCount() ) + OSL_ENSURE( i_nPanel < m_pPanels->GetPanelCount(), "ToolPanelDeck_Impl::ActivatePanel: illegal panel no.!" ); + if ( i_nPanel >= m_pPanels->GetPanelCount() ) return; - if ( !!m_aActivePanel && ( *m_aActivePanel == i_nPanel ) ) + if ( m_aActivePanel == i_nPanel ) return; // hide the old panel const PToolPanel pOldActive( GetActiveOrDummyPanel_Impl() ); pOldActive->Hide(); + const ::boost::optional< size_t > aOldPanel( m_aActivePanel ); m_aActivePanel = i_nPanel; // position and show the new panel @@ -139,8 +142,14 @@ namespace svt pNewActive->SetPosSizePixel( m_aPanelPlayground ); pNewActive->Show(); - // tell the layouter - it might need to adjust its visuals to the new situation - // TODO + // notify listeners + for ( ::std::vector< IToolPanelDeckListener* >::iterator loop = m_aListeners.begin(); + loop != m_aListeners.end(); + ++loop + ) + { + (*loop)->ActivePanelChanged( aOldPanel, *m_aActivePanel ); + } } //-------------------------------------------------------------------- @@ -159,6 +168,28 @@ namespace svt pActive->SetPosSizePixel( m_aPanelPlayground ); } + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener ) + { + m_aListeners.push_back( &i_rListener ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener ) + { + for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin(); + lookup != m_aListeners.end(); + ++lookup + ) + { + if ( *lookup == &i_rListener ) + { + m_aListeners.erase( lookup ); + return; + } + } + } + //==================================================================== //= ToolPanelDeck //==================================================================== @@ -167,11 +198,14 @@ namespace svt :Control( &i_rParent, i_nStyle ) ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) { + // use a default layouter + SetLayouter( PDeckLayouter( new TabDeckLayouter( TABS_RIGHT, *this ) ) ); } //-------------------------------------------------------------------- ToolPanelDeck::~ToolPanelDeck() { + GetLayouter()->Destroy(); } //-------------------------------------------------------------------- @@ -199,15 +233,21 @@ namespace svt } //-------------------------------------------------------------------- - const ToolPanelCollection& ToolPanelDeck::GetPanels() const + PToolPanelContainer ToolPanelDeck::GetPanels() const { return m_pImpl->GetPanels(); } //-------------------------------------------------------------------- - ToolPanelCollection& ToolPanelDeck::GetPanels() + void ToolPanelDeck::AddListener( IToolPanelDeckListener& i_rListener ) { - return m_pImpl->GetPanels(); + m_pImpl->AddListener( i_rListener ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck::RemoveListener( IToolPanelDeckListener& i_rListener ) + { + m_pImpl->RemoveListener( i_rListener ); } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 6b02208fbdfe..d717ed9a3fd6 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -82,25 +83,40 @@ public: class ColoredPanel : public IToolPanel { public: - ColoredPanel( Window& i_rParent, const Color& i_rColor ); + ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ); ~ColoredPanel(); // IToolPanel virtual void Show(); virtual void Hide(); virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; + + // IReference + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); private: + oslInterlockedCount m_refCount; ColoredPanelWindow m_aWindow; + ::rtl::OUString m_aPanelName; + BitmapEx m_aPanelIcon; }; //============================================================================= //= ColoredPanel //============================================================================= //----------------------------------------------------------------------------- -ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor ) - :m_aWindow( i_rParent, i_rColor ) +ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ) + :m_refCount(0) + ,m_aWindow( i_rParent, i_rColor ) + ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) + ,m_aPanelIcon() { + Bitmap aBitmap( Size( 16, 16 ), 8 ); + m_aPanelIcon = BitmapEx( aBitmap ); + m_aPanelIcon.Erase( i_rColor ); } //----------------------------------------------------------------------------- @@ -108,6 +124,21 @@ ColoredPanel::~ColoredPanel() { } +//----------------------------------------------------------------------------- +oslInterlockedCount SAL_CALL ColoredPanel::acquire() +{ + return osl_incrementInterlockedCount( &m_refCount ); +} + +//----------------------------------------------------------------------------- +oslInterlockedCount SAL_CALL ColoredPanel::release() +{ + oslInterlockedCount newCount = osl_decrementInterlockedCount( &m_refCount ); + if ( 0 == newCount ) + delete this; + return newCount; +} + //----------------------------------------------------------------------------- void ColoredPanel::Show() { @@ -126,6 +157,18 @@ void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); } +//----------------------------------------------------------------------------- +::rtl::OUString ColoredPanel::GetDisplayName() const +{ + return m_aPanelName; +} + +//----------------------------------------------------------------------------- +Image ColoredPanel::GetImage() const +{ + return Image( m_aPanelIcon ); +} + //============================================================================= //= PanelDemoMainWindow //============================================================================= @@ -155,16 +198,20 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); - ToolPanelCollection& rPanels = m_aToolPanelDeck.GetPanels(); - const size_t nFirstPanelPosition = rPanels.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ) ) ), rPanels.GetPanelCount() ); - m_aToolPanelDeck.ActivatePanel( nFirstPanelPosition ); + PToolPanelContainer pPanels( m_aToolPanelDeck.GetPanels() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), pPanels->GetPanelCount() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), pPanels->GetPanelCount() ); + pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), pPanels->GetPanelCount() ); + m_aToolPanelDeck.ActivatePanel( 0 ); m_aToolPanelDeck.Show(); SetBackground( Color( COL_LIGHTGRAY ) ); SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); Show(); + + Help::EnableQuickHelp(); } //----------------------------------------------------------------------------- -- cgit From cdacac2bb85acf05395a19545e787aea16da1d9d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Mar 2010 15:36:46 +0100 Subject: slidecopy: make compile with GCC --- svtools/source/toolpanel/paneltabbar.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 0229ce664560..e65477fca693 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -262,6 +262,8 @@ namespace svt // IToolPanelContainerListener virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) { + (void)i_pPanel; + (void)i_nPosition; bItemsDirty = true; } @@ -404,7 +406,7 @@ namespace svt } //-------------------------------------------------------------------------------------------------------------- - static void lcl_drawItems( const PanelTabBar_Data& i_rData, PanelTabBar& i_rTabBar, const Rectangle& i_rTargetArea ) + static void lcl_drawItems( const PanelTabBar_Data& i_rData, const Rectangle& i_rTargetArea ) { size_t i=0; for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); @@ -495,7 +497,7 @@ namespace svt DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); // items - lcl_drawItems( *m_pData, *this, i_rRect ); + lcl_drawItems( *m_pData, i_rRect ); } //------------------------------------------------------------------------------------------------------------------ -- cgit From fbf16affc4d096d09b47bf39144b62ded7bb37f4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Mar 2010 10:31:11 +0100 Subject: slidecopy: going forward with the VCL ToolPanelDeck. Keyboard control, focus handling, moved from shared_ptr to IReference, enhancements to the test program, misc improvements --- svtools/inc/svtools/toolpanel/decklayouter.hxx | 7 +- svtools/inc/svtools/toolpanel/refbase.hxx | 78 +++++++++ svtools/inc/svtools/toolpanel/tablayouter.hxx | 7 +- svtools/inc/svtools/toolpanel/toolpanel.hxx | 26 ++- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 2 + svtools/source/toolpanel/dummypanel.cxx | 11 ++ svtools/source/toolpanel/dummypanel.hxx | 8 +- svtools/source/toolpanel/paneltabbar.cxx | 202 ++++++++++++++++++---- svtools/source/toolpanel/paneltabbar.hxx | 4 + svtools/source/toolpanel/refbase.cxx | 2 +- svtools/source/toolpanel/refbase.hxx | 78 --------- svtools/source/toolpanel/tablayouter.cxx | 11 ++ svtools/source/toolpanel/toolpanelcollection.hxx | 2 +- svtools/source/toolpanel/toolpaneldeck.cxx | 145 +++++++++++++++- svtools/workben/toolpanel/makefile.mk | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 209 +++++++++++++++++++++-- 16 files changed, 648 insertions(+), 145 deletions(-) create mode 100644 svtools/inc/svtools/toolpanel/refbase.hxx delete mode 100644 svtools/source/toolpanel/refbase.hxx diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx index 6ee858e482c6..6050a0955715 100644 --- a/svtools/inc/svtools/toolpanel/decklayouter.hxx +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -57,10 +57,15 @@ namespace svt Since the layouter is ref-counted, but might keep references to non-ref-counted objects (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted), Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards, - but non-functioal. + but non-functional. */ virtual void Destroy() = 0; + /** assuming that a layouter neesds to provide some kind of panel selector control, this method + requests to set the focus to this control. + */ + virtual void SetFocusToPanelSelector() = 0; + virtual ~IDeckLayouter() { } diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx new file mode 100644 index 000000000000..4cbcc41ffd2a --- /dev/null +++ b/svtools/inc/svtools/toolpanel/refbase.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 REFBASE_HXX +#define REFBASE_HXX + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= RefBase + //==================================================================== + class RefBase + { + protected: + RefBase() + :m_refCount( 0 ) + { + } + + virtual ~RefBase() + { + } + + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); + + private: + oslInterlockedCount m_refCount; + }; + +#define DECLARE_IREFERENCE() \ + virtual oslInterlockedCount SAL_CALL acquire(); \ + virtual oslInterlockedCount SAL_CALL release(); + + +#define IMPLEMENT_IREFERENCE( classname ) \ + oslInterlockedCount classname::acquire() \ + { \ + return RefBase::acquire(); \ + } \ + oslInterlockedCount classname::release() \ + { \ + return RefBase::release(); \ + } + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // REFBASE_HXX diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index e2d46ff8b42d..cf901d2e57b3 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -29,7 +29,7 @@ #include "svtools/toolpanel/decklayouter.hxx" #include "svtools/toolpanel/toolpanelcontainer.hxx" -#include "refbase.hxx" +#include "svtools/toolpanel/refbase.hxx" #include @@ -42,8 +42,8 @@ namespace svt enum TabAlignment { - TABS_RIGHT, - TABS_LEFT + TABS_LEFT, + TABS_RIGHT }; struct TabDeckLayouter_Data; @@ -69,6 +69,7 @@ namespace svt // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); + virtual void SetFocusToPanelSelector(); // IReference DECLARE_IREFERENCE() diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index 24a166be362d..760b59f40255 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -47,17 +47,31 @@ namespace svt class IToolPanel : public ::rtl::IReference { public: - /// shows the panel - virtual void Show() = 0; - /// hides the panel - virtual void Hide() = 0; - /// sets the position of the panel - virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ) = 0; /// retrieves the display name of the panel virtual ::rtl::OUString GetDisplayName() const = 0; + /// retrieves the image associated with the panel, if any virtual Image GetImage() const = 0; + /// shows the panel window + virtual void Show() = 0; + + /// hides the panel window + virtual void Hide() = 0; + + /// sets the position of the panel window + virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ) = 0; + + /// sets the focus to the panel window + virtual void GrabFocus() = 0; + + /** determines whether the panel window, or any of its children, currently has the focus + + Effectively, an implementation simply needs to redelegate this to its panel window's HasChildPathFocus + method. + */ + virtual bool HasFocus() const = 0; + virtual ~IToolPanel() { } diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 42045c36b71a..573248235957 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -77,6 +77,8 @@ namespace svt protected: // Window overridables virtual void Resize(); + virtual long Notify( NotifyEvent& i_rNotifyEvent ); + virtual void GetFocus(); private: ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl; diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index 405f103d9713..6bf1fb6ea60e 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -76,6 +76,17 @@ namespace svt return Image(); } + //-------------------------------------------------------------------- + void DummyPanel::GrabFocus() + { + } + + //-------------------------------------------------------------------- + bool DummyPanel::HasFocus() const + { + return false; + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index 46b1218abe93..41afe1ad51e2 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -28,7 +28,7 @@ #define DUMMYPANEL_HXX #include "svtools/toolpanel/toolpanel.hxx" -#include "refbase.hxx" +#include "svtools/toolpanel/refbase.hxx" //........................................................................ namespace svt @@ -47,11 +47,13 @@ namespace svt ~DummyPanel(); // IToolPanel + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; virtual void Show(); virtual void Hide(); virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); - virtual ::rtl::OUString GetDisplayName() const; - virtual Image GetImage() const; + virtual void GrabFocus(); + virtual bool HasFocus() const; DECLARE_IREFERENCE() }; diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index e65477fca693..fcca3585d618 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -35,7 +35,9 @@ #include // space around an item -#define ITEM_OUTER_SPACE 2 * 3 +#define ITEM_OUTER_SPACE 2 * 2 +// spacing before and after (in writing direction, whether this is horizontal or vertical) an item's text +#define ITEM_TEXT_FLOW_SPACE 2 // distance between two items #define ITEM_DISTANCE_PIXEL 2 // space between item icon and icon text @@ -53,6 +55,33 @@ namespace svt #define ITEM_STATE_NORMAL 0x00 #define ITEM_STATE_ACTIVE 0x01 #define ITEM_STATE_HOVERED 0x02 + #define ITEM_STATE_FOCUSED 0x04 + + //================================================================================================================== + //= ItemDescriptor + //================================================================================================================== + struct ItemDescriptor + { + PToolPanel pPanel; + Rectangle aMinArea; + Rectangle aPrefArea; + bool bUseMinimal; + + ItemDescriptor() + :pPanel() + ,aMinArea() + ,aPrefArea() + ,bUseMinimal( false ) + { + } + + const Rectangle& GetCurrentRect() const + { + return bUseMinimal ? aMinArea : aPrefArea; + } + }; + + typedef ::std::vector< ItemDescriptor > ItemDescriptors; //================================================================================================================== //= IItemsLayout @@ -83,6 +112,11 @@ namespace svt */ virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) = 0; + + /** updates the given items to use their minimal or optimal size, so they fit (if possible) into the given + area. + */ + virtual void FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ) = 0; }; typedef ::boost::shared_ptr< IItemsLayout > PItemsLayout; @@ -102,6 +136,7 @@ namespace svt virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const; virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ); + virtual void FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ); }; //------------------------------------------------------------------------------------------------------------------ @@ -126,6 +161,8 @@ namespace svt const Size aTextSize( i_rReferenceDevice.GetCtrlTextWidth( sItemText ), i_rReferenceDevice.GetTextHeight() ); aItemSize.Height() += aTextSize.Width(); aItemSize.Width() = ::std::max( aItemSize.Width(), aTextSize.Height() ); + + aItemSize.Height() += 2 * ITEM_TEXT_FLOW_SPACE; } aItemSize.Width() += 2 * ITEM_OUTER_SPACE; @@ -165,6 +202,8 @@ namespace svt if ( !i_bDrawMinimal ) { + aDrawPos.Y() += ITEM_TEXT_FLOW_SPACE; + // draw the text i_rTargetWindow.Push( PUSH_FONT ); @@ -187,7 +226,8 @@ namespace svt const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); - if ( bActive || bHovered ) + const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); + if ( bActive || bHovered || bFocused ) { Rectangle aSelectionRect( i_rItemRect ); aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; @@ -196,8 +236,8 @@ namespace svt aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; i_rTargetWindow.DrawSelectionBackground( aSelectionRect, - bHovered ? ( bActive ? 1 : 2 ) : 0 /* hilight */, - FALSE /* check */, + ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, + bActive /* check */, TRUE /* border */, FALSE /* ext border only */, 0 /* corner radius */, @@ -207,31 +247,24 @@ namespace svt } } - //================================================================================================================== - //= ItemDescriptor - //================================================================================================================== - struct ItemDescriptor + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ) { - PToolPanel pPanel; - Rectangle aMinArea; - Rectangle aPrefArea; - bool bUseMinimal; - - ItemDescriptor() - :pPanel() - ,aMinArea() - ,aPrefArea() - ,bUseMinimal( false ) - { - } + if ( i_rItems.empty() ) + // nothing to do + return; - const Rectangle& GetCurrentRect() const + // use the minimal sizes if and only if the preferred sizes do not fit + const Point aBottomRight( i_rItems.rbegin()->aPrefArea.BottomRight() ); + bool bUseMinimal = ( aBottomRight.Y() >= i_rFitInto.Bottom() ); + for ( ItemDescriptors::iterator item = i_rItems.begin(); + item != i_rItems.end(); + ++item + ) { - return bUseMinimal ? aMinArea : aPrefArea; + item->bUseMinimal = bUseMinimal; } - }; - - typedef ::std::vector< ItemDescriptor > ItemDescriptors; + } //================================================================================================================== //= PanelTabBar_Data @@ -245,6 +278,7 @@ namespace svt ,rPanelDeck( dynamic_cast< ToolPanelDeck& >( *i_rTabBar.GetParent() ) ) ,pLayout( new VerticalItemLayout ) ,aHoveredItem() + ,aFocusedItem() ,bMouseButtonDown( false ) ,aItems() ,bItemsDirty( true ) @@ -265,6 +299,7 @@ namespace svt (void)i_pPanel; (void)i_nPosition; bItemsDirty = true; + rTabBar.Invalidate(); } // IToolPanelDeckListener @@ -275,6 +310,7 @@ namespace svt ToolPanelDeck& rPanelDeck; const PItemsLayout pLayout; ::boost::optional< size_t > aHoveredItem; + ::boost::optional< size_t > aFocusedItem; bool bMouseButtonDown; ItemDescriptors aItems; @@ -401,6 +437,9 @@ namespace svt if ( i_rData.rPanelDeck.GetActivePanel() == i_nItemIndex ) nItemFlags |= ITEM_STATE_ACTIVE; + if ( i_rData.aFocusedItem == i_nItemIndex ) + nItemFlags |= ITEM_STATE_FOCUSED; + i_rData.rTabBar.DrawRect( rItem.GetCurrentRect() ); i_rData.pLayout->DrawItem( rItem.pPanel, i_rData.rTabBar, rItem.GetCurrentRect(), nItemFlags, rItem.bUseMinimal ); } @@ -475,17 +514,14 @@ namespace svt Control::Resize(); // decide whether we should use the minimal or the prefered version of the items - const Size aPreferredSize( GetOptimalSize( WINDOWSIZE_PREFERRED ) ); - const Size aOutputSize( GetOutputSizePixel() ); - const bool bDrawMinimal( aPreferredSize.Height() >= aOutputSize.Height() ); - for ( ItemDescriptors::iterator item = m_pData->aItems.begin(); - item != m_pData->aItems.end(); - ++item - ) - { - item->bUseMinimal = bDrawMinimal; - } + // the available size + Size aOutputSize( GetOutputSizePixel() ); + // shrunk by the outer space + aOutputSize.Width() -= TAB_BAR_OUTER_SPACE; + aOutputSize.Height() -= TAB_BAR_OUTER_SPACE; + // let the layouter decide + m_pData->pLayout->FitItemRects( m_pData->aItems, Rectangle( Point(), aOutputSize ) ); } //------------------------------------------------------------------------------------------------------------------ @@ -592,6 +628,102 @@ namespace svt Help::ShowQuickHelp( this, rItem.GetCurrentRect(), sItemText ); } + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::GetFocus() + { + Control::GetFocus(); + if ( m_pData->rPanelDeck.GetPanels()->GetPanelCount() ) + { + m_pData->aFocusedItem.reset( m_pData->rPanelDeck.GetActivePanel() ); + lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::LoseFocus() + { + Control::LoseFocus(); + + ::boost::optional< size_t > aPreviouslyFocused( m_pData->aFocusedItem ); + m_pData->aFocusedItem.reset(); + if ( !!aPreviouslyFocused ) + lcl_drawItem( *m_pData, *aPreviouslyFocused ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent ) + { + Control::KeyInput( i_rKeyEvent ); + + const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() ); + if ( rKeyCode.GetModifier() != 0 ) + // only interested in mere key presses + return; + + // if there are less than 2 panels, we cannot travel them ... + const size_t nPanelCount( m_pData->rPanelDeck.GetPanels()->GetPanelCount() ); + if ( nPanelCount < 2 ) + return; + + OSL_PRECOND( !!m_pData->aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); + // if we get KeyInput events, we should have the focus. In this case, aFocusedItem should not be empty, + // except if there are no panels, but then we bail out of this method here earlier ... + + bool bFocusNext = false; + bool bFocusPrev = false; + + switch ( rKeyCode.GetCode() ) + { + case KEY_UP: bFocusPrev = true; break; + case KEY_DOWN: bFocusNext = true; break; + case KEY_LEFT: + if ( IsRTLEnabled() ) + bFocusNext = true; + else + bFocusPrev = true; + break; + case KEY_RIGHT: + if ( IsRTLEnabled() ) + bFocusPrev = true; + else + bFocusNext = true; + break; + case KEY_RETURN: + m_pData->rPanelDeck.ActivatePanel( *m_pData->aFocusedItem ); + break; + } + + if ( !bFocusNext && !bFocusPrev ) + return; + + const size_t nOldFocus = *m_pData->aFocusedItem; + if ( bFocusNext ) + { + m_pData->aFocusedItem.reset( ( *m_pData->aFocusedItem + 1 ) % nPanelCount ); + } + else + { + m_pData->aFocusedItem.reset( ( *m_pData->aFocusedItem + nPanelCount - 1 ) % nPanelCount ); + } + + lcl_drawItem( *m_pData, nOldFocus ); + lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::DataChanged( const DataChangedEvent& i_rDataChanedEvent ) + { + Control::DataChanged( i_rDataChanedEvent ); + + if ( ( i_rDataChanedEvent.GetType() == DATACHANGED_SETTINGS ) + && ( ( i_rDataChanedEvent.GetFlags() & SETTINGS_STYLE ) != 0 ) + ) + { + SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + Invalidate(); + } + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index abbc82173c57..e718619dbc4f 100644 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -62,6 +62,10 @@ namespace svt virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent ); virtual void RequestHelp( const HelpEvent& i_rHelpEvent ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void KeyInput( const KeyEvent& i_rKeyEvent ); + virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent ); private: ::std::auto_ptr< PanelTabBar_Data > m_pData; diff --git a/svtools/source/toolpanel/refbase.cxx b/svtools/source/toolpanel/refbase.cxx index cd4433045b33..f41aa2d9bb9c 100644 --- a/svtools/source/toolpanel/refbase.cxx +++ b/svtools/source/toolpanel/refbase.cxx @@ -26,7 +26,7 @@ #include "precompiled_svtools.hxx" -#include "refbase.hxx" +#include "svtools/toolpanel/refbase.hxx" //........................................................................ namespace svt diff --git a/svtools/source/toolpanel/refbase.hxx b/svtools/source/toolpanel/refbase.hxx deleted file mode 100644 index 4cbcc41ffd2a..000000000000 --- a/svtools/source/toolpanel/refbase.hxx +++ /dev/null @@ -1,78 +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 REFBASE_HXX -#define REFBASE_HXX - -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - //==================================================================== - //= RefBase - //==================================================================== - class RefBase - { - protected: - RefBase() - :m_refCount( 0 ) - { - } - - virtual ~RefBase() - { - } - - virtual oslInterlockedCount SAL_CALL acquire(); - virtual oslInterlockedCount SAL_CALL release(); - - private: - oslInterlockedCount m_refCount; - }; - -#define DECLARE_IREFERENCE() \ - virtual oslInterlockedCount SAL_CALL acquire(); \ - virtual oslInterlockedCount SAL_CALL release(); - - -#define IMPLEMENT_IREFERENCE( classname ) \ - oslInterlockedCount classname::acquire() \ - { \ - return RefBase::acquire(); \ - } \ - oslInterlockedCount classname::release() \ - { \ - return RefBase::release(); \ - } - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // REFBASE_HXX diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 7b237e8f09f6..269a6a1c4acd 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -132,6 +132,17 @@ namespace svt m_pData->pTabBar.reset(); } + //-------------------------------------------------------------------- + void TabDeckLayouter::SetFocusToPanelSelector() + { + if ( !m_pData->pTabBar.get() ) + { + OSL_ENSURE( false, "TabDeckLayouter::SetFocusToPanelSelector: already disposed!" ); + return; + } + m_pData->pTabBar->GrabFocus(); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index 3eb5ea7fb44e..0fb377fafaa2 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -28,7 +28,7 @@ #define TOOLPANELCOLLECTION_HXX #include "svtools/toolpanel/toolpanelcontainer.hxx" -#include "refbase.hxx" +#include "svtools/toolpanel/refbase.hxx" #include diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 8bd521689a8a..f6ae7993b8ec 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -39,10 +39,25 @@ namespace svt { //........................................................................ + enum DeckAction + { + /// activates the first panel + ACTION_ACTIVATE_FIRST, + // activates the panel after the currently active panel + ACTION_ACTIVATE_NEXT, + // activates the panel before the currently active panel + ACTION_ACTIVATE_PREV, + // activates the last panel + ACTION_ACTIVATE_LAST, + + // toggles the focus between the active panel and the panel selector + ACTION_TOGGLE_FOCUS, + }; + //==================================================================== //= ToolPanelDeck_Impl //==================================================================== - class ToolPanelDeck_Impl + class ToolPanelDeck_Impl : public IToolPanelContainerListener { public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) @@ -53,8 +68,7 @@ namespace svt ,m_pLayouter() ,m_aPanelPlayground() { - // TODO: add as listener to the panels collection - we're interested in panels - // being added and removed, as we need to re-layout then + m_pPanels->AddListener( *this ); } PToolPanelContainer GetPanels() const { return m_pPanels; } @@ -71,11 +85,17 @@ namespace svt /// re-layouts everything void LayoutAll() { ImplDoLayout(); } - private: - void ImplDoLayout(); + void DoAction( const DeckAction i_eAction ); + + void FocusActivePanel(); + + protected: + // IToolPanelContainerListener + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); private: - PToolPanel GetActiveOrDummyPanel_Impl(); + void ImplDoLayout(); + PToolPanel GetActiveOrDummyPanel_Impl(); private: ToolPanelDeck& m_rDeck; @@ -141,6 +161,7 @@ namespace svt const PToolPanel pNewActive( GetActiveOrDummyPanel_Impl() ); pNewActive->SetPosSizePixel( m_aPanelPlayground ); pNewActive->Show(); + pNewActive->GrabFocus(); // notify listeners for ( ::std::vector< IToolPanelDeckListener* >::iterator loop = m_aListeners.begin(); @@ -190,6 +211,65 @@ namespace svt } } + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction ) + { + ::boost::optional< size_t > aActivatePanel; + const size_t nPanelCount( GetPanels()->GetPanelCount() ); + const size_t nActivePanel( GetActivePanel() ); + + switch ( i_eAction ) + { + case ACTION_ACTIVATE_FIRST: + if ( nPanelCount > 0 ) + aActivatePanel = 0; + break; + case ACTION_ACTIVATE_PREV: + if ( nActivePanel > 0 ) + aActivatePanel = nActivePanel - 1; + break; + case ACTION_ACTIVATE_NEXT: + if ( nActivePanel < nPanelCount - 1 ) + aActivatePanel = nActivePanel + 1; + break; + case ACTION_ACTIVATE_LAST: + if ( nPanelCount > 0 ) + aActivatePanel = nPanelCount - 1; + break; + case ACTION_TOGGLE_FOCUS: + { + PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); + if ( !pActivePanel->HasFocus() ) + pActivePanel->GrabFocus(); + else + GetLayouter()->SetFocusToPanelSelector(); + } + break; + } + + if ( !!aActivatePanel ) + { + ActivatePanel( *aActivatePanel ); + } + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::FocusActivePanel() + { + PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); + pActivePanel->GrabFocus(); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) + { + if ( !!m_aActivePanel ) + { + if ( i_nPosition <= *m_aActivePanel ) + ++*m_aActivePanel; + } + } + //==================================================================== //= ToolPanelDeck //==================================================================== @@ -257,6 +337,59 @@ namespace svt m_pImpl->LayoutAll(); } + //-------------------------------------------------------------------- + long ToolPanelDeck::Notify( NotifyEvent& i_rNotifyEvent ) + { + bool bHandled = false; + if ( i_rNotifyEvent.GetType() == EVENT_KEYINPUT ) + { + const KeyEvent* pEvent = i_rNotifyEvent.GetKeyEvent(); + const KeyCode& rKeyCode = pEvent->GetKeyCode(); + if ( rKeyCode.GetModifier() == KEY_MOD1 ) + { + bHandled = true; + switch ( rKeyCode.GetCode() ) + { + case KEY_HOME: + m_pImpl->DoAction( ACTION_ACTIVATE_FIRST ); + break; + case KEY_PAGEUP: + m_pImpl->DoAction( ACTION_ACTIVATE_PREV ); + break; + case KEY_PAGEDOWN: + m_pImpl->DoAction( ACTION_ACTIVATE_NEXT ); + break; + case KEY_END: + m_pImpl->DoAction( ACTION_ACTIVATE_LAST ); + break; + default: + bHandled = false; + break; + } + } + else if ( rKeyCode.GetModifier() == ( KEY_MOD1 | KEY_SHIFT ) ) + { + if ( rKeyCode.GetCode() == KEY_E ) + { + m_pImpl->DoAction( ACTION_TOGGLE_FOCUS ); + bHandled = true; + } + } + } + + if ( bHandled ) + return 1; + + return Control::Notify( i_rNotifyEvent ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck::GetFocus() + { + Control::GetFocus(); + m_pImpl->FocusActivePanel(); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk index 8572ccaa3607..88f1117e48b3 100644 --- a/svtools/workben/toolpanel/makefile.mk +++ b/svtools/workben/toolpanel/makefile.mk @@ -53,6 +53,7 @@ APP1OBJS= $(OBJFILES) APP1LIBS= $(SLB)/toolpanel.lib APP1STDLIBS=\ $(VCLLIB) \ + $(UCBHELPERLIB) \ $(SALLIB) \ $(TOOLSLIB) \ $(COMPHELPERLIB) \ diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index d717ed9a3fd6..44c03fb1e661 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -27,6 +27,7 @@ #include "precompiled_svtools.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" +#include "svtools/toolpanel/tablayouter.hxx" #include #include @@ -35,14 +36,20 @@ #include #include #include +#include +#include +#include #include #include +#include #include namespace svt { namespace toolpanel { using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Any; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::uno::XComponentContext; @@ -66,15 +73,35 @@ class ColoredPanelWindow : public Window public: ColoredPanelWindow( Window& i_rParent, const Color& i_rColor ) :Window( &i_rParent ) + ,m_aEdit( this, WB_BORDER ) { SetLineColor(); SetFillColor( i_rColor ); + + m_aEdit.Show(); } virtual void Paint( const Rectangle& i_rRect ) { DrawRect( i_rRect ); } + + virtual void GetFocus() + { + m_aEdit.GrabFocus(); + } + + virtual void Resize() + { + const Size aOutputSize( GetOutputSizePixel() ); + m_aEdit.SetPosSizePixel( + Point( 20, 20 ), + Size( aOutputSize.Width() - 40, 20 ) + ); + } + +private: + Edit m_aEdit; }; //============================================================================= @@ -87,11 +114,13 @@ public: ~ColoredPanel(); // IToolPanel + virtual ::rtl::OUString GetDisplayName() const; + virtual Image GetImage() const; virtual void Show(); virtual void Hide(); virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); - virtual ::rtl::OUString GetDisplayName() const; - virtual Image GetImage() const; + virtual void GrabFocus(); + virtual bool HasFocus() const; // IReference virtual oslInterlockedCount SAL_CALL acquire(); @@ -157,6 +186,18 @@ void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); } +//----------------------------------------------------------------------------- +void ColoredPanel::GrabFocus() +{ + m_aWindow.GrabFocus(); +} + +//----------------------------------------------------------------------------- +bool ColoredPanel::HasFocus() const +{ + return m_aWindow.HasChildPathFocus(); +} + //----------------------------------------------------------------------------- ::rtl::OUString ColoredPanel::GetDisplayName() const { @@ -170,31 +211,153 @@ Image ColoredPanel::GetImage() const } //============================================================================= -//= PanelDemoMainWindow +//= OptionsWindow //============================================================================= -class PanelDemoMainWindow : public WorkWindow +class PanelDemoMainWindow; +class OptionsWindow : public Window { +public: + OptionsWindow( PanelDemoMainWindow& i_rParent ); + + virtual void Resize(); + virtual void GetFocus(); + private: - ToolPanelDeck m_aToolPanelDeck; + DECL_LINK( OnAlignmentChanged, void* ); -protected: - virtual void GetFocus(); +private: + RadioButton m_aAlignLeft; + RadioButton m_aAlignRight; +}; +//============================================================================= +//= PanelDemoMainWindow +//============================================================================= +class PanelDemoMainWindow : public WorkWindow +{ public: PanelDemoMainWindow(); ~PanelDemoMainWindow(); + // window overridables virtual void Resize(); + +public: + // operations + void AlignTabs( const ::svt::TabAlignment i_eAlignment ); + +protected: + virtual void GetFocus(); + +private: + ToolPanelDeck m_aToolPanelDeck; + OptionsWindow m_aDemoOptions; }; //============================================================================= -//= PanelDemoMainWindow +//= PanelDemoMainWindow - implementation +//============================================================================= +//----------------------------------------------------------------------------- +OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) + :Window( &i_rParent, WB_BORDER | WB_DIALOGCONTROL ) + ,m_aAlignLeft( this, WB_GROUP ) + ,m_aAlignRight( this, 0 ) +{ + SetBorderStyle( WINDOW_BORDER_MONO ); + const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); + SetBackground( aFaceColor ); + + RadioButton* pRadios[] = + { + &m_aAlignLeft, &m_aAlignRight + }; + const sal_Char* pTexts[] = + { + "Left", "Right" + }; + for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) + { + pRadios[i]->SetText( String::CreateFromAscii( pTexts[i] ) ); + pRadios[i]->SetControlBackground( aFaceColor ); + pRadios[i]->Show(); + pRadios[i]->SetToggleHdl( LINK( this, OptionsWindow, OnAlignmentChanged ) ); + } + + m_aAlignRight.Check(); + + Show(); +} + +//----------------------------------------------------------------------------- +void OptionsWindow::GetFocus() +{ + Window::GetFocus(); + RadioButton* pRadios[] = + { + &m_aAlignLeft, &m_aAlignRight + }; + for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) + { + if ( pRadios[i]->IsChecked() ) + { + pRadios[i]->GrabFocus(); + break; + } + } +} + +//----------------------------------------------------------------------------- +void OptionsWindow::Resize() +{ + Window::Resize(); + + const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); + const Size aOutputSize( GetOutputSizePixel() ); + + const Size aRadioSize( + aOutputSize.Width() - 2 * aSpacing.Width(), + LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() + ); + + Point aRadioPos( aSpacing.Width(), aSpacing.Height() ); + RadioButton* pRadios[] = + { + &m_aAlignLeft, &m_aAlignRight + }; + for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) + { + pRadios[i]->SetPosSizePixel( aRadioPos, aRadioSize ); + aRadioPos.Move( 0, aRadioSize.Height() + aSpacing.Height() ); + } +} + +//----------------------------------------------------------------------------- +IMPL_LINK( OptionsWindow, OnAlignmentChanged, void*, /**/ ) +{ + PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) ); + if ( m_aAlignLeft.IsChecked() ) + { + rController.AlignTabs( TABS_LEFT ); + } + else if ( m_aAlignRight.IsChecked() ) + { + rController.AlignTabs( TABS_RIGHT ); + } + return 0L; +} +//============================================================================= +//= PanelDemoMainWindow - implementation //============================================================================= //----------------------------------------------------------------------------- PanelDemoMainWindow::PanelDemoMainWindow() :WorkWindow( NULL, WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) ,m_aToolPanelDeck( *this, WB_BORDER ) + ,m_aDemoOptions( *this ) { + const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); + + SetBackground( aFaceColor ); + m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); @@ -206,17 +369,22 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.ActivatePanel( 0 ); m_aToolPanelDeck.Show(); - SetBackground( Color( COL_LIGHTGRAY ) ); - SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); Show(); + AlignTabs( TABS_RIGHT ); + Help::EnableQuickHelp(); + + GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aToolPanelDeck ); + GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aDemoOptions ); } //----------------------------------------------------------------------------- PanelDemoMainWindow::~PanelDemoMainWindow() { + GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aDemoOptions ); + GetSystemWindow()->GetTaskPaneList()->RemoveWindow( &m_aToolPanelDeck ); } //----------------------------------------------------------------------------- @@ -231,9 +399,20 @@ void PanelDemoMainWindow::Resize() { WorkWindow::Resize(); Size aSize( GetOutputSizePixel() ); - aSize.Width() -= 40; + aSize.Width() -= 140; aSize.Height() -= 40; m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize ); + + m_aDemoOptions.SetPosSizePixel( + Point( 20 + aSize.Width(), 20 ), + Size( 100, aSize.Height() ) + ); +} + +//----------------------------------------------------------------------------- +void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment ) +{ + m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( i_eAlignment, m_aToolPanelDeck ) ) ); } //============================================================================= @@ -260,9 +439,17 @@ Reference< XMultiServiceFactory > PanelDemo::createApplicationServiceManager() //----------------------------------------------------------------------------- void __EXPORT PanelDemo::Main() { + // create service factory Reference< XMultiServiceFactory > xSMgr = createApplicationServiceManager(); ::comphelper::setProcessServiceFactory( xSMgr ); + // initialize the UCB + Sequence< Any > aArgs(2); + aArgs[0] <<= rtl::OUString::createFromAscii( "Local" ); + aArgs[1] <<= rtl::OUString::createFromAscii( "Office" ); + ::ucbhelper::ContentBroker::initialize( xSMgr, aArgs ); + + // run the application PanelDemoMainWindow aWindow; Execute(); } -- cgit From 270d3a6d94cfd6d188094d2b517871e2f043d7c4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Mar 2010 12:01:59 +0100 Subject: slidecopy: draw tab bar items with toolbar's NWF --- svtools/source/toolpanel/paneltabbar.cxx | 58 +++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index fcca3585d618..935bcdd1b0f1 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -37,7 +37,7 @@ // space around an item #define ITEM_OUTER_SPACE 2 * 2 // spacing before and after (in writing direction, whether this is horizontal or vertical) an item's text -#define ITEM_TEXT_FLOW_SPACE 2 +#define ITEM_TEXT_FLOW_SPACE 5 // distance between two items #define ITEM_DISTANCE_PIXEL 2 // space between item icon and icon text @@ -185,6 +185,21 @@ namespace svt { const Size aItemSize( CalculateItemSize( i_pPanel, i_rTargetWindow, i_bDrawMinimal ) ); + bool bNativeOK = false; + if ( i_rTargetWindow.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + ImplControlValue aControlValue; + Region aCtrlRegion( i_rItemRect ); + ControlState nState = CTRL_STATE_ENABLED; + + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_PRESSED; + if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + + aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); + + bNativeOK = i_rTargetWindow.DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, aCtrlRegion, nState, aControlValue, rtl::OUString() ); + } + Point aDrawPos( i_rItemRect.TopLeft() ); aDrawPos.Y() += ITEM_OUTER_SPACE; @@ -224,26 +239,29 @@ namespace svt i_rTargetWindow.Pop(); } - const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); - const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); - const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); - if ( bActive || bHovered || bFocused ) + if ( !bNativeOK ) { - Rectangle aSelectionRect( i_rItemRect ); - aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; - aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; - i_rTargetWindow.DrawSelectionBackground( - aSelectionRect, - ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, - bActive /* check */, - TRUE /* border */, - FALSE /* ext border only */, - 0 /* corner radius */, - NULL, - NULL - ); + const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); + const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); + const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); + if ( bActive || bHovered || bFocused ) + { + Rectangle aSelectionRect( i_rItemRect ); + aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; + aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; + i_rTargetWindow.DrawSelectionBackground( + aSelectionRect, + ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, + bActive /* check */, + TRUE /* border */, + FALSE /* ext border only */, + 0 /* corner radius */, + NULL, + NULL + ); + } } } -- cgit From accdb573f76a7cb599f2941fb45ba3f16090b757 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Mar 2010 11:08:18 +0100 Subject: slidecopy: moved the native widget rendering functions from Window to OutputDevice This allows to render native widgets onto a virtual device (on platform/theme combinations where this is possible). At the same time, removed the SalControlHandle parameter from all thos functions. It was nowehere used, and all callers always passed *NULL, anyway. --- vcl/aqua/inc/salgdi.h | 8 +- vcl/aqua/source/gdi/salnativewidgets.cxx | 10 +- vcl/inc/vcl/outdev.hxx | 44 ++++ vcl/inc/vcl/salgdi.hxx | 12 +- vcl/inc/vcl/window.h | 2 - vcl/inc/vcl/window.hxx | 40 ---- vcl/os2/inc/salgdi.h | 8 +- vcl/source/gdi/makefile.mk | 1 + vcl/source/gdi/outdevnative.cxx | 287 +++++++++++++++++++++++++++ vcl/source/gdi/salgdilayout.cxx | 24 +-- vcl/source/gdi/salnativewidgets-none.cxx | 7 - vcl/source/window/window.cxx | 5 - vcl/source/window/window3.cxx | 253 ----------------------- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 135 ++++++------- vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 40 ++-- vcl/unx/kde/salnativewidgets-kde.cxx | 25 +-- vcl/unx/kde4/KDESalGraphics.cxx | 6 +- vcl/unx/kde4/KDESalGraphics.hxx | 15 +- vcl/win/inc/salgdi.h | 8 +- vcl/win/source/gdi/salnativewidgets-luna.cxx | 14 +- 20 files changed, 462 insertions(+), 482 deletions(-) create mode 100644 vcl/source/gdi/outdevnative.cxx diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index f557c4d2e79b..78b785440b80 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -233,15 +233,15 @@ public: CGPoint* makeCGptArray(ULONG nPoints, const SalPoint* pPtAry); // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); // get device resolution diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 1536299331cb..48060ca3fee2 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -378,7 +378,7 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n * nType/nPart combination. */ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& rPos, SalControlHandle& rControlHandle, BOOL& rIsInside ) + const Point& rPos, BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { @@ -466,7 +466,6 @@ UInt32 AquaSalGraphics::getTrackState( ControlState nState ) * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, @@ -474,7 +473,6 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ) { BOOL bOK = FALSE; @@ -1194,12 +1192,11 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ) + const rtl::OUString& aCaption ) { return( FALSE ); } @@ -1216,11 +1213,10 @@ BOOL AquaSalGraphics::drawNativeControlText( ControlType nType, ControlPart nPar * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the AquaSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) { diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 0c03652d9300..4c3c464e20d5 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -1157,6 +1158,49 @@ public: BitmapEx GetDownsampledBitmapEx( const Size& rDstSz, const Point& rSrcPt, const Size& rSrcSz, const BitmapEx& rBmpEx, long nMaxBmpDPIX, long nMaxBmpDPIY ); + + //------------------------------------- + // Native Widget Rendering functions + //------------------------------------- + + // These all just call through to the private mpGraphics functions of the same name. + + // Query the platform layer for control support + BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); + + // Query the native control to determine if it was acted upon + BOOL HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + BOOL& rIsInside ); + + // Request rendering of a particular control and/or part + BOOL DrawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Request rendering of a caption string for a control + BOOL DrawNativeControlText( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ); + + // Query the native control's actual drawing region (including adornment) + BOOL GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ); + }; #endif // _SV_OUTDEV_HXX diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 55f8a0d03deb..66034434f5f5 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -162,15 +162,15 @@ protected: // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); /** Render bitmap with alpha channel @@ -444,7 +444,6 @@ public: ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ); @@ -454,7 +453,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, const OutputDevice *pOutDev ); @@ -464,7 +462,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, const OutputDevice *pOutDev ); @@ -474,7 +471,6 @@ public: const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index 0fec51e2e702..78f7ef2554cb 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -59,7 +59,6 @@ class VirtualDevice; class Cursor; class ImplDevFontList; class ImplFontCache; -class SalControlHandle; class SmartId; class VCLXWindow; class SalFrame; @@ -123,7 +122,6 @@ struct ImplWinData USHORT mnTrackFlags; USHORT mnIsTopWindow; BOOL mbMouseOver; // tracks mouse over for native widget paint effect - SalControlHandle* mpSalControlHandle; // native data for NWF BOOL mbEnableNativeWidget; // toggle native widget rendering SmartId* mpSmartHelpId; SmartId* mpSmartUniqueId; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index c14ee7add4fb..044b560aac36 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -557,14 +557,12 @@ public: SAL_DLLPRIVATE void ImplStartDnd(); SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); - SAL_DLLPRIVATE void ImplInitSalControlHandle(); SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos ); SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList(); SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList ); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const; - SAL_DLLPRIVATE void ImplMoveControlValue( ControlType, const ImplControlValue&, const Point& ) const; private: // Default construction is forbidden and not implemented. @@ -1095,44 +1093,6 @@ public: void EnableNativeWidget( BOOL bEnable = TRUE ); BOOL IsNativeWidgetEnabled() const; - // These all just call through to the private mpWindowImpl->mpFrame functions of the same name. - - // Query the platform layer for control support - BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); - - // Query the native control to determine if it was acted upon - BOOL HitTestNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - const Point& aPos, - BOOL& rIsInside ); - - // Request rendering of a particular control and/or part - BOOL DrawNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption ); - - // Request rendering of a caption string for a control - BOOL DrawNativeControlText( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption ); - - // Query the native control's actual drawing region (including adornment) - BOOL GetNativeControlRegion( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - rtl::OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ); - // a helper method for a Control's Draw method void PaintToDevice( OutputDevice* pDevice, const Point& rPos, const Size& rSize ); diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index 1fb51f089100..44cd145d3889 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -200,15 +200,15 @@ protected: #if 0 // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, rtl::OUString aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, rtl::OUString aCaption ); + rtl::OUString aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, rtl::OUString aCaption, + const ImplControlValue& aValue, rtl::OUString aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); #endif diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index ed2a9b2ba1e1..6490d5ffc6a4 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -110,6 +110,7 @@ SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ + $(SLO)$/outdevnative.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx new file mode 100644 index 000000000000..39969bd53e98 --- /dev/null +++ b/vcl/source/gdi/outdevnative.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: window3.cxx,v $ + * $Revision: 1.13 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 "vcl/outdev.hxx" +#include "vcl/window.hxx" +#include "vcl/salgdi.hxx" +#include "vcl/salnativewidgets.hxx" +#include "vcl/pdfextoutdevdata.hxx" + +// ----------------------------------------------------------------------- + +static bool lcl_enableNativeWidget( const OutputDevice& i_rDevice ) +{ + const OutDevType eType( i_rDevice.GetOutDevType() ); + switch ( eType ) + { + + case OUTDEV_WINDOW: + return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled(); + + case OUTDEV_VIRDEV: + { + const ::vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() ); + const ::vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const ::vcl::PDFExtOutDevData* >( pOutDevData ) ); + if ( pPDFData != NULL ) + return false; + return true; + } + + default: + return false; + } +} + +// ----------------------------------------------------------------------- +// These functions are mainly passthrough functions that allow access to +// the SalFrame behind a Window object for native widget rendering purposes. +// ----------------------------------------------------------------------- + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + return( mpGraphics->IsNativeControlSupported(nType, nPart) ); +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::HitTestNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + const Point& aPos, + BOOL& rIsInside ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, Point( aPos.X() + mnOutOffX, aPos.Y() + mnOutOffY ), + rIsInside, this ) ); +} + +// ----------------------------------------------------------------------- + +static void lcl_moveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) +{ + if( aValue.getOptionalVal() ) + { + switch( nType ) + { + case CTRL_SCROLLBAR: + { + ScrollbarValue* pScVal = reinterpret_cast(aValue.getOptionalVal()); + 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: + { + SpinbuttonValue* pSpVal = reinterpret_cast(aValue.getOptionalVal()); + pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); + pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + case CTRL_TOOLBAR: + { + ToolbarValue* pTVal = reinterpret_cast(aValue.getOptionalVal()); + pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); + } + break; + } + } +} + +BOOL OutputDevice::DrawNativeControl( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + 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() ) + return FALSE; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return TRUE; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + + // do so for ImplControlValue members, also + lcl_moveControlValue( nType, aValue, aWinOffs ); + + Region aTestRegion( GetActiveClipRegion() ); + aTestRegion.Intersect( rControlRegion ); + if( aTestRegion == rControlRegion ) + nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed + + BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::DrawNativeControlText(ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + // make sure the current clip region is initialized correctly + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return false; + + if ( mbInitClipRegion ) + ImplInitClipRegion(); + if ( mbOutputClipped ) + return true; + + if ( mbInitLineColor ) + ImplInitLineColor(); + if ( mbInitFillColor ) + ImplInitFillColor(); + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, aCaption, this ); + + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + +// ----------------------------------------------------------------------- + +BOOL OutputDevice::GetNativeControlRegion( ControlType nType, + ControlPart nPart, + const Region& rControlRegion, + ControlState nState, + const ImplControlValue& aValue, + ::rtl::OUString aCaption, + Region &rNativeBoundingRegion, + Region &rNativeContentRegion ) +{ + if( !lcl_enableNativeWidget( *this ) ) + return FALSE; + + if ( !mpGraphics ) + if ( !ImplGetGraphics() ) + return FALSE; + + // Convert the coordinates from relative to Window-absolute, so we draw + // in the correct place in platform code + Point aWinOffs( mnOutOffX, mnOutOffY ); + Region screenRegion( rControlRegion ); + screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); + lcl_moveControlValue( nType, aValue, aWinOffs ); + + BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, + aCaption, rNativeBoundingRegion, + rNativeContentRegion, this ); + if( bRet ) + { + // transform back native regions + rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); + } + // transform back ImplControlValue members + lcl_moveControlValue( nType, aValue, Point()-aWinOffs ); + + return bRet; +} + + diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index c1f987377c67..d45ce332adeb 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -672,7 +672,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* } BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) + const Point& aPos, BOOL& rIsInside, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { @@ -680,10 +680,10 @@ BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, co Region rgn( rControlRegion ); mirror( pt.X(), pOutDev ); mirror( rgn, pOutDev ); - return hitTestNativeControl( nType, nPart, rgn, pt, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rgn, pt, rIsInside ); } else - return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rControlHandle, rIsInside ); + return hitTestNativeControl( nType, nPart, rControlRegion, aPos, rIsInside ); } void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const OutputDevice* pOutDev, bool bBack ) const @@ -719,7 +719,7 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const } BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -727,33 +727,33 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControl( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControl( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) + const OUString& aCaption, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption ); + BOOL bRet = drawNativeControlText( nType, nPart, rgn, nState, aValue, aCaption ); mirror( nType, aValue, pOutDev, true ); return bRet; } else - return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption ); + return drawNativeControlText( nType, nPart, rControlRegion, nState, aValue, aCaption ); } BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, + const ImplControlValue& aValue, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) @@ -761,7 +761,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, Region rgn( rControlRegion ); mirror( rgn, pOutDev ); mirror( nType, aValue, pOutDev ); - if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, rControlHandle, aCaption, + if( getNativeControlRegion( nType, nPart, rgn, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ) ) { mirror( rNativeBoundingRegion, pOutDev, true ); @@ -776,7 +776,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, } } else - return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, rControlHandle, aCaption, + return getNativeControlRegion( nType, nPart, rControlRegion, nState, aValue, aCaption, rNativeBoundingRegion, rNativeContentRegion ); } diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx index a454d4f61683..1df1a05450d0 100644 --- a/vcl/source/gdi/salnativewidgets-none.cxx +++ b/vcl/source/gdi/salnativewidgets-none.cxx @@ -63,7 +63,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) { return( FALSE ); @@ -77,7 +76,6 @@ BOOL SalGraphics::hitTestNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControl( ControlType, @@ -85,7 +83,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -100,7 +97,6 @@ BOOL SalGraphics::drawNativeControl( ControlType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::drawNativeControlText( ControlType, @@ -108,7 +104,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -126,7 +121,6 @@ BOOL SalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * aCaption: A caption or title string (like button text etc) */ BOOL SalGraphics::getNativeControlRegion( ControlType, @@ -134,7 +128,6 @@ BOOL SalGraphics::getNativeControlRegion( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString&, Region &, Region & ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5689972e69d6..502d61d8958a 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1318,7 +1318,6 @@ ImplWinData* Window::ImplGetWinData() const mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow()) mpWindowImpl->mpWinData->mbMouseOver = FALSE; mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; mpWindowImpl->mpWinData->mpSmartHelpId = NULL; mpWindowImpl->mpWinData->mpSmartUniqueId = NULL; } @@ -4718,10 +4717,6 @@ Window::~Window() delete mpWindowImpl->mpWinData->mpFocusRect; if ( mpWindowImpl->mpWinData->mpTrackRect ) delete mpWindowImpl->mpWinData->mpTrackRect; - // Native widget support - delete mpWindowImpl->mpWinData->mpSalControlHandle; - mpWindowImpl->mpWinData->mpSalControlHandle = NULL; - if ( mpWindowImpl->mpWinData->mpSmartHelpId ) delete mpWindowImpl->mpWinData->mpSmartHelpId; if ( mpWindowImpl->mpWinData->mpSmartUniqueId ) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 4c875c24fc25..7c8e4f14f158 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -31,263 +31,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#define _SV_WINDOW_CXX - -#include "svsys.h" -#include "vcl/window.h" #include "vcl/window.hxx" #include "vcl/waitobj.hxx" -#include "vcl/salgdi.hxx" -#include "vcl/salnativewidgets.hxx" -#include "vcl/salctrlhandle.hxx" -#include "rtl/ustring.hxx" #include "vcl/button.hxx" -using namespace rtl; - -// ----------------------------------------------------------------------- -// These functions are mainly passthrough functions that allow access to -// the SalFrame behind a Window object for native widget rendering purposes. -// ----------------------------------------------------------------------- - -void Window::ImplInitSalControlHandle() -{ - // create SalControlHandle on demand - // not needed for ordinary windows - // TODO: move creation to SalGraphics - //if( !ImplGetWinData()->mpSalControlHandle ) - // ImplGetWinData()->mpSalControlHandle = new SalControlHandle; -} - -// ----------------------------------------------------------------------- - -BOOL Window::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - return( mpGraphics->IsNativeControlSupported(nType, nPart) ); -} - - -// ----------------------------------------------------------------------- - -BOOL Window::HitTestNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - const Point& aPos, - BOOL& rIsInside ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - return( mpGraphics->HitTestNativeControl(nType, nPart, screenRegion, OutputToScreenPixel( aPos ), *ImplGetWinData()->mpSalControlHandle, rIsInside, this ) ); -} - -// ----------------------------------------------------------------------- - -void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aValue, const Point& rDelta ) const -{ - if( aValue.getOptionalVal() ) - { - switch( nType ) - { - case CTRL_SCROLLBAR: - { - ScrollbarValue* pScVal = reinterpret_cast(aValue.getOptionalVal()); - 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: - { - SpinbuttonValue* pSpVal = reinterpret_cast(aValue.getOptionalVal()); - pSpVal->maUpperRect.Move( rDelta.X(), rDelta.Y() ); - pSpVal->maLowerRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - case CTRL_TOOLBAR: - { - ToolbarValue* pTVal = reinterpret_cast(aValue.getOptionalVal()); - pTVal->maGripRect.Move( rDelta.X(), rDelta.Y() ); - } - break; - } - } -} - -BOOL Window::DrawNativeControl( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - 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; - } - */ - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return TRUE; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - - // do so for ImplControlValue members, also - ImplMoveControlValue( nType, aValue, aWinOffs ); - - Region aTestRegion( GetActiveClipRegion() ); - aTestRegion.Intersect( rControlRegion ); - if( aTestRegion == rControlRegion ) - nState |= CTRL_CACHING_ALLOWED; // control is not clipped, caching allowed - - BOOL bRet = mpGraphics->DrawNativeControl(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::DrawNativeControlText(ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - ImplInitSalControlHandle(); - - // make sure the current clip region is initialized correctly - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return false; - - if ( mbInitClipRegion ) - ImplInitClipRegion(); - if ( mbOutputClipped ) - return true; - - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( mbInitFillColor ) - ImplInitFillColor(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->DrawNativeControlText(nType, nPart, screenRegion, nState, aValue, *ImplGetWinData()->mpSalControlHandle, aCaption, this ); - - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - -// ----------------------------------------------------------------------- - -BOOL Window::GetNativeControlRegion( ControlType nType, - ControlPart nPart, - const Region& rControlRegion, - ControlState nState, - const ImplControlValue& aValue, - OUString aCaption, - Region &rNativeBoundingRegion, - Region &rNativeContentRegion ) -{ - if( !IsNativeWidgetEnabled() ) - return FALSE; - - if ( !mpGraphics ) - if ( !ImplGetGraphics() ) - return FALSE; - - ImplInitSalControlHandle(); - - // Convert the coordinates from relative to Window-absolute, so we draw - // in the correct place in platform code - Point aWinOffs; - aWinOffs = OutputToScreenPixel( aWinOffs ); - Region screenRegion( rControlRegion ); - screenRegion.Move( aWinOffs.X(), aWinOffs.Y()); - ImplMoveControlValue( nType, aValue, aWinOffs ); - - BOOL bRet = mpGraphics->GetNativeControlRegion(nType, nPart, screenRegion, nState, aValue, - *ImplGetWinData()->mpSalControlHandle, aCaption, rNativeBoundingRegion, - rNativeContentRegion, this ); - if( bRet ) - { - // transform back native regions - rNativeBoundingRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - rNativeContentRegion.Move( -aWinOffs.X(), -aWinOffs.Y() ); - } - // transform back ImplControlValue members - ImplMoveControlValue( nType, aValue, Point()-aWinOffs ); - - return bRet; -} - - // ----------------------------------------------------------------------- WaitObject::~WaitObject() diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 654f39c51a92..08612fbda01a 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -187,34 +187,34 @@ static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ); //--- static Rectangle NWGetButtonArea( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetEditBoxPixmapRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static void NWPaintOneEditBox( int nScreen, GdkDrawable * gdkDrawable, GdkRectangle *gdkRect, ControlType nType, ControlPart nPart, Rectangle aEditBoxRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); //--- static Rectangle NWGetSpinButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static void NWPaintOneSpinButton( int nScreen, GdkPixmap * pixmap, ControlType nType, ControlPart nPart, Rectangle aAreaRect, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetComboBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); //--- static Rectangle NWGetListBoxButtonRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static Rectangle NWGetListBoxIndicatorRect( int nScreen, ControlType nType, ControlPart nPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + const ImplControlValue& aValue, const OUString& rCaption ); static Rectangle NWGetToolbarRect( int nScreen, ControlType nType, @@ -222,7 +222,6 @@ static Rectangle NWGetToolbarRect( int nScreen, Rectangle aAreaRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); //--- @@ -611,7 +610,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle&, BOOL& rIsInside ) { if ( ( nType == CTRL_SCROLLBAR ) && @@ -716,7 +714,6 @@ BOOL GtkSalGraphics::hitTestNativeControl( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, @@ -724,13 +721,12 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) && aValue.getTristateVal() == BUTTONVALUE_MIXED ) { - return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption ); } BOOL returnVal = FALSE; @@ -793,61 +789,61 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, if ( (nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKButton( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKRadio( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKCheck( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_SCROLLBAR) && ((nPart==PART_DRAW_BACKGROUND_HORZ) || (nPart==PART_DRAW_BACKGROUND_VERT)) ) { - returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKScrollbar( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) || ((nType==CTRL_SPINBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) || ((nType==CTRL_COMBOBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) || ((nType==CTRL_LISTBOX) && (nPart==HAS_BACKGROUND_TEXTURE)) ) { - returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_MULTILINE_EDITBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==HAS_BACKGROUND_TEXTURE)) ) ) { - returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKEditBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( ((nType==CTRL_SPINBOX) || (nType==CTRL_SPINBUTTONS)) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_ALL_BUTTONS)) ) { - returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKSpinBox( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType == CTRL_COMBOBOX) && ( (nPart==PART_ENTIRE_CONTROL) ||(nPart==PART_BUTTON_DOWN) ) ) { - returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKComboBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER) ) { if ( nType == CTRL_TAB_BODY ) returnVal = TRUE; else - returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption); + returnVal = NWPaintGTKTabItem( nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption); } else if ( (nType==CTRL_LISTBOX) && ((nPart==PART_ENTIRE_CONTROL) || (nPart==PART_WINDOW)) ) { - returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKListBox( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType== CTRL_TOOLBAR) ) { - returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKToolbar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if ( (nType== CTRL_MENUBAR) ) { - returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKMenubar( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_MENU_POPUP) && ( (nPart == PART_ENTIRE_CONTROL) @@ -857,19 +853,19 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, ) ) { - returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKPopupMenu( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_TOOLTIP) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKTooltip( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_PROGRESS) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKProgress( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_LISTNODE) && (nPart == PART_ENTIRE_CONTROL) ) { - returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + returnVal = NWPaintGTKListNode( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption ); } else if( (nType == CTRL_LISTNET) && (nPart == PART_ENTIRE_CONTROL) ) { @@ -891,7 +887,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { // need to emulate something for mixed state @@ -914,7 +909,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, SetClipRegion( pFontGC_, aRegion ); XDestroyRegion( aRegion ); - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); if( returnVal ) { @@ -925,7 +920,7 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, XUnionRectWithRegion( &aXRect, aRegion, aRegion ); SetClipRegion( pFontGC_, aRegion ); XDestroyRegion( aRegion ); - returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rControlHandle, rCaption ); + returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption ); } // clean up @@ -944,7 +939,6 @@ BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::drawNativeControlText( ControlType, @@ -952,7 +946,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( FALSE ); @@ -970,7 +963,6 @@ BOOL GtkSalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the SalFrame implementation. * rCaption: A caption or title string (like button text etc) */ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, @@ -978,7 +970,6 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) @@ -990,7 +981,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, && (rControlRegion.GetBoundRect().GetHeight() > 16) ) { rNativeBoundingRegion = NWGetButtonArea( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); rNativeContentRegion = rControlRegion; returnVal = TRUE; @@ -998,7 +989,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if ( (nType==CTRL_COMBOBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetComboBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1007,7 +998,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, { rNativeBoundingRegion = NWGetSpinButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1015,7 +1006,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, if ( (nType==CTRL_LISTBOX) && ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) ) { rNativeBoundingRegion = NWGetListBoxButtonRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; @@ -1028,7 +1019,7 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, (nPart==PART_BUTTON) )) { - rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rControlHandle, rCaption ); + rNativeBoundingRegion = NWGetToolbarRect( m_nScreen, nType, nPart, rControlRegion.GetBoundRect(), nState, aValue, rCaption ); rNativeContentRegion = rNativeBoundingRegion; returnVal = TRUE; } @@ -1118,7 +1109,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -1231,7 +1222,7 @@ BOOL GtkSalGraphics::NWPaintGTKButton( static Rectangle NWGetButtonArea( int nScreen, ControlType, ControlPart, Rectangle aAreaRect, ControlState nState, - const ImplControlValue&, SalControlHandle&, const OUString& ) + const ImplControlValue&, const OUString& ) { gboolean interiorFocus; gint focusWidth; @@ -1287,7 +1278,7 @@ BOOL GtkSalGraphics::NWPaintGTKRadio( GdkDrawable* gdkDrawable, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { GtkStateType stateType; @@ -1346,7 +1337,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -1401,7 +1392,7 @@ BOOL GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList&, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal()); @@ -1807,7 +1798,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& rCaption ) { Rectangle pixmapRect; @@ -1816,7 +1807,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, // Find the overall bounding rect of the buttons's drawing area, // plus its actual draw rect excluding adornment pixmapRect = NWGetEditBoxPixmapRect( m_nScreen, nType, nPart, rControlRectangle, - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it ) { clipRect.x = it->Left(); @@ -1824,7 +1815,7 @@ BOOL GtkSalGraphics::NWPaintGTKEditBox( GdkDrawable* gdkDrawable, clipRect.width = it->GetWidth(); clipRect.height = it->GetHeight(); - NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rControlHandle, rCaption ); + NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, pixmapRect, nState, aValue, rCaption ); } return( TRUE ); @@ -1841,7 +1832,6 @@ static Rectangle NWGetEditBoxPixmapRect(int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle pixmapRect = aAreaRect; @@ -1878,7 +1868,6 @@ static void NWPaintOneEditBox( int nScreen, Rectangle aEditBoxRect, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { GtkStateType stateType; @@ -1947,7 +1936,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const clipList&, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { GdkPixmap * pixmap; Rectangle pixmapRect; @@ -1995,8 +1984,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, if ( !pixmap ) return( FALSE ); - upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption ); - downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption ); + upBtnRect = NWGetSpinButtonRect( m_nScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); + downBtnRect = NWGetSpinButtonRect( m_nScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); if ( (nType==CTRL_SPINBOX) && (nPart!=PART_ALL_BUTTONS) ) { @@ -2006,7 +1995,7 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, aEditBoxRect.setX( 0 ); aEditBoxRect.setY( 0 ); - NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rControlHandle, rCaption ); + NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption ); } NWSetWidgetState( gWidgetData[m_nScreen].gSpinButtonWidget, nState, stateType ); @@ -2023,8 +2012,8 @@ BOOL GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, shadowRect.GetWidth(), shadowRect.GetHeight() ); } - NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rControlHandle, rCaption ); - NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rControlHandle, rCaption ); + NWPaintOneSpinButton( m_nScreen, pixmap, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption ); + NWPaintOneSpinButton( m_nScreen, pixmap, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption ); if( !NWRenderPixmapToScreen(pixmap, pixmapRect) ) { @@ -2044,7 +2033,6 @@ static Rectangle NWGetSpinButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { gint buttonSize; @@ -2088,7 +2076,6 @@ static void NWPaintOneSpinButton( int nScreen, Rectangle aAreaRect, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) { Rectangle buttonRect; @@ -2100,7 +2087,7 @@ static void NWPaintOneSpinButton( int nScreen, NWEnsureGTKSpinButton( nScreen ); NWConvertVCLStateToGTKState( nState, &stateType, &shadowType ); - buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rControlHandle, rCaption ); + buttonRect = NWGetSpinButtonRect( nScreen, nType, nPart, aAreaRect, nState, aValue, rCaption ); NWSetWidgetState( gWidgetData[nScreen].gSpinButtonWidget, nState, stateType ); gtk_paint_box( gWidgetData[nScreen].gSpinButtonWidget->style, pixmap, stateType, shadowType, NULL, gWidgetData[nScreen].gSpinButtonWidget, @@ -2132,7 +2119,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { Rectangle pixmapRect; Rectangle buttonRect; @@ -2157,7 +2144,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, NWSetWidgetState( gWidgetData[m_nScreen].gComboWidget, nState, stateType ); NWSetWidgetState( gWidgetData[m_nScreen].gArrowWidget, nState, stateType ); - buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rControlHandle, rCaption ); + buttonRect = NWGetComboBoxButtonRect( m_nScreen, nType, PART_BUTTON_DOWN, pixmapRect, nState, aValue, rCaption ); if( nPart == PART_BUTTON_DOWN ) buttonRect.Left() += 1; @@ -2179,7 +2166,7 @@ BOOL GtkSalGraphics::NWPaintGTKComboBox( GdkDrawable* gdkDrawable, if( nPart == PART_ENTIRE_CONTROL ) NWPaintOneEditBox( m_nScreen, gdkDrawable, &clipRect, nType, nPart, aEditBoxRect, - nState, aValue, rControlHandle, rCaption ); + nState, aValue, rCaption ); // Buttons must paint opaque since some themes have alpha-channel enabled buttons gtk_paint_flat_box( gWidgetData[m_nScreen].gBtnWidget->style, gdkDrawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, @@ -2210,7 +2197,6 @@ static Rectangle NWGetComboBoxButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aButtonRect; @@ -2265,7 +2251,7 @@ BOOL GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart, const clipList&, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GdkPixmap * pixmap; Rectangle pixmapRect; @@ -2407,7 +2393,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ) + const OUString& rCaption ) { Rectangle pixmapRect; Rectangle widgetRect; @@ -2474,7 +2460,7 @@ BOOL GtkSalGraphics::NWPaintGTKListBox( GdkDrawable* gdkDrawable, y+(widgetRect.Top() - pixmapRect.Top()), widgetRect.GetWidth(), widgetRect.GetHeight() ); aIndicatorRect = NWGetListBoxIndicatorRect( m_nScreen, nType, nPart, widgetRect, nState, - aValue, rControlHandle, rCaption ); + aValue, rCaption ); gtk_paint_tab( gWidgetData[m_nScreen].gOptionMenuWidget->style, gdkDrawable, stateType, shadowType, &clipRect, gWidgetData[m_nScreen].gOptionMenuWidget, "optionmenutab", x+(aIndicatorRect.Left() - pixmapRect.Left()), @@ -2501,7 +2487,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -2648,7 +2634,7 @@ BOOL GtkSalGraphics::NWPaintGTKMenubar( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { GtkStateType stateType; GtkShadowType shadowType; @@ -2733,7 +2719,7 @@ BOOL GtkSalGraphics::NWPaintGTKPopupMenu( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { // #i50745# gtk does not draw disabled menu entries (and crux theme // even crashes), draw them using vcl functionality. @@ -2863,7 +2849,7 @@ BOOL GtkSalGraphics::NWPaintGTKTooltip( const Rectangle& rControlRectangle, const clipList& rClipList, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKTooltip( m_nScreen ); @@ -2901,7 +2887,7 @@ BOOL GtkSalGraphics::NWPaintGTKListNode( const Rectangle& rControlRectangle, const clipList&, ControlState nState, const ImplControlValue& rValue, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKTreeView( m_nScreen ); @@ -2955,7 +2941,7 @@ BOOL GtkSalGraphics::NWPaintGTKProgress( const Rectangle& rControlRectangle, const clipList&, ControlState, const ImplControlValue& rValue, - SalControlHandle&, const OUString& ) + const OUString& ) { NWEnsureGTKProgressBar( m_nScreen ); @@ -3021,7 +3007,6 @@ static Rectangle NWGetListBoxButtonRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aPartRect; @@ -3084,7 +3069,6 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aIndicatorRect; @@ -3131,7 +3115,6 @@ static Rectangle NWGetToolbarRect( int nScreen, Rectangle aAreaRect, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { Rectangle aRet; diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 5bc7ab40b98e..6e3b692ac46e 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -67,15 +67,15 @@ public: // native widget methods virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& rCaption ); + const rtl::OUString& rCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& rCaption, + const ImplControlValue& aValue, const rtl::OUString& rCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); //helper methods for frame's UpdateSettings @@ -104,81 +104,81 @@ protected: const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKScrollbar( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKSpinBox( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKTabItem( ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& rCaption ); + const OUString& rCaption ); BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& rCaption ); }; diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index cd461fc36c8f..bd8d74f96a19 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1180,18 +1180,18 @@ class KDESalGraphics : public X11SalGraphics virtual BOOL IsNativeControlSupported( ControlType nType, ControlPart nPart ); virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside ); + BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); }; @@ -1245,7 +1245,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP */ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& rPos, - SalControlHandle&, BOOL& rIsInside ) + BOOL& rIsInside ) { if ( nType == CTRL_SCROLLBAR ) { @@ -1347,15 +1347,12 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart, @param aValue An optional value (tristate/numerical/string). - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle&, + const ImplControlValue& aValue, const OUString& ) { BOOL bReturn = FALSE; @@ -1492,15 +1489,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, const Region&, ControlState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const OUString& ) { return FALSE; @@ -1520,15 +1514,12 @@ BOOL KDESalGraphics::drawNativeControlText( ControlType, ControlPart, @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ BOOL KDESalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const OUString&, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) { diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 1c9882923b43..2661c68270eb 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -146,7 +146,7 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) + BOOL& ) { return FALSE; } @@ -177,7 +177,7 @@ void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveEleme BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& value, SalControlHandle&, + const ImplControlValue& value, const OUString& ) { // put not implemented types here @@ -554,7 +554,7 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, const Region& controlRegion, ControlState controlState, - const ImplControlValue& val, SalControlHandle&, + const ImplControlValue& val, const OUString&, Region &nativeBoundingRegion, Region &nativeContentRegion ) { diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx index e598f75be75f..2231a7104e81 100644 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ b/vcl/unx/kde4/KDESalGraphics.hxx @@ -53,7 +53,7 @@ class KDESalGraphics : public X11SalGraphics */ virtual BOOL hitTestNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, const Point& aPos, - SalControlHandle& rControlHandle, BOOL& rIsInside ); + BOOL& rIsInside ); /** Draw the requested control described by part/nControlState. @param rControlRegion @@ -62,15 +62,12 @@ class KDESalGraphics : public X11SalGraphics @param aValue An optional value (tristate/numerical/string). - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ virtual BOOL drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const rtl::OUString& aCaption ); /** Draw text on the widget. @@ -79,12 +76,11 @@ class KDESalGraphics : public X11SalGraphics @param rControlRegion The bounding region of the complete control in VCL frame coordinates. @param aValue An optional value (tristate/numerical/string) - @param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation. @param aCaption A caption or title string (like button text etc.) */ virtual BOOL drawNativeControlText( ControlType, ControlPart, const Region&, ControlState, - const ImplControlValue&, SalControlHandle&, + const ImplControlValue&, const rtl::OUString& ) { return false; } /** Check if the bounding regions match. @@ -100,15 +96,12 @@ class KDESalGraphics : public X11SalGraphics @param aValue An optional value (tristate/numerical/string) - @param rControlHandle - Carries platform dependent data and is maintained by the SalFrame implementation. - @param aCaption A caption or title string (like button text etc.) */ virtual BOOL getNativeControlRegion( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); }; \ No newline at end of file diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index c7ceb68199b9..befe9bf86aea 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -231,15 +231,15 @@ protected: // native widget rendering methods that require mirroring virtual BOOL hitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside ); + const Point& aPos, BOOL& rIsInside ); virtual BOOL drawNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, + ControlState nState, const ImplControlValue& aValue, const rtl::OUString& aCaption ); virtual BOOL drawNativeControlText( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const rtl::OUString& aCaption ); + const rtl::OUString& aCaption ); virtual BOOL getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, ControlState nState, - const ImplControlValue& aValue, SalControlHandle& rControlHandle, const rtl::OUString& aCaption, + const ImplControlValue& aValue, const rtl::OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion ); virtual bool drawAlphaBitmap( const SalTwoRect&, diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 5c85d5d67144..6a66a7955d49 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -314,7 +314,6 @@ BOOL WinSalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, - SalControlHandle&, BOOL& ) { return FALSE; @@ -420,7 +419,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlPart nPart, ControlState nState, const ImplControlValue& aValue, - SalControlHandle&, OUString aCaption ) { // a listbox dropdown is actually a combobox dropdown @@ -903,7 +901,6 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::drawNativeControl( ControlType nType, @@ -911,7 +908,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, const Region& rControlRegion, ControlState nState, const ImplControlValue& aValue, - SalControlHandle& rControlHandle, const OUString& aCaption ) { BOOL bOk = false; @@ -994,7 +990,7 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics bOk = ImplDrawNativeControl(mhDC, hTheme, rc, nType, nPart, nState, aValue, - rControlHandle, aCaptionStr ); + aCaptionStr ); // restore alignment SetTextAlign( mhDC, ta ); @@ -1014,7 +1010,6 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, * * rControlRegion: The bounding region of the complete control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::drawNativeControlText( ControlType, @@ -1022,7 +1017,6 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, const Region&, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString& ) { return( false ); @@ -1040,7 +1034,6 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, * * rControlRegion: The bounding region of the control in VCL frame coordinates. * aValue: An optional value (tristate/numerical/string) - * rControlHandle: Carries platform dependent data and is maintained by the WinSalGraphics implementation. * aCaption: A caption or title string (like button text etc) */ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, @@ -1048,7 +1041,6 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, const Region& rControlRegion, ControlState, const ImplControlValue&, - SalControlHandle&, const OUString&, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) @@ -1166,6 +1158,10 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } + if ( ( nType == CTRL_TAB_ITEM ) && ( nType == PART_ENTIRE_CONTROL ) ) + { + } + ReleaseDC( mhWnd, hDC ); return( bRet ); } -- cgit From ea3e3cdae879ea62f371874cf4ce1cde020ce969 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Mar 2010 14:16:02 +0100 Subject: slidecopy: +Rectangle::Transpose --- tools/inc/tools/gen.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 0d82f4d73160..2ab762ef82da 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -423,6 +423,7 @@ public: Point Center() const; void Move( long nHorzMove, long nVertMove ); + inline void Transpose(); inline void SetPos( const Point& rPoint ); void SetSize( const Size& rSize ); inline Size GetSize() const; @@ -581,6 +582,20 @@ inline void Rectangle::Move( long nHorzMove, long nVertMove ) nBottom += nVertMove; } +void Rectangle::Transpose() +{ + if ( !IsEmpty() ) + { + long swap( nLeft ); + nLeft = nTop; + nTop = swap; + + swap = nRight; + nRight = nBottom; + nBottom = swap; + } +} + inline void Rectangle::SetPos( const Point& rPoint ) { if ( nRight != RECT_EMPTY ) -- cgit From a39e924c9f5a0eaa74554bb9082a862671fdfbd4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Mar 2010 10:52:52 +0100 Subject: slidecopy: more native theming for the tool panel deck tabs. On Windows, they would look like rotated tab dialog tabs now, if salnativewidgets-luna.cxx had its change committed. Which it hasn't, since the TabControl tabs would look ugly then ... still need to investigate this. --- svtools/inc/svtools/toolpanel/tabalignment.hxx | 45 +++ svtools/inc/svtools/toolpanel/tablayouter.hxx | 7 +- svtools/source/toolpanel/paneltabbar.cxx | 403 ++++++++++++++++++++----- svtools/source/toolpanel/paneltabbar.hxx | 3 +- svtools/source/toolpanel/tablayouter.cxx | 2 +- svtools/workben/toolpanel/makefile.mk | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 2 - 7 files changed, 385 insertions(+), 78 deletions(-) create mode 100644 svtools/inc/svtools/toolpanel/tabalignment.hxx diff --git a/svtools/inc/svtools/toolpanel/tabalignment.hxx b/svtools/inc/svtools/toolpanel/tabalignment.hxx new file mode 100644 index 000000000000..e14db1bd841a --- /dev/null +++ b/svtools/inc/svtools/toolpanel/tabalignment.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TABALIGNMENT_HXX +#define TABALIGNMENT_HXX + +//........................................................................ +namespace svt +{ +//........................................................................ + + enum TabAlignment + { + TABS_LEFT, + TABS_RIGHT + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TABALIGNMENT_HXX diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index cf901d2e57b3..522739fc76e0 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -29,6 +29,7 @@ #include "svtools/toolpanel/decklayouter.hxx" #include "svtools/toolpanel/toolpanelcontainer.hxx" +#include "svtools/toolpanel/tabalignment.hxx" #include "svtools/toolpanel/refbase.hxx" #include @@ -40,12 +41,6 @@ namespace svt class ToolPanelDeck; - enum TabAlignment - { - TABS_LEFT, - TABS_RIGHT - }; - struct TabDeckLayouter_Data; //==================================================================== diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 935bcdd1b0f1..9a76532c5dc1 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -29,7 +29,11 @@ #include "svtools/toolpanel/toolpaneldeck.hxx" #include "paneltabbar.hxx" +#include +#include +#include #include +#include #include #include @@ -39,11 +43,11 @@ // spacing before and after (in writing direction, whether this is horizontal or vertical) an item's text #define ITEM_TEXT_FLOW_SPACE 5 // distance between two items -#define ITEM_DISTANCE_PIXEL 2 +#define ITEM_DISTANCE_PIXEL 0 // space between item icon and icon text #define ITEM_ICON_TEXT_DISTANCE 4 // outer space (aka margin) of the complete tab bar control -#define TAB_BAR_OUTER_SPACE 2 +#define TAB_BAR_OUTER_SPACE 1 //........................................................................ namespace svt @@ -56,6 +60,8 @@ namespace svt #define ITEM_STATE_ACTIVE 0x01 #define ITEM_STATE_HOVERED 0x02 #define ITEM_STATE_FOCUSED 0x04 + #define ITEM_POSITION_FIRST 0x08 + #define ITEM_POSITION_LAST 0x10 //================================================================================================================== //= ItemDescriptor @@ -90,8 +96,25 @@ namespace svt { public: /** calculates the size of the area occupied by the item representing the given tool panel + @param i_pPanel + denotes the panel whose item's size should be calculated + @param i_bMinimum + if and only if the minimal version of the item should be rendered + @param o_rBoundingSize + contains, upon return, the overall size needed to render the item, including possible decorations which are + not available for the item content + @param o_rContentArea + contains, upon return, the area which is available to render the item content. It lies completely + within an assuming bounding rectangle, which starts at corrdinates (0, 0), and has the size returned + in o_rBoundingSize. + */ - virtual Size CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const = 0; + virtual void CalculateItemSize( + const PToolPanel& i_pPanel, + const bool i_bMinimum, + Size& o_rBoundingSize, + Rectangle& o_rContentArea + ) const = 0; /** returns the position where the next item should start, assuming the previous item occupies a given area */ @@ -100,17 +123,15 @@ namespace svt /** draws the item onto the given device, in the givem area @param i_pPanel the panel whose item representation is to be drawn - @param i_rTargetWindow - the window onto which to drawa - @param i_rItemRect - the area to paint the item into. The caller is responsible for ensuring that is has a size sufficient to - hold the item (which can be determined by calling CalculateItemSize beforehand). + @param i_rPosition + the position to paint the item to. Starting at this point, an area of the size returned + as "bounding size" in CalculateItemSize might be used. @param i_nItemFlags defines in which state to draw the item @param i_bDrawMinimal defines whether the minimal version of the item should be drawn */ - virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, + virtual void DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) = 0; /** updates the given items to use their minimal or optimal size, so they fit (if possible) into the given @@ -127,48 +148,206 @@ namespace svt class VerticalItemLayout : public IItemsLayout { public: - VerticalItemLayout() - { - } + VerticalItemLayout( Window& i_rTargetWindow, const bool i_bLeft ); // IItemsLayout overridables - virtual Size CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const; + virtual void CalculateItemSize( + const PToolPanel& i_pPanel, + const bool i_bMinimum, + Size& o_rBoundingSize, + Rectangle& o_rContentArea + ) const; virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const; - virtual void DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, - const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ); + virtual void DrawItem( + const PToolPanel& i_pPanel, + const Point& i_rPosition, + const ItemFlags i_nItemFlags, + const bool i_bDrawMinimal + ); virtual void FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ); + + private: + void impl_preRender( + const Rectangle& i_rBoundingArea, + const Rectangle& i_rContentArea, + const ItemFlags& i_nFlags + ); + void impl_renderContent( + const PToolPanel& i_pPanel, + const Rectangle& i_rContentArea, + const bool i_bMinimal + ); + void impl_postRender( + const Rectangle& i_rBoundingArea, + const Rectangle& i_rContentArea, + const ItemFlags& i_nFlags + ); + + /** rotates a pair of bounding/content rect in formation, so they properly keep their relative position, + and so that the upper left corner of the bounding rect is constant. + */ + static void + impl_rotateFormation( Rectangle& io_rBoundingRect, Rectangle& io_rContentRect, const bool i_bLeft ); + + private: + Window& m_rTargetWindow; + const bool m_bLeft; + + enum ItemRenderMode + { + /// the items are to be rendered in the look of a native widget toolbar item + NWF_TOOLBAR_ITEM, + /// the items are to be rendered in the look of a native widget tab bar item + NWF_TABBAR_ITEM, + /// the items are to be rendered with VCL functionality only + VCL_BASED + }; + ItemRenderMode m_eRenderMode; }; //------------------------------------------------------------------------------------------------------------------ - Size VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const OutputDevice& i_rReferenceDevice, const bool i_bMinimum ) const + VerticalItemLayout::VerticalItemLayout( Window& i_rTargetWindow, const bool i_bLeft ) + :m_rTargetWindow( i_rTargetWindow ) + ,m_bLeft( i_bLeft ) + ,m_eRenderMode( NWF_TOOLBAR_ITEM ) + { +#ifdef WNT + if ( m_rTargetWindow.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) + // this mode requires the NWF framework to be able to render those items onto a virtual + // device. For some frameworks (some GTK themes, in particular), this is known to fail. + // So, be on the safe side for the moment. + m_eRenderMode = NWF_TABBAR_ITEM; + else +#endif + if ( m_rTargetWindow.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + m_eRenderMode = NWF_TOOLBAR_ITEM; + else + m_eRenderMode = VCL_BASED; + } + + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::impl_rotateFormation( Rectangle& io_rBoundingRect, Rectangle& io_rContentRect, const bool i_bLeft ) + { + // move the to-be-upper-left corner to (0,0) + ::basegfx::B2DHomMatrix aTransformation; + aTransformation.translate( + i_bLeft ? -io_rBoundingRect.Right() : -io_rBoundingRect.Left(), + i_bLeft ? -io_rBoundingRect.Top() : -io_rBoundingRect.Bottom() ); + // rotate by 90 resp. -90 degrees + aTransformation.rotate( i_bLeft ? -F_PI2 : F_PI2 ); + // note on the screen, the ordinate goes top-down, while basegfx calculates in a system where the ordinate + // does bottom-up; thus the "wrong" sign before F_PI2 here + // move back to original coordinates + aTransformation.translate( io_rBoundingRect.Left(), io_rBoundingRect.Top() ); + + // apply + ::basegfx::B2DRange aBoundingRange( io_rBoundingRect.Left(), io_rBoundingRect.Top(), io_rBoundingRect.Right(), io_rBoundingRect.Bottom() ); + aBoundingRange.transform( aTransformation ); + io_rBoundingRect.Left() = long( aBoundingRange.getMinX() ); + io_rBoundingRect.Top() = long( aBoundingRange.getMinY() ); + io_rBoundingRect.Right() = long( aBoundingRange.getMaxX() ); + io_rBoundingRect.Bottom() = long( aBoundingRange.getMaxY() ); + + ::basegfx::B2DRange aContentRange( io_rContentRect.Left(), io_rContentRect.Top(), io_rContentRect.Right(), io_rContentRect.Bottom() ); + aContentRange.transform( aTransformation ); + io_rContentRect.Left() = long( aContentRange.getMinX() ); + io_rContentRect.Top() = long( aContentRange.getMinY() ); + io_rContentRect.Right() = long( aContentRange.getMaxX() ); + io_rContentRect.Bottom() = long( aContentRange.getMaxY() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const bool i_bMinimum, + Size& o_rBoundingSize, Rectangle& o_rContentArea ) const { const Image aImage( i_pPanel->GetImage() ); const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); // for the moment, we display the icons only - Size aItemSize; + Size aItemContentSize; if ( !!aImage ) { - aItemSize = aImage.GetSizePixel(); + aItemContentSize = aImage.GetSizePixel(); } if ( !i_bMinimum && sItemText.getLength() ) { if ( !!aImage ) - aItemSize.Height() += ITEM_ICON_TEXT_DISTANCE; + aItemContentSize.Height() += ITEM_ICON_TEXT_DISTANCE; // add space for vertical text - const Size aTextSize( i_rReferenceDevice.GetCtrlTextWidth( sItemText ), i_rReferenceDevice.GetTextHeight() ); - aItemSize.Height() += aTextSize.Width(); - aItemSize.Width() = ::std::max( aItemSize.Width(), aTextSize.Height() ); + const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); + aItemContentSize.Height() += aTextSize.Width(); + aItemContentSize.Width() = ::std::max( aItemContentSize.Width(), aTextSize.Height() ); + + aItemContentSize.Height() += 2 * ITEM_TEXT_FLOW_SPACE; + } - aItemSize.Height() += 2 * ITEM_TEXT_FLOW_SPACE; + aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; + aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; + + Region aBoundingRegion, aContentRegion; + bool bNativeOK = false; + if ( m_eRenderMode == NWF_TOOLBAR_ITEM ) + { + // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. + // Instead, simply assume that both the content and the bounding region are the same. +// const ImplControlValue aControlValue; +// bNativeOK = m_rTargetWindow.GetNativeControlRegion( +// CTRL_TOOLBAR, PART_BUTTON, +// Rectangle( Point(), aItemContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, +// aControlValue, ::rtl::OUString(), +// aBoundingRegion, aContentRegion +// ); + aContentRegion = Rectangle( Point( 1, 1 ), aItemContentSize ); + aBoundingRegion = Rectangle( Point( 0, 0 ), Size( aItemContentSize.Width() + 2, aItemContentSize.Height() + 2 ) ); + bNativeOK = true; } + else if ( m_eRenderMode == NWF_TABBAR_ITEM ) + { + Rectangle aRotatedContentArea( Point(), aItemContentSize ); + aRotatedContentArea.Transpose(); + + TabitemValue tiValue; + ImplControlValue aControlValue( (void*)(&tiValue) ); + + bNativeOK = m_rTargetWindow.GetNativeControlRegion( + CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, + Rectangle( aRotatedContentArea ), + CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, + aControlValue, ::rtl::OUString(), + aBoundingRegion, aContentRegion + ); + OSL_ENSURE( bNativeOK, "VerticalItemLayout::CalculateItemSize: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - aItemSize.Width() += 2 * ITEM_OUTER_SPACE; - aItemSize.Height() += 2 * ITEM_OUTER_SPACE; + Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); + Rectangle aContentRect( aContentRegion.GetBoundRect() ); + + impl_rotateFormation( aBoundingRect, aContentRect, m_bLeft ); + + aBoundingRegion = aBoundingRect; + aContentRegion = aContentRect; + } + + if ( bNativeOK ) + { + const Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); + + o_rContentArea = aContentRegion.GetBoundRect(); + o_rBoundingSize = aBoundingRect.GetSize(); + + // normalize the content area, it is assumed to be relative to a rectangle which starts + // at (0,0), and has a size of o_rBoundingSize. + o_rContentArea.Move( -aBoundingRect.Left(), -aBoundingRect.Top() ); + } + else + { + o_rContentArea = Rectangle( Point( 0, 0 ), aItemContentSize ); + o_rBoundingSize = aItemContentSize; - return aItemSize; + // don't attempt native rendering, again. If it didn't work this time, it won't work in the future. + const_cast< VerticalItemLayout* >( this )->m_eRenderMode = VCL_BASED; + } } //------------------------------------------------------------------------------------------------------------------ @@ -180,27 +359,77 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, Window& i_rTargetWindow, const Rectangle& i_rItemRect, - const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) + void VerticalItemLayout::impl_preRender( const Rectangle& i_rBoundingArea, const Rectangle& i_rContentArea, const ItemFlags& i_nItemFlags ) { - const Size aItemSize( CalculateItemSize( i_pPanel, i_rTargetWindow, i_bDrawMinimal ) ); + ControlState nState = CTRL_STATE_ENABLED; + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; + if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; - bool bNativeOK = false; - if ( i_rTargetWindow.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + switch ( m_eRenderMode ) + { + case NWF_TOOLBAR_ITEM: { - ImplControlValue aControlValue; - Region aCtrlRegion( i_rItemRect ); - ControlState nState = CTRL_STATE_ENABLED; + // completely erase the target area, toolbar item NWF is not expected to do this + m_rTargetWindow.DrawRect( i_rBoundingArea ); - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_PRESSED; - if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + const Region aCtrlRegion( i_rContentArea ); + ImplControlValue aControlValue; aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); - bNativeOK = i_rTargetWindow.DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, aCtrlRegion, nState, aControlValue, rtl::OUString() ); + bool bNativeOK = m_rTargetWindow.DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, aCtrlRegion, nState, aControlValue, rtl::OUString() ); + (void)bNativeOK; + OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); + // IsNativeControlSupported returned true, previously, otherwise we would not be here ... + } + break; + + case NWF_TABBAR_ITEM: + { + VirtualDevice aRenderDevice( m_rTargetWindow ); + + Rectangle aRotatedBoundingArea( i_rBoundingArea ); + Rectangle aRotatedContentArea( i_rContentArea ); + impl_rotateFormation( aRotatedBoundingArea, aRotatedContentArea, !m_bLeft ); + + const Size aRotatedBoundingSize( aRotatedBoundingArea.GetSize() ); + aRenderDevice.SetOutputSizePixel( aRotatedBoundingSize ); + + const Point aRotatedContentOffset( aRotatedContentArea.Left() - aRotatedBoundingArea.Left(), aRotatedContentArea.Top() - aRotatedBoundingArea.Top() ); + const Size aRotatedContentSize( aRotatedContentArea.GetSize() ); + const Region aCtrlRegion( Rectangle( aRotatedContentOffset, aRotatedContentSize ) ); + + TabitemValue tiValue; + if ( i_nItemFlags & ITEM_POSITION_FIRST ) + tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP; + if ( i_nItemFlags & ITEM_POSITION_LAST ) + tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; + + ImplControlValue aControlValue( (void *)(&tiValue) ); + + bool bNativeOK = aRenderDevice.DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString() ); + OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); + // IsNativeControlSupported returned true, previously, otherwise we would not be here ... + + BitmapEx aBitmap( aRenderDevice.GetBitmapEx( Point( 0, 0 ), Size( aRotatedBoundingSize.Width() - 1, aRotatedBoundingSize.Height() - 1 ) ) ); + aBitmap.Rotate( m_bLeft ? 900 : 2700, Color( COL_BLACK ) ); + + m_rTargetWindow.DrawBitmapEx( i_rBoundingArea.TopLeft(), aBitmap ); } + break; + + case VCL_BASED: + // completely erase the target area. Otherwise, the DrawSelectionBackground from postRender will constantly add up + m_rTargetWindow.DrawRect( i_rBoundingArea ); + break; + } + } - Point aDrawPos( i_rItemRect.TopLeft() ); + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const bool i_bDrawMinimal ) + { + Point aDrawPos( i_rContentArea.TopLeft() ); aDrawPos.Y() += ITEM_OUTER_SPACE; // draw the image @@ -208,8 +437,8 @@ namespace svt if ( !!aItemImage ) { const Size aImageSize( aItemImage.GetSizePixel() ); - i_rTargetWindow.DrawImage( - Point( aDrawPos.X() + ( aItemSize.Width() - aImageSize.Width() ) / 2, aDrawPos.Y() ), + m_rTargetWindow.DrawImage( + Point( aDrawPos.X() + ( i_rContentArea.GetWidth() - aImageSize.Width() ) / 2, aDrawPos.Y() ), aItemImage ); aDrawPos.Y() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; @@ -220,38 +449,44 @@ namespace svt aDrawPos.Y() += ITEM_TEXT_FLOW_SPACE; // draw the text - i_rTargetWindow.Push( PUSH_FONT ); + m_rTargetWindow.Push( PUSH_FONT ); - Font aFont( i_rTargetWindow.GetFont() ); + Font aFont( m_rTargetWindow.GetFont() ); aFont.SetOrientation( 2700 ); aFont.SetVertical( TRUE ); - i_rTargetWindow.SetFont( aFont ); + m_rTargetWindow.SetFont( aFont ); const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); - const Size aTextSize( i_rTargetWindow.GetCtrlTextWidth( sItemText ), i_rTargetWindow.GetTextHeight() ); + const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); Point aTextPos( aDrawPos ); aTextPos.X() += aTextSize.Height(); - aTextPos.X() += ( i_rItemRect.GetWidth() - aTextSize.Height() ) / 2; + aTextPos.X() += ( i_rContentArea.GetWidth() - aTextSize.Height() ) / 2; - i_rTargetWindow.DrawText( aTextPos, sItemText ); + m_rTargetWindow.DrawText( aTextPos, sItemText ); - i_rTargetWindow.Pop(); + m_rTargetWindow.Pop(); } + } + + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::impl_postRender( const Rectangle& i_rBoundingArea, const Rectangle& i_rContentArea, const ItemFlags& i_nItemFlags ) + { + (void)i_rBoundingArea; - if ( !bNativeOK ) + if ( m_eRenderMode == VCL_BASED ) { const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); if ( bActive || bHovered || bFocused ) { - Rectangle aSelectionRect( i_rItemRect ); + Rectangle aSelectionRect( i_rContentArea ); aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; - i_rTargetWindow.DrawSelectionBackground( + m_rTargetWindow.DrawSelectionBackground( aSelectionRect, ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, bActive /* check */, @@ -265,6 +500,22 @@ namespace svt } } + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, + const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) + { + Rectangle aContentArea; + Size aBoundingSize; + CalculateItemSize( i_pPanel, i_bDrawMinimal, aBoundingSize, aContentArea ); + + aContentArea.Move( i_rPosition.X(), i_rPosition.Y() ); + const Rectangle aBoundingArea( i_rPosition, aBoundingSize ); + + impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); + impl_renderContent( i_pPanel, aContentArea, i_bDrawMinimal ); + impl_postRender( aBoundingArea, aContentArea, i_nItemFlags ); + } + //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ) { @@ -291,16 +542,19 @@ namespace svt ,public IToolPanelDeckListener { public: - PanelTabBar_Data( PanelTabBar& i_rTabBar ) + PanelTabBar_Data( PanelTabBar& i_rTabBar, const TabAlignment i_eAlignment ) :rTabBar( i_rTabBar ) ,rPanelDeck( dynamic_cast< ToolPanelDeck& >( *i_rTabBar.GetParent() ) ) - ,pLayout( new VerticalItemLayout ) + ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) ,aHoveredItem() ,aFocusedItem() ,bMouseButtonDown( false ) ,aItems() ,bItemsDirty( true ) { + OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), + "PanelTabBar_Data: unsupported alignment!" ); + rPanelDeck.AddListener( *this ); rPanelDeck.GetPanels()->AddListener( *this ); } @@ -375,7 +629,7 @@ namespace svt #endif //-------------------------------------------------------------------------------------------------------------- - static void lcl_calcItemRects( PanelTabBar_Data& io_rData, const OutputDevice& i_rReferenceDevice ) + static void lcl_calcItemRects( PanelTabBar_Data& io_rData ) { io_rData.aItems.resize(0); @@ -392,9 +646,15 @@ namespace svt ItemDescriptor aItem; aItem.pPanel = pPanel; - const Size aMinItemSize = io_rData.pLayout->CalculateItemSize( pPanel, i_rReferenceDevice, true ); - const Size aPrefItemSize = io_rData.pLayout->CalculateItemSize( pPanel, i_rReferenceDevice, false ); - // TODO: have one method calculating both sizes + Rectangle aContentArea; + + Size aMinItemSize; + io_rData.pLayout->CalculateItemSize( pPanel, true, aMinItemSize, aContentArea ); + + Size aPrefItemSize; + io_rData.pLayout->CalculateItemSize( pPanel, false, aPrefItemSize, aContentArea ); + + // TODO: have one method calculating both sizes? aItem.aMinArea = Rectangle( aMinItemPos, aMinItemSize ); aItem.aPrefArea = Rectangle( aPrefItemPos, aPrefItemSize ); @@ -409,14 +669,14 @@ namespace svt } //-------------------------------------------------------------------------------------------------------------- - static void lcl_ensureItemsCache( PanelTabBar_Data& io_rData, const OutputDevice& i_rReferenceDevice ) + static void lcl_ensureItemsCache( PanelTabBar_Data& io_rData ) { if ( io_rData.bItemsDirty == false ) { DBG_CHECK( io_rData ); return; } - lcl_calcItemRects( io_rData, i_rReferenceDevice ); + lcl_calcItemRects( io_rData ); OSL_POSTCOND( io_rData.bItemsDirty == false, "lcl_ensureItemsCache: cache still dirty!" ); DBG_CHECK( io_rData ); } @@ -458,8 +718,15 @@ namespace svt if ( i_rData.aFocusedItem == i_nItemIndex ) nItemFlags |= ITEM_STATE_FOCUSED; - i_rData.rTabBar.DrawRect( rItem.GetCurrentRect() ); - i_rData.pLayout->DrawItem( rItem.pPanel, i_rData.rTabBar, rItem.GetCurrentRect(), nItemFlags, rItem.bUseMinimal ); + if ( 0 == i_nItemIndex ) + nItemFlags |= ITEM_POSITION_FIRST; + + if ( i_rData.rPanelDeck.GetPanels()->GetPanelCount() - 1 == i_nItemIndex ) + nItemFlags |= ITEM_POSITION_LAST; + + i_rData.rTabBar.SetUpdateMode( FALSE ); + i_rData.pLayout->DrawItem( rItem.pPanel, rItem.GetCurrentRect().TopLeft(), nItemFlags, rItem.bUseMinimal ); + i_rData.rTabBar.SetUpdateMode( TRUE ); } //-------------------------------------------------------------------------------------------------------------- @@ -485,7 +752,7 @@ namespace svt //================================================================================================================== void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) { - lcl_ensureItemsCache( *this, rTabBar ); + lcl_ensureItemsCache( *this ); if ( !!i_rOldActive ) lcl_drawItem( *this, *i_rOldActive ); @@ -496,9 +763,9 @@ namespace svt //= PanelTabBar //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck ) + PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment ) :Control( &i_rPanelDeck, 0 ) - ,m_pData( new PanelTabBar_Data( *this ) ) + ,m_pData( new PanelTabBar_Data( *this, i_eAlignment ) ) { DBG_CHECK( *m_pData ); @@ -514,7 +781,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { - lcl_ensureItemsCache( *m_pData, *this ); + lcl_ensureItemsCache( *m_pData ); if ( m_pData->aItems.empty() ) return Size( 2 * TAB_BAR_OUTER_SPACE, 2 * TAB_BAR_OUTER_SPACE ); @@ -545,7 +812,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::Paint( const Rectangle& i_rRect ) { - lcl_ensureItemsCache( *m_pData, *this ); + lcl_ensureItemsCache( *m_pData ); // background DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); @@ -557,7 +824,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent ) { - lcl_ensureItemsCache( *m_pData, *this ); + lcl_ensureItemsCache( *m_pData ); ::boost::optional< size_t > aOldItem( m_pData->aHoveredItem ); ::boost::optional< size_t > aNewItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); @@ -589,7 +856,7 @@ namespace svt if ( !i_rMouseEvent.IsLeft() ) return; - lcl_ensureItemsCache( *m_pData, *this ); + lcl_ensureItemsCache( *m_pData ); ::boost::optional< size_t > aHitItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); if ( !aHitItem ) @@ -627,7 +894,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent ) { - lcl_ensureItemsCache( *m_pData, *this ); + lcl_ensureItemsCache( *m_pData ); ::boost::optional< size_t > aHelpItem( lcl_findItemForPoint( *m_pData, ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) ); if ( !aHelpItem ) diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index e718619dbc4f..f53f68cbf5ee 100644 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -27,6 +27,7 @@ #define PANELTABBAR_HXX #include "svtools/toolpanel/toolpanelcontainer.hxx" +#include "svtools/toolpanel/tabalignment.hxx" #include @@ -51,7 +52,7 @@ namespace svt class PanelTabBar : public Control { public: - PanelTabBar( ToolPanelDeck& i_rParent ); + PanelTabBar( ToolPanelDeck& i_rParent, const TabAlignment i_eAlignment ); ~PanelTabBar(); // Window overridables diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 269a6a1c4acd..10405c0b75aa 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -50,7 +50,7 @@ namespace svt TabDeckLayouter_Data( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ) :eAlignment( i_eAlignment ) ,pPanels( i_rPanelDeck.GetPanels() ) - ,pTabBar( new PanelTabBar( i_rPanelDeck ) ) + ,pTabBar( new PanelTabBar( i_rPanelDeck, i_eAlignment ) ) { pTabBar->Show(); } diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk index 88f1117e48b3..68050083412f 100644 --- a/svtools/workben/toolpanel/makefile.mk +++ b/svtools/workben/toolpanel/makefile.mk @@ -59,6 +59,7 @@ APP1STDLIBS=\ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ + $(BASEGFXLIB) \ .IF "$(GUI)"!="UNX" diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 44c03fb1e661..e09e6e362e59 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -372,8 +372,6 @@ PanelDemoMainWindow::PanelDemoMainWindow() SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); Show(); - AlignTabs( TABS_RIGHT ); - Help::EnableQuickHelp(); GetSystemWindow()->GetTaskPaneList()->AddWindow( &m_aToolPanelDeck ); -- cgit From 0bfe5e8c35f2e5b529d928cae9cc22998469520f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Mar 2010 11:29:42 +0100 Subject: slidecopy: use native theming for tab's background, too --- svtools/source/toolpanel/paneltabbar.cxx | 73 +++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 9a76532c5dc1..faaf22c91efa 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -92,6 +92,13 @@ namespace svt //================================================================================================================== //= IItemsLayout //================================================================================================================== + // TODO: originally, IItemsLayout was intended to abstract from the "vertical vs. horizontal" problem. Meanwhile, + // the only existing implementation (VerticalItemLayout) does much more than just caring for the vertical layout, + // a lot of the code would need to be re-used for horizontal layout. + // Thinking about, horizontal and vertical layout only differ in some coordinate and font rotations. So, + // one could probably have a single layouter instance, which calculates, say, a default horizontal layout, and + // derive every other layout by just rotating the coordinates. + class IItemsLayout { public: @@ -120,6 +127,10 @@ namespace svt */ virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const = 0; + /** fills the background of our target device + */ + virtual void DrawBackground( const Rectangle& i_rArea ) = 0; + /** draws the item onto the given device, in the givem area @param i_pPanel the panel whose item representation is to be drawn @@ -158,6 +169,7 @@ namespace svt Rectangle& o_rContentArea ) const; virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const; + virtual void DrawBackground( const Rectangle& i_rArea ); virtual void DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, @@ -500,6 +512,35 @@ namespace svt } } + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::DrawBackground( const Rectangle& i_rArea ) + { + bool bNativeOK = false; + switch ( m_eRenderMode ) + { + case VCL_BASED: + case NWF_TOOLBAR_ITEM: + break; + + case NWF_TABBAR_ITEM: + { + ControlState nState( 0 ); + if ( m_rTargetWindow.IsEnabled() ) + nState |= CTRL_STATE_ENABLED; + if ( m_rTargetWindow.HasChildPathFocus() ) + nState |= CTRL_STATE_FOCUSED; + + bNativeOK = m_rTargetWindow.IsNativeControlSupported( CTRL_TAB_PANE, PART_ENTIRE_CONTROL ) + && m_rTargetWindow.DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, i_rArea, nState, + ImplControlValue(), rtl::OUString() ); + } + break; + } + + if ( !bNativeOK ) + m_rTargetWindow.DrawRect( i_rArea ); + } + //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) @@ -728,23 +769,6 @@ namespace svt i_rData.pLayout->DrawItem( rItem.pPanel, rItem.GetCurrentRect().TopLeft(), nItemFlags, rItem.bUseMinimal ); i_rData.rTabBar.SetUpdateMode( TRUE ); } - - //-------------------------------------------------------------------------------------------------------------- - static void lcl_drawItems( const PanelTabBar_Data& i_rData, const Rectangle& i_rTargetArea ) - { - size_t i=0; - for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); - item != i_rData.aItems.end(); - ++item, ++i - ) - { - const Rectangle& rItemRect( item->GetCurrentRect() ); - if ( rItemRect.IsOver( i_rTargetArea ) ) - { - lcl_drawItem( i_rData, i ); - } - } - } } //================================================================================================================== @@ -815,10 +839,21 @@ namespace svt lcl_ensureItemsCache( *m_pData ); // background - DrawRect( Rectangle( Point(), GetOutputSizePixel() ) ); + m_pData->pLayout->DrawBackground( Rectangle( Point(), GetOutputSizePixel() ) ); // items - lcl_drawItems( *m_pData, i_rRect ); + size_t i=0; + for ( ItemDescriptors::const_iterator item = m_pData->aItems.begin(); + item != m_pData->aItems.end(); + ++item, ++i + ) + { + const Rectangle& rItemRect( item->GetCurrentRect() ); + if ( rItemRect.IsOver( i_rRect ) ) + { + lcl_drawItem( *m_pData, i ); + } + } } //------------------------------------------------------------------------------------------------------------------ -- cgit From dae64ecf7507f1b8f8f021bc367f0ef69cac0b03 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Mar 2010 13:42:48 +0100 Subject: slidecopy: allow to toggle whether the tab bar items contain images and text, images only, or text only --- svtools/inc/svtools/toolpanel/tabitemcontent.hxx | 46 +++++ svtools/inc/svtools/toolpanel/tablayouter.hxx | 17 +- svtools/source/toolpanel/paneltabbar.cxx | 245 ++++++++++++++--------- svtools/source/toolpanel/paneltabbar.hxx | 7 +- svtools/source/toolpanel/tablayouter.cxx | 39 +++- svtools/source/toolpanel/toolpaneldeck.cxx | 2 +- svtools/workben/toolpanel/toolpaneltest.cxx | 135 ++++++++++--- 7 files changed, 358 insertions(+), 133 deletions(-) create mode 100644 svtools/inc/svtools/toolpanel/tabitemcontent.hxx diff --git a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx new file mode 100644 index 000000000000..295a644e7566 --- /dev/null +++ b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TABITEMCONTENT_HXX +#define TABITEMCONTENT_HXX + +//........................................................................ +namespace svt +{ +//........................................................................ + + enum TabItemContent + { + TABITEM_IMAGE_AND_TEXT, + TABITEM_IMAGE_ONLY, + TABITEM_TEXT_ONLY + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TABITEMCONTENT_HXX diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 522739fc76e0..0c1d850a487d 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -30,6 +30,7 @@ #include "svtools/toolpanel/decklayouter.hxx" #include "svtools/toolpanel/toolpanelcontainer.hxx" #include "svtools/toolpanel/tabalignment.hxx" +#include "svtools/toolpanel/tabitemcontent.hxx" #include "svtools/toolpanel/refbase.hxx" #include @@ -51,16 +52,26 @@ namespace svt { public: /** creates a new layouter - @param i_eAlignment - specifies the alignment of the panel selector @param i_rPanelDeck the panel deck which the layouter is responsible for. Provides access to the panels container, and can and should be used as parent for any other windows which the layouter needs to create. + @param i_eAlignment + specifies the alignment of the panel selector + @param TabItemContent + specifies the content to show on the tab items */ - TabDeckLayouter( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ); + TabDeckLayouter( + ToolPanelDeck& i_rPanelDeck, + const TabAlignment i_eAlignment, + const TabItemContent i_eItemContent + ); ~TabDeckLayouter(); + // attribute access + TabItemContent GetTabItemContent() const; + void SetTabItemContent( const TabItemContent& i_eItemContent ); + // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index faaf22c91efa..063210e0e0be 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -68,22 +68,36 @@ namespace svt //================================================================================================================== struct ItemDescriptor { - PToolPanel pPanel; - Rectangle aMinArea; - Rectangle aPrefArea; - bool bUseMinimal; + PToolPanel pPanel; + Rectangle aCompleteArea; + Rectangle aIconOnlyArea; + Rectangle aTextOnlyArea; + TabItemContent eContent; + // content to be used for this particular item. Might differ from item content which has been set + // up for the complete control, in case not the complete content fits into the available space. ItemDescriptor() :pPanel() - ,aMinArea() - ,aPrefArea() - ,bUseMinimal( false ) + ,aCompleteArea() + ,aIconOnlyArea() + ,aTextOnlyArea() + ,eContent( TABITEM_IMAGE_AND_TEXT ) { } + const Rectangle& GetRect( const TabItemContent i_eItemContent ) const + { + return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT ) + ? aCompleteArea + : ( ( i_eItemContent == TABITEM_TEXT_ONLY ) + ? aTextOnlyArea + : aIconOnlyArea + ); + } + const Rectangle& GetCurrentRect() const { - return bUseMinimal ? aMinArea : aPrefArea; + return GetRect( eContent ); } }; @@ -105,8 +119,8 @@ namespace svt /** calculates the size of the area occupied by the item representing the given tool panel @param i_pPanel denotes the panel whose item's size should be calculated - @param i_bMinimum - if and only if the minimal version of the item should be rendered + @param i_eItemContent + defines which content to draw on the tab item @param o_rBoundingSize contains, upon return, the overall size needed to render the item, including possible decorations which are not available for the item content @@ -118,7 +132,7 @@ namespace svt */ virtual void CalculateItemSize( const PToolPanel& i_pPanel, - const bool i_bMinimum, + const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const = 0; @@ -139,16 +153,11 @@ namespace svt as "bounding size" in CalculateItemSize might be used. @param i_nItemFlags defines in which state to draw the item - @param i_bDrawMinimal - defines whether the minimal version of the item should be drawn + @param i_eItemContent + defines which content to draw on the tab item */ virtual void DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, - const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) = 0; - - /** updates the given items to use their minimal or optimal size, so they fit (if possible) into the given - area. - */ - virtual void FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ) = 0; + const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) = 0; }; typedef ::boost::shared_ptr< IItemsLayout > PItemsLayout; @@ -164,7 +173,7 @@ namespace svt // IItemsLayout overridables virtual void CalculateItemSize( const PToolPanel& i_pPanel, - const bool i_bMinimum, + const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const; @@ -174,9 +183,8 @@ namespace svt const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, - const bool i_bDrawMinimal + const TabItemContent i_eItemContent ); - virtual void FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ); private: void impl_preRender( @@ -187,7 +195,7 @@ namespace svt void impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, - const bool i_bMinimal + const TabItemContent i_eItemContent ); void impl_postRender( const Rectangle& i_rBoundingArea, @@ -202,8 +210,8 @@ namespace svt impl_rotateFormation( Rectangle& io_rBoundingRect, Rectangle& io_rContentRect, const bool i_bLeft ); private: - Window& m_rTargetWindow; - const bool m_bLeft; + Window& m_rTargetWindow; + const bool m_bLeft; enum ItemRenderMode { @@ -269,22 +277,24 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const bool i_bMinimum, + void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const { const Image aImage( i_pPanel->GetImage() ); + const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); - // for the moment, we display the icons only Size aItemContentSize; - if ( !!aImage ) + if ( bUseImage ) { aItemContentSize = aImage.GetSizePixel(); } - if ( !i_bMinimum && sItemText.getLength() ) + if ( bUseText ) { - if ( !!aImage ) + if ( bUseImage ) aItemContentSize.Height() += ITEM_ICON_TEXT_DISTANCE; // add space for vertical text @@ -439,25 +449,32 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const bool i_bDrawMinimal ) + void VerticalItemLayout::impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) { Point aDrawPos( i_rContentArea.TopLeft() ); aDrawPos.Y() += ITEM_OUTER_SPACE; // draw the image const Image aItemImage( i_pPanel->GetImage() ); - if ( !!aItemImage ) + const Size aImageSize( aItemImage.GetSizePixel() ); + const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); + + if ( bUseImage ) { - const Size aImageSize( aItemImage.GetSizePixel() ); m_rTargetWindow.DrawImage( Point( aDrawPos.X() + ( i_rContentArea.GetWidth() - aImageSize.Width() ) / 2, aDrawPos.Y() ), aItemImage ); - aDrawPos.Y() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; } - if ( !i_bDrawMinimal ) + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); + + if ( bUseText ) { + if ( bUseImage ) + aDrawPos.Y() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; + aDrawPos.Y() += ITEM_TEXT_FLOW_SPACE; // draw the text @@ -468,7 +485,6 @@ namespace svt aFont.SetVertical( TRUE ); m_rTargetWindow.SetFont( aFont ); - const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); Point aTextPos( aDrawPos ); @@ -543,39 +559,20 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, - const ItemFlags i_nItemFlags, const bool i_bDrawMinimal ) + const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) { Rectangle aContentArea; Size aBoundingSize; - CalculateItemSize( i_pPanel, i_bDrawMinimal, aBoundingSize, aContentArea ); + CalculateItemSize( i_pPanel, i_eItemContent, aBoundingSize, aContentArea ); aContentArea.Move( i_rPosition.X(), i_rPosition.Y() ); const Rectangle aBoundingArea( i_rPosition, aBoundingSize ); impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); - impl_renderContent( i_pPanel, aContentArea, i_bDrawMinimal ); + impl_renderContent( i_pPanel, aContentArea, i_eItemContent ); impl_postRender( aBoundingArea, aContentArea, i_nItemFlags ); } - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::FitItemRects( ItemDescriptors& i_rItems, const Rectangle& i_rFitInto ) - { - if ( i_rItems.empty() ) - // nothing to do - return; - - // use the minimal sizes if and only if the preferred sizes do not fit - const Point aBottomRight( i_rItems.rbegin()->aPrefArea.BottomRight() ); - bool bUseMinimal = ( aBottomRight.Y() >= i_rFitInto.Bottom() ); - for ( ItemDescriptors::iterator item = i_rItems.begin(); - item != i_rItems.end(); - ++item - ) - { - item->bUseMinimal = bUseMinimal; - } - } - //================================================================================================================== //= PanelTabBar_Data //================================================================================================================== @@ -583,9 +580,11 @@ namespace svt ,public IToolPanelDeckListener { public: - PanelTabBar_Data( PanelTabBar& i_rTabBar, const TabAlignment i_eAlignment ) + PanelTabBar_Data( PanelTabBar& i_rTabBar, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :rTabBar( i_rTabBar ) ,rPanelDeck( dynamic_cast< ToolPanelDeck& >( *i_rTabBar.GetParent() ) ) + ,eAlignment( i_eAlignment ) + ,eTabItemContent( i_eItemContent ) ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) ,aHoveredItem() ,aFocusedItem() @@ -621,7 +620,9 @@ namespace svt public: PanelTabBar& rTabBar; ToolPanelDeck& rPanelDeck; - const PItemsLayout pLayout; + const TabAlignment eAlignment; + TabItemContent eTabItemContent; + PItemsLayout pLayout; ::boost::optional< size_t > aHoveredItem; ::boost::optional< size_t > aFocusedItem; bool bMouseButtonDown; @@ -674,8 +675,9 @@ namespace svt { io_rData.aItems.resize(0); - Point aMinItemPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); - Point aPrefItemPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + Point aCompletePos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + Point aIconOnlyPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + Point aTextOnlyPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); for ( size_t i = 0; i < io_rData.rPanelDeck.GetPanels()->GetPanelCount(); @@ -689,21 +691,26 @@ namespace svt Rectangle aContentArea; - Size aMinItemSize; - io_rData.pLayout->CalculateItemSize( pPanel, true, aMinItemSize, aContentArea ); + Size aCompleteSize; + io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_AND_TEXT, aCompleteSize, aContentArea ); - Size aPrefItemSize; - io_rData.pLayout->CalculateItemSize( pPanel, false, aPrefItemSize, aContentArea ); + Size aIconOnlySize; + io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_ONLY, aIconOnlySize, aContentArea ); - // TODO: have one method calculating both sizes? + Size aTextOnlySize; + io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_TEXT_ONLY, aTextOnlySize, aContentArea ); - aItem.aMinArea = Rectangle( aMinItemPos, aMinItemSize ); - aItem.aPrefArea = Rectangle( aPrefItemPos, aPrefItemSize ); + // TODO: have one method calculating all sizes? + + aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); + aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); + aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); io_rData.aItems.push_back( aItem ); - aMinItemPos = io_rData.pLayout->GetNextItemPosition( aItem.aMinArea ); - aPrefItemPos = io_rData.pLayout->GetNextItemPosition( aItem.aPrefArea ); + aCompletePos = io_rData.pLayout->GetNextItemPosition( aItem.aCompleteArea ); + aIconOnlyPos = io_rData.pLayout->GetNextItemPosition( aItem.aIconOnlyArea ); + aTextOnlyPos = io_rData.pLayout->GetNextItemPosition( aItem.aTextOnlyArea ); } io_rData.bItemsDirty = false; @@ -766,9 +773,63 @@ namespace svt nItemFlags |= ITEM_POSITION_LAST; i_rData.rTabBar.SetUpdateMode( FALSE ); - i_rData.pLayout->DrawItem( rItem.pPanel, rItem.GetCurrentRect().TopLeft(), nItemFlags, rItem.bUseMinimal ); + i_rData.pLayout->DrawItem( rItem.pPanel, rItem.GetCurrentRect().TopLeft(), nItemFlags, rItem.eContent ); i_rData.rTabBar.SetUpdateMode( TRUE ); } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_fitItems( PanelTabBar_Data& io_rData ) + { + if ( io_rData.aItems.empty() ) + // nothing to do + return; + + // the available size + Size aOutputSize( io_rData.rTabBar.GetOutputSizePixel() ); + // shrunk by the outer space + aOutputSize.Width() -= TAB_BAR_OUTER_SPACE; + aOutputSize.Height() -= TAB_BAR_OUTER_SPACE; + const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); + + // the "content modes" to try + TabItemContent eTryThis[] = + { + TABITEM_IMAGE_ONLY, // assumed to have the smalles rects + TABITEM_TEXT_ONLY, + TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects + }; + + // do not start with the largest, but with the one currently set up for the TabBar + size_t nTryIndex = 0; + while ( ( nTryIndex < ( sizeof( eTryThis ) / sizeof( eTryThis[0] ) ) ) + && ( eTryThis[nTryIndex] != io_rData.eTabItemContent ) + ) + { + ++nTryIndex; + } + + // determine which of the different version fits + TabItemContent eContent = eTryThis[0]; + while ( nTryIndex > 0 ) + { + const Point aBottomRight( io_rData.aItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); + if ( aFitInto.IsInside( aBottomRight ) ) + { + eContent = eTryThis[ nTryIndex ]; + break; + } + --nTryIndex; + } + + // propagate to the items + for ( ItemDescriptors::iterator item = io_rData.aItems.begin(); + item != io_rData.aItems.end(); + ++item + ) + { + item->eContent = eContent; + } + } } //================================================================================================================== @@ -787,9 +848,9 @@ namespace svt //= PanelTabBar //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment ) + PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :Control( &i_rPanelDeck, 0 ) - ,m_pData( new PanelTabBar_Data( *this, i_eAlignment ) ) + ,m_pData( new PanelTabBar_Data( *this, i_eAlignment, i_eItemContent ) ) { DBG_CHECK( *m_pData ); @@ -802,6 +863,20 @@ namespace svt { } + //------------------------------------------------------------------------------------------------------------------ + TabItemContent PanelTabBar::GetTabItemContent() const + { + return m_pData->eTabItemContent; + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent ) + { + m_pData->eTabItemContent = i_eItemContent; + lcl_fitItems( *m_pData ); + Invalidate(); + } + //------------------------------------------------------------------------------------------------------------------ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { @@ -810,27 +885,18 @@ namespace svt if ( m_pData->aItems.empty() ) return Size( 2 * TAB_BAR_OUTER_SPACE, 2 * TAB_BAR_OUTER_SPACE ); - const bool nMinimalSize = ( i_eType == WINDOWSIZE_MINIMUM ); + const bool bMinimalSize = ( i_eType == WINDOWSIZE_MINIMUM ); // the rect of the last item - const Rectangle& rLastItemRect( nMinimalSize ? m_pData->aItems.rbegin()->aMinArea : m_pData->aItems.rbegin()->aPrefArea ); + const Rectangle& rLastItemRect( bMinimalSize ? m_pData->aItems.rbegin()->aIconOnlyArea : m_pData->aItems.rbegin()->aCompleteArea ); const Point aBottomRight( rLastItemRect.BottomRight() ); - return Size( aBottomRight.X() + TAB_BAR_OUTER_SPACE, aBottomRight.Y() + TAB_BAR_OUTER_SPACE ); + return Size( aBottomRight.X() + 1 + TAB_BAR_OUTER_SPACE, aBottomRight.Y() + 1 + TAB_BAR_OUTER_SPACE ); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::Resize() { Control::Resize(); - - // decide whether we should use the minimal or the prefered version of the items - - // the available size - Size aOutputSize( GetOutputSizePixel() ); - // shrunk by the outer space - aOutputSize.Width() -= TAB_BAR_OUTER_SPACE; - aOutputSize.Height() -= TAB_BAR_OUTER_SPACE; - // let the layouter decide - m_pData->pLayout->FitItemRects( m_pData->aItems, Rectangle( Point(), aOutputSize ) ); + lcl_fitItems( *m_pData ); } //------------------------------------------------------------------------------------------------------------------ @@ -936,9 +1002,8 @@ namespace svt return; const ItemDescriptor& rItem( m_pData->aItems[ *aHelpItem ] ); - if ( !rItem.bUseMinimal ) - // if we do not use the minimal representation of the item, then the text is completely drawn - no - // need to show it as tooltip, too + if ( rItem.eContent != TABITEM_IMAGE_ONLY ) + // if the text is displayed for the item, we do not need to show it as tooltip return; const ::rtl::OUString sItemText( rItem.pPanel->GetDisplayName() ); diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index f53f68cbf5ee..7a272205f382 100644 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -28,6 +28,7 @@ #include "svtools/toolpanel/toolpanelcontainer.hxx" #include "svtools/toolpanel/tabalignment.hxx" +#include "svtools/toolpanel/tabitemcontent.hxx" #include @@ -52,9 +53,13 @@ namespace svt class PanelTabBar : public Control { public: - PanelTabBar( ToolPanelDeck& i_rParent, const TabAlignment i_eAlignment ); + PanelTabBar( ToolPanelDeck& i_rParent, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); ~PanelTabBar(); + // attribute access + TabItemContent GetTabItemContent() const; + void SetTabItemContent( const TabItemContent& i_eItemContent ); + // Window overridables virtual Size GetOptimalSize( WindowSizeType i_eType ) const; virtual void Paint( const Rectangle& i_rRect ); diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 10405c0b75aa..e3213bd75267 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -47,10 +47,10 @@ namespace svt ::std::auto_ptr< PanelTabBar > pTabBar; - TabDeckLayouter_Data( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ) + TabDeckLayouter_Data( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :eAlignment( i_eAlignment ) ,pPanels( i_rPanelDeck.GetPanels() ) - ,pTabBar( new PanelTabBar( i_rPanelDeck, i_eAlignment ) ) + ,pTabBar( new PanelTabBar( i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { pTabBar->Show(); } @@ -66,14 +66,24 @@ namespace svt return ( i_eAlignment == TABS_RIGHT ) || ( i_eAlignment == TABS_LEFT ); } + + static bool lcl_checkDisposed( const TabDeckLayouter_Data& i_rData ) + { + if ( !i_rData.pTabBar.get() ) + { + OSL_ENSURE( false, "lcl_checkDisposed: already disposed!" ); + return true; + } + return false; + } } //==================================================================== //= TabDeckLayouter //==================================================================== //-------------------------------------------------------------------- - TabDeckLayouter::TabDeckLayouter( const TabAlignment i_eAlignment, ToolPanelDeck& i_rPanelDeck ) - :m_pData( new TabDeckLayouter_Data( i_eAlignment, i_rPanelDeck ) ) + TabDeckLayouter::TabDeckLayouter( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :m_pData( new TabDeckLayouter_Data( i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { } @@ -85,14 +95,27 @@ namespace svt //-------------------------------------------------------------------- IMPLEMENT_IREFERENCE( TabDeckLayouter ) + //-------------------------------------------------------------------- + TabItemContent TabDeckLayouter::GetTabItemContent() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return TABITEM_IMAGE_AND_TEXT; + return m_pData->pTabBar->GetTabItemContent(); + } + + //-------------------------------------------------------------------- + void TabDeckLayouter::SetTabItemContent( const TabItemContent& i_eItemContent ) + { + if ( lcl_checkDisposed( *m_pData ) ) + return; + m_pData->pTabBar->SetTabItemContent( i_eItemContent ); + } + //-------------------------------------------------------------------- Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) { - if ( !m_pData->pTabBar.get() ) - { - OSL_ENSURE( false, "TabDeckLayouter::Layout: disposed!" ); + if ( lcl_checkDisposed( *m_pData ) ) return i_rDeckPlayground; - } if ( lcl_isVerticalTabBar( m_pData->eAlignment ) ) { diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index f6ae7993b8ec..b6dcc0598bb8 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -279,7 +279,7 @@ namespace svt ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) { // use a default layouter - SetLayouter( PDeckLayouter( new TabDeckLayouter( TABS_RIGHT, *this ) ) ); + SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index e09e6e362e59..51f3001e761a 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -223,11 +224,16 @@ public: virtual void GetFocus(); private: - DECL_LINK( OnAlignmentChanged, void* ); + DECL_LINK( OnRadioToggled, RadioButton* ); private: + FixedLine m_aAlignmentHeader; RadioButton m_aAlignLeft; RadioButton m_aAlignRight; + FixedLine m_aTabItemContent; + RadioButton m_aImagesAndText; + RadioButton m_aImagesOnly; + RadioButton m_aTextOnly; }; //============================================================================= @@ -245,6 +251,7 @@ public: public: // operations void AlignTabs( const ::svt::TabAlignment i_eAlignment ); + void SetTabItemContent( const TabItemContent i_eItemContent ); protected: virtual void GetFocus(); @@ -260,30 +267,38 @@ private: //----------------------------------------------------------------------------- OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) :Window( &i_rParent, WB_BORDER | WB_DIALOGCONTROL ) + ,m_aAlignmentHeader( this ) ,m_aAlignLeft( this, WB_GROUP ) ,m_aAlignRight( this, 0 ) + ,m_aTabItemContent( this ) + ,m_aImagesAndText( this ) + ,m_aImagesOnly( this ) + ,m_aTextOnly( this ) { SetBorderStyle( WINDOW_BORDER_MONO ); const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); SetBackground( aFaceColor ); - RadioButton* pRadios[] = + Window* pControls[] = { - &m_aAlignLeft, &m_aAlignRight + &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, &m_aTextOnly }; const sal_Char* pTexts[] = { - "Left", "Right" + "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only" }; - for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) + for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i ) { - pRadios[i]->SetText( String::CreateFromAscii( pTexts[i] ) ); - pRadios[i]->SetControlBackground( aFaceColor ); - pRadios[i]->Show(); - pRadios[i]->SetToggleHdl( LINK( this, OptionsWindow, OnAlignmentChanged ) ); + pControls[i]->SetText( String::CreateFromAscii( pTexts[i] ) ); + pControls[i]->SetControlBackground( aFaceColor ); + pControls[i]->Show(); + + if ( pControls[i]->GetType() == WINDOW_RADIOBUTTON ) + static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) ); } m_aAlignRight.Check(); + m_aImagesAndText.Check(); Show(); } @@ -311,37 +326,79 @@ void OptionsWindow::Resize() { Window::Resize(); - const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); const Size aOutputSize( GetOutputSizePixel() ); - const Size aRadioSize( - aOutputSize.Width() - 2 * aSpacing.Width(), - LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() - ); + const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); + const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() ); + const long nLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() ); - Point aRadioPos( aSpacing.Width(), aSpacing.Height() ); - RadioButton* pRadios[] = + const Size aSuperordinateSize( aOutputSize.Width() - 2 * aSpacing.Width(), nLineHeight ); + const long nSuperordinateX = aSpacing.Width(); + + const Size aSubordinateSize( aOutputSize.Width() - 2 * aSpacing.Width() - nIndent, nLineHeight ); + const long nSubordinateX = aSpacing.Width() + nIndent; + + Point aItemPos( nSuperordinateX, aSpacing.Height() ); + + struct ControlRow { - &m_aAlignLeft, &m_aAlignRight + Window* pWindow; + bool bSubordinate; + ControlRow( Window& i_rWindow, const bool i_bSubordinate ) : pWindow( &i_rWindow ), bSubordinate( i_bSubordinate ) { } }; - for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) + ControlRow aControlRows[] = + { + ControlRow( m_aAlignmentHeader, false ), + ControlRow( m_aAlignLeft, true ), + ControlRow( m_aAlignRight, true ), + ControlRow( m_aTabItemContent, false ), + ControlRow( m_aImagesAndText, true ), + ControlRow( m_aImagesOnly, true ), + ControlRow( m_aTextOnly, true ) + }; + bool bPreviousWasSubordinate = false; + for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i ) { - pRadios[i]->SetPosSizePixel( aRadioPos, aRadioSize ); - aRadioPos.Move( 0, aRadioSize.Height() + aSpacing.Height() ); + aItemPos.X() = ( aControlRows[i].bSubordinate ) ? nSubordinateX : nSuperordinateX; + + if ( bPreviousWasSubordinate && !aControlRows[i].bSubordinate ) + aItemPos.Y() += aSpacing.Height(); + bPreviousWasSubordinate = aControlRows[i].bSubordinate; + + const Size& rControlSize = ( aControlRows[i].bSubordinate ) ? aSubordinateSize : aSuperordinateSize; + aControlRows[i].pWindow->SetPosSizePixel( aItemPos, rControlSize ); + + aItemPos.Move( 0, rControlSize.Height() + aSpacing.Height() ); } } //----------------------------------------------------------------------------- -IMPL_LINK( OptionsWindow, OnAlignmentChanged, void*, /**/ ) +IMPL_LINK( OptionsWindow, OnRadioToggled, RadioButton*, i_pRadioButton ) { PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) ); - if ( m_aAlignLeft.IsChecked() ) - { - rController.AlignTabs( TABS_LEFT ); - } - else if ( m_aAlignRight.IsChecked() ) + + if ( i_pRadioButton->IsChecked() ) { - rController.AlignTabs( TABS_RIGHT ); + if ( i_pRadioButton == &m_aAlignLeft ) + { + rController.AlignTabs( TABS_LEFT ); + } + else if ( i_pRadioButton == &m_aAlignRight ) + { + rController.AlignTabs( TABS_RIGHT ); + } + else if ( i_pRadioButton == &m_aImagesAndText ) + { + rController.SetTabItemContent( TABITEM_IMAGE_AND_TEXT ); + } + else if ( i_pRadioButton == &m_aImagesOnly ) + { + rController.SetTabItemContent( TABITEM_IMAGE_ONLY ); + } + else if ( i_pRadioButton == &m_aTextOnly ) + { + rController.SetTabItemContent( TABITEM_TEXT_ONLY ); + } } return 0L; } @@ -397,20 +454,38 @@ void PanelDemoMainWindow::Resize() { WorkWindow::Resize(); Size aSize( GetOutputSizePixel() ); - aSize.Width() -= 140; + aSize.Width() -= 190; aSize.Height() -= 40; m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize ); m_aDemoOptions.SetPosSizePixel( Point( 20 + aSize.Width(), 20 ), - Size( 100, aSize.Height() ) + Size( 150, aSize.Height() ) ); } //----------------------------------------------------------------------------- void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment ) { - m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( i_eAlignment, m_aToolPanelDeck ) ) ); + TabItemContent eCurrentItemContent( TABITEM_IMAGE_AND_TEXT ); + TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() ); + OSL_ENSURE( pLayouter, "PanelDemoMainWindow::AlignTabs: wrong layouter!" ); + if ( pLayouter ) + eCurrentItemContent = pLayouter->GetTabItemContent(); + + m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) ); +} + +//----------------------------------------------------------------------------- +void PanelDemoMainWindow::SetTabItemContent( const TabItemContent i_eItemContent ) +{ + TabDeckLayouter* pLayouter = dynamic_cast< TabDeckLayouter* >( m_aToolPanelDeck.GetLayouter().get() ); + OSL_ENSURE( pLayouter, "PanelDemoMainWindow::SetTabItemContent: wrong layouter!" ); + // we currently use tab layouters only ... + if ( !pLayouter ) + return; + + pLayouter->SetTabItemContent( i_eItemContent ); } //============================================================================= -- cgit From 031fdf9504458c7d243888d73a48914caef186a3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Mar 2010 14:30:01 +0100 Subject: slidecopy: TAB_BAR_OUTER_SPACE replaced with alignment dependent, non-uniform values --- svtools/source/toolpanel/paneltabbar.cxx | 38 ++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 063210e0e0be..b216b43161bd 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -46,8 +46,6 @@ #define ITEM_DISTANCE_PIXEL 0 // space between item icon and icon text #define ITEM_ICON_TEXT_DISTANCE 4 -// outer space (aka margin) of the complete tab bar control -#define TAB_BAR_OUTER_SPACE 1 //........................................................................ namespace svt @@ -597,6 +595,17 @@ namespace svt rPanelDeck.AddListener( *this ); rPanelDeck.GetPanels()->AddListener( *this ); + + if ( i_eAlignment == TABS_LEFT ) + { + aTopLeftSpace = Size( 2, 2 ); + aBottomRightSpace = Size( 1, 1 ); + } + else if ( i_eAlignment == TABS_RIGHT ) + { + aTopLeftSpace = Size( 1, 1 ); + aBottomRightSpace = Size( 2, 2 ); + } } ~PanelTabBar_Data() @@ -620,15 +629,20 @@ namespace svt public: PanelTabBar& rTabBar; ToolPanelDeck& rPanelDeck; + const TabAlignment eAlignment; TabItemContent eTabItemContent; PItemsLayout pLayout; + ::boost::optional< size_t > aHoveredItem; ::boost::optional< size_t > aFocusedItem; bool bMouseButtonDown; ItemDescriptors aItems; bool bItemsDirty; + + Size aTopLeftSpace; + Size aBottomRightSpace; }; //================================================================================================================== @@ -675,9 +689,9 @@ namespace svt { io_rData.aItems.resize(0); - Point aCompletePos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); - Point aIconOnlyPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); - Point aTextOnlyPos( TAB_BAR_OUTER_SPACE, TAB_BAR_OUTER_SPACE ); + Point aCompletePos( io_rData.aTopLeftSpace.Width(), io_rData.aTopLeftSpace.Height() ); + Point aIconOnlyPos( aCompletePos ); + Point aTextOnlyPos( aCompletePos ); for ( size_t i = 0; i < io_rData.rPanelDeck.GetPanels()->GetPanelCount(); @@ -787,8 +801,8 @@ namespace svt // the available size Size aOutputSize( io_rData.rTabBar.GetOutputSizePixel() ); // shrunk by the outer space - aOutputSize.Width() -= TAB_BAR_OUTER_SPACE; - aOutputSize.Height() -= TAB_BAR_OUTER_SPACE; + aOutputSize.Width() -= io_rData.aBottomRightSpace.Width(); + aOutputSize.Height() -= io_rData.aBottomRightSpace.Height(); const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); // the "content modes" to try @@ -883,13 +897,19 @@ namespace svt lcl_ensureItemsCache( *m_pData ); if ( m_pData->aItems.empty() ) - return Size( 2 * TAB_BAR_OUTER_SPACE, 2 * TAB_BAR_OUTER_SPACE ); + return Size( + m_pData->aTopLeftSpace.Width() + m_pData->aBottomRightSpace.Width(), + m_pData->aTopLeftSpace.Height() + m_pData->aBottomRightSpace.Height() + ); const bool bMinimalSize = ( i_eType == WINDOWSIZE_MINIMUM ); // the rect of the last item const Rectangle& rLastItemRect( bMinimalSize ? m_pData->aItems.rbegin()->aIconOnlyArea : m_pData->aItems.rbegin()->aCompleteArea ); const Point aBottomRight( rLastItemRect.BottomRight() ); - return Size( aBottomRight.X() + 1 + TAB_BAR_OUTER_SPACE, aBottomRight.Y() + 1 + TAB_BAR_OUTER_SPACE ); + return Size( + aBottomRight.X() + 1 + m_pData->aBottomRightSpace.Width(), + aBottomRight.Y() + 1 + m_pData->aBottomRightSpace.Height() + ); } //------------------------------------------------------------------------------------------------------------------ -- cgit From c485afb88869cccc146de9e548182c9fb293eda1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 10:57:16 +0100 Subject: slidecopy: made the tab bar control independent from the concret PanelDeckImplementation In this course, IToolPanelDeck has been introduced, merging the previous IToolPanelContainer functionality with administration of the active panel. --- svtools/inc/svtools/toolpanel/tablayouter.hxx | 1 - .../inc/svtools/toolpanel/toolpanelcontainer.hxx | 85 ---------- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 75 +++++++-- svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/paneldecklisteners.cxx | 110 +++++++++++++ svtools/source/toolpanel/paneldecklisteners.hxx | 70 ++++++++ svtools/source/toolpanel/paneltabbar.cxx | 57 ++++--- svtools/source/toolpanel/paneltabbar.hxx | 4 +- svtools/source/toolpanel/tablayouter.cxx | 6 +- svtools/source/toolpanel/toolpanelcollection.cxx | 65 +++++--- svtools/source/toolpanel/toolpanelcollection.hxx | 20 +-- svtools/source/toolpanel/toolpaneldeck.cxx | 182 ++++++++++++--------- svtools/workben/toolpanel/toolpaneltest.cxx | 7 +- 13 files changed, 436 insertions(+), 247 deletions(-) delete mode 100644 svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx create mode 100644 svtools/source/toolpanel/paneldecklisteners.cxx create mode 100644 svtools/source/toolpanel/paneldecklisteners.hxx diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 0c1d850a487d..4a09fd565ca3 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -28,7 +28,6 @@ #define TABLAYOUTER_HXX #include "svtools/toolpanel/decklayouter.hxx" -#include "svtools/toolpanel/toolpanelcontainer.hxx" #include "svtools/toolpanel/tabalignment.hxx" #include "svtools/toolpanel/tabitemcontent.hxx" #include "svtools/toolpanel/refbase.hxx" diff --git a/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx b/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx deleted file mode 100644 index c57e80e614d7..000000000000 --- a/svtools/inc/svtools/toolpanel/toolpanelcontainer.hxx +++ /dev/null @@ -1,85 +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 TOOLPANELCONTAINER_HXX -#define TOOLPANELCONTAINER_HXX - -#include "svtools/toolpanel/toolpanel.hxx" - -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - //==================================================================== - //= IToolPanelContainerListener - //==================================================================== - class SAL_NO_VTABLE IToolPanelContainerListener - { - public: - virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; - }; - - //==================================================================== - //= IToolPanelContainer - //==================================================================== - class IToolPanelContainer : public ::rtl::IReference - { - public: - /** returns the number of panels in the container - */ - virtual size_t GetPanelCount() const = 0; - - /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the - non-product version, and silently ignored in the product version, with a NULL panel being returned. - */ - virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0; - - /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the - current panel count. Violations of this will be reported via an assertion in the non-product version, and - silently ignored in the product version. - */ - virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; - - /** adds a new listener to be notified when the container content changes. The caller is responsible - for life time control, i.e. removing the listener before it actually dies. - */ - virtual void AddListener( IToolPanelContainerListener& i_rListener ) = 0; - - /** removes a container listener previously added via addListener. - */ - virtual void RemoveListener( IToolPanelContainerListener& i_rListener ) = 0; - }; - - typedef ::rtl::Reference< IToolPanelContainer > PToolPanelContainer; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // TOOLPANELCONTAINER_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 573248235957..7119941914b2 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -27,8 +27,8 @@ #ifndef TOOLPANELDECK_HXX #define TOOLPANELDECK_HXX +#include "svtools/toolpanel/toolpanel.hxx" #include "svtools/toolpanel/decklayouter.hxx" -#include "svtools/toolpanel/toolpanelcontainer.hxx" #include @@ -49,13 +49,67 @@ namespace svt class SAL_NO_VTABLE IToolPanelDeckListener { public: + /** called when a panel has been inserted into the deck + */ + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + + /** called when the active panel of the deck changed + */ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) = 0; + + /** called when the tool panel deck which the listener registered at is dying. The listener is required to + release all references to the deck then. + */ + virtual void Dying() = 0; + }; + + //==================================================================== + //= IToolPanelDeck + //==================================================================== + class SAL_NO_VTABLE IToolPanelDeck + { + public: + /** returns the number of panels in the container + */ + virtual size_t GetPanelCount() const = 0; + + /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the + non-product version, and silently ignored in the product version, with a NULL panel being returned. + */ + virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0; + + /** returns the number of the currently active panel. If the deck does not currently contain any panel, + the behavior is undefined. + */ + virtual ::boost::optional< size_t > + GetActivePanel() const; + + /** activates the panel with the given number. If the given number is larger or equal to the number of panels + in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored. + */ + virtual void ActivatePanel( const size_t i_nPanel ) = 0; + + /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the + current panel count. Violations of this will be reported via an assertion in the non-product version, and + silently ignored in the product version. + */ + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + + /** adds a new listener to be notified when the container content changes. The caller is responsible + for life time control, i.e. removing the listener before it actually dies. + */ + virtual void AddListener( IToolPanelDeckListener& i_rListener ) = 0; + + /** removes a container listener previously added via addListener. + */ + virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) = 0; }; //==================================================================== //= ToolPanelDeck //==================================================================== - class ToolPanelDeck : public Control + class ToolPanelDeck :public Control + ,public IToolPanelDeck { public: ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle ); @@ -65,14 +119,15 @@ namespace svt PDeckLayouter GetLayouter() const; void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - PToolPanelContainer GetPanels() const; - - size_t GetActivePanel() const; - void ActivatePanel( const size_t i_nPanel ); - - // listeners - void AddListener( IToolPanelDeckListener& i_rListener ); - void RemoveListener( IToolPanelDeckListener& i_rListener ); + // IToolPanelDeck + virtual size_t GetPanelCount() const; + virtual PToolPanel GetPanel( const size_t i_nPos ) const; + virtual ::boost::optional< size_t > + GetActivePanel() const; + virtual void ActivatePanel( const size_t i_nPanel ); + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void AddListener( IToolPanelDeckListener& i_rListener ); + virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); protected: // Window overridables diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 576db7c84ee5..42c12ab99ead 100644 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES=\ $(SLO)$/dummypanel.obj \ + $(SLO)$/paneldecklisteners.obj \ $(SLO)$/paneltabbar.obj \ $(SLO)$/refbase.obj \ $(SLO)$/tablayouter.obj \ diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx new file mode 100644 index 000000000000..766b3a63428d --- /dev/null +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "paneldecklisteners.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= PanelDeckListeners + //==================================================================== + //-------------------------------------------------------------------- + PanelDeckListeners::PanelDeckListeners() + { + } + + //-------------------------------------------------------------------- + PanelDeckListeners::~PanelDeckListeners() + { + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) + { + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); + loop != m_aListeners.end(); + ++loop + ) + { + (*loop)->PanelInserted( i_pPanel, i_nPosition ); + } + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + { + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); + loop != m_aListeners.end(); + ++loop + ) + { + (*loop)->ActivePanelChanged( i_rOldActive, i_nNewActive ); + } + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::Dying() + { + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); + loop != m_aListeners.end(); + ++loop + ) + { + (*loop)->Dying(); + } + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::AddListener( IToolPanelDeckListener& i_rListener ) + { + m_aListeners.push_back( &i_rListener ); + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::RemoveListener( IToolPanelDeckListener& i_rListener ) + { + for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin(); + lookup != m_aListeners.end(); + ++lookup + ) + { + if ( *lookup == &i_rListener ) + { + m_aListeners.erase( lookup ); + return; + } + } + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx new file mode 100644 index 000000000000..56445e892a65 --- /dev/null +++ b/svtools/source/toolpanel/paneldecklisteners.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef PANELDECKLISTENERS_HXX +#define PANELDECKLISTENERS_HXX + +#include "svtools/toolpanel/toolpanel.hxx" + +#include +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + class IToolPanelDeckListener; + + //==================================================================== + //= PanelDeckListeners + //==================================================================== + /** implements a container for IToolPanelDeckListeners + */ + class PanelDeckListeners + { + public: + PanelDeckListeners(); + ~PanelDeckListeners(); + + // IToolPanelDeckListener equivalents, forward the events to all registered listeners + void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); + void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + void Dying(); + + // listener maintainance + void AddListener( IToolPanelDeckListener& i_rListener ); + void RemoveListener( IToolPanelDeckListener& i_rListener ); + + private: + ::std::vector< IToolPanelDeckListener* > m_aListeners; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // PANELDECKLISTENERS_HXX diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index b216b43161bd..9566d89c0b7e 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -574,13 +574,12 @@ namespace svt //================================================================================================================== //= PanelTabBar_Data //================================================================================================================== - class PanelTabBar_Data :public IToolPanelContainerListener - ,public IToolPanelDeckListener + class PanelTabBar_Data : public IToolPanelDeckListener { public: - PanelTabBar_Data( PanelTabBar& i_rTabBar, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :rTabBar( i_rTabBar ) - ,rPanelDeck( dynamic_cast< ToolPanelDeck& >( *i_rTabBar.GetParent() ) ) + ,rPanelDeck( i_rPanelDeck ) ,eAlignment( i_eAlignment ) ,eTabItemContent( i_eItemContent ) ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) @@ -594,7 +593,6 @@ namespace svt "PanelTabBar_Data: unsupported alignment!" ); rPanelDeck.AddListener( *this ); - rPanelDeck.GetPanels()->AddListener( *this ); if ( i_eAlignment == TABS_LEFT ) { @@ -610,11 +608,10 @@ namespace svt ~PanelTabBar_Data() { - rPanelDeck.GetPanels()->RemoveListener( *this ); rPanelDeck.RemoveListener( *this ); } - // IToolPanelContainerListener + // IToolPanelDeckListener virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) { (void)i_pPanel; @@ -623,12 +620,12 @@ namespace svt rTabBar.Invalidate(); } - // IToolPanelDeckListener virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + virtual void Dying(); public: PanelTabBar& rTabBar; - ToolPanelDeck& rPanelDeck; + IToolPanelDeck& rPanelDeck; const TabAlignment eAlignment; TabItemContent eTabItemContent; @@ -654,21 +651,16 @@ namespace svt #if OSL_DEBUG_LEVEL > 0 static void lcl_checkConsistency( const PanelTabBar_Data& i_rData ) { - if ( !i_rData.rPanelDeck.GetPanels().get() ) - { - OSL_ENSURE( false, "lcl_checkConsistency: NULL panels?!" ); - return; - } if ( !i_rData.bItemsDirty ) { - if ( i_rData.rPanelDeck.GetPanels()->GetPanelCount() != i_rData.aItems.size() ) + if ( i_rData.rPanelDeck.GetPanelCount() != i_rData.aItems.size() ) { OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" ); return; } - for ( size_t i = 0; i < i_rData.rPanelDeck.GetPanels()->GetPanelCount(); ++i ) + for ( size_t i = 0; i < i_rData.rPanelDeck.GetPanelCount(); ++i ) { - if ( i_rData.rPanelDeck.GetPanels()->GetPanel( i ).get() != i_rData.aItems[i].pPanel.get() ) + if ( i_rData.rPanelDeck.GetPanel( i ).get() != i_rData.aItems[i].pPanel.get() ) { OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" ); return; @@ -694,11 +686,11 @@ namespace svt Point aTextOnlyPos( aCompletePos ); for ( size_t i = 0; - i < io_rData.rPanelDeck.GetPanels()->GetPanelCount(); + i < io_rData.rPanelDeck.GetPanelCount(); ++i ) { - PToolPanel pPanel( io_rData.rPanelDeck.GetPanels()->GetPanel( i ) ); + PToolPanel pPanel( io_rData.rPanelDeck.GetPanel( i ) ); ItemDescriptor aItem; aItem.pPanel = pPanel; @@ -783,7 +775,7 @@ namespace svt if ( 0 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_FIRST; - if ( i_rData.rPanelDeck.GetPanels()->GetPanelCount() - 1 == i_nItemIndex ) + if ( i_rData.rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_LAST; i_rData.rTabBar.SetUpdateMode( FALSE ); @@ -849,6 +841,7 @@ namespace svt //================================================================================================================== //= PanelTabBar_Data //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) { lcl_ensureItemsCache( *this ); @@ -858,13 +851,19 @@ namespace svt lcl_drawItem( *this, i_nNewActive ); } + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Data::Dying() + { + // TODO + } + //================================================================================================================== //= PanelTabBar //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - PanelTabBar::PanelTabBar( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :Control( &i_rPanelDeck, 0 ) - ,m_pData( new PanelTabBar_Data( *this, i_eAlignment, i_eItemContent ) ) + PanelTabBar::PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :Control( &i_rParentWindow, 0 ) + ,m_pData( new PanelTabBar_Data( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { DBG_CHECK( *m_pData ); @@ -1037,10 +1036,14 @@ namespace svt void PanelTabBar::GetFocus() { Control::GetFocus(); - if ( m_pData->rPanelDeck.GetPanels()->GetPanelCount() ) + if ( m_pData->rPanelDeck.GetPanelCount() ) { - m_pData->aFocusedItem.reset( m_pData->rPanelDeck.GetActivePanel() ); - lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + ::boost::optional< size_t > aActivePanel( m_pData->rPanelDeck.GetActivePanel() ); + if ( !!aActivePanel ) + { + m_pData->aFocusedItem = aActivePanel; + lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + } } } @@ -1066,7 +1069,7 @@ namespace svt return; // if there are less than 2 panels, we cannot travel them ... - const size_t nPanelCount( m_pData->rPanelDeck.GetPanels()->GetPanelCount() ); + const size_t nPanelCount( m_pData->rPanelDeck.GetPanelCount() ); if ( nPanelCount < 2 ) return; diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index 7a272205f382..b01f75785c0f 100644 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -26,7 +26,6 @@ #ifndef PANELTABBAR_HXX #define PANELTABBAR_HXX -#include "svtools/toolpanel/toolpanelcontainer.hxx" #include "svtools/toolpanel/tabalignment.hxx" #include "svtools/toolpanel/tabitemcontent.hxx" @@ -39,7 +38,6 @@ namespace svt { //........................................................................ - class ToolPanelDeck; class PanelTabBar_Data; //==================================================================== @@ -53,7 +51,7 @@ namespace svt class PanelTabBar : public Control { public: - PanelTabBar( ToolPanelDeck& i_rParent, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); + PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); ~PanelTabBar(); // attribute access diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index e3213bd75267..755b58979fe2 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -43,14 +43,14 @@ namespace svt struct TabDeckLayouter_Data { TabAlignment eAlignment; - PToolPanelContainer pPanels; + IToolPanelDeck& rPanels; ::std::auto_ptr< PanelTabBar > pTabBar; TabDeckLayouter_Data( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :eAlignment( i_eAlignment ) - ,pPanels( i_rPanelDeck.GetPanels() ) - ,pTabBar( new PanelTabBar( i_rPanelDeck, i_eAlignment, i_eItemContent ) ) + ,rPanels( i_rPanelDeck ) + ,pTabBar( new PanelTabBar( i_rPanelDeck, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { pTabBar->Show(); } diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index b0a2571fc71e..35742f66016c 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -27,6 +27,7 @@ #include "precompiled_svtools.hxx" #include "toolpanelcollection.hxx" +#include "paneldecklisteners.hxx" #include @@ -42,8 +43,9 @@ namespace svt //==================================================================== struct ToolPanelCollection_Data { - ::std::vector< PToolPanel > aPanels; - ::std::vector< IToolPanelContainerListener* > aListeners; + ::std::vector< PToolPanel > aPanels; + ::boost::optional< size_t > aActivePanel; + PanelDeckListeners aListeners; }; //==================================================================== @@ -58,17 +60,38 @@ namespace svt //-------------------------------------------------------------------- ToolPanelCollection::~ToolPanelCollection() { + m_pData->aListeners.Dying(); } - //-------------------------------------------------------------------- - IMPLEMENT_IREFERENCE( ToolPanelCollection ) - //-------------------------------------------------------------------- size_t ToolPanelCollection::GetPanelCount() const { return m_pData->aPanels.size(); } + //-------------------------------------------------------------------- + ::boost::optional< size_t > ToolPanelCollection::GetActivePanel() const + { + return m_pData->aActivePanel; + } + + //-------------------------------------------------------------------- + void ToolPanelCollection::ActivatePanel( const size_t i_nPanel ) + { + OSL_ENSURE( i_nPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" ); + if ( i_nPanel >= GetPanelCount() ) + return; + + if ( m_pData->aActivePanel == i_nPanel ) + return; + + const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel ); + m_pData->aActivePanel = i_nPanel; + + // notify listeners + m_pData->aListeners.ActivePanelChanged( aOldPanel, *m_pData->aActivePanel ); + } + //-------------------------------------------------------------------- PToolPanel ToolPanelCollection::GetPanel( const size_t i_nPos ) const { @@ -85,41 +108,33 @@ namespace svt if ( !i_pPanel.get() ) return 0; + // insert const size_t position = i_nPosition < m_pData->aPanels.size() ? i_nPosition : m_pData->aPanels.size(); m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel ); - // notifications - for ( ::std::vector< IToolPanelContainerListener* >::const_iterator loop = m_pData->aListeners.begin(); - loop != m_pData->aListeners.end(); - ++loop - ) + // update active panel + if ( !!m_pData->aActivePanel ) { - (*loop)->PanelInserted( i_pPanel, i_nPosition ); + if ( i_nPosition <= *m_pData->aActivePanel ) + ++*m_pData->aActivePanel; } + // notifications + m_pData->aListeners.PanelInserted( i_pPanel, i_nPosition ); + return position; } //-------------------------------------------------------------------- - void ToolPanelCollection::AddListener( IToolPanelContainerListener& i_rListener ) + void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener ) { - m_pData->aListeners.push_back( &i_rListener ); + m_pData->aListeners.AddListener( i_rListener ); } //-------------------------------------------------------------------- - void ToolPanelCollection::RemoveListener( IToolPanelContainerListener& i_rListener ) + void ToolPanelCollection::RemoveListener( IToolPanelDeckListener& i_rListener ) { - for ( ::std::vector< IToolPanelContainerListener* >::iterator lookup = m_pData->aListeners.begin(); - lookup != m_pData->aListeners.end(); - ++lookup - ) - { - if ( *lookup == &i_rListener ) - { - m_pData->aListeners.erase( lookup ); - return; - } - } + m_pData->aListeners.RemoveListener( i_rListener ); } //........................................................................ diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index 0fb377fafaa2..eff5a6efb9b2 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -27,8 +27,7 @@ #ifndef TOOLPANELCOLLECTION_HXX #define TOOLPANELCOLLECTION_HXX -#include "svtools/toolpanel/toolpanelcontainer.hxx" -#include "svtools/toolpanel/refbase.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" #include @@ -42,22 +41,21 @@ namespace svt //==================================================================== //= ToolPanelCollection //==================================================================== - class ToolPanelCollection :public RefBase - ,public IToolPanelContainer + class ToolPanelCollection : public IToolPanelDeck { public: ToolPanelCollection(); ~ToolPanelCollection(); - // IToolPanelContainer + // IToolPanelDeck virtual size_t GetPanelCount() const; virtual PToolPanel GetPanel( const size_t i_nPos ) const; - virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_pPosition ); - virtual void AddListener( IToolPanelContainerListener& i_rListener ); - virtual void RemoveListener( IToolPanelContainerListener& i_rListener ); - - // IReference - DECLARE_IREFERENCE() + virtual ::boost::optional< size_t > + GetActivePanel() const; + virtual void ActivatePanel( const size_t i_nPanel ); + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void AddListener( IToolPanelDeckListener& i_rListener ); + virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); private: ::std::auto_ptr< ToolPanelCollection_Data > m_pData; diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index b6dcc0598bb8..8c8565d2cad2 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -28,6 +28,7 @@ #include "dummypanel.hxx" #include "toolpanelcollection.hxx" +#include "paneldecklisteners.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" @@ -57,41 +58,50 @@ namespace svt //==================================================================== //= ToolPanelDeck_Impl //==================================================================== - class ToolPanelDeck_Impl : public IToolPanelContainerListener + class ToolPanelDeck_Impl : public IToolPanelDeckListener { public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) - ,m_pPanels( new( ToolPanelCollection ) ) + ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) - ,m_aActivePanel() ,m_pLayouter() ,m_aPanelPlayground() { - m_pPanels->AddListener( *this ); + m_aPanels.AddListener( *this ); } - PToolPanelContainer GetPanels() const { return m_pPanels; } - - size_t GetActivePanel() const; - void ActivatePanel( const size_t i_nPanel ); + ~ToolPanelDeck_Impl() + { + m_aPanels.RemoveListener( *this ); + m_aListeners.Dying(); + } PDeckLayouter GetLayouter() const { return m_pLayouter; } void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + // IToolPanelDeck equivalents + size_t GetPanelCount() const; + PToolPanel GetPanel( const size_t i_nPos ) const; + ::boost::optional< size_t > + GetActivePanel() const; + void ActivatePanel( const size_t i_nPanel ); + size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); void AddListener( IToolPanelDeckListener& i_rListener ); void RemoveListener( IToolPanelDeckListener& i_rListener ); /// re-layouts everything - void LayoutAll() { ImplDoLayout(); } + void LayoutAll() { ImplDoLayout(); } void DoAction( const DeckAction i_eAction ); void FocusActivePanel(); protected: - // IToolPanelContainerListener + // IToolPanelDeckListener virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + virtual void Dying(); private: void ImplDoLayout(); @@ -99,25 +109,21 @@ namespace svt private: ToolPanelDeck& m_rDeck; - - PToolPanelContainer m_pPanels; + ToolPanelCollection m_aPanels; PToolPanel m_pDummyPanel; - ::boost::optional< size_t > - m_aActivePanel; + PanelDeckListeners m_aListeners; PDeckLayouter m_pLayouter; Rectangle m_aPanelPlayground; - - ::std::vector< IToolPanelDeckListener* > - m_aListeners; }; //-------------------------------------------------------------------- PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl() { - if ( !m_aActivePanel ) + ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() ); + if ( !aActivePanel ) return m_pDummyPanel; - return m_pPanels->GetPanel( *m_aActivePanel ); + return m_aPanels.GetPanel( *aActivePanel ); } //-------------------------------------------------------------------- @@ -132,45 +138,33 @@ namespace svt } //-------------------------------------------------------------------- - size_t ToolPanelDeck_Impl::GetActivePanel() const + size_t ToolPanelDeck_Impl::GetPanelCount() const { - OSL_PRECOND( !!m_aActivePanel, "ToolPanelDeck_Impl::GetActivePanel: no active panel (yet)!" ); - if ( !m_aActivePanel ) - return 0; - return *m_aActivePanel; + return m_aPanels.GetPanelCount(); } //-------------------------------------------------------------------- - void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel ) + PToolPanel ToolPanelDeck_Impl::GetPanel( const size_t i_nPos ) const { - OSL_ENSURE( i_nPanel < m_pPanels->GetPanelCount(), "ToolPanelDeck_Impl::ActivatePanel: illegal panel no.!" ); - if ( i_nPanel >= m_pPanels->GetPanelCount() ) - return; - - if ( m_aActivePanel == i_nPanel ) - return; - - // hide the old panel - const PToolPanel pOldActive( GetActiveOrDummyPanel_Impl() ); - pOldActive->Hide(); + return m_aPanels.GetPanel( i_nPos ); + } - const ::boost::optional< size_t > aOldPanel( m_aActivePanel ); - m_aActivePanel = i_nPanel; + //-------------------------------------------------------------------- + ::boost::optional< size_t > ToolPanelDeck_Impl::GetActivePanel() const + { + return m_aPanels.GetActivePanel(); + } - // position and show the new panel - const PToolPanel pNewActive( GetActiveOrDummyPanel_Impl() ); - pNewActive->SetPosSizePixel( m_aPanelPlayground ); - pNewActive->Show(); - pNewActive->GrabFocus(); + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel ) + { + m_aPanels.ActivatePanel( i_nPanel ); + } - // notify listeners - for ( ::std::vector< IToolPanelDeckListener* >::iterator loop = m_aListeners.begin(); - loop != m_aListeners.end(); - ++loop - ) - { - (*loop)->ActivePanelChanged( aOldPanel, *m_aActivePanel ); - } + //-------------------------------------------------------------------- + size_t ToolPanelDeck_Impl::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) + { + return m_aPanels.InsertPanel( i_pPanel, i_nPosition ); } //-------------------------------------------------------------------- @@ -192,31 +186,21 @@ namespace svt //-------------------------------------------------------------------- void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener ) { - m_aListeners.push_back( &i_rListener ); + m_aListeners.AddListener( i_rListener ); } //-------------------------------------------------------------------- void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener ) { - for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin(); - lookup != m_aListeners.end(); - ++lookup - ) - { - if ( *lookup == &i_rListener ) - { - m_aListeners.erase( lookup ); - return; - } - } + m_aListeners.RemoveListener( i_rListener ); } //-------------------------------------------------------------------- void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction ) { + const size_t nPanelCount( m_aPanels.GetPanelCount() ); ::boost::optional< size_t > aActivatePanel; - const size_t nPanelCount( GetPanels()->GetPanelCount() ); - const size_t nActivePanel( GetActivePanel() ); + ::boost::optional< size_t > aCurrentPanel( GetActivePanel() ); switch ( i_eAction ) { @@ -225,12 +209,18 @@ namespace svt aActivatePanel = 0; break; case ACTION_ACTIVATE_PREV: - if ( nActivePanel > 0 ) - aActivatePanel = nActivePanel - 1; + if ( !aCurrentPanel && ( nPanelCount > 0 ) ) + aActivatePanel = nPanelCount - 1; + else + if ( !!aCurrentPanel && ( *aCurrentPanel > 0 ) ) + aActivatePanel = *aCurrentPanel - 1; break; case ACTION_ACTIVATE_NEXT: - if ( nActivePanel < nPanelCount - 1 ) - aActivatePanel = nActivePanel + 1; + if ( !aCurrentPanel && ( nPanelCount > 0 ) ) + aActivatePanel = 0; + else + if ( !!aCurrentPanel && ( *aCurrentPanel < nPanelCount - 1 ) ) + aActivatePanel = *aCurrentPanel + 1; break; case ACTION_ACTIVATE_LAST: if ( nPanelCount > 0 ) @@ -263,11 +253,35 @@ namespace svt //-------------------------------------------------------------------- void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) { - if ( !!m_aActivePanel ) + // multiplex to our own listeners + m_aListeners.PanelInserted( i_pPanel, i_nPosition ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + { + // hide the old panel + if ( !!i_rOldActive ) { - if ( i_nPosition <= *m_aActivePanel ) - ++*m_aActivePanel; + const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) ); + pOldActive->Hide(); } + + // position and show the new panel + const PToolPanel pNewActive( m_aPanels.GetPanel( i_nNewActive ) ); + pNewActive->SetPosSizePixel( m_aPanelPlayground ); + pNewActive->Show(); + pNewActive->GrabFocus(); + + // multiplex to our own listeners + m_aListeners.ActivePanelChanged( i_rOldActive, i_nNewActive ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::Dying() + { + // not interested in. Since the ToolPanelCollection is our member, this just means we ourself + // are dying, and we already sent this notification in our dtor. } //==================================================================== @@ -289,7 +303,19 @@ namespace svt } //-------------------------------------------------------------------- - size_t ToolPanelDeck::GetActivePanel() const + size_t ToolPanelDeck::GetPanelCount() const + { + return m_pImpl->GetPanelCount(); + } + + //-------------------------------------------------------------------- + PToolPanel ToolPanelDeck::GetPanel( const size_t i_nPos ) const + { + return m_pImpl->GetPanel( i_nPos ); + } + + //-------------------------------------------------------------------- + ::boost::optional< size_t > ToolPanelDeck::GetActivePanel() const { return m_pImpl->GetActivePanel(); } @@ -301,21 +327,21 @@ namespace svt } //-------------------------------------------------------------------- - PDeckLayouter ToolPanelDeck::GetLayouter() const + size_t ToolPanelDeck::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) { - return m_pImpl->GetLayouter(); + return m_pImpl->InsertPanel( i_pPanel, i_nPosition ); } //-------------------------------------------------------------------- - void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter ) + PDeckLayouter ToolPanelDeck::GetLayouter() const { - return m_pImpl->SetLayouter( i_pNewLayouter ); + return m_pImpl->GetLayouter(); } //-------------------------------------------------------------------- - PToolPanelContainer ToolPanelDeck::GetPanels() const + void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter ) { - return m_pImpl->GetPanels(); + return m_pImpl->SetLayouter( i_pNewLayouter ); } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 51f3001e761a..68deeeb7739e 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -418,10 +418,9 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); - PToolPanelContainer pPanels( m_aToolPanelDeck.GetPanels() ); - pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), pPanels->GetPanelCount() ); - pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), pPanels->GetPanelCount() ); - pPanels->InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), pPanels->GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.ActivatePanel( 0 ); m_aToolPanelDeck.Show(); -- cgit From d068a1234eff68772943dd8b60d3de28a4d06cc6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 11:19:08 +0100 Subject: slidecopy: implement getNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) for Luna. Adjust TabControl::ImplGetItemSize to cope with this change --- vcl/source/control/tabctrl.cxx | 5 ++-- vcl/win/source/gdi/salnativewidgets-luna.cxx | 36 ++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 43c459b6c52e..0609b11b7aa7 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -405,6 +405,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) if( aImageSize.Height() > aSize.Height() ) aSize.Height() = aImageSize.Height(); + aSize.Width() += TAB_TABOFFSET_X*2; + aSize.Height() += TAB_TABOFFSET_Y*2; + Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) ); Region aBoundingRgn, aContentRgn; const ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); @@ -416,8 +419,6 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) return aCont.GetSize(); } - aSize.Width() += TAB_TABOFFSET_X*2; - aSize.Height() += TAB_TABOFFSET_Y*2; // For systems without synthetic bold support if ( mbExtraSpace ) aSize.Width() += TAB_EXTRASPACE_X; diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 6a66a7955d49..bd5ee206ca68 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -811,7 +811,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( pValue->isRightAligned() ) rc.right+=1; } - rc.top-=2; + rc.top-=3; rc.bottom+=2; } else if( nState & CTRL_STATE_ROLLOVER ) @@ -1039,8 +1039,8 @@ BOOL WinSalGraphics::drawNativeControlText( ControlType, BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPart, const Region& rControlRegion, - ControlState, - const ImplControlValue&, + ControlState nState, + const ImplControlValue& rControlValue, const OUString&, Region &rNativeBoundingRegion, Region &rNativeContentRegion ) @@ -1158,8 +1158,36 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, } } - if ( ( nType == CTRL_TAB_ITEM ) && ( nType == PART_ENTIRE_CONTROL ) ) + if ( ( nType == CTRL_TAB_ITEM ) && ( nPart == PART_ENTIRE_CONTROL ) ) { + Rectangle aControlRect( rControlRegion.GetBoundRect() ); + rNativeContentRegion = aControlRect; + + --aControlRect.Bottom(); + + TabitemValue *pValue = static_cast< TabitemValue* >( rControlValue.getOptionalVal() ); + if ( pValue ) + { + if ( pValue->isBothAligned() ) + --aControlRect.Right(); + } + + if ( nState & CTRL_STATE_SELECTED ) + { + aControlRect.Left() -= 2; + aControlRect.Right() += 1; + if ( pValue && !pValue->isBothAligned() ) + { + if ( pValue->isLeftAligned() || pValue->isNotAligned() ) + aControlRect.Right() += 2; + if ( pValue->isRightAligned() ) + aControlRect.Right() += 1; + } + aControlRect.Top() -= 3; + aControlRect.Bottom() += 2; + } + rNativeBoundingRegion = aControlRect; + bRet = TRUE; } ReleaseDC( mhWnd, hDC ); -- cgit From ba4b0d6185953c735607ed69c0f70e91e2aa60de Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 11:32:59 +0100 Subject: slidecopy: introduced TABITEM_AUTO value for TabItemContent, do the automatic adjustment of the tab's contents only when this is set, in all other cases, do not tamper with what our client gave us. --- svtools/inc/svtools/toolpanel/tabitemcontent.hxx | 4 +- svtools/source/toolpanel/paneltabbar.cxx | 67 +++++++++++++----------- svtools/workben/toolpanel/toolpaneltest.cxx | 26 +++++---- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx index 295a644e7566..e9d41a7c821b 100644 --- a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx +++ b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx @@ -36,7 +36,9 @@ namespace svt { TABITEM_IMAGE_AND_TEXT, TABITEM_IMAGE_ONLY, - TABITEM_TEXT_ONLY + TABITEM_TEXT_ONLY, + + TABITEM_AUTO }; //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 9566d89c0b7e..5602d83fdb88 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -85,6 +85,8 @@ namespace svt const Rectangle& GetRect( const TabItemContent i_eItemContent ) const { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" ); + return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT ) ? aCompleteArea : ( ( i_eItemContent == TABITEM_TEXT_ONLY ) @@ -278,6 +280,8 @@ namespace svt void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::CalculateItemSize: illegal TabItemContent value!" ); + const Image aImage( i_pPanel->GetImage() ); const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); @@ -449,6 +453,8 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::impl_renderContent: illegal TabItemContent value!" ); + Point aDrawPos( i_rContentArea.TopLeft() ); aDrawPos.Y() += ITEM_OUTER_SPACE; @@ -790,41 +796,38 @@ namespace svt // nothing to do return; - // the available size - Size aOutputSize( io_rData.rTabBar.GetOutputSizePixel() ); - // shrunk by the outer space - aOutputSize.Width() -= io_rData.aBottomRightSpace.Width(); - aOutputSize.Height() -= io_rData.aBottomRightSpace.Height(); - const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); - - // the "content modes" to try - TabItemContent eTryThis[] = - { - TABITEM_IMAGE_ONLY, // assumed to have the smalles rects - TABITEM_TEXT_ONLY, - TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects - }; - - // do not start with the largest, but with the one currently set up for the TabBar - size_t nTryIndex = 0; - while ( ( nTryIndex < ( sizeof( eTryThis ) / sizeof( eTryThis[0] ) ) ) - && ( eTryThis[nTryIndex] != io_rData.eTabItemContent ) - ) + TabItemContent eItemContent( io_rData.eTabItemContent ); + if ( io_rData.eTabItemContent == TABITEM_AUTO ) { - ++nTryIndex; - } + // the available size + Size aOutputSize( io_rData.rTabBar.GetOutputSizePixel() ); + // shrunk by the outer space + aOutputSize.Width() -= io_rData.aBottomRightSpace.Width(); + aOutputSize.Height() -= io_rData.aBottomRightSpace.Height(); + const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); + + // the "content modes" to try + TabItemContent eTryThis[] = + { + TABITEM_IMAGE_ONLY, // assumed to have the smallest rects + TABITEM_TEXT_ONLY, + TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects + }; - // determine which of the different version fits - TabItemContent eContent = eTryThis[0]; - while ( nTryIndex > 0 ) - { - const Point aBottomRight( io_rData.aItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); - if ( aFitInto.IsInside( aBottomRight ) ) + + // determine which of the different version fits + eItemContent = eTryThis[0]; + size_t nTryIndex = 2; + while ( nTryIndex > 0 ) { - eContent = eTryThis[ nTryIndex ]; - break; + const Point aBottomRight( io_rData.aItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); + if ( aFitInto.IsInside( aBottomRight ) ) + { + eItemContent = eTryThis[ nTryIndex ]; + break; + } + --nTryIndex; } - --nTryIndex; } // propagate to the items @@ -833,7 +836,7 @@ namespace svt ++item ) { - item->eContent = eContent; + item->eContent = eItemContent; } } } diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 68deeeb7739e..f0e12962d1fd 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -234,6 +234,7 @@ private: RadioButton m_aImagesAndText; RadioButton m_aImagesOnly; RadioButton m_aTextOnly; + RadioButton m_aAutomaticContent; }; //============================================================================= @@ -274,6 +275,7 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) ,m_aImagesAndText( this ) ,m_aImagesOnly( this ) ,m_aTextOnly( this ) + ,m_aAutomaticContent( this ) { SetBorderStyle( WINDOW_BORDER_MONO ); const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); @@ -281,11 +283,12 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) Window* pControls[] = { - &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, &m_aTextOnly + &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, + &m_aTextOnly, &m_aAutomaticContent }; const sal_Char* pTexts[] = { - "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only" + "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic" }; for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i ) { @@ -348,13 +351,14 @@ void OptionsWindow::Resize() }; ControlRow aControlRows[] = { - ControlRow( m_aAlignmentHeader, false ), - ControlRow( m_aAlignLeft, true ), - ControlRow( m_aAlignRight, true ), - ControlRow( m_aTabItemContent, false ), - ControlRow( m_aImagesAndText, true ), - ControlRow( m_aImagesOnly, true ), - ControlRow( m_aTextOnly, true ) + ControlRow( m_aAlignmentHeader, false ), + ControlRow( m_aAlignLeft, true ), + ControlRow( m_aAlignRight, true ), + ControlRow( m_aTabItemContent, false ), + ControlRow( m_aImagesAndText, true ), + ControlRow( m_aImagesOnly, true ), + ControlRow( m_aTextOnly, true ), + ControlRow( m_aAutomaticContent, true ) }; bool bPreviousWasSubordinate = false; for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i ) @@ -399,6 +403,10 @@ IMPL_LINK( OptionsWindow, OnRadioToggled, RadioButton*, i_pRadioButton ) { rController.SetTabItemContent( TABITEM_TEXT_ONLY ); } + else if ( i_pRadioButton == &m_aAutomaticContent ) + { + rController.SetTabItemContent( TABITEM_AUTO ); + } } return 0L; } -- cgit From 1f498a3f5e889a9137d5993b117e8c9dec9dc366 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 11:57:45 +0100 Subject: slidecopy: reverted a previous change to ImplDrawNativeControl( CTRL_TAB_ITEM ), had some side effects ... --- vcl/win/source/gdi/salnativewidgets-luna.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index bd5ee206ca68..60c8b397eaa7 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -811,7 +811,7 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( pValue->isRightAligned() ) rc.right+=1; } - rc.top-=3; + rc.top-=2; rc.bottom+=2; } else if( nState & CTRL_STATE_ROLLOVER ) -- cgit From 460a9fc8302c670012cddb7468c4c5e77d190c88 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 13:18:36 +0100 Subject: slidecopy: tool panel deck now supports removal of panels --- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 14 +- svtools/source/toolpanel/paneldecklisteners.cxx | 16 +- svtools/source/toolpanel/paneldecklisteners.hxx | 3 +- svtools/source/toolpanel/paneltabbar.cxx | 14 +- svtools/source/toolpanel/toolpanelcollection.cxx | 45 ++++- svtools/source/toolpanel/toolpanelcollection.hxx | 1 + svtools/source/toolpanel/toolpaneldeck.cxx | 29 +++- svtools/workben/toolpanel/toolpaneltest.cxx | 202 ++++++++++++++++++++--- 8 files changed, 287 insertions(+), 37 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 7119941914b2..eb83fbefef10 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -53,9 +53,13 @@ namespace svt */ virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + /** called when a panel has been removed from the deck + */ + virtual void PanelRemoved( const size_t i_nPosition ) = 0; + /** called when the active panel of the deck changed */ - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) = 0; + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0; /** called when the tool panel deck which the listener registered at is dying. The listener is required to release all references to the deck then. @@ -78,8 +82,7 @@ namespace svt */ virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0; - /** returns the number of the currently active panel. If the deck does not currently contain any panel, - the behavior is undefined. + /** returns the number of the currently active panel. */ virtual ::boost::optional< size_t > GetActivePanel() const; @@ -95,6 +98,10 @@ namespace svt */ virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; + /** removes a panel specified by its position. + */ + virtual void RemovePanel( const size_t i_nPosition ) = 0; + /** adds a new listener to be notified when the container content changes. The caller is responsible for life time control, i.e. removing the listener before it actually dies. */ @@ -126,6 +133,7 @@ namespace svt GetActivePanel() const; virtual void ActivatePanel( const size_t i_nPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx index 766b3a63428d..26a025f7181f 100644 --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -60,14 +60,26 @@ namespace svt } //-------------------------------------------------------------------- - void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + void PanelDeckListeners::PanelRemoved( const size_t i_nPosition ) { for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); loop != m_aListeners.end(); ++loop ) { - (*loop)->ActivePanelChanged( i_rOldActive, i_nNewActive ); + (*loop)->PanelRemoved( i_nPosition ); + } + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); + loop != m_aListeners.end(); + ++loop + ) + { + (*loop)->ActivePanelChanged( i_rOldActive, i_rNewActive ); } } diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx index 56445e892a65..d3178d385e20 100644 --- a/svtools/source/toolpanel/paneldecklisteners.hxx +++ b/svtools/source/toolpanel/paneldecklisteners.hxx @@ -52,7 +52,8 @@ namespace svt // IToolPanelDeckListener equivalents, forward the events to all registered listeners void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); - void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + void PanelRemoved( const size_t i_nPosition ); + void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); void Dying(); // listener maintainance diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 5602d83fdb88..75873f9c6411 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -626,7 +626,14 @@ namespace svt rTabBar.Invalidate(); } - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + virtual void PanelRemoved( const size_t i_nPosition ) + { + (void)i_nPosition; + bItemsDirty = true; + rTabBar.Invalidate(); + } + + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); virtual void Dying(); public: @@ -845,13 +852,14 @@ namespace svt //= PanelTabBar_Data //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { lcl_ensureItemsCache( *this ); if ( !!i_rOldActive ) lcl_drawItem( *this, *i_rOldActive ); - lcl_drawItem( *this, i_nNewActive ); + if ( !!i_rNewActive ) + lcl_drawItem( *this, *i_rNewActive ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index 35742f66016c..c92241d34b7c 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -89,7 +89,7 @@ namespace svt m_pData->aActivePanel = i_nPanel; // notify listeners - m_pData->aListeners.ActivePanelChanged( aOldPanel, *m_pData->aActivePanel ); + m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel ); } //-------------------------------------------------------------------- @@ -125,6 +125,49 @@ namespace svt return position; } + //-------------------------------------------------------------------- + void ToolPanelCollection::RemovePanel( const size_t i_nPosition ) + { + OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" ); + if ( i_nPosition >= m_pData->aPanels.size() ) + return; + + // if the active panel is going to be removed, activate another one (before the actual removal) + if ( m_pData->aActivePanel == i_nPosition ) + { + const ::boost::optional< size_t > aOldActive( m_pData->aActivePanel ); + + if ( i_nPosition + 1 < GetPanelCount() ) + { + ++*m_pData->aActivePanel; + } + else if ( i_nPosition > 0 ) + { + --*m_pData->aActivePanel; + } + else + { + m_pData->aActivePanel.reset(); + } + + m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel ); + } + + // actually remove + m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition ); + + if ( !!m_pData->aActivePanel ) + { + if ( i_nPosition < *m_pData->aActivePanel ) + { + --*m_pData->aActivePanel; + } + } + + // notify removed panel + m_pData->aListeners.PanelRemoved( i_nPosition ); + } + //-------------------------------------------------------------------- void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener ) { diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index eff5a6efb9b2..5c1f7ce3b8e3 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -54,6 +54,7 @@ namespace svt GetActivePanel() const; virtual void ActivatePanel( const size_t i_nPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 8c8565d2cad2..b8ca75e74fac 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -87,6 +87,7 @@ namespace svt GetActivePanel() const; void ActivatePanel( const size_t i_nPanel ); size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + void RemovePanel( const size_t i_nPosition ); void AddListener( IToolPanelDeckListener& i_rListener ); void RemoveListener( IToolPanelDeckListener& i_rListener ); @@ -100,7 +101,8 @@ namespace svt protected: // IToolPanelDeckListener virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); virtual void Dying(); private: @@ -167,6 +169,12 @@ namespace svt return m_aPanels.InsertPanel( i_pPanel, i_nPosition ); } + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition ) + { + m_aPanels.RemovePanel( i_nPosition ); + } + //-------------------------------------------------------------------- void ToolPanelDeck_Impl::ImplDoLayout() { @@ -258,7 +266,14 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const size_t i_nNewActive ) + void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) + { + // multiplex to our own listeners + m_aListeners.PanelRemoved( i_nPosition ); + } + + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { // hide the old panel if ( !!i_rOldActive ) @@ -268,13 +283,13 @@ namespace svt } // position and show the new panel - const PToolPanel pNewActive( m_aPanels.GetPanel( i_nNewActive ) ); + const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) ); pNewActive->SetPosSizePixel( m_aPanelPlayground ); pNewActive->Show(); pNewActive->GrabFocus(); // multiplex to our own listeners - m_aListeners.ActivePanelChanged( i_rOldActive, i_nNewActive ); + m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); } //-------------------------------------------------------------------- @@ -332,6 +347,12 @@ namespace svt return m_pImpl->InsertPanel( i_pPanel, i_nPosition ); } + //-------------------------------------------------------------------- + void ToolPanelDeck::RemovePanel( const size_t i_nPosition ) + { + m_pImpl->RemovePanel( i_nPosition ); + } + //-------------------------------------------------------------------- PDeckLayouter ToolPanelDeck::GetLayouter() const { diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index f0e12962d1fd..3a593d140670 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -215,16 +216,32 @@ Image ColoredPanel::GetImage() const //= OptionsWindow //============================================================================= class PanelDemoMainWindow; -class OptionsWindow : public Window +class OptionsWindow :public Window + ,public ::svt::IToolPanelDeckListener { public: OptionsWindow( PanelDemoMainWindow& i_rParent ); + ~OptionsWindow(); - virtual void Resize(); - virtual void GetFocus(); + // Window overridables + virtual void Resize(); + virtual void GetFocus(); + virtual void StateChanged( StateChangedType i_nStateChange ); + + // IToolPanelDeckListener + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void Dying(); private: DECL_LINK( OnRadioToggled, RadioButton* ); + DECL_LINK( OnListEntrySelected, ListBox* ); + DECL_LINK( OnListEntryDoubleClicked, ListBox* ); + DECL_LINK( OnButtonClicked, PushButton* ); + + void impl_initPanelList(); + void impl_updateRemoveButton(); private: FixedLine m_aAlignmentHeader; @@ -235,6 +252,10 @@ private: RadioButton m_aImagesOnly; RadioButton m_aTextOnly; RadioButton m_aAutomaticContent; + + FixedLine m_aPanelsHeader; + ListBox m_aPanelList; + PushButton m_aRemovePanel; }; //============================================================================= @@ -254,6 +275,9 @@ public: void AlignTabs( const ::svt::TabAlignment i_eAlignment ); void SetTabItemContent( const TabItemContent i_eItemContent ); + // member access + IToolPanelDeck& GetToolPanelDeck(); + protected: virtual void GetFocus(); @@ -276,28 +300,41 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) ,m_aImagesOnly( this ) ,m_aTextOnly( this ) ,m_aAutomaticContent( this ) + ,m_aPanelsHeader( this ) + ,m_aPanelList( this ) + ,m_aRemovePanel( this ) { SetBorderStyle( WINDOW_BORDER_MONO ); - const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); - SetBackground( aFaceColor ); - Window* pControls[] = { &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, - &m_aTextOnly, &m_aAutomaticContent + &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, &m_aRemovePanel }; const sal_Char* pTexts[] = { - "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic" + "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic", + "Panels", "", "Remove Panel" }; for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i ) { + const WindowType eWindowType = pControls[i]->GetType(); + pControls[i]->SetText( String::CreateFromAscii( pTexts[i] ) ); - pControls[i]->SetControlBackground( aFaceColor ); pControls[i]->Show(); - if ( pControls[i]->GetType() == WINDOW_RADIOBUTTON ) + if ( eWindowType == WINDOW_RADIOBUTTON ) static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) ); + + if ( eWindowType == WINDOW_LISTBOX ) + { + static_cast< ListBox* >( pControls[i] )->SetSelectHdl( LINK( this, OptionsWindow, OnListEntrySelected ) ); + static_cast< ListBox* >( pControls[i] )->SetDoubleClickHdl( LINK( this, OptionsWindow, OnListEntryDoubleClicked ) ); + } + + if ( eWindowType == WINDOW_PUSHBUTTON ) + { + static_cast< PushButton* >( pControls[i] )->SetClickHdl( LINK( this, OptionsWindow, OnButtonClicked ) ); + } } m_aAlignRight.Check(); @@ -306,6 +343,48 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) Show(); } +//----------------------------------------------------------------------------- +OptionsWindow::~OptionsWindow() +{ +} + +//----------------------------------------------------------------------------- +void OptionsWindow::impl_updateRemoveButton() +{ + m_aRemovePanel.Enable( m_aPanelList.GetSelectEntryCount() > 0 ); +} + +//----------------------------------------------------------------------------- +void OptionsWindow::impl_initPanelList() +{ + m_aPanelList.Clear(); + + PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) ); + IToolPanelDeck& rPanelDeck( rController.GetToolPanelDeck() ); + + for ( size_t i=0; iGetDisplayName(), pPanel->GetImage() ); + } + ActivePanelChanged( ::boost::optional< size_t >(), rPanelDeck.GetActivePanel() ); + + impl_updateRemoveButton(); + + rPanelDeck.AddListener( *this ); +} + +//----------------------------------------------------------------------------- +void OptionsWindow::StateChanged( StateChangedType i_nStateChange ) +{ + Window::StateChanged( i_nStateChange ); + + if ( i_nStateChange == STATE_CHANGE_INITSHOW ) + { + impl_initPanelList(); + } +} + //----------------------------------------------------------------------------- void OptionsWindow::GetFocus() { @@ -335,10 +414,10 @@ void OptionsWindow::Resize() const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() ); const long nLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() ); - const Size aSuperordinateSize( aOutputSize.Width() - 2 * aSpacing.Width(), nLineHeight ); + const long nSuperordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width(); const long nSuperordinateX = aSpacing.Width(); - const Size aSubordinateSize( aOutputSize.Width() - 2 * aSpacing.Width() - nIndent, nLineHeight ); + const long nSubordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width() - nIndent; const long nSubordinateX = aSpacing.Width() + nIndent; Point aItemPos( nSuperordinateX, aSpacing.Height() ); @@ -347,7 +426,14 @@ void OptionsWindow::Resize() { Window* pWindow; bool bSubordinate; - ControlRow( Window& i_rWindow, const bool i_bSubordinate ) : pWindow( &i_rWindow ), bSubordinate( i_bSubordinate ) { } + size_t nRows; + + ControlRow( Window& i_rWindow, const bool i_bSubordinate, const size_t i_nRows = 1 ) + :pWindow( &i_rWindow ) + ,bSubordinate( i_bSubordinate ) + ,nRows( i_nRows ) + { + } }; ControlRow aControlRows[] = { @@ -358,7 +444,10 @@ void OptionsWindow::Resize() ControlRow( m_aImagesAndText, true ), ControlRow( m_aImagesOnly, true ), ControlRow( m_aTextOnly, true ), - ControlRow( m_aAutomaticContent, true ) + ControlRow( m_aAutomaticContent, true ), + ControlRow( m_aPanelsHeader, false ), + ControlRow( m_aPanelList, true, 8 ), + ControlRow( m_aRemovePanel, true, 2 ) }; bool bPreviousWasSubordinate = false; for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i ) @@ -369,11 +458,76 @@ void OptionsWindow::Resize() aItemPos.Y() += aSpacing.Height(); bPreviousWasSubordinate = aControlRows[i].bSubordinate; - const Size& rControlSize = ( aControlRows[i].bSubordinate ) ? aSubordinateSize : aSuperordinateSize; - aControlRows[i].pWindow->SetPosSizePixel( aItemPos, rControlSize ); + Size aControlSize( + aControlRows[i].bSubordinate ? nSubordinateWidth : nSuperordinateWidth, + nLineHeight * aControlRows[i].nRows + ); + aControlRows[i].pWindow->SetPosSizePixel( aItemPos, aControlSize ); + + aItemPos.Move( 0, aControlSize.Height() + aSpacing.Height() ); + } +} + +//----------------------------------------------------------------------------- +void OptionsWindow::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) +{ + m_aPanelList.InsertEntry( i_pPanel->GetDisplayName(), i_pPanel->GetImage(), USHORT( i_nPosition ) ); +} - aItemPos.Move( 0, rControlSize.Height() + aSpacing.Height() ); +//----------------------------------------------------------------------------- +void OptionsWindow::PanelRemoved( const size_t i_nPosition ) +{ + m_aPanelList.RemoveEntry( USHORT( i_nPosition ) ); + impl_updateRemoveButton(); +} + +//----------------------------------------------------------------------------- +void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) +{ + (void)i_rOldActive; + + if ( !i_rNewActive ) + m_aPanelList.SetNoSelection(); + else + m_aPanelList.SelectEntryPos( USHORT( *i_rNewActive ) ); +} + +//----------------------------------------------------------------------------- +void OptionsWindow::Dying() +{ + // not interested in +} + +//----------------------------------------------------------------------------- +IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox ) +{ + impl_updateRemoveButton(); + return 0L; +} + +//----------------------------------------------------------------------------- +IMPL_LINK( OptionsWindow, OnListEntryDoubleClicked, ListBox*, i_pListBox ) +{ + PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) ); + + if ( i_pListBox == &m_aPanelList ) + { + size_t nActivatePanel = size_t( m_aPanelList.GetSelectEntryPos() ); + rController.GetToolPanelDeck().ActivatePanel( nActivatePanel ); + } + + return 0L; +} +//----------------------------------------------------------------------------- +IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton ) +{ + PanelDemoMainWindow& rController( dynamic_cast< PanelDemoMainWindow& >( *GetParent() ) ); + + if ( i_pPushButton == &m_aRemovePanel ) + { + rController.GetToolPanelDeck().RemovePanel( size_t( m_aPanelList.GetSelectEntryPos() ) ); } + return 0L; } //----------------------------------------------------------------------------- @@ -419,10 +573,6 @@ PanelDemoMainWindow::PanelDemoMainWindow() ,m_aToolPanelDeck( *this, WB_BORDER ) ,m_aDemoOptions( *this ) { - const Color aFaceColor( GetSettings().GetStyleSettings().GetFaceColor() ); - - SetBackground( aFaceColor ); - m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); @@ -461,13 +611,13 @@ void PanelDemoMainWindow::Resize() { WorkWindow::Resize(); Size aSize( GetOutputSizePixel() ); - aSize.Width() -= 190; + aSize.Width() -= 240; aSize.Height() -= 40; m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), aSize ); m_aDemoOptions.SetPosSizePixel( Point( 20 + aSize.Width(), 20 ), - Size( 150, aSize.Height() ) + Size( 200, aSize.Height() ) ); } @@ -495,6 +645,12 @@ void PanelDemoMainWindow::SetTabItemContent( const TabItemContent i_eItemContent pLayouter->SetTabItemContent( i_eItemContent ); } +//----------------------------------------------------------------------------- +IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck() +{ + return m_aToolPanelDeck; +} + //============================================================================= //= PanelDemo //============================================================================= -- cgit From ccb15ef4a56fe416ec7a293593a45ac8976f07df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Mar 2010 13:29:53 +0100 Subject: add a tab control for comparison --- svtools/workben/toolpanel/toolpaneltest.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 3a593d140670..68b6fe1c8680 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -76,11 +77,23 @@ public: ColoredPanelWindow( Window& i_rParent, const Color& i_rColor ) :Window( &i_rParent ) ,m_aEdit( this, WB_BORDER ) + ,m_aTabControl( this ) { SetLineColor(); SetFillColor( i_rColor ); m_aEdit.Show(); + m_aTabControl.Show(); + + const sal_Char* pTabTitles[] = + { + "This", "is a", "Tab", "Control", "test", "intended", "for", "comparison" + }; + for ( size_t i=0; i < sizeof( pTabTitles ) / sizeof( pTabTitles[0] ); ++i ) + { + String sText( String::CreateFromAscii( pTabTitles[i] ) ); + m_aTabControl.InsertPage( i + 1, sText ); + } } virtual void Paint( const Rectangle& i_rRect ) @@ -100,10 +113,15 @@ public: Point( 20, 20 ), Size( aOutputSize.Width() - 40, 20 ) ); + m_aTabControl.SetPosSizePixel( + Point( 20, 50 ), + Size( aOutputSize.Width() - 40, 150 ) + ); } private: - Edit m_aEdit; + Edit m_aEdit; + TabControl m_aTabControl; }; //============================================================================= -- cgit From e81174982a2cf99c4911391bb5c326789943135c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 09:07:59 +0100 Subject: slidecopy: make compile on unxlngi6.pro --- svtools/source/toolpanel/paneltabbar.cxx | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 75873f9c6411..0aa9b8aca035 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -433,6 +433,7 @@ namespace svt ImplControlValue aControlValue( (void *)(&tiValue) ); bool bNativeOK = aRenderDevice.DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString() ); + (void)bNativeOK; OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 68b6fe1c8680..60755a55b516 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -517,7 +517,7 @@ void OptionsWindow::Dying() } //----------------------------------------------------------------------------- -IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox ) +IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, /*i_pListBox*/ ) { impl_updateRemoveButton(); return 0L; -- cgit From febb0caf8ebd7e2ea0c31666ce513e37b5b09fd9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 12:37:13 +0100 Subject: slidecopy: buttons for scrolling tab items when they do not fit --- svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/paneltabbar.cxx | 617 ++++++++++++------------- svtools/source/toolpanel/tabbargeometry.cxx | 309 +++++++++++++ svtools/source/toolpanel/tabbargeometry.hxx | 141 ++++++ svtools/source/toolpanel/tabitemdescriptor.hxx | 90 ++++ svtools/workben/toolpanel/toolpaneltest.cxx | 1 + 6 files changed, 829 insertions(+), 330 deletions(-) create mode 100644 svtools/source/toolpanel/tabbargeometry.cxx create mode 100644 svtools/source/toolpanel/tabbargeometry.hxx create mode 100644 svtools/source/toolpanel/tabitemdescriptor.hxx diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 42c12ab99ead..e3dd07fac005 100644 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -48,6 +48,7 @@ SLOFILES=\ $(SLO)$/paneldecklisteners.obj \ $(SLO)$/paneltabbar.obj \ $(SLO)$/refbase.obj \ + $(SLO)$/tabbargeometry.obj \ $(SLO)$/tablayouter.obj \ $(SLO)$/toolpanelcollection.obj \ $(SLO)$/toolpaneldeck.obj \ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 0aa9b8aca035..f50dfb1c3ff0 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -27,11 +27,14 @@ #include "precompiled_svtools.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" +#include "tabitemdescriptor.hxx" #include "paneltabbar.hxx" +#include "tabbargeometry.hxx" #include #include #include +#include #include #include @@ -40,10 +43,10 @@ // space around an item #define ITEM_OUTER_SPACE 2 * 2 +// the distance between the button and the control's border, in "upright" direction (what this means depends on the alignment) +#define BUTTON_UPRIGHT_DISTANCE 2 // spacing before and after (in writing direction, whether this is horizontal or vertical) an item's text #define ITEM_TEXT_FLOW_SPACE 5 -// distance between two items -#define ITEM_DISTANCE_PIXEL 0 // space between item icon and icon text #define ITEM_ICON_TEXT_DISTANCE 4 @@ -61,48 +64,6 @@ namespace svt #define ITEM_POSITION_FIRST 0x08 #define ITEM_POSITION_LAST 0x10 - //================================================================================================================== - //= ItemDescriptor - //================================================================================================================== - struct ItemDescriptor - { - PToolPanel pPanel; - Rectangle aCompleteArea; - Rectangle aIconOnlyArea; - Rectangle aTextOnlyArea; - TabItemContent eContent; - // content to be used for this particular item. Might differ from item content which has been set - // up for the complete control, in case not the complete content fits into the available space. - - ItemDescriptor() - :pPanel() - ,aCompleteArea() - ,aIconOnlyArea() - ,aTextOnlyArea() - ,eContent( TABITEM_IMAGE_AND_TEXT ) - { - } - - const Rectangle& GetRect( const TabItemContent i_eItemContent ) const - { - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" ); - - return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT ) - ? aCompleteArea - : ( ( i_eItemContent == TABITEM_TEXT_ONLY ) - ? aTextOnlyArea - : aIconOnlyArea - ); - } - - const Rectangle& GetCurrentRect() const - { - return GetRect( eContent ); - } - }; - - typedef ::std::vector< ItemDescriptor > ItemDescriptors; - //================================================================================================================== //= IItemsLayout //================================================================================================================== @@ -116,6 +77,10 @@ namespace svt class IItemsLayout { public: + /** fills the background of our target device + */ + virtual void DrawBackground( const Rectangle& i_rArea ) = 0; + /** calculates the size of the area occupied by the item representing the given tool panel @param i_pPanel denotes the panel whose item's size should be calculated @@ -128,36 +93,26 @@ namespace svt contains, upon return, the area which is available to render the item content. It lies completely within an assuming bounding rectangle, which starts at corrdinates (0, 0), and has the size returned in o_rBoundingSize. - */ - virtual void CalculateItemSize( - const PToolPanel& i_pPanel, - const TabItemContent i_eItemContent, - Size& o_rBoundingSize, - Rectangle& o_rContentArea - ) const = 0; - - /** returns the position where the next item should start, assuming the previous item occupies a given area - */ - virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const = 0; - - /** fills the background of our target device - */ - virtual void DrawBackground( const Rectangle& i_rArea ) = 0; + virtual void CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const = 0; /** draws the item onto the given device, in the givem area @param i_pPanel the panel whose item representation is to be drawn @param i_rPosition - the position to paint the item to. Starting at this point, an area of the size returned - as "bounding size" in CalculateItemSize might be used. + the position to paint the item to. @param i_nItemFlags defines in which state to draw the item @param i_eItemContent defines which content to draw on the tab item */ - virtual void DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, - const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) = 0; + virtual void DrawItem( + const TabBarGeometry& i_rGeometry, + const PToolPanel& i_pPanel, + const Point& i_rPosition, + const ItemFlags i_nItemFlags, + const TabItemContent i_eItemContent + ) = 0; }; typedef ::boost::shared_ptr< IItemsLayout > PItemsLayout; @@ -171,15 +126,15 @@ namespace svt VerticalItemLayout( Window& i_rTargetWindow, const bool i_bLeft ); // IItemsLayout overridables + virtual void DrawBackground( const Rectangle& i_rArea ); virtual void CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const; - virtual Point GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const; - virtual void DrawBackground( const Rectangle& i_rArea ); virtual void DrawItem( + const TabBarGeometry& i_rGeometry, const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, @@ -203,15 +158,9 @@ namespace svt const ItemFlags& i_nFlags ); - /** rotates a pair of bounding/content rect in formation, so they properly keep their relative position, - and so that the upper left corner of the bounding rect is constant. - */ - static void - impl_rotateFormation( Rectangle& io_rBoundingRect, Rectangle& io_rContentRect, const bool i_bLeft ); - private: - Window& m_rTargetWindow; - const bool m_bLeft; + Window& m_rTargetWindow; + const bool m_bLeft; enum ItemRenderMode { @@ -245,143 +194,6 @@ namespace svt m_eRenderMode = VCL_BASED; } - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::impl_rotateFormation( Rectangle& io_rBoundingRect, Rectangle& io_rContentRect, const bool i_bLeft ) - { - // move the to-be-upper-left corner to (0,0) - ::basegfx::B2DHomMatrix aTransformation; - aTransformation.translate( - i_bLeft ? -io_rBoundingRect.Right() : -io_rBoundingRect.Left(), - i_bLeft ? -io_rBoundingRect.Top() : -io_rBoundingRect.Bottom() ); - // rotate by 90 resp. -90 degrees - aTransformation.rotate( i_bLeft ? -F_PI2 : F_PI2 ); - // note on the screen, the ordinate goes top-down, while basegfx calculates in a system where the ordinate - // does bottom-up; thus the "wrong" sign before F_PI2 here - // move back to original coordinates - aTransformation.translate( io_rBoundingRect.Left(), io_rBoundingRect.Top() ); - - // apply - ::basegfx::B2DRange aBoundingRange( io_rBoundingRect.Left(), io_rBoundingRect.Top(), io_rBoundingRect.Right(), io_rBoundingRect.Bottom() ); - aBoundingRange.transform( aTransformation ); - io_rBoundingRect.Left() = long( aBoundingRange.getMinX() ); - io_rBoundingRect.Top() = long( aBoundingRange.getMinY() ); - io_rBoundingRect.Right() = long( aBoundingRange.getMaxX() ); - io_rBoundingRect.Bottom() = long( aBoundingRange.getMaxY() ); - - ::basegfx::B2DRange aContentRange( io_rContentRect.Left(), io_rContentRect.Top(), io_rContentRect.Right(), io_rContentRect.Bottom() ); - aContentRange.transform( aTransformation ); - io_rContentRect.Left() = long( aContentRange.getMinX() ); - io_rContentRect.Top() = long( aContentRange.getMinY() ); - io_rContentRect.Right() = long( aContentRange.getMaxX() ); - io_rContentRect.Bottom() = long( aContentRange.getMaxY() ); - } - - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, - Size& o_rBoundingSize, Rectangle& o_rContentArea ) const - { - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::CalculateItemSize: illegal TabItemContent value!" ); - - const Image aImage( i_pPanel->GetImage() ); - const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); - - const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); - const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); - - Size aItemContentSize; - if ( bUseImage ) - { - aItemContentSize = aImage.GetSizePixel(); - } - - if ( bUseText ) - { - if ( bUseImage ) - aItemContentSize.Height() += ITEM_ICON_TEXT_DISTANCE; - - // add space for vertical text - const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); - aItemContentSize.Height() += aTextSize.Width(); - aItemContentSize.Width() = ::std::max( aItemContentSize.Width(), aTextSize.Height() ); - - aItemContentSize.Height() += 2 * ITEM_TEXT_FLOW_SPACE; - } - - aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; - aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; - - Region aBoundingRegion, aContentRegion; - bool bNativeOK = false; - if ( m_eRenderMode == NWF_TOOLBAR_ITEM ) - { - // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. - // Instead, simply assume that both the content and the bounding region are the same. -// const ImplControlValue aControlValue; -// bNativeOK = m_rTargetWindow.GetNativeControlRegion( -// CTRL_TOOLBAR, PART_BUTTON, -// Rectangle( Point(), aItemContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, -// aControlValue, ::rtl::OUString(), -// aBoundingRegion, aContentRegion -// ); - aContentRegion = Rectangle( Point( 1, 1 ), aItemContentSize ); - aBoundingRegion = Rectangle( Point( 0, 0 ), Size( aItemContentSize.Width() + 2, aItemContentSize.Height() + 2 ) ); - bNativeOK = true; - } - else if ( m_eRenderMode == NWF_TABBAR_ITEM ) - { - Rectangle aRotatedContentArea( Point(), aItemContentSize ); - aRotatedContentArea.Transpose(); - - TabitemValue tiValue; - ImplControlValue aControlValue( (void*)(&tiValue) ); - - bNativeOK = m_rTargetWindow.GetNativeControlRegion( - CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, - Rectangle( aRotatedContentArea ), - CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, - aControlValue, ::rtl::OUString(), - aBoundingRegion, aContentRegion - ); - OSL_ENSURE( bNativeOK, "VerticalItemLayout::CalculateItemSize: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - - Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); - Rectangle aContentRect( aContentRegion.GetBoundRect() ); - - impl_rotateFormation( aBoundingRect, aContentRect, m_bLeft ); - - aBoundingRegion = aBoundingRect; - aContentRegion = aContentRect; - } - - if ( bNativeOK ) - { - const Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); - - o_rContentArea = aContentRegion.GetBoundRect(); - o_rBoundingSize = aBoundingRect.GetSize(); - - // normalize the content area, it is assumed to be relative to a rectangle which starts - // at (0,0), and has a size of o_rBoundingSize. - o_rContentArea.Move( -aBoundingRect.Left(), -aBoundingRect.Top() ); - } - else - { - o_rContentArea = Rectangle( Point( 0, 0 ), aItemContentSize ); - o_rBoundingSize = aItemContentSize; - - // don't attempt native rendering, again. If it didn't work this time, it won't work in the future. - const_cast< VerticalItemLayout* >( this )->m_eRenderMode = VCL_BASED; - } - } - - //------------------------------------------------------------------------------------------------------------------ - Point VerticalItemLayout::GetNextItemPosition( const Rectangle& i_rPreviousItemArea ) const - { - Point aNewPos( i_rPreviousItemArea.BottomLeft() ); - aNewPos.Y() += ITEM_DISTANCE_PIXEL; - return aNewPos; - } - //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::impl_preRender( const Rectangle& i_rBoundingArea, const Rectangle& i_rContentArea, const ItemFlags& i_nItemFlags ) { @@ -413,16 +225,15 @@ namespace svt { VirtualDevice aRenderDevice( m_rTargetWindow ); - Rectangle aRotatedBoundingArea( i_rBoundingArea ); - Rectangle aRotatedContentArea( i_rContentArea ); - impl_rotateFormation( aRotatedBoundingArea, aRotatedContentArea, !m_bLeft ); + NormalizedArea aNormalized( i_rBoundingArea, true ); + const Rectangle aNormalizedBounds( aNormalized.getReference() ); + const Rectangle aNormalizedContent( aNormalized.getNormalized( i_rContentArea, m_bLeft ? TABS_LEFT : TABS_RIGHT ) ); - const Size aRotatedBoundingSize( aRotatedBoundingArea.GetSize() ); - aRenderDevice.SetOutputSizePixel( aRotatedBoundingSize ); + const Size aNormalizedBoundingSize( aNormalizedBounds.GetSize() ); + aRenderDevice.SetOutputSizePixel( aNormalizedBoundingSize ); - const Point aRotatedContentOffset( aRotatedContentArea.Left() - aRotatedBoundingArea.Left(), aRotatedContentArea.Top() - aRotatedBoundingArea.Top() ); - const Size aRotatedContentSize( aRotatedContentArea.GetSize() ); - const Region aCtrlRegion( Rectangle( aRotatedContentOffset, aRotatedContentSize ) ); + const Point aNormalizedContentOffset( aNormalizedContent.Left() - aNormalizedBounds.Left(), aNormalizedContent.Top() - aNormalizedBounds.Top() ); + const Region aCtrlRegion( Rectangle( aNormalizedContentOffset, aNormalizedContent.GetSize() ) ); TabitemValue tiValue; if ( i_nItemFlags & ITEM_POSITION_FIRST ) @@ -437,8 +248,10 @@ namespace svt OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... - BitmapEx aBitmap( aRenderDevice.GetBitmapEx( Point( 0, 0 ), Size( aRotatedBoundingSize.Width() - 1, aRotatedBoundingSize.Height() - 1 ) ) ); - aBitmap.Rotate( m_bLeft ? 900 : 2700, Color( COL_BLACK ) ); + BitmapEx aBitmap( aRenderDevice.GetBitmapEx( Point( 0, 0 ), Size( aNormalizedBoundingSize.Width() - 1, aNormalizedBoundingSize.Height() - 1 ) ) ); + aBitmap.Rotate( 2700, Color( COL_BLACK ) ); + if ( m_bLeft ) + aBitmap.Mirror( BMP_MIRROR_HORZ ); m_rTargetWindow.DrawBitmapEx( i_rBoundingArea.TopLeft(), aBitmap ); } @@ -563,16 +376,110 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::DrawItem( const PToolPanel& i_pPanel, const Point& i_rPosition, + void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, + const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const + { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::CalculateItemSize: illegal TabItemContent value!" ); + + const Image aImage( i_pPanel->GetImage() ); + const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); + + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); + + Size aItemContentSize; + if ( bUseImage ) + { + aItemContentSize = aImage.GetSizePixel(); + } + + if ( bUseText ) + { + if ( bUseImage ) + aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE; + + // add space for text + const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); + aItemContentSize.Width() += aTextSize.Width(); + aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() ); + + aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE; + } + + aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; + aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; + + Region aBoundingRegion, aContentRegion; + bool bNativeOK = false; + if ( m_eRenderMode == NWF_TOOLBAR_ITEM ) + { + // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. + // Instead, simply assume that both the content and the bounding region are the same. +// const ImplControlValue aControlValue; +// bNativeOK = m_rTargetWindow.GetNativeControlRegion( +// CTRL_TOOLBAR, PART_BUTTON, +// Rectangle( Point(), aItemContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, +// aControlValue, ::rtl::OUString(), +// aBoundingRegion, aContentRegion +// ); + aContentRegion = Rectangle( Point( 1, 1 ), aItemContentSize ); + aBoundingRegion = Rectangle( Point( 0, 0 ), Size( aItemContentSize.Width() + 2, aItemContentSize.Height() + 2 ) ); + bNativeOK = true; + } + else if ( m_eRenderMode == NWF_TABBAR_ITEM ) + { + TabitemValue tiValue; + ImplControlValue aControlValue( (void*)(&tiValue) ); + + bNativeOK = m_rTargetWindow.GetNativeControlRegion( + CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, + Rectangle( Point(), aItemContentSize ), + CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, + aControlValue, ::rtl::OUString(), + aBoundingRegion, aContentRegion + ); + OSL_ENSURE( bNativeOK, "VerticalItemLayout::CalculateItemSize: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); + } + + if ( bNativeOK ) + { + const Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); + + o_rContentArea = aContentRegion.GetBoundRect(); + o_rBoundingSize = aBoundingRect.GetSize(); + + // normalize the content area, it is assumed to be relative to a rectangle which starts + // at (0,0), and has a size of o_rBoundingSize. + o_rContentArea.Move( -aBoundingRect.Left(), -aBoundingRect.Top() ); + } + else + { + o_rContentArea = Rectangle( Point( 0, 0 ), aItemContentSize ); + o_rBoundingSize = aItemContentSize; + + // don't attempt native rendering, again. If it didn't work this time, it won't work in the future. + const_cast< VerticalItemLayout* >( this )->m_eRenderMode = VCL_BASED; + } + } + //------------------------------------------------------------------------------------------------------------------ + void VerticalItemLayout::DrawItem( const TabBarGeometry& i_rGeometry, const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) { + // calculate content and bounding size Rectangle aContentArea; Size aBoundingSize; CalculateItemSize( i_pPanel, i_eItemContent, aBoundingSize, aContentArea ); + // CalculateItemSize returns a normalized size, i.e. one assuming TABS_TOP + const NormalizedArea aNormalized( Rectangle( Point(), aBoundingSize ), false ); + aContentArea = aNormalized.getTransformed( aContentArea, i_rGeometry.getAlignment() ); + aBoundingSize = Size( aBoundingSize.Height(), aBoundingSize.Width() ); + + // move both rects to the given position aContentArea.Move( i_rPosition.X(), i_rPosition.Y() ); const Rectangle aBoundingArea( i_rPosition, aBoundingSize ); + // actually draw impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); impl_renderContent( i_pPanel, aContentArea, i_eItemContent ); impl_postRender( aBoundingArea, aContentArea, i_nItemFlags ); @@ -584,34 +491,7 @@ namespace svt class PanelTabBar_Data : public IToolPanelDeckListener { public: - PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :rTabBar( i_rTabBar ) - ,rPanelDeck( i_rPanelDeck ) - ,eAlignment( i_eAlignment ) - ,eTabItemContent( i_eItemContent ) - ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) - ,aHoveredItem() - ,aFocusedItem() - ,bMouseButtonDown( false ) - ,aItems() - ,bItemsDirty( true ) - { - OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), - "PanelTabBar_Data: unsupported alignment!" ); - - rPanelDeck.AddListener( *this ); - - if ( i_eAlignment == TABS_LEFT ) - { - aTopLeftSpace = Size( 2, 2 ); - aBottomRightSpace = Size( 1, 1 ); - } - else if ( i_eAlignment == TABS_RIGHT ) - { - aTopLeftSpace = Size( 1, 1 ); - aBottomRightSpace = Size( 2, 2 ); - } - } + PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); ~PanelTabBar_Data() { @@ -637,12 +517,20 @@ namespace svt virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); virtual void Dying(); + void UpdateScrollButtons() + { + m_aScrollBack.Enable( m_nScrollPosition > 0 ); + m_aScrollForward.Enable( m_nScrollPosition < aItems.size() - 1 ); + } + + protected: + DECL_LINK( OnScroll, const PushButton* ); + public: PanelTabBar& rTabBar; + TabBarGeometry aGeometry; IToolPanelDeck& rPanelDeck; - const TabAlignment eAlignment; - TabItemContent eTabItemContent; PItemsLayout pLayout; ::boost::optional< size_t > aHoveredItem; @@ -652,10 +540,65 @@ namespace svt ItemDescriptors aItems; bool bItemsDirty; - Size aTopLeftSpace; - Size aBottomRightSpace; + PushButton m_aScrollBack; + PushButton m_aScrollForward; + + size_t m_nScrollPosition; }; + //================================================================================================================== + //= PanelTabBar_Data - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelTabBar_Data::PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :rTabBar( i_rTabBar ) + ,aGeometry( i_eAlignment, i_eItemContent ) + ,rPanelDeck( i_rPanelDeck ) + ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) + ,aHoveredItem() + ,aFocusedItem() + ,bMouseButtonDown( false ) + ,aItems() + ,bItemsDirty( true ) + ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) + ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) + ,m_nScrollPosition( 0 ) + { + OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), + "PanelTabBar_Data: unsupported alignment!" ); + + rPanelDeck.AddListener( *this ); + + m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); + m_aScrollBack.Show(); + m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Data, OnScroll ) ); + + m_aScrollForward.SetSymbol( SYMBOL_ARROW_DOWN ); + m_aScrollForward.Show(); + m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Data, OnScroll ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( PanelTabBar_Data, OnScroll, const PushButton*, i_pButton ) + { + if ( i_pButton == &m_aScrollBack ) + { + OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Data::OnScroll: inconsistency!" ); + --m_nScrollPosition; + rTabBar.Invalidate(); + } + else if ( i_pButton == &m_aScrollForward ) + { + OSL_ENSURE( m_nScrollPosition < aItems.size() - 1, "PanelTabBar_Data::OnScroll: inconsistency!" ); + ++m_nScrollPosition; + rTabBar.Invalidate(); + } + + UpdateScrollButtons(); + + return 0L; + } + //================================================================================================================== //= helper //================================================================================================================== @@ -695,7 +638,7 @@ namespace svt { io_rData.aItems.resize(0); - Point aCompletePos( io_rData.aTopLeftSpace.Width(), io_rData.aTopLeftSpace.Height() ); + Point aCompletePos( io_rData.aGeometry.getFirstItemPosition() ); Point aIconOnlyPos( aCompletePos ); Point aTextOnlyPos( aCompletePos ); @@ -713,12 +656,15 @@ namespace svt Size aCompleteSize; io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_AND_TEXT, aCompleteSize, aContentArea ); + ::std::swap( aCompleteSize.Width(), aCompleteSize.Height() ); Size aIconOnlySize; io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_ONLY, aIconOnlySize, aContentArea ); + ::std::swap( aIconOnlySize.Width(), aIconOnlySize.Height() ); Size aTextOnlySize; io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_TEXT_ONLY, aTextOnlySize, aContentArea ); + ::std::swap( aTextOnlySize.Width(), aTextOnlySize.Height() ); // TODO: have one method calculating all sizes? @@ -728,9 +674,9 @@ namespace svt io_rData.aItems.push_back( aItem ); - aCompletePos = io_rData.pLayout->GetNextItemPosition( aItem.aCompleteArea ); - aIconOnlyPos = io_rData.pLayout->GetNextItemPosition( aItem.aIconOnlyArea ); - aTextOnlyPos = io_rData.pLayout->GetNextItemPosition( aItem.aTextOnlyArea ); + aCompletePos = aItem.aCompleteArea.BottomLeft(); + aIconOnlyPos = aItem.aIconOnlyArea.BottomLeft(); + aTextOnlyPos = aItem.aTextOnlyArea.BottomLeft(); } io_rData.bItemsDirty = false; @@ -749,17 +695,44 @@ namespace svt DBG_CHECK( io_rData ); } + //-------------------------------------------------------------------------------------------------------------- + Rectangle lcl_getActualItemRect( const PanelTabBar_Data& i_rData, const Rectangle& i_rLogicalItemRect ) + { + // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons + Rectangle aItemRect( i_rLogicalItemRect ); + + const TabBarGeometry& rGeometry( i_rData.aGeometry ); + aItemRect.Move( + rGeometry.isVertical() ? 0 : rGeometry.getItemsRect().Left() - rGeometry.getButtonBackRect().Left(), + rGeometry.isVertical() ? rGeometry.getItemsRect().Top() - rGeometry.getButtonBackRect().Top() : 0 + ); + + // care for the current scroll position + OSL_ENSURE( i_rData.m_nScrollPosition < i_rData.aItems.size(), "lcl_getActualItemRect: invalid scroll position!" ); + if ( ( i_rData.m_nScrollPosition > 0 ) && ( i_rData.m_nScrollPosition < i_rData.aItems.size() ) ) + { + long nOffsetX = i_rData.aItems[ i_rData.m_nScrollPosition ].GetCurrentRect().Left() - i_rData.aItems[ 0 ].GetCurrentRect().Left(); + long nOffsetY = i_rData.aItems[ i_rData.m_nScrollPosition ].GetCurrentRect().Top() - i_rData.aItems[ 0 ].GetCurrentRect().Top(); + aItemRect.Move( -nOffsetX, -nOffsetY ); + } + + return aItemRect; + } + //-------------------------------------------------------------------------------------------------------------- static ::boost::optional< size_t > lcl_findItemForPoint( const PanelTabBar_Data& i_rData, const Point& i_rPoint ) { + if ( !i_rData.aGeometry.getItemsRect().IsInside( i_rPoint ) ) + return ::boost::optional< size_t >(); + size_t i=0; for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); item != i_rData.aItems.end(); ++item, ++i ) { - const Rectangle& rItemRect( item->GetCurrentRect() ); - if ( rItemRect.IsInside( i_rPoint ) ) + Rectangle aItemRect( lcl_getActualItemRect( i_rData, item->GetCurrentRect() ) ); + if ( aItemRect.IsInside( i_rPoint ) ) { return ::boost::optional< size_t >( i ); } @@ -767,6 +740,26 @@ namespace svt return ::boost::optional< size_t >(); } + //-------------------------------------------------------------------------------------------------------------- + class ClipItemRegion + { + public: + ClipItemRegion( const PanelTabBar_Data& i_rData ) + :m_rDevice( i_rData.rTabBar ) + { + m_rDevice.Push( PUSH_CLIPREGION ); + m_rDevice.SetClipRegion( i_rData.aGeometry.getItemsRect() ); + } + + ~ClipItemRegion() + { + m_rDevice.Pop(); + } + + private: + OutputDevice& m_rDevice; + }; + //-------------------------------------------------------------------------------------------------------------- static void lcl_drawItem( const PanelTabBar_Data& i_rData, const size_t i_nItemIndex ) { @@ -792,60 +785,28 @@ namespace svt if ( i_rData.rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_LAST; + // the actual item pos might differ from the saved one, if we have scroll buttons + const Point aActualItemPos( lcl_getActualItemRect( i_rData, rItem.GetCurrentRect() ).TopLeft() ); + i_rData.rTabBar.SetUpdateMode( FALSE ); - i_rData.pLayout->DrawItem( rItem.pPanel, rItem.GetCurrentRect().TopLeft(), nItemFlags, rItem.eContent ); + i_rData.pLayout->DrawItem( i_rData.aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); i_rData.rTabBar.SetUpdateMode( TRUE ); } //-------------------------------------------------------------------------------------------------------------- - static void lcl_fitItems( PanelTabBar_Data& io_rData ) + static void lcl_relayout( PanelTabBar_Data& io_rData ) { - if ( io_rData.aItems.empty() ) - // nothing to do - return; + io_rData.aGeometry.relayout( io_rData.rTabBar.GetOutputSizePixel(), io_rData.aItems ); - TabItemContent eItemContent( io_rData.eTabItemContent ); - if ( io_rData.eTabItemContent == TABITEM_AUTO ) - { - // the available size - Size aOutputSize( io_rData.rTabBar.GetOutputSizePixel() ); - // shrunk by the outer space - aOutputSize.Width() -= io_rData.aBottomRightSpace.Width(); - aOutputSize.Height() -= io_rData.aBottomRightSpace.Height(); - const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); - - // the "content modes" to try - TabItemContent eTryThis[] = - { - TABITEM_IMAGE_ONLY, // assumed to have the smallest rects - TABITEM_TEXT_ONLY, - TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects - }; + const Rectangle& rButtonBack( io_rData.aGeometry.getButtonBackRect() ); + io_rData.m_aScrollBack.SetPosSizePixel( rButtonBack.TopLeft(), rButtonBack.GetSize() ); + io_rData.m_aScrollBack.Show( !rButtonBack.IsEmpty() ); + const Rectangle& rButtonForward( io_rData.aGeometry.getButtonForwardRect() ); + io_rData.m_aScrollForward.SetPosSizePixel( rButtonForward.TopLeft(), rButtonForward.GetSize() ); + io_rData.m_aScrollForward.Show( !rButtonForward.IsEmpty() ); - // determine which of the different version fits - eItemContent = eTryThis[0]; - size_t nTryIndex = 2; - while ( nTryIndex > 0 ) - { - const Point aBottomRight( io_rData.aItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); - if ( aFitInto.IsInside( aBottomRight ) ) - { - eItemContent = eTryThis[ nTryIndex ]; - break; - } - --nTryIndex; - } - } - - // propagate to the items - for ( ItemDescriptors::iterator item = io_rData.aItems.begin(); - item != io_rData.aItems.end(); - ++item - ) - { - item->eContent = eItemContent; - } + io_rData.UpdateScrollButtons(); } } @@ -857,6 +818,7 @@ namespace svt { lcl_ensureItemsCache( *this ); + ClipItemRegion aClipItems( *this ); if ( !!i_rOldActive ) lcl_drawItem( *this, *i_rOldActive ); if ( !!i_rNewActive ) @@ -866,7 +828,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Data::Dying() { - // TODO + // not interested in - the notifier is a member of this instance here, so we're dying ourself at the moment } //================================================================================================================== @@ -891,14 +853,14 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ TabItemContent PanelTabBar::GetTabItemContent() const { - return m_pData->eTabItemContent; + return m_pData->aGeometry.getItemContent(); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent ) { - m_pData->eTabItemContent = i_eItemContent; - lcl_fitItems( *m_pData ); + m_pData->aGeometry.setItemContent( i_eItemContent ); + lcl_relayout( *m_pData ); Invalidate(); } @@ -906,28 +868,14 @@ namespace svt Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { lcl_ensureItemsCache( *m_pData ); - - if ( m_pData->aItems.empty() ) - return Size( - m_pData->aTopLeftSpace.Width() + m_pData->aBottomRightSpace.Width(), - m_pData->aTopLeftSpace.Height() + m_pData->aBottomRightSpace.Height() - ); - - const bool bMinimalSize = ( i_eType == WINDOWSIZE_MINIMUM ); - // the rect of the last item - const Rectangle& rLastItemRect( bMinimalSize ? m_pData->aItems.rbegin()->aIconOnlyArea : m_pData->aItems.rbegin()->aCompleteArea ); - const Point aBottomRight( rLastItemRect.BottomRight() ); - return Size( - aBottomRight.X() + 1 + m_pData->aBottomRightSpace.Width(), - aBottomRight.Y() + 1 + m_pData->aBottomRightSpace.Height() - ); + return m_pData->aGeometry.getOptimalSize( m_pData->aItems, i_eType == WINDOWSIZE_MINIMUM ); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::Resize() { Control::Resize(); - lcl_fitItems( *m_pData ); + lcl_relayout( *m_pData ); } //------------------------------------------------------------------------------------------------------------------ @@ -938,6 +886,9 @@ namespace svt // background m_pData->pLayout->DrawBackground( Rectangle( Point(), GetOutputSizePixel() ) ); + // ensure the items really paint into their own playground only + ClipItemRegion aClipItems( *m_pData ); + // items size_t i=0; for ( ItemDescriptors::const_iterator item = m_pData->aItems.begin(); @@ -945,8 +896,8 @@ namespace svt ++item, ++i ) { - const Rectangle& rItemRect( item->GetCurrentRect() ); - if ( rItemRect.IsOver( i_rRect ) ) + Rectangle aItemRect( lcl_getActualItemRect( *m_pData, item->GetCurrentRect() ) ); + if ( aItemRect.IsOver( i_rRect ) ) { lcl_drawItem( *m_pData, i ); } @@ -968,15 +919,13 @@ namespace svt { m_pData->aHoveredItem = aNewItem; + ClipItemRegion aClipItems( *m_pData ); + if ( !!aOldItem ) - { lcl_drawItem( *m_pData, *aOldItem ); - } if ( !!aNewItem ) - { lcl_drawItem( *m_pData, *aNewItem ); - } } } @@ -997,6 +946,7 @@ namespace svt CaptureMouse(); m_pData->bMouseButtonDown = true; + ClipItemRegion aClipItems( *m_pData ); lcl_drawItem( *m_pData, *aHitItem ); } @@ -1016,6 +966,7 @@ namespace svt if ( !!aHitItem ) { // re-draw that item now that we're not in mouse-down mode anymore + ClipItemRegion aClipItems( *m_pData ); lcl_drawItem( *m_pData, *aHitItem ); // activate the respective panel m_pData->rPanelDeck.ActivatePanel( *aHitItem ); @@ -1054,6 +1005,7 @@ namespace svt if ( !!aActivePanel ) { m_pData->aFocusedItem = aActivePanel; + ClipItemRegion aClipItems( *m_pData ); lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); } } @@ -1066,8 +1018,12 @@ namespace svt ::boost::optional< size_t > aPreviouslyFocused( m_pData->aFocusedItem ); m_pData->aFocusedItem.reset(); + if ( !!aPreviouslyFocused ) + { + ClipItemRegion aClipItems( *m_pData ); lcl_drawItem( *m_pData, *aPreviouslyFocused ); + } } //------------------------------------------------------------------------------------------------------------------ @@ -1126,6 +1082,7 @@ namespace svt m_pData->aFocusedItem.reset( ( *m_pData->aFocusedItem + nPanelCount - 1 ) % nPanelCount ); } + ClipItemRegion aClipItems( *m_pData ); lcl_drawItem( *m_pData, nOldFocus ); lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); } diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx new file mode 100644 index 000000000000..9d682b141da5 --- /dev/null +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -0,0 +1,309 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "tabbargeometry.hxx" + +#include +#include +#include + +#include + +#include + +// the width (or height, depending on alignment) of the scroll buttons +#define BUTTON_FLOW_WIDTH 20 +// the space between the scroll buttons and the items +#define BUTTON_FLOW_SPACE 2 +// outer space to apply between the tab bar borders and any content. Note that those refer to a "normalized" geometry, +// i.e. if the tab bar were aligned at the top +#define OUTER_SPACE_LEFT 2 +#define OUTER_SPACE_TOP 4 +#define OUTER_SPACE_RIGHT 4 +#define OUTER_SPACE_BOTTOM 2 + +// outer space to apply between the area for the items, and the actual items. They refer to aligned geometry at the moment, +// they need to be adjusted once we support a horizontal tab bar +#define ITEMS_SPACE_LEFT 0 +#define ITEMS_SPACE_TOP 2 +#define ITEMS_SPACE_RIGHT 2 +#define ITEMS_SPACE_BOTTOM 4 + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + static void lcl_transform( Rectangle& io_rRect, const ::basegfx::B2DHomMatrix& i_rTransformation ) + { + ::basegfx::B2DRange aRect( io_rRect.Left(), io_rRect.Top(), io_rRect.Right(), io_rRect.Bottom() ); + aRect.transform( i_rTransformation ); + io_rRect.Left() = long( aRect.getMinX() ); + io_rRect.Top() = long( aRect.getMinY() ); + io_rRect.Right() = long( aRect.getMaxX() ); + io_rRect.Bottom() = long( aRect.getMaxY() ); + } + + //-------------------------------------------------------------------------------------------------------------- + /** transforms the given, possible rotated playground, + */ + void lcl_rotate( const Rectangle& i_rReference, Rectangle& io_rArea, const bool i_bRight ) + { + // step 1: move the to-be-upper-left corner (left/bottom) of the rectangle to (0,0) + ::basegfx::B2DHomMatrix aTransformation; + aTransformation.translate( + i_bRight ? -i_rReference.Left() : -i_rReference.Right(), + i_bRight ? -i_rReference.Bottom() : -i_rReference.Top() + ); + + // step 2: rotate by -90 degrees + aTransformation.rotate( i_bRight ? +F_PI2 : -F_PI2 ); + // note: + // on the screen, the ordinate goes top-down, while basegfx calculates in a system where the + // ordinate goes bottom-up; thus the "wrong" sign before F_PI2 here + + // step 3: move back to original coordinates + aTransformation.translate( i_rReference.Left(), i_rReference.Top() ); + + // apply transformation + lcl_transform( io_rArea, aTransformation ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void lcl_mirrorHorizontally( const Rectangle& i_rReferenceArea, Rectangle& io_rArea ) + { + io_rArea.Left() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Left(); + io_rArea.Right() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Right(); + ::std::swap( io_rArea.Left(), io_rArea.Right() ); + } + + //================================================================================================================== + //= NormalizedArea + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ) + :m_aReference( i_bIsVertical ? Rectangle( i_rReference.TopLeft(), Size( i_rReference.GetHeight(), i_rReference.GetWidth() ) ) : i_rReference ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const + { + OSL_ENSURE( ( i_eTargetAlignment == TABS_LEFT ) || ( i_eTargetAlignment == TABS_RIGHT ), + "NormalizedArea::getTransformed: unsupported alignment!" ); + + Rectangle aResult( i_rArea ); + + if ( ( i_eTargetAlignment == TABS_RIGHT ) + || ( i_eTargetAlignment == TABS_LEFT ) + ) + { + lcl_rotate( m_aReference, aResult, true ); + + if ( i_eTargetAlignment == TABS_LEFT ) + { + Rectangle aReference( m_aReference ); + aReference.Transpose(); + lcl_mirrorHorizontally( aReference, aResult ); + } + } + return aResult; + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle NormalizedArea::getNormalized( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const + { + OSL_ENSURE( ( i_eTargetAlignment == TABS_LEFT ) || ( i_eTargetAlignment == TABS_RIGHT ), + "NormalizedArea::gerNormalized: unsupported alignment!" ); + + Rectangle aResult( i_rArea ); + + if ( ( i_eTargetAlignment == TABS_RIGHT ) + || ( i_eTargetAlignment == TABS_LEFT ) + ) + { + Rectangle aReference( m_aReference ); + lcl_rotate( m_aReference, aReference, true ); + + if ( i_eTargetAlignment == TABS_LEFT ) + { + lcl_mirrorHorizontally( aReference, aResult ); + } + + lcl_rotate( aReference, aResult, false ); + } + return aResult; + } + + //================================================================================================================== + //= TabBarGeometry + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + TabBarGeometry::TabBarGeometry( const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :m_eTabAlignment( i_eAlignment ) + ,m_eTabItemContent( i_eItemContent ) + ,m_aNormalizedPlayground( Rectangle(), false ) + ,m_aButtonBackRect() + ,m_aItemsRect() + ,m_aButtonForwardRect() + { + } + + //------------------------------------------------------------------------------------------------------------------ + TabBarGeometry::~TabBarGeometry() + { + } + + namespace + { + //-------------------------------------------------------------------------------------------------------------- + static bool lcl_fitItems( const TabBarGeometry& i_rGeometry, ItemDescriptors& io_rItems ) + { + if ( io_rItems.empty() ) + // nothing to do, "no items" perfectly fit into any space we have ... + return true; + + // the available size + Size aOutputSize( i_rGeometry.getItemsRect().GetSize() ); + // shrunk by the outer space + aOutputSize.Width() -= ITEMS_SPACE_RIGHT; + aOutputSize.Height() -= ITEMS_SPACE_BOTTOM; + const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); + + TabItemContent eItemContent( i_rGeometry.getItemContent() ); + if ( eItemContent == TABITEM_AUTO ) + { + // the "content modes" to try + TabItemContent eTryThis[] = + { + TABITEM_IMAGE_ONLY, // assumed to have the smallest rects + TABITEM_TEXT_ONLY, + TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects + }; + + + // determine which of the different version fits + eItemContent = eTryThis[0]; + size_t nTryIndex = 2; + while ( nTryIndex > 0 ) + { + const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); + if ( aFitInto.IsInside( aBottomRight ) ) + { + eItemContent = eTryThis[ nTryIndex ]; + break; + } + --nTryIndex; + } + } + + // propagate to the items + for ( ItemDescriptors::iterator item = io_rItems.begin(); + item != io_rItems.end(); + ++item + ) + { + item->eContent = eItemContent; + } + + const ItemDescriptor& rLastItem( *io_rItems.rbegin() ); + const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() ); + return aFitInto.IsInside( aLastItemBottomRight ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Size TabBarGeometry::getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const + { + if ( io_rItems.empty() ) + return Size( + ITEMS_SPACE_LEFT + ITEMS_SPACE_RIGHT, + ITEMS_SPACE_TOP + ITEMS_SPACE_BOTTOM + ); + + // the rect of the last item + const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea ); + const Point aBottomRight( rLastItemRect.BottomRight() ); + return Size( + aBottomRight.X() + 1 + ITEMS_SPACE_RIGHT, + aBottomRight.Y() + 1 + ITEMS_SPACE_BOTTOM + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void TabBarGeometry::relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ) + { + m_aNormalizedPlayground = NormalizedArea( Rectangle( Point(), i_rActualOutputSize ), isVertical() ); + const Size aNormalizedSize( m_aNormalizedPlayground.getReferenceSize() ); + + // assume all items fit + Point aButtonBackPos( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); + m_aButtonBackRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonBackPos, Size( 1, 1 ) ), getAlignment() ); + m_aButtonBackRect.SetEmpty(); // do this after the transformation, it cannot cope with empty rects + + Point aButtonForwardPos( aNormalizedSize.Width(), OUTER_SPACE_TOP ); + m_aButtonForwardRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonForwardPos, Size( 1, 1 ) ), getAlignment() ); + m_aButtonBackRect.SetEmpty(); // do this after the transformation, it cannot cope with empty rects + + Point aItemsPos( OUTER_SPACE_LEFT, 0 ); + Size aItemsSize( aNormalizedSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, aNormalizedSize.Height() ); + m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); + + if ( !lcl_fitItems( *this, io_rItems ) ) + { + // assumption was wrong, the items do not fit => calculate rects for the scroll buttons + const Size aButtonSize( BUTTON_FLOW_WIDTH, aNormalizedSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM ); + + aButtonBackPos = Point( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); + m_aButtonBackRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonBackPos, aButtonSize ), m_eTabAlignment ); + + aButtonForwardPos = Point( aNormalizedSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP ); + m_aButtonForwardRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonForwardPos, aButtonSize ), m_eTabAlignment ); + + aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE; + aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X(); + m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Point TabBarGeometry::getFirstItemPosition() const + { + return Point( ITEMS_SPACE_LEFT, ITEMS_SPACE_TOP ); + } + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx new file mode 100644 index 000000000000..81343b254b6d --- /dev/null +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 TABBARGEOMETRY_HXX +#define TABBARGEOMETRY_HXX + +#include "svtools/toolpanel/tabalignment.hxx" + +#include "tabitemdescriptor.hxx" + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + //================================================================================================================== + //= NormalizedArea + //================================================================================================================== + /** a rectangle which automatically translates between unrotated and rotated geometry. + + It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects, + relative to its playground. + */ + class NormalizedArea + { + public: + NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ); + + /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment + @param i_rArea + the area which is to be transformed. + */ + Rectangle getTransformed( + const Rectangle& i_rArea, + const TabAlignment i_eTargetAlignment + ) const; + + /** normalizes an already transformed rectangle + @param i_rArea + the area which is to be normalized. + */ + Rectangle getNormalized( + const Rectangle& i_rArea, + const TabAlignment i_eTargetAlignment + ) const; + + + Size getReferenceSize() const { return m_aReference.GetSize(); } + const Rectangle& + getReference() const { return m_aReference; } + + private: + // the normalized reference area + Rectangle m_aReference; + }; + + //================================================================================================================== + //= TabBarGeometry + //================================================================================================================== + class TabBarGeometry_Impl; + class TabBarGeometry + { + public: + TabBarGeometry( const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); + ~TabBarGeometry(); + + // retrieves the rectangle to be occupied by the button for scrolling backward through the items + const Rectangle& getButtonBackRect() const { return m_aButtonBackRect; } + // retrieves the rectangle to be occupied by the items + const Rectangle& getItemsRect() const { return m_aItemsRect; } + // retrieves the rectangle to be occupied by the button for scrolling forward through the items + const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; } + + inline TabAlignment getAlignment() const { return m_eTabAlignment; } + + inline TabItemContent + getItemContent() const { return m_eTabItemContent; } + inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; } + + inline bool isVertical() const + { + return ( m_eTabAlignment == TABS_LEFT ) + || ( m_eTabAlignment == TABS_RIGHT ); + } + + inline Rectangle getTransformed( const Rectangle& i_rNormalizedRect ) const + { + return m_aNormalizedPlayground.getTransformed( i_rNormalizedRect, m_eTabAlignment ); + } + + /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items + */ + void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ); + + /** calculates the optimal size of the tab bar, depending on the item's sizes + */ + Size getOptimalSize( ItemDescriptors& io_rItems, const bool i_bMinimalSize ) const; + + /** retrieves the position where the first item should start, relative to the item rect + */ + Point getFirstItemPosition() const; + + private: + const TabAlignment m_eTabAlignment; + TabItemContent m_eTabItemContent; + NormalizedArea m_aNormalizedPlayground; + Rectangle m_aButtonBackRect; + Rectangle m_aItemsRect; + Rectangle m_aButtonForwardRect; + }; + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... + +#endif // TABBARGEOMETRY_HXX diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx new file mode 100644 index 000000000000..3de280a7c92f --- /dev/null +++ b/svtools/source/toolpanel/tabitemdescriptor.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef TABITEMDESCRIPTOR_HXX +#define TABITEMDESCRIPTOR_HXX + +#include "svtools/toolpanel/toolpanel.hxx" +#include "svtools/toolpanel/tabitemcontent.hxx" + +#include +#include + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + //================================================================================================================== + //= ItemDescriptor + //================================================================================================================== + struct ItemDescriptor + { + PToolPanel pPanel; + Rectangle aCompleteArea; + Rectangle aIconOnlyArea; + Rectangle aTextOnlyArea; + TabItemContent eContent; + // content to be used for this particular item. Might differ from item content which has been set + // up for the complete control, in case not the complete content fits into the available space. + + ItemDescriptor() + :pPanel() + ,aCompleteArea() + ,aIconOnlyArea() + ,aTextOnlyArea() + ,eContent( TABITEM_IMAGE_AND_TEXT ) + { + } + + const Rectangle& GetRect( const TabItemContent i_eItemContent ) const + { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" ); + + return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT ) + ? aCompleteArea + : ( ( i_eItemContent == TABITEM_TEXT_ONLY ) + ? aTextOnlyArea + : aIconOnlyArea + ); + } + + const Rectangle& GetCurrentRect() const + { + return GetRect( eContent ); + } + }; + + typedef ::std::vector< ItemDescriptor > ItemDescriptors; + + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // TABITEMDESCRIPTOR_HXX diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 60755a55b516..972d330141e5 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -597,6 +597,7 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.ActivatePanel( 0 ); m_aToolPanelDeck.Show(); -- cgit From 1cfeb64544c8cc832127a50847de049ef126cadb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 12:37:14 +0100 Subject: slidecopy: do not draw a background at the tab bar in NWF_TABBAR_ITEM mode, VCL's default behaviour is better here --- svtools/source/toolpanel/paneltabbar.cxx | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index f50dfb1c3ff0..647e31c66762 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -232,6 +232,7 @@ namespace svt const Size aNormalizedBoundingSize( aNormalizedBounds.GetSize() ); aRenderDevice.SetOutputSizePixel( aNormalizedBoundingSize ); + // draw the actual item const Point aNormalizedContentOffset( aNormalizedContent.Left() - aNormalizedBounds.Left(), aNormalizedContent.Top() - aNormalizedBounds.Top() ); const Region aCtrlRegion( Rectangle( aNormalizedContentOffset, aNormalizedContent.GetSize() ) ); @@ -248,8 +249,9 @@ namespace svt OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... + // copy content over to the target window BitmapEx aBitmap( aRenderDevice.GetBitmapEx( Point( 0, 0 ), Size( aNormalizedBoundingSize.Width() - 1, aNormalizedBoundingSize.Height() - 1 ) ) ); - aBitmap.Rotate( 2700, Color( COL_BLACK ) ); + aBitmap.Rotate( 2700, COL_BLACK ); if ( m_bLeft ) aBitmap.Mirror( BMP_MIRROR_HORZ ); @@ -357,18 +359,10 @@ namespace svt break; case NWF_TABBAR_ITEM: - { - ControlState nState( 0 ); - if ( m_rTargetWindow.IsEnabled() ) - nState |= CTRL_STATE_ENABLED; - if ( m_rTargetWindow.HasChildPathFocus() ) - nState |= CTRL_STATE_FOCUSED; - - bNativeOK = m_rTargetWindow.IsNativeControlSupported( CTRL_TAB_PANE, PART_ENTIRE_CONTROL ) - && m_rTargetWindow.DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, i_rArea, nState, - ImplControlValue(), rtl::OUString() ); - } - break; + bNativeOK = true; + // don't draw any background. The default behavior of VCL windows - draw a dialog face color - + // is completely sufficient here. + break; } if ( !bNativeOK ) -- cgit From 34028753e61c25a796fded5055fb64453b711f2f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 13:06:08 +0100 Subject: slidecopy: when calculating the item insets, take the tab bar alignment into account --- svtools/source/toolpanel/paneltabbar.cxx | 5 +- svtools/source/toolpanel/tabbargeometry.cxx | 134 ++++++++++++++++------------ svtools/source/toolpanel/tabbargeometry.hxx | 26 ++++++ 3 files changed, 105 insertions(+), 60 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 647e31c66762..7357b7440ba8 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -88,11 +88,12 @@ namespace svt defines which content to draw on the tab item @param o_rBoundingSize contains, upon return, the overall size needed to render the item, including possible decorations which are - not available for the item content + not available for the item content. The rectangle is in normalized form, i.e. assuming that + the tab bar is aligned at top. @param o_rContentArea contains, upon return, the area which is available to render the item content. It lies completely within an assuming bounding rectangle, which starts at corrdinates (0, 0), and has the size returned - in o_rBoundingSize. + in o_rBoundingSize. The rectangle is in normalized form, i.e. assuming that the tab bar is aligned at top. */ virtual void CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const = 0; diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index 9d682b141da5..ce5a45a0eb08 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -47,12 +47,11 @@ #define OUTER_SPACE_RIGHT 4 #define OUTER_SPACE_BOTTOM 2 -// outer space to apply between the area for the items, and the actual items. They refer to aligned geometry at the moment, -// they need to be adjusted once we support a horizontal tab bar -#define ITEMS_SPACE_LEFT 0 -#define ITEMS_SPACE_TOP 2 -#define ITEMS_SPACE_RIGHT 2 -#define ITEMS_SPACE_BOTTOM 4 +// outer space to apply between the area for the items, and the actual items. They refer to a normalized geometry. +#define ITEMS_INSET_LEFT 2 +#define ITEMS_INSET_TOP 2 +#define ITEMS_INSET_RIGHT 4 +#define ITEMS_INSET_BOTTOM 0 //...................................................................................................................... namespace svt @@ -174,11 +173,29 @@ namespace svt TabBarGeometry::TabBarGeometry( const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :m_eTabAlignment( i_eAlignment ) ,m_eTabItemContent( i_eItemContent ) + ,m_aItemsInset() ,m_aNormalizedPlayground( Rectangle(), false ) ,m_aButtonBackRect() ,m_aItemsRect() ,m_aButtonForwardRect() { + // calculate the items' inset + const Rectangle aArtificial( Point( 0, 0 ), Size( 10, 10 ) ); + const Rectangle aInsetRect( + Point( ITEMS_INSET_LEFT, ITEMS_INSET_TOP ), + Size( + aArtificial.GetWidth() - ITEMS_INSET_LEFT - ITEMS_INSET_RIGHT, + aArtificial.GetHeight() - ITEMS_INSET_TOP - ITEMS_INSET_BOTTOM + ) + ); + + const NormalizedArea aNormalized( aArtificial, false ); + const Rectangle aTransformedInner( aNormalized.getTransformed( aInsetRect, getAlignment() ) ); + + m_aItemsInset.nLeft = aTransformedInner.Left() - aNormalized.getReference().Left(); + m_aItemsInset.nTop = aTransformedInner.Top() - aNormalized.getReference().Top() ; + m_aItemsInset.nRight = aNormalized.getReference().Right() - aTransformedInner.Right() ; + m_aItemsInset.nBottom = aNormalized.getReference().Bottom() - aTransformedInner.Bottom() ; } //------------------------------------------------------------------------------------------------------------------ @@ -186,62 +203,59 @@ namespace svt { } - namespace + //------------------------------------------------------------------------------------------------------------------ + bool TabBarGeometry::impl_fitItems( ItemDescriptors& io_rItems ) const { - //-------------------------------------------------------------------------------------------------------------- - static bool lcl_fitItems( const TabBarGeometry& i_rGeometry, ItemDescriptors& io_rItems ) + if ( io_rItems.empty() ) + // nothing to do, "no items" perfectly fit into any space we have ... + return true; + + // the available size + Size aOutputSize( getItemsRect().GetSize() ); + // shrunk by the outer space + aOutputSize.Width() -= m_aItemsInset.nRight; + aOutputSize.Height() -= m_aItemsInset.nBottom; + const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); + + TabItemContent eItemContent( getItemContent() ); + if ( eItemContent == TABITEM_AUTO ) { - if ( io_rItems.empty() ) - // nothing to do, "no items" perfectly fit into any space we have ... - return true; - - // the available size - Size aOutputSize( i_rGeometry.getItemsRect().GetSize() ); - // shrunk by the outer space - aOutputSize.Width() -= ITEMS_SPACE_RIGHT; - aOutputSize.Height() -= ITEMS_SPACE_BOTTOM; - const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); - - TabItemContent eItemContent( i_rGeometry.getItemContent() ); - if ( eItemContent == TABITEM_AUTO ) + // the "content modes" to try + TabItemContent eTryThis[] = { - // the "content modes" to try - TabItemContent eTryThis[] = - { - TABITEM_IMAGE_ONLY, // assumed to have the smallest rects - TABITEM_TEXT_ONLY, - TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects - }; + TABITEM_IMAGE_ONLY, // assumed to have the smallest rects + TABITEM_TEXT_ONLY, + TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects + }; - // determine which of the different version fits - eItemContent = eTryThis[0]; - size_t nTryIndex = 2; - while ( nTryIndex > 0 ) + // determine which of the different version fits + eItemContent = eTryThis[0]; + size_t nTryIndex = 2; + while ( nTryIndex > 0 ) + { + const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); + if ( aFitInto.IsInside( aBottomRight ) ) { - const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); - if ( aFitInto.IsInside( aBottomRight ) ) - { - eItemContent = eTryThis[ nTryIndex ]; - break; - } - --nTryIndex; + eItemContent = eTryThis[ nTryIndex ]; + break; } + --nTryIndex; } + } - // propagate to the items - for ( ItemDescriptors::iterator item = io_rItems.begin(); - item != io_rItems.end(); - ++item - ) - { - item->eContent = eItemContent; - } - - const ItemDescriptor& rLastItem( *io_rItems.rbegin() ); - const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() ); - return aFitInto.IsInside( aLastItemBottomRight ); + // propagate to the items + for ( ItemDescriptors::iterator item = io_rItems.begin(); + item != io_rItems.end(); + ++item + ) + { + item->eContent = eItemContent; } + + const ItemDescriptor& rLastItem( *io_rItems.rbegin() ); + const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() ); + return aFitInto.IsInside( aLastItemBottomRight ); } //------------------------------------------------------------------------------------------------------------------ @@ -249,16 +263,16 @@ namespace svt { if ( io_rItems.empty() ) return Size( - ITEMS_SPACE_LEFT + ITEMS_SPACE_RIGHT, - ITEMS_SPACE_TOP + ITEMS_SPACE_BOTTOM + m_aItemsInset.nLeft + m_aItemsInset.nRight, + m_aItemsInset.nTop + m_aItemsInset.nBottom ); // the rect of the last item const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea ); const Point aBottomRight( rLastItemRect.BottomRight() ); return Size( - aBottomRight.X() + 1 + ITEMS_SPACE_RIGHT, - aBottomRight.Y() + 1 + ITEMS_SPACE_BOTTOM + aBottomRight.X() + 1 + m_aItemsInset.nRight, + aBottomRight.Y() + 1 + m_aItemsInset.nBottom ); } @@ -281,7 +295,7 @@ namespace svt Size aItemsSize( aNormalizedSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, aNormalizedSize.Height() ); m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); - if ( !lcl_fitItems( *this, io_rItems ) ) + if ( !impl_fitItems( io_rItems ) ) { // assumption was wrong, the items do not fit => calculate rects for the scroll buttons const Size aButtonSize( BUTTON_FLOW_WIDTH, aNormalizedSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM ); @@ -295,13 +309,17 @@ namespace svt aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE; aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X(); m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); + + // fit items, again. In the TABITEM_AUTO case, the smaller playground for the items might lead to another + // item content. + impl_fitItems( io_rItems ); } } //------------------------------------------------------------------------------------------------------------------ Point TabBarGeometry::getFirstItemPosition() const { - return Point( ITEMS_SPACE_LEFT, ITEMS_SPACE_TOP ); + return Point( m_aItemsInset.nLeft, m_aItemsInset.nTop ); } //...................................................................................................................... diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx index 81343b254b6d..57bf3422cf8e 100644 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -79,6 +79,25 @@ namespace svt Rectangle m_aReference; }; + //================================================================================================================== + //= Inset + //================================================================================================================== + struct Inset + { + long nLeft; + long nRight; + long nTop; + long nBottom; + + Inset() + :nLeft(0) + ,nRight(0) + ,nTop(0) + ,nBottom(0) + { + } + }; + //================================================================================================================== //= TabBarGeometry //================================================================================================================== @@ -126,8 +145,15 @@ namespace svt Point getFirstItemPosition() const; private: + bool impl_fitItems( ItemDescriptors& io_rItems ) const; + + private: + /// specifies the alignment of the tab bar const TabAlignment m_eTabAlignment; + /// specifies the content to be displayed in the tab items TabItemContent m_eTabItemContent; + /// specifies the inset to be used in the items area, depends on the actual alignment + Inset m_aItemsInset; NormalizedArea m_aNormalizedPlayground; Rectangle m_aButtonBackRect; Rectangle m_aItemsRect; -- cgit From 4c969b1be929c1fadee8f12dfde761b5d8060f20 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 13:10:33 +0100 Subject: slidecopy: update scroll buttons upon panel insertion/removal --- svtools/source/toolpanel/paneltabbar.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 7357b7440ba8..4cf3a7ab8779 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -500,13 +500,18 @@ namespace svt (void)i_nPosition; bItemsDirty = true; rTabBar.Invalidate(); + + UpdateScrollButtons(); } virtual void PanelRemoved( const size_t i_nPosition ) { - (void)i_nPosition; bItemsDirty = true; rTabBar.Invalidate(); + + if ( i_nPosition <= m_nScrollPosition ) + --m_nScrollPosition; + UpdateScrollButtons(); } virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); -- cgit From 16132767ef827fcd5e63d80566ba1e4238324d99 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 14:05:35 +0100 Subject: slidecopy: properly update scroll position when a panel is removed --- svtools/source/toolpanel/paneltabbar.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 4cf3a7ab8779..d204e6875722 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -509,7 +509,7 @@ namespace svt bItemsDirty = true; rTabBar.Invalidate(); - if ( i_nPosition <= m_nScrollPosition ) + if ( i_nPosition < m_nScrollPosition ) --m_nScrollPosition; UpdateScrollButtons(); } -- cgit From 6312e2a0f20db579f72fd297db308acbe290381a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 14:29:01 +0100 Subject: slidecopy: also relayout when panels are inserted/removed, this might affect the availability of scroll buttons / changed the data structure to an impl class --- svtools/source/toolpanel/paneltabbar.cxx | 526 ++++++++++++++++--------------- svtools/source/toolpanel/paneltabbar.hxx | 4 +- 2 files changed, 270 insertions(+), 260 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index d204e6875722..641eb65721de 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -481,14 +481,14 @@ namespace svt } //================================================================================================================== - //= PanelTabBar_Data + //= PanelTabBar_Impl //================================================================================================================== - class PanelTabBar_Data : public IToolPanelDeckListener + class PanelTabBar_Impl : public IToolPanelDeckListener { public: - PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); + PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); - ~PanelTabBar_Data() + ~PanelTabBar_Impl() { rPanelDeck.RemoveListener( *this ); } @@ -501,7 +501,7 @@ namespace svt bItemsDirty = true; rTabBar.Invalidate(); - UpdateScrollButtons(); + Relayout(); } virtual void PanelRemoved( const size_t i_nPosition ) @@ -511,7 +511,8 @@ namespace svt if ( i_nPosition < m_nScrollPosition ) --m_nScrollPosition; - UpdateScrollButtons(); + + Relayout(); } virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); @@ -523,9 +524,17 @@ namespace svt m_aScrollForward.Enable( m_nScrollPosition < aItems.size() - 1 ); } + void Relayout(); + void EnsureItemsCache(); + ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; + void DrawItem( const size_t i_nItemIndex ) const; + Rectangle GetActualItemRect( const Rectangle& i_rLogicalItemRect ) const; + protected: DECL_LINK( OnScroll, const PushButton* ); + void impl_calcItemRects(); + public: PanelTabBar& rTabBar; TabBarGeometry aGeometry; @@ -546,59 +555,6 @@ namespace svt size_t m_nScrollPosition; }; - //================================================================================================================== - //= PanelTabBar_Data - implementation - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - PanelTabBar_Data::PanelTabBar_Data( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :rTabBar( i_rTabBar ) - ,aGeometry( i_eAlignment, i_eItemContent ) - ,rPanelDeck( i_rPanelDeck ) - ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) - ,aHoveredItem() - ,aFocusedItem() - ,bMouseButtonDown( false ) - ,aItems() - ,bItemsDirty( true ) - ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) - ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) - ,m_nScrollPosition( 0 ) - { - OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), - "PanelTabBar_Data: unsupported alignment!" ); - - rPanelDeck.AddListener( *this ); - - m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); - m_aScrollBack.Show(); - m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Data, OnScroll ) ); - - m_aScrollForward.SetSymbol( SYMBOL_ARROW_DOWN ); - m_aScrollForward.Show(); - m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Data, OnScroll ) ); - } - - //------------------------------------------------------------------------------------------------------------------ - IMPL_LINK( PanelTabBar_Data, OnScroll, const PushButton*, i_pButton ) - { - if ( i_pButton == &m_aScrollBack ) - { - OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Data::OnScroll: inconsistency!" ); - --m_nScrollPosition; - rTabBar.Invalidate(); - } - else if ( i_pButton == &m_aScrollForward ) - { - OSL_ENSURE( m_nScrollPosition < aItems.size() - 1, "PanelTabBar_Data::OnScroll: inconsistency!" ); - ++m_nScrollPosition; - rTabBar.Invalidate(); - } - - UpdateScrollButtons(); - - return 0L; - } - //================================================================================================================== //= helper //================================================================================================================== @@ -606,18 +562,18 @@ namespace svt { //-------------------------------------------------------------------------------------------------------------- #if OSL_DEBUG_LEVEL > 0 - static void lcl_checkConsistency( const PanelTabBar_Data& i_rData ) + static void lcl_checkConsistency( const PanelTabBar_Impl& i_rImpl ) { - if ( !i_rData.bItemsDirty ) + if ( !i_rImpl.bItemsDirty ) { - if ( i_rData.rPanelDeck.GetPanelCount() != i_rData.aItems.size() ) + if ( i_rImpl.rPanelDeck.GetPanelCount() != i_rImpl.aItems.size() ) { OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" ); return; } - for ( size_t i = 0; i < i_rData.rPanelDeck.GetPanelCount(); ++i ) + for ( size_t i = 0; i < i_rImpl.rPanelDeck.GetPanelCount(); ++i ) { - if ( i_rData.rPanelDeck.GetPanel( i ).get() != i_rData.aItems[i].pPanel.get() ) + if ( i_rImpl.rPanelDeck.GetPanel( i ).get() != i_rImpl.aItems[i].pPanel.get() ) { OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" ); return; @@ -634,199 +590,253 @@ namespace svt #endif //-------------------------------------------------------------------------------------------------------------- - static void lcl_calcItemRects( PanelTabBar_Data& io_rData ) + class ClipItemRegion { - io_rData.aItems.resize(0); - - Point aCompletePos( io_rData.aGeometry.getFirstItemPosition() ); - Point aIconOnlyPos( aCompletePos ); - Point aTextOnlyPos( aCompletePos ); + public: + ClipItemRegion( const PanelTabBar_Impl& i_rImpl ) + :m_rDevice( i_rImpl.rTabBar ) + { + m_rDevice.Push( PUSH_CLIPREGION ); + m_rDevice.SetClipRegion( i_rImpl.aGeometry.getItemsRect() ); + } - for ( size_t i = 0; - i < io_rData.rPanelDeck.GetPanelCount(); - ++i - ) + ~ClipItemRegion() { - PToolPanel pPanel( io_rData.rPanelDeck.GetPanel( i ) ); + m_rDevice.Pop(); + } - ItemDescriptor aItem; - aItem.pPanel = pPanel; + private: + OutputDevice& m_rDevice; + }; + } - Rectangle aContentArea; + //================================================================================================================== + //= PanelTabBar_Impl - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :rTabBar( i_rTabBar ) + ,aGeometry( i_eAlignment, i_eItemContent ) + ,rPanelDeck( i_rPanelDeck ) + ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) + ,aHoveredItem() + ,aFocusedItem() + ,bMouseButtonDown( false ) + ,aItems() + ,bItemsDirty( true ) + ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) + ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) + ,m_nScrollPosition( 0 ) + { + OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), + "PanelTabBar_Impl: unsupported alignment!" ); - Size aCompleteSize; - io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_AND_TEXT, aCompleteSize, aContentArea ); - ::std::swap( aCompleteSize.Width(), aCompleteSize.Height() ); + rPanelDeck.AddListener( *this ); - Size aIconOnlySize; - io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_ONLY, aIconOnlySize, aContentArea ); - ::std::swap( aIconOnlySize.Width(), aIconOnlySize.Height() ); + m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); + m_aScrollBack.Show(); + m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - Size aTextOnlySize; - io_rData.pLayout->CalculateItemSize( pPanel, TABITEM_TEXT_ONLY, aTextOnlySize, aContentArea ); - ::std::swap( aTextOnlySize.Width(), aTextOnlySize.Height() ); + m_aScrollForward.SetSymbol( SYMBOL_ARROW_DOWN ); + m_aScrollForward.Show(); + m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + } - // TODO: have one method calculating all sizes? + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::impl_calcItemRects() + { + aItems.resize(0); - aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); - aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); - aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); + Point aCompletePos( aGeometry.getFirstItemPosition() ); + Point aIconOnlyPos( aCompletePos ); + Point aTextOnlyPos( aCompletePos ); - io_rData.aItems.push_back( aItem ); + for ( size_t i = 0; + i < rPanelDeck.GetPanelCount(); + ++i + ) + { + PToolPanel pPanel( rPanelDeck.GetPanel( i ) ); - aCompletePos = aItem.aCompleteArea.BottomLeft(); - aIconOnlyPos = aItem.aIconOnlyArea.BottomLeft(); - aTextOnlyPos = aItem.aTextOnlyArea.BottomLeft(); - } + ItemDescriptor aItem; + aItem.pPanel = pPanel; - io_rData.bItemsDirty = false; - } + Rectangle aContentArea; - //-------------------------------------------------------------------------------------------------------------- - static void lcl_ensureItemsCache( PanelTabBar_Data& io_rData ) - { - if ( io_rData.bItemsDirty == false ) - { - DBG_CHECK( io_rData ); - return; - } - lcl_calcItemRects( io_rData ); - OSL_POSTCOND( io_rData.bItemsDirty == false, "lcl_ensureItemsCache: cache still dirty!" ); - DBG_CHECK( io_rData ); - } + Size aCompleteSize; + pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_AND_TEXT, aCompleteSize, aContentArea ); + ::std::swap( aCompleteSize.Width(), aCompleteSize.Height() ); - //-------------------------------------------------------------------------------------------------------------- - Rectangle lcl_getActualItemRect( const PanelTabBar_Data& i_rData, const Rectangle& i_rLogicalItemRect ) - { - // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons - Rectangle aItemRect( i_rLogicalItemRect ); + Size aIconOnlySize; + pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_ONLY, aIconOnlySize, aContentArea ); + ::std::swap( aIconOnlySize.Width(), aIconOnlySize.Height() ); - const TabBarGeometry& rGeometry( i_rData.aGeometry ); - aItemRect.Move( - rGeometry.isVertical() ? 0 : rGeometry.getItemsRect().Left() - rGeometry.getButtonBackRect().Left(), - rGeometry.isVertical() ? rGeometry.getItemsRect().Top() - rGeometry.getButtonBackRect().Top() : 0 - ); + Size aTextOnlySize; + pLayout->CalculateItemSize( pPanel, TABITEM_TEXT_ONLY, aTextOnlySize, aContentArea ); + ::std::swap( aTextOnlySize.Width(), aTextOnlySize.Height() ); - // care for the current scroll position - OSL_ENSURE( i_rData.m_nScrollPosition < i_rData.aItems.size(), "lcl_getActualItemRect: invalid scroll position!" ); - if ( ( i_rData.m_nScrollPosition > 0 ) && ( i_rData.m_nScrollPosition < i_rData.aItems.size() ) ) - { - long nOffsetX = i_rData.aItems[ i_rData.m_nScrollPosition ].GetCurrentRect().Left() - i_rData.aItems[ 0 ].GetCurrentRect().Left(); - long nOffsetY = i_rData.aItems[ i_rData.m_nScrollPosition ].GetCurrentRect().Top() - i_rData.aItems[ 0 ].GetCurrentRect().Top(); - aItemRect.Move( -nOffsetX, -nOffsetY ); - } + // TODO: have one method calculating all sizes? + + aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); + aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); + aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); + + aItems.push_back( aItem ); - return aItemRect; + aCompletePos = aItem.aCompleteArea.BottomLeft(); + aIconOnlyPos = aItem.aIconOnlyArea.BottomLeft(); + aTextOnlyPos = aItem.aTextOnlyArea.BottomLeft(); } - //-------------------------------------------------------------------------------------------------------------- - static ::boost::optional< size_t > lcl_findItemForPoint( const PanelTabBar_Data& i_rData, const Point& i_rPoint ) + bItemsDirty = false; + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex ) const + { + const ItemDescriptor& rItem( aItems[ i_nItemIndex ] ); + + ItemFlags nItemFlags( ITEM_STATE_NORMAL ); + if ( aHoveredItem == i_nItemIndex ) { - if ( !i_rData.aGeometry.getItemsRect().IsInside( i_rPoint ) ) - return ::boost::optional< size_t >(); - - size_t i=0; - for ( ItemDescriptors::const_iterator item = i_rData.aItems.begin(); - item != i_rData.aItems.end(); - ++item, ++i - ) - { - Rectangle aItemRect( lcl_getActualItemRect( i_rData, item->GetCurrentRect() ) ); - if ( aItemRect.IsInside( i_rPoint ) ) - { - return ::boost::optional< size_t >( i ); - } - } - return ::boost::optional< size_t >(); + nItemFlags |= ITEM_STATE_HOVERED; + if ( bMouseButtonDown ) + nItemFlags |= ITEM_STATE_ACTIVE; } - //-------------------------------------------------------------------------------------------------------------- - class ClipItemRegion - { - public: - ClipItemRegion( const PanelTabBar_Data& i_rData ) - :m_rDevice( i_rData.rTabBar ) - { - m_rDevice.Push( PUSH_CLIPREGION ); - m_rDevice.SetClipRegion( i_rData.aGeometry.getItemsRect() ); - } + if ( rPanelDeck.GetActivePanel() == i_nItemIndex ) + nItemFlags |= ITEM_STATE_ACTIVE; - ~ClipItemRegion() - { - m_rDevice.Pop(); - } + if ( aFocusedItem == i_nItemIndex ) + nItemFlags |= ITEM_STATE_FOCUSED; - private: - OutputDevice& m_rDevice; - }; + if ( 0 == i_nItemIndex ) + nItemFlags |= ITEM_POSITION_FIRST; - //-------------------------------------------------------------------------------------------------------------- - static void lcl_drawItem( const PanelTabBar_Data& i_rData, const size_t i_nItemIndex ) + if ( rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) + nItemFlags |= ITEM_POSITION_LAST; + + // the actual item pos might differ from the saved one, if we have scroll buttons + const Point aActualItemPos( GetActualItemRect( rItem.GetCurrentRect() ).TopLeft() ); + + rTabBar.SetUpdateMode( FALSE ); + pLayout->DrawItem( aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); + rTabBar.SetUpdateMode( TRUE ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::EnsureItemsCache() + { + if ( bItemsDirty == false ) { - const ItemDescriptor& rItem( i_rData.aItems[ i_nItemIndex ] ); + DBG_CHECK( *this ); + return; + } + impl_calcItemRects(); + OSL_POSTCOND( bItemsDirty == false, "EnsureItemsCache: cache still dirty!" ); + DBG_CHECK( *this ); + } - ItemFlags nItemFlags( ITEM_STATE_NORMAL ); - if ( i_rData.aHoveredItem == i_nItemIndex ) - { - nItemFlags |= ITEM_STATE_HOVERED; - if ( i_rData.bMouseButtonDown ) - nItemFlags |= ITEM_STATE_ACTIVE; - } + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::Relayout() + { + EnsureItemsCache(); - if ( i_rData.rPanelDeck.GetActivePanel() == i_nItemIndex ) - nItemFlags |= ITEM_STATE_ACTIVE; + aGeometry.relayout( rTabBar.GetOutputSizePixel(), aItems ); - if ( i_rData.aFocusedItem == i_nItemIndex ) - nItemFlags |= ITEM_STATE_FOCUSED; + const Rectangle& rButtonBack( aGeometry.getButtonBackRect() ); + m_aScrollBack.SetPosSizePixel( rButtonBack.TopLeft(), rButtonBack.GetSize() ); + m_aScrollBack.Show( !rButtonBack.IsEmpty() ); - if ( 0 == i_nItemIndex ) - nItemFlags |= ITEM_POSITION_FIRST; + const Rectangle& rButtonForward( aGeometry.getButtonForwardRect() ); + m_aScrollForward.SetPosSizePixel( rButtonForward.TopLeft(), rButtonForward.GetSize() ); + m_aScrollForward.Show( !rButtonForward.IsEmpty() ); - if ( i_rData.rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) - nItemFlags |= ITEM_POSITION_LAST; + UpdateScrollButtons(); + } - // the actual item pos might differ from the saved one, if we have scroll buttons - const Point aActualItemPos( lcl_getActualItemRect( i_rData, rItem.GetCurrentRect() ).TopLeft() ); + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > PanelTabBar_Impl::FindItemForPoint( const Point& i_rPoint ) const + { + if ( !aGeometry.getItemsRect().IsInside( i_rPoint ) ) + return ::boost::optional< size_t >(); - i_rData.rTabBar.SetUpdateMode( FALSE ); - i_rData.pLayout->DrawItem( i_rData.aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); - i_rData.rTabBar.SetUpdateMode( TRUE ); + size_t i=0; + for ( ItemDescriptors::const_iterator item = aItems.begin(); + item != aItems.end(); + ++item, ++i + ) + { + Rectangle aItemRect( GetActualItemRect( item->GetCurrentRect() ) ); + if ( aItemRect.IsInside( i_rPoint ) ) + { + return ::boost::optional< size_t >( i ); + } } - - //-------------------------------------------------------------------------------------------------------------- - static void lcl_relayout( PanelTabBar_Data& io_rData ) + return ::boost::optional< size_t >(); + } + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) + { + if ( i_pButton == &m_aScrollBack ) + { + OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" ); + --m_nScrollPosition; + rTabBar.Invalidate(); + } + else if ( i_pButton == &m_aScrollForward ) { - io_rData.aGeometry.relayout( io_rData.rTabBar.GetOutputSizePixel(), io_rData.aItems ); + OSL_ENSURE( m_nScrollPosition < aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); + ++m_nScrollPosition; + rTabBar.Invalidate(); + } - const Rectangle& rButtonBack( io_rData.aGeometry.getButtonBackRect() ); - io_rData.m_aScrollBack.SetPosSizePixel( rButtonBack.TopLeft(), rButtonBack.GetSize() ); - io_rData.m_aScrollBack.Show( !rButtonBack.IsEmpty() ); + UpdateScrollButtons(); - const Rectangle& rButtonForward( io_rData.aGeometry.getButtonForwardRect() ); - io_rData.m_aScrollForward.SetPosSizePixel( rButtonForward.TopLeft(), rButtonForward.GetSize() ); - io_rData.m_aScrollForward.Show( !rButtonForward.IsEmpty() ); + return 0L; + } - io_rData.UpdateScrollButtons(); + //------------------------------------------------------------------------------------------------------------------ + Rectangle PanelTabBar_Impl::GetActualItemRect( const Rectangle& i_rLogicalItemRect ) const + { + // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons + Rectangle aItemRect( i_rLogicalItemRect ); + + const TabBarGeometry& rGeometry( aGeometry ); + aItemRect.Move( + rGeometry.isVertical() ? 0 : rGeometry.getItemsRect().Left() - rGeometry.getButtonBackRect().Left(), + rGeometry.isVertical() ? rGeometry.getItemsRect().Top() - rGeometry.getButtonBackRect().Top() : 0 + ); + + // care for the current scroll position + OSL_ENSURE( m_nScrollPosition < aItems.size(), "GetActualItemRect: invalid scroll position!" ); + if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < aItems.size() ) ) + { + long nOffsetX = aItems[ m_nScrollPosition ].GetCurrentRect().Left() - aItems[ 0 ].GetCurrentRect().Left(); + long nOffsetY = aItems[ m_nScrollPosition ].GetCurrentRect().Top() - aItems[ 0 ].GetCurrentRect().Top(); + aItemRect.Move( -nOffsetX, -nOffsetY ); } + + return aItemRect; } //================================================================================================================== - //= PanelTabBar_Data + //= PanelTabBar_Impl //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - void PanelTabBar_Data::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + void PanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { - lcl_ensureItemsCache( *this ); + EnsureItemsCache(); ClipItemRegion aClipItems( *this ); if ( !!i_rOldActive ) - lcl_drawItem( *this, *i_rOldActive ); + DrawItem( *i_rOldActive ); if ( !!i_rNewActive ) - lcl_drawItem( *this, *i_rNewActive ); + DrawItem( *i_rNewActive ); } //------------------------------------------------------------------------------------------------------------------ - void PanelTabBar_Data::Dying() + void PanelTabBar_Impl::Dying() { // not interested in - the notifier is a member of this instance here, so we're dying ourself at the moment } @@ -837,9 +847,9 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ PanelTabBar::PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :Control( &i_rParentWindow, 0 ) - ,m_pData( new PanelTabBar_Data( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) + ,m_pImpl( new PanelTabBar_Impl( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { - DBG_CHECK( *m_pData ); + DBG_CHECK( *m_pImpl ); SetLineColor(); SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); @@ -853,53 +863,53 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ TabItemContent PanelTabBar::GetTabItemContent() const { - return m_pData->aGeometry.getItemContent(); + return m_pImpl->aGeometry.getItemContent(); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent ) { - m_pData->aGeometry.setItemContent( i_eItemContent ); - lcl_relayout( *m_pData ); + m_pImpl->aGeometry.setItemContent( i_eItemContent ); + m_pImpl->Relayout(); Invalidate(); } //------------------------------------------------------------------------------------------------------------------ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { - lcl_ensureItemsCache( *m_pData ); - return m_pData->aGeometry.getOptimalSize( m_pData->aItems, i_eType == WINDOWSIZE_MINIMUM ); + m_pImpl->EnsureItemsCache(); + return m_pImpl->aGeometry.getOptimalSize( m_pImpl->aItems, i_eType == WINDOWSIZE_MINIMUM ); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::Resize() { Control::Resize(); - lcl_relayout( *m_pData ); + m_pImpl->Relayout(); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::Paint( const Rectangle& i_rRect ) { - lcl_ensureItemsCache( *m_pData ); + m_pImpl->EnsureItemsCache(); // background - m_pData->pLayout->DrawBackground( Rectangle( Point(), GetOutputSizePixel() ) ); + m_pImpl->pLayout->DrawBackground( Rectangle( Point(), GetOutputSizePixel() ) ); // ensure the items really paint into their own playground only - ClipItemRegion aClipItems( *m_pData ); + ClipItemRegion aClipItems( *m_pImpl ); // items size_t i=0; - for ( ItemDescriptors::const_iterator item = m_pData->aItems.begin(); - item != m_pData->aItems.end(); + for ( ItemDescriptors::const_iterator item = m_pImpl->aItems.begin(); + item != m_pImpl->aItems.end(); ++item, ++i ) { - Rectangle aItemRect( lcl_getActualItemRect( *m_pData, item->GetCurrentRect() ) ); + Rectangle aItemRect( m_pImpl->GetActualItemRect( item->GetCurrentRect() ) ); if ( aItemRect.IsOver( i_rRect ) ) { - lcl_drawItem( *m_pData, i ); + m_pImpl->DrawItem( i ); } } } @@ -907,25 +917,25 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent ) { - lcl_ensureItemsCache( *m_pData ); + m_pImpl->EnsureItemsCache(); - ::boost::optional< size_t > aOldItem( m_pData->aHoveredItem ); - ::boost::optional< size_t > aNewItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + ::boost::optional< size_t > aOldItem( m_pImpl->aHoveredItem ); + ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( i_rMouseEvent.IsLeaveWindow() ) aNewItem.reset(); if ( aOldItem != aNewItem ) { - m_pData->aHoveredItem = aNewItem; + m_pImpl->aHoveredItem = aNewItem; - ClipItemRegion aClipItems( *m_pData ); + ClipItemRegion aClipItems( *m_pImpl ); if ( !!aOldItem ) - lcl_drawItem( *m_pData, *aOldItem ); + m_pImpl->DrawItem( *aOldItem ); if ( !!aNewItem ) - lcl_drawItem( *m_pData, *aNewItem ); + m_pImpl->DrawItem( *aNewItem ); } } @@ -937,17 +947,17 @@ namespace svt if ( !i_rMouseEvent.IsLeft() ) return; - lcl_ensureItemsCache( *m_pData ); + m_pImpl->EnsureItemsCache(); - ::boost::optional< size_t > aHitItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( !aHitItem ) return; CaptureMouse(); - m_pData->bMouseButtonDown = true; + m_pImpl->bMouseButtonDown = true; - ClipItemRegion aClipItems( *m_pData ); - lcl_drawItem( *m_pData, *aHitItem ); + ClipItemRegion aClipItems( *m_pImpl ); + m_pImpl->DrawItem( *aHitItem ); } //------------------------------------------------------------------------------------------------------------------ @@ -955,21 +965,21 @@ namespace svt { Control::MouseButtonUp( i_rMouseEvent ); - if ( m_pData->bMouseButtonDown ) + if ( m_pImpl->bMouseButtonDown ) { OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); if ( IsMouseCaptured() ) ReleaseMouse(); - m_pData->bMouseButtonDown = false; + m_pImpl->bMouseButtonDown = false; - ::boost::optional< size_t > aHitItem( lcl_findItemForPoint( *m_pData, i_rMouseEvent.GetPosPixel() ) ); + ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( !!aHitItem ) { // re-draw that item now that we're not in mouse-down mode anymore - ClipItemRegion aClipItems( *m_pData ); - lcl_drawItem( *m_pData, *aHitItem ); + ClipItemRegion aClipItems( *m_pImpl ); + m_pImpl->DrawItem( *aHitItem ); // activate the respective panel - m_pData->rPanelDeck.ActivatePanel( *aHitItem ); + m_pImpl->rPanelDeck.ActivatePanel( *aHitItem ); } } } @@ -977,13 +987,13 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent ) { - lcl_ensureItemsCache( *m_pData ); + m_pImpl->EnsureItemsCache(); - ::boost::optional< size_t > aHelpItem( lcl_findItemForPoint( *m_pData, ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) ); + ::boost::optional< size_t > aHelpItem( m_pImpl->FindItemForPoint( ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) ); if ( !aHelpItem ) return; - const ItemDescriptor& rItem( m_pData->aItems[ *aHelpItem ] ); + const ItemDescriptor& rItem( m_pImpl->aItems[ *aHelpItem ] ); if ( rItem.eContent != TABITEM_IMAGE_ONLY ) // if the text is displayed for the item, we do not need to show it as tooltip return; @@ -999,14 +1009,14 @@ namespace svt void PanelTabBar::GetFocus() { Control::GetFocus(); - if ( m_pData->rPanelDeck.GetPanelCount() ) + if ( m_pImpl->rPanelDeck.GetPanelCount() ) { - ::boost::optional< size_t > aActivePanel( m_pData->rPanelDeck.GetActivePanel() ); + ::boost::optional< size_t > aActivePanel( m_pImpl->rPanelDeck.GetActivePanel() ); if ( !!aActivePanel ) { - m_pData->aFocusedItem = aActivePanel; - ClipItemRegion aClipItems( *m_pData ); - lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + m_pImpl->aFocusedItem = aActivePanel; + ClipItemRegion aClipItems( *m_pImpl ); + m_pImpl->DrawItem( *m_pImpl->aFocusedItem ); } } } @@ -1016,13 +1026,13 @@ namespace svt { Control::LoseFocus(); - ::boost::optional< size_t > aPreviouslyFocused( m_pData->aFocusedItem ); - m_pData->aFocusedItem.reset(); + ::boost::optional< size_t > aPreviouslyFocused( m_pImpl->aFocusedItem ); + m_pImpl->aFocusedItem.reset(); if ( !!aPreviouslyFocused ) { - ClipItemRegion aClipItems( *m_pData ); - lcl_drawItem( *m_pData, *aPreviouslyFocused ); + ClipItemRegion aClipItems( *m_pImpl ); + m_pImpl->DrawItem( *aPreviouslyFocused ); } } @@ -1037,11 +1047,11 @@ namespace svt return; // if there are less than 2 panels, we cannot travel them ... - const size_t nPanelCount( m_pData->rPanelDeck.GetPanelCount() ); + const size_t nPanelCount( m_pImpl->rPanelDeck.GetPanelCount() ); if ( nPanelCount < 2 ) return; - OSL_PRECOND( !!m_pData->aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); + OSL_PRECOND( !!m_pImpl->aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); // if we get KeyInput events, we should have the focus. In this case, aFocusedItem should not be empty, // except if there are no panels, but then we bail out of this method here earlier ... @@ -1065,26 +1075,26 @@ namespace svt bFocusNext = true; break; case KEY_RETURN: - m_pData->rPanelDeck.ActivatePanel( *m_pData->aFocusedItem ); + m_pImpl->rPanelDeck.ActivatePanel( *m_pImpl->aFocusedItem ); break; } if ( !bFocusNext && !bFocusPrev ) return; - const size_t nOldFocus = *m_pData->aFocusedItem; + const size_t nOldFocus = *m_pImpl->aFocusedItem; if ( bFocusNext ) { - m_pData->aFocusedItem.reset( ( *m_pData->aFocusedItem + 1 ) % nPanelCount ); + m_pImpl->aFocusedItem.reset( ( *m_pImpl->aFocusedItem + 1 ) % nPanelCount ); } else { - m_pData->aFocusedItem.reset( ( *m_pData->aFocusedItem + nPanelCount - 1 ) % nPanelCount ); + m_pImpl->aFocusedItem.reset( ( *m_pImpl->aFocusedItem + nPanelCount - 1 ) % nPanelCount ); } - ClipItemRegion aClipItems( *m_pData ); - lcl_drawItem( *m_pData, nOldFocus ); - lcl_drawItem( *m_pData, *m_pData->aFocusedItem ); + ClipItemRegion aClipItems( *m_pImpl ); + m_pImpl->DrawItem( nOldFocus ); + m_pImpl->DrawItem( *m_pImpl->aFocusedItem ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index b01f75785c0f..ea2890e4cd36 100644 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -38,7 +38,7 @@ namespace svt { //........................................................................ - class PanelTabBar_Data; + class PanelTabBar_Impl; //==================================================================== //= PanelTabBar @@ -72,7 +72,7 @@ namespace svt virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent ); private: - ::std::auto_ptr< PanelTabBar_Data > m_pData; + ::std::auto_ptr< PanelTabBar_Impl > m_pImpl; }; //........................................................................ -- cgit From baf5177a6baa57ce5c16ba7a9b1be8b7ccb4f9e2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 14:35:13 +0100 Subject: slidecopy: test program support for interactive insertion of panels --- svtools/workben/toolpanel/makefile.mk | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 129 ++++++++++++++++++++++++++-- 2 files changed, 121 insertions(+), 9 deletions(-) diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk index 68050083412f..6f2c9e3c6e87 100644 --- a/svtools/workben/toolpanel/makefile.mk +++ b/svtools/workben/toolpanel/makefile.mk @@ -60,6 +60,7 @@ APP1STDLIBS=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(BASEGFXLIB) \ + $(SVTOOLLIB) \ .IF "$(GUI)"!="UNX" diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 972d330141e5..53304b4e71e8 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -26,6 +26,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" +#include "svtools/ctrlbox.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" @@ -131,6 +132,7 @@ class ColoredPanel : public IToolPanel { public: ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ); + ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName ); ~ColoredPanel(); // IToolPanel @@ -168,6 +170,18 @@ ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_ m_aPanelIcon.Erase( i_rColor ); } +//----------------------------------------------------------------------------- +ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName ) + :m_refCount(0) + ,m_aWindow( i_rParent, i_rColor ) + ,m_aPanelName( i_rPanelName ) + ,m_aPanelIcon() +{ + Bitmap aBitmap( Size( 16, 16 ), 8 ); + m_aPanelIcon = BitmapEx( aBitmap ); + m_aPanelIcon.Erase( i_rColor ); +} + //----------------------------------------------------------------------------- ColoredPanel::~ColoredPanel() { @@ -257,9 +271,11 @@ private: DECL_LINK( OnListEntrySelected, ListBox* ); DECL_LINK( OnListEntryDoubleClicked, ListBox* ); DECL_LINK( OnButtonClicked, PushButton* ); + DECL_LINK( OnEditModified, Edit* ); void impl_initPanelList(); void impl_updateRemoveButton(); + void impl_updateInsertButton(); private: FixedLine m_aAlignmentHeader; @@ -274,6 +290,9 @@ private: FixedLine m_aPanelsHeader; ListBox m_aPanelList; PushButton m_aRemovePanel; + ColorListBox m_aColors; + Edit m_aNewPanelName; + PushButton m_aInsertPanel; }; //============================================================================= @@ -295,6 +314,7 @@ public: // member access IToolPanelDeck& GetToolPanelDeck(); + PToolPanel CreateToolPanel( const Color& i_rColor, const String& i_rPanelName ); protected: virtual void GetFocus(); @@ -321,17 +341,40 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) ,m_aPanelsHeader( this ) ,m_aPanelList( this ) ,m_aRemovePanel( this ) + ,m_aColors( this, WB_DROPDOWN ) + ,m_aNewPanelName( this, WB_BORDER ) + ,m_aInsertPanel( this ) { SetBorderStyle( WINDOW_BORDER_MONO ); + + m_aColors.InsertEntry( Color( COL_BLACK ), String( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) ); + m_aColors.InsertEntry( Color( COL_BLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) ); + m_aColors.InsertEntry( Color( COL_GREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) ); + m_aColors.InsertEntry( Color( COL_CYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) ); + m_aColors.InsertEntry( Color( COL_RED ), String( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) ); + m_aColors.InsertEntry( Color( COL_MAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) ); + m_aColors.InsertEntry( Color( COL_BROWN ), String( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) ); + m_aColors.InsertEntry( Color( COL_GRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTGRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTBLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTGREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTCYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTRED ), String( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTMAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) ); + m_aColors.InsertEntry( Color( COL_YELLOW ), String( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) ); + m_aColors.InsertEntry( Color( COL_WHITE ), String( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) ); + m_aColors.SetDropDownLineCount( 16 ); + Window* pControls[] = { &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, - &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, &m_aRemovePanel + &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, &m_aRemovePanel, &m_aColors, + &m_aNewPanelName, &m_aInsertPanel }; const sal_Char* pTexts[] = { "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic", - "Panels", "", "Remove Panel" + "Panels", "", "Remove Panel", "", "", "Insert Panel" }; for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i ) { @@ -343,7 +386,7 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) if ( eWindowType == WINDOW_RADIOBUTTON ) static_cast< RadioButton* >( pControls[i] )->SetToggleHdl( LINK( this, OptionsWindow, OnRadioToggled ) ); - if ( eWindowType == WINDOW_LISTBOX ) + if ( eWindowType == WINDOW_LISTBOX ) { static_cast< ListBox* >( pControls[i] )->SetSelectHdl( LINK( this, OptionsWindow, OnListEntrySelected ) ); static_cast< ListBox* >( pControls[i] )->SetDoubleClickHdl( LINK( this, OptionsWindow, OnListEntryDoubleClicked ) ); @@ -353,6 +396,11 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) { static_cast< PushButton* >( pControls[i] )->SetClickHdl( LINK( this, OptionsWindow, OnButtonClicked ) ); } + + if ( eWindowType == WINDOW_EDIT ) + { + static_cast< Edit* >( pControls[i] )->SetModifyHdl( LINK( this, OptionsWindow, OnEditModified ) ); + } } m_aAlignRight.Check(); @@ -366,6 +414,12 @@ OptionsWindow::~OptionsWindow() { } +//----------------------------------------------------------------------------- +void OptionsWindow::impl_updateInsertButton() +{ + m_aInsertPanel.Enable( ( m_aColors.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) && ( m_aNewPanelName.GetText().Len() > 0 ) ); +} + //----------------------------------------------------------------------------- void OptionsWindow::impl_updateRemoveButton() { @@ -388,6 +442,7 @@ void OptionsWindow::impl_initPanelList() ActivePanelChanged( ::boost::optional< size_t >(), rPanelDeck.GetActivePanel() ); impl_updateRemoveButton(); + impl_updateInsertButton(); rPanelDeck.AddListener( *this ); } @@ -430,7 +485,9 @@ void OptionsWindow::Resize() const Size aSpacing( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); const long nIndent( LogicToPixel( Size( 6, 9 ), MAP_APPFONT ).Width() ); - const long nLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() ); + const long nFixedLineHeight( LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height() ); + const long nEditLineHeight( LogicToPixel( Size( 0, 12 ), MAP_APPFONT ).Height() ); + const long nButtonLineHeight( LogicToPixel( Size( 0, 14 ), MAP_APPFONT ).Height() ); const long nSuperordinateWidth = aOutputSize.Width() - 2 * aSpacing.Width(); const long nSuperordinateX = aSpacing.Width(); @@ -464,8 +521,11 @@ void OptionsWindow::Resize() ControlRow( m_aTextOnly, true ), ControlRow( m_aAutomaticContent, true ), ControlRow( m_aPanelsHeader, false ), - ControlRow( m_aPanelList, true, 8 ), - ControlRow( m_aRemovePanel, true, 2 ) + ControlRow( m_aPanelList, true, 6 ), + ControlRow( m_aRemovePanel, true ), + ControlRow( m_aColors, true ), + ControlRow( m_aNewPanelName, true ), + ControlRow( m_aInsertPanel, true ) }; bool bPreviousWasSubordinate = false; for ( size_t i=0; i < sizeof( aControlRows ) / sizeof( aControlRows[0] ); ++i ) @@ -476,9 +536,25 @@ void OptionsWindow::Resize() aItemPos.Y() += aSpacing.Height(); bPreviousWasSubordinate = aControlRows[i].bSubordinate; + // height depends on the window type + const WindowType eWindowType = aControlRows[i].pWindow->GetType(); + long nControlHeight( nFixedLineHeight ); + if ( ( eWindowType == WINDOW_EDIT ) + || ( eWindowType == WINDOW_LISTBOX ) + ) + { + nControlHeight = nEditLineHeight; + } + else + if ( ( eWindowType == WINDOW_PUSHBUTTON ) + ) + { + nControlHeight = nButtonLineHeight; + } + Size aControlSize( aControlRows[i].bSubordinate ? nSubordinateWidth : nSuperordinateWidth, - nLineHeight * aControlRows[i].nRows + nControlHeight * aControlRows[i].nRows ); aControlRows[i].pWindow->SetPosSizePixel( aItemPos, aControlSize ); @@ -517,9 +593,17 @@ void OptionsWindow::Dying() } //----------------------------------------------------------------------------- -IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, /*i_pListBox*/ ) +IMPL_LINK( OptionsWindow, OnListEntrySelected, ListBox*, i_pListBox ) { - impl_updateRemoveButton(); + if ( i_pListBox == &m_aColors ) + { + m_aNewPanelName.SetText( m_aColors.GetEntry( m_aColors.GetSelectEntryPos() ) ); + impl_updateInsertButton(); + } + else if ( i_pListBox == &m_aPanelList ) + { + impl_updateRemoveButton(); + } return 0L; } @@ -536,6 +620,18 @@ IMPL_LINK( OptionsWindow, OnListEntryDoubleClicked, ListBox*, i_pListBox ) return 0L; } + +//----------------------------------------------------------------------------- +IMPL_LINK( OptionsWindow, OnEditModified, Edit*, i_pEdit ) +{ + if ( i_pEdit && &m_aNewPanelName ) + { + impl_updateInsertButton(); + } + + return 0L; +} + //----------------------------------------------------------------------------- IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton ) { @@ -545,6 +641,15 @@ IMPL_LINK( OptionsWindow, OnButtonClicked, PushButton*, i_pPushButton ) { rController.GetToolPanelDeck().RemovePanel( size_t( m_aPanelList.GetSelectEntryPos() ) ); } + else if ( i_pPushButton == &m_aInsertPanel ) + { + PToolPanel pNewPanel( rController.CreateToolPanel( m_aColors.GetEntryColor( m_aColors.GetSelectEntryPos() ), m_aNewPanelName.GetText() ) ); + + ::boost::optional< size_t > aActivePanel( rController.GetToolPanelDeck().GetActivePanel() ); + size_t nNewPanelPos = !aActivePanel ? rController.GetToolPanelDeck().GetPanelCount() : *aActivePanel + 1; + + rController.GetToolPanelDeck().InsertPanel( pNewPanel, nNewPanelPos ); + } return 0L; } @@ -670,6 +775,12 @@ IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck() return m_aToolPanelDeck; } +//----------------------------------------------------------------------------- +PToolPanel PanelDemoMainWindow::CreateToolPanel( const Color& i_rColor, const String& i_rPanelName ) +{ + return PToolPanel( new ColoredPanel( m_aToolPanelDeck, i_rColor, i_rPanelName ) ); +} + //============================================================================= //= PanelDemo //============================================================================= -- cgit From eb505e54fa8bced9e5f41fdd4535ea93c098309d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 14:35:45 +0100 Subject: slidecopy: fixed color names --- svtools/workben/toolpanel/toolpaneltest.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 53304b4e71e8..61a1aac27fc3 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -355,12 +355,12 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) m_aColors.InsertEntry( Color( COL_MAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) ); m_aColors.InsertEntry( Color( COL_BROWN ), String( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) ); m_aColors.InsertEntry( Color( COL_GRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTGRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTBLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTGREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTCYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTRED ), String( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) ); - m_aColors.InsertEntry( Color( COL_LIGHTMAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTGRAY ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Gray" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTBLUE ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Blue" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTGREEN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Green" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTCYAN ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Cyan" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTRED ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Red" ) ) ); + m_aColors.InsertEntry( Color( COL_LIGHTMAGENTA ), String( RTL_CONSTASCII_USTRINGPARAM( "Light Magenta" ) ) ); m_aColors.InsertEntry( Color( COL_YELLOW ), String( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) ); m_aColors.InsertEntry( Color( COL_WHITE ), String( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) ); m_aColors.SetDropDownLineCount( 16 ); -- cgit From 0a231a49a8844f4a673dd84010ebfdbc76949238 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 14:42:30 +0100 Subject: slidecopy: link the toolpanel lib into the svtools lib --- svtools/prj/build.lst | 2 +- svtools/util/makefile.mk | 45 ++++++++++++++++++----------------- svtools/workben/toolpanel/makefile.mk | 1 - 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index a71d30487bb4..9ce50aafcd70 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -27,4 +27,4 @@ st svtools\util nmake - all st_util st__brw st__ctr st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL -st svtools\workben\toolpanel nmake - all st_workben_toolpanel st_toolpanel NULL +st svtools\workben\toolpanel nmake - all st_workben_toolpanel st_util st_toolpanel NULL diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 22be04f95d3f..1113c7ffd240 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -52,29 +52,30 @@ LIB2TARGET= $(LB)$/svtool.lib LIB2FILES= $(LB)$/_svt.lib .ENDIF -LIB1TARGET= $(SLB)$/svt.lib +LIB1TARGET= $(SLB)/svt.lib LIB1FILES= \ - $(SLB)$/browse.lib \ - $(SLB)$/config.lib \ - $(SLB)$/svcontnr.lib \ - $(SLB)$/ctrl.lib \ - $(SLB)$/dialogs.lib \ - $(SLB)$/edit.lib \ - $(SLB)$/filter.lib \ - $(SLB)$/filter.uno.lib \ - $(SLB)$/igif.lib \ - $(SLB)$/jpeg.lib \ - $(SLB)$/ixpm.lib \ - $(SLB)$/ixbm.lib \ - $(SLB)$/wmf.lib \ - $(SLB)$/java.lib \ - $(SLB)$/misc.lib \ - $(SLB)$/plugapp.lib \ - $(SLB)$/svhtml.lib \ - $(SLB)$/svrtf.lib \ - $(SLB)$/table.lib \ - $(SLB)$/unoiface.lib \ - $(SLB)$/urlobj.lib + $(SLB)/browse.lib \ + $(SLB)/config.lib \ + $(SLB)/svcontnr.lib \ + $(SLB)/ctrl.lib \ + $(SLB)/dialogs.lib \ + $(SLB)/edit.lib \ + $(SLB)/filter.lib \ + $(SLB)/filter.uno.lib \ + $(SLB)/igif.lib \ + $(SLB)/jpeg.lib \ + $(SLB)/ixpm.lib \ + $(SLB)/ixbm.lib \ + $(SLB)/wmf.lib \ + $(SLB)/java.lib \ + $(SLB)/misc.lib \ + $(SLB)/plugapp.lib \ + $(SLB)/svhtml.lib \ + $(SLB)/svrtf.lib \ + $(SLB)/table.lib \ + $(SLB)/unoiface.lib \ + $(SLB)/urlobj.lib \ + $(SLB)/toolpanel.lib # generation of resourcen-lib ---------------------------------------- diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk index 6f2c9e3c6e87..279638a23e2c 100644 --- a/svtools/workben/toolpanel/makefile.mk +++ b/svtools/workben/toolpanel/makefile.mk @@ -50,7 +50,6 @@ OBJFILES= $(OBJ)$/toolpaneltest.obj APP1TARGET= $(TARGET) APP1OBJS= $(OBJFILES) -APP1LIBS= $(SLB)/toolpanel.lib APP1STDLIBS=\ $(VCLLIB) \ $(UCBHELPERLIB) \ -- cgit From 72925bad05ebd705b6859fd525589b66938b0dbf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 15:51:48 +0100 Subject: slidecopy: visibility --- svtools/inc/svtools/toolpanel/tablayouter.hxx | 5 +++-- svtools/inc/svtools/toolpanel/toolpanel.hxx | 4 +++- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 4a09fd565ca3..1bcb0f8b47f9 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -27,6 +27,7 @@ #ifndef TABLAYOUTER_HXX #define TABLAYOUTER_HXX +#include "svtools/svtdllapi.h" #include "svtools/toolpanel/decklayouter.hxx" #include "svtools/toolpanel/tabalignment.hxx" #include "svtools/toolpanel/tabitemcontent.hxx" @@ -46,8 +47,8 @@ namespace svt //==================================================================== //= TabDeckLayouter //==================================================================== - class TabDeckLayouter :public RefBase - ,public IDeckLayouter + class SVT_DLLPUBLIC TabDeckLayouter :public RefBase + ,public IDeckLayouter { public: /** creates a new layouter diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index 760b59f40255..acb27e8ec067 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -27,6 +27,8 @@ #ifndef TOOLPANEL_HXX #define TOOLPANEL_HXX +#include "svtools/svtdllapi.h" + #include #include @@ -44,7 +46,7 @@ namespace svt //==================================================================== /** abstract interface for a single tool panel */ - class IToolPanel : public ::rtl::IReference + class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference { public: /// retrieves the display name of the panel diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index eb83fbefef10..d11767885af1 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -27,6 +27,7 @@ #ifndef TOOLPANELDECK_HXX #define TOOLPANELDECK_HXX +#include "svtools/svtdllapi.h" #include "svtools/toolpanel/toolpanel.hxx" #include "svtools/toolpanel/decklayouter.hxx" @@ -70,7 +71,7 @@ namespace svt //==================================================================== //= IToolPanelDeck //==================================================================== - class SAL_NO_VTABLE IToolPanelDeck + class SVT_DLLPUBLIC IToolPanelDeck { public: /** returns the number of panels in the container @@ -85,7 +86,7 @@ namespace svt /** returns the number of the currently active panel. */ virtual ::boost::optional< size_t > - GetActivePanel() const; + GetActivePanel() const = 0; /** activates the panel with the given number. If the given number is larger or equal to the number of panels in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored. @@ -115,8 +116,8 @@ namespace svt //==================================================================== //= ToolPanelDeck //==================================================================== - class ToolPanelDeck :public Control - ,public IToolPanelDeck + class SVT_DLLPUBLIC ToolPanelDeck :public Control + ,public IToolPanelDeck { public: ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle ); -- cgit From c4007b3b84756d4a721c90ba47785fdf8d50a007 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 8 Mar 2010 22:28:30 +0100 Subject: slidecopy: make TabDeckLayouter class non-copyable, to be able to compile the whole thing with MSVC --- svtools/inc/svtools/toolpanel/tablayouter.hxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 1bcb0f8b47f9..c5f41717aab7 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -35,6 +35,8 @@ #include +#include + //........................................................................ namespace svt { @@ -49,6 +51,7 @@ namespace svt //==================================================================== class SVT_DLLPUBLIC TabDeckLayouter :public RefBase ,public IDeckLayouter + ,public ::boost::noncopyable { public: /** creates a new layouter -- cgit From a3cfa3c7fe52422a1df4a6b55ab33a80e38bbcea Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 10:25:36 +0100 Subject: slidecopy: less colors --- svtools/workben/toolpanel/makefile.mk | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/svtools/workben/toolpanel/makefile.mk b/svtools/workben/toolpanel/makefile.mk index 279638a23e2c..e64e3cd8eccd 100644 --- a/svtools/workben/toolpanel/makefile.mk +++ b/svtools/workben/toolpanel/makefile.mk @@ -61,6 +61,7 @@ APP1STDLIBS=\ $(BASEGFXLIB) \ $(SVTOOLLIB) \ +APP1RAPTH=BRAND .IF "$(GUI)"!="UNX" APP1DEF= $(MISC)$/$(TARGET).def diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 61a1aac27fc3..3850a75c5bf7 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -75,10 +75,11 @@ private: class ColoredPanelWindow : public Window { public: - ColoredPanelWindow( Window& i_rParent, const Color& i_rColor ) + ColoredPanelWindow( Window& i_rParent, const Color& i_rColor, const String& i_rTitle ) :Window( &i_rParent ) ,m_aEdit( this, WB_BORDER ) ,m_aTabControl( this ) + ,m_sTitle( i_rTitle ) { SetLineColor(); SetFillColor( i_rColor ); @@ -99,7 +100,11 @@ public: virtual void Paint( const Rectangle& i_rRect ) { - DrawRect( i_rRect ); + const Size aOutputSize( GetOutputSizePixel() ); + const Rectangle aTitleRect( Point( 10, 10 ), Size( aOutputSize.Width() - 20, 20 ) ); + DrawRect( aTitleRect ); + SetTextColor( GetFillColor().IsDark() ? COL_WHITE : COL_BLACK ); + DrawText( aTitleRect, m_sTitle, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER ); } virtual void GetFocus() @@ -111,11 +116,11 @@ public: { const Size aOutputSize( GetOutputSizePixel() ); m_aEdit.SetPosSizePixel( - Point( 20, 20 ), + Point( 20, 40 ), Size( aOutputSize.Width() - 40, 20 ) ); m_aTabControl.SetPosSizePixel( - Point( 20, 50 ), + Point( 20, 70 ), Size( aOutputSize.Width() - 40, 150 ) ); } @@ -123,6 +128,7 @@ public: private: Edit m_aEdit; TabControl m_aTabControl; + String m_sTitle; }; //============================================================================= @@ -161,7 +167,7 @@ private: //----------------------------------------------------------------------------- ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ) :m_refCount(0) - ,m_aWindow( i_rParent, i_rColor ) + ,m_aWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) ,m_aPanelIcon() { @@ -173,7 +179,7 @@ ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_ //----------------------------------------------------------------------------- ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName ) :m_refCount(0) - ,m_aWindow( i_rParent, i_rColor ) + ,m_aWindow( i_rParent, i_rColor, i_rPanelName ) ,m_aPanelName( i_rPanelName ) ,m_aPanelIcon() { -- cgit From 02f32a1cdcb01320aa7a6205da11fa526c420260 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 14:50:09 +0100 Subject: slidecopy: hold a render-device (normalized, i.e. as if top-aligned), on which all items are rendered the same. This hopefully opens the door for future changes, i.e. proper native tab item rendering (without spacing between the tabs). Not finished, yet. Only VCL-based rendering has been implemented by now, tab item and toolbox item rendering to follow. --- svtools/source/toolpanel/inset.hxx | 58 +++ svtools/source/toolpanel/paneltabbar.cxx | 541 ++++++++++++++++--------- svtools/source/toolpanel/tabbargeometry.cxx | 54 +-- svtools/source/toolpanel/tabbargeometry.hxx | 38 +- svtools/source/toolpanel/tabitemdescriptor.hxx | 9 +- svtools/source/toolpanel/toolpaneldeck.cxx | 2 + 6 files changed, 428 insertions(+), 274 deletions(-) create mode 100644 svtools/source/toolpanel/inset.hxx diff --git a/svtools/source/toolpanel/inset.hxx b/svtools/source/toolpanel/inset.hxx new file mode 100644 index 000000000000..a8ea877c4881 --- /dev/null +++ b/svtools/source/toolpanel/inset.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef INSET_HXX +#define INSET_HXX + +//........................................................................ +namespace svt +{ +//........................................................................ + + //================================================================================================================== + //= Inset + //================================================================================================================== + struct Inset + { + long nLeft; + long nRight; + long nTop; + long nBottom; + + Inset() + :nLeft(0) + ,nRight(0) + ,nTop(0) + ,nBottom(0) + { + } + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // INSET_HXX diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 641eb65721de..83a9b3af1143 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -65,15 +65,101 @@ namespace svt #define ITEM_POSITION_LAST 0x10 //================================================================================================================== - //= IItemsLayout + //= ITabBarRenderer + //================================================================================================================== + class SAL_NO_VTABLE ITabBarRenderer + { + public: + virtual void renderBackground( const Rectangle& i_rArea ) const = 0; + virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const = 0; + virtual void preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; + virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; + + // TODO: postRenderItem takes the "real" output device, i.e. effectively the tab bar. This is because + // DrawSelectionBackground needs to be applied after everything else is painted. This is weird, and implies + // that now the renderer needs to know about the TabAlignment, which is No Good (TM). + // So, we should get rid of postRenderItem completely. + }; + typedef ::boost::shared_ptr< ITabBarRenderer > PTabBarRenderer; + //================================================================================================================== - // TODO: originally, IItemsLayout was intended to abstract from the "vertical vs. horizontal" problem. Meanwhile, - // the only existing implementation (VerticalItemLayout) does much more than just caring for the vertical layout, - // a lot of the code would need to be re-used for horizontal layout. - // Thinking about, horizontal and vertical layout only differ in some coordinate and font rotations. So, - // one could probably have a single layouter instance, which calculates, say, a default horizontal layout, and - // derive every other layout by just rotating the coordinates. + //= VCLItemRenderer - declaration + //================================================================================================================== + class VCLItemRenderer : public ITabBarRenderer + { + public: + VCLItemRenderer( OutputDevice& i_rTargetDevice ) + :m_rTargetDevice( i_rTargetDevice ) + { + } + + // ITabBarRenderer + virtual void renderBackground( const Rectangle& i_rArea ) const; + virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual void preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; + virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; + + protected: + OutputDevice& getTargetDevice() const { return m_rTargetDevice; } + + private: + OutputDevice& m_rTargetDevice; + }; + + //================================================================================================================== + //= VCLItemRenderer - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + void VCLItemRenderer::renderBackground( const Rectangle& i_rArea ) const + { + getTargetDevice().DrawRect( i_rArea ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle VCLItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + { + // no decorations at all + return Rectangle( Point(), i_rContentSize ); + } + + //------------------------------------------------------------------------------------------------------------------ + void VCLItemRenderer::preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const + { + // completely erase the target area. Otherwise, the DrawSelectionBackground from postRender will constantly add up + getTargetDevice().DrawRect( i_rItemRect ); + } + //------------------------------------------------------------------------------------------------------------------ + void VCLItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const + { + const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); + const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); + const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); + if ( bActive || bHovered || bFocused ) + { + Rectangle aSelectionRect( i_rItemRect ); + aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; + aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; + aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; + i_rActualWindow.DrawSelectionBackground( + aSelectionRect, + ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, + bActive /* check */, + TRUE /* border */, + FALSE /* ext border only */, + 0 /* corner radius */, + NULL, + NULL + ); + } + } + + +#if 0 + //================================================================================================================== + //= IItemsLayout + //================================================================================================================== class IItemsLayout { public: @@ -153,11 +239,6 @@ namespace svt const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ); - void impl_postRender( - const Rectangle& i_rBoundingArea, - const Rectangle& i_rContentArea, - const ItemFlags& i_nFlags - ); private: Window& m_rTargetWindow; @@ -259,93 +340,6 @@ namespace svt m_rTargetWindow.DrawBitmapEx( i_rBoundingArea.TopLeft(), aBitmap ); } break; - - case VCL_BASED: - // completely erase the target area. Otherwise, the DrawSelectionBackground from postRender will constantly add up - m_rTargetWindow.DrawRect( i_rBoundingArea ); - break; - } - } - - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::impl_renderContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) - { - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::impl_renderContent: illegal TabItemContent value!" ); - - Point aDrawPos( i_rContentArea.TopLeft() ); - aDrawPos.Y() += ITEM_OUTER_SPACE; - - // draw the image - const Image aItemImage( i_pPanel->GetImage() ); - const Size aImageSize( aItemImage.GetSizePixel() ); - const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); - - if ( bUseImage ) - { - m_rTargetWindow.DrawImage( - Point( aDrawPos.X() + ( i_rContentArea.GetWidth() - aImageSize.Width() ) / 2, aDrawPos.Y() ), - aItemImage - ); - } - - const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); - const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); - - if ( bUseText ) - { - if ( bUseImage ) - aDrawPos.Y() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; - - aDrawPos.Y() += ITEM_TEXT_FLOW_SPACE; - - // draw the text - m_rTargetWindow.Push( PUSH_FONT ); - - Font aFont( m_rTargetWindow.GetFont() ); - aFont.SetOrientation( 2700 ); - aFont.SetVertical( TRUE ); - m_rTargetWindow.SetFont( aFont ); - - const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); - - Point aTextPos( aDrawPos ); - aTextPos.X() += aTextSize.Height(); - aTextPos.X() += ( i_rContentArea.GetWidth() - aTextSize.Height() ) / 2; - - m_rTargetWindow.DrawText( aTextPos, sItemText ); - - m_rTargetWindow.Pop(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::impl_postRender( const Rectangle& i_rBoundingArea, const Rectangle& i_rContentArea, const ItemFlags& i_nItemFlags ) - { - (void)i_rBoundingArea; - - if ( m_eRenderMode == VCL_BASED ) - { - const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); - const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); - const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); - if ( bActive || bHovered || bFocused ) - { - Rectangle aSelectionRect( i_rContentArea ); - aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; - aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; - m_rTargetWindow.DrawSelectionBackground( - aSelectionRect, - ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* hilight */, - bActive /* check */, - TRUE /* border */, - FALSE /* ext border only */, - 0 /* corner radius */, - NULL, - NULL - ); - } } } @@ -374,36 +368,6 @@ namespace svt void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const { - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "VerticalItemLayout::CalculateItemSize: illegal TabItemContent value!" ); - - const Image aImage( i_pPanel->GetImage() ); - const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); - - const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); - const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); - - Size aItemContentSize; - if ( bUseImage ) - { - aItemContentSize = aImage.GetSizePixel(); - } - - if ( bUseText ) - { - if ( bUseImage ) - aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE; - - // add space for text - const Size aTextSize( m_rTargetWindow.GetCtrlTextWidth( sItemText ), m_rTargetWindow.GetTextHeight() ); - aItemContentSize.Width() += aTextSize.Width(); - aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() ); - - aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE; - } - - aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; - aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; - Region aBoundingRegion, aContentRegion; bool bNativeOK = false; if ( m_eRenderMode == NWF_TOOLBAR_ITEM ) @@ -435,27 +399,8 @@ namespace svt ); OSL_ENSURE( bNativeOK, "VerticalItemLayout::CalculateItemSize: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); } - - if ( bNativeOK ) - { - const Rectangle aBoundingRect( aBoundingRegion.GetBoundRect() ); - - o_rContentArea = aContentRegion.GetBoundRect(); - o_rBoundingSize = aBoundingRect.GetSize(); - - // normalize the content area, it is assumed to be relative to a rectangle which starts - // at (0,0), and has a size of o_rBoundingSize. - o_rContentArea.Move( -aBoundingRect.Left(), -aBoundingRect.Top() ); - } - else - { - o_rContentArea = Rectangle( Point( 0, 0 ), aItemContentSize ); - o_rBoundingSize = aItemContentSize; - - // don't attempt native rendering, again. If it didn't work this time, it won't work in the future. - const_cast< VerticalItemLayout* >( this )->m_eRenderMode = VCL_BASED; - } } + //------------------------------------------------------------------------------------------------------------------ void VerticalItemLayout::DrawItem( const TabBarGeometry& i_rGeometry, const PToolPanel& i_pPanel, const Point& i_rPosition, const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) @@ -477,8 +422,8 @@ namespace svt // actually draw impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); impl_renderContent( i_pPanel, aContentArea, i_eItemContent ); - impl_postRender( aBoundingArea, aContentArea, i_nItemFlags ); } +#endif //================================================================================================================== //= PanelTabBar_Impl @@ -528,19 +473,30 @@ namespace svt void EnsureItemsCache(); ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; void DrawItem( const size_t i_nItemIndex ) const; - Rectangle GetActualItemRect( const Rectangle& i_rLogicalItemRect ) const; + Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; + + inline bool IsVertical() const + { + return ( ( m_eTabAlignment == TABS_LEFT ) + || ( m_eTabAlignment == TABS_RIGHT ) + ); + } protected: DECL_LINK( OnScroll, const PushButton* ); - void impl_calcItemRects(); + void impl_calcItemRects(); + Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const; + void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const; public: PanelTabBar& rTabBar; TabBarGeometry aGeometry; + TabAlignment m_eTabAlignment; IToolPanelDeck& rPanelDeck; - PItemsLayout pLayout; + VirtualDevice aRenderDevice; + PTabBarRenderer pRenderer; ::boost::optional< size_t > aHoveredItem; ::boost::optional< size_t > aFocusedItem; @@ -597,7 +553,8 @@ namespace svt :m_rDevice( i_rImpl.rTabBar ) { m_rDevice.Push( PUSH_CLIPREGION ); - m_rDevice.SetClipRegion( i_rImpl.aGeometry.getItemsRect() ); + NormalizedArea aNormalizer( Rectangle( Point(), i_rImpl.aRenderDevice.GetOutputSizePixel() ), false ); + m_rDevice.SetClipRegion( aNormalizer.getTransformed( i_rImpl.aGeometry.getItemsRect(), i_rImpl.m_eTabAlignment ) ); } ~ClipItemRegion() @@ -608,6 +565,22 @@ namespace svt private: OutputDevice& m_rDevice; }; + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_inflateSize( Size& io_rSize, const Inset& i_rInset ) + { + io_rSize.Width() += i_rInset.nLeft + i_rInset.nRight; + io_rSize.Height() += i_rInset.nTop + i_rInset.nBottom; + } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_deflateRect( Rectangle& io_rArea, const Inset& i_rInset ) + { + io_rArea.Left() += i_rInset.nLeft; + io_rArea.Top() += i_rInset.nTop; + io_rArea.Right() -= i_rInset.nRight; + io_rArea.Bottom() -= i_rInset.nBottom; + } } //================================================================================================================== @@ -616,9 +589,11 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :rTabBar( i_rTabBar ) - ,aGeometry( i_eAlignment, i_eItemContent ) + ,aGeometry( i_eItemContent ) + ,m_eTabAlignment( i_eAlignment ) ,rPanelDeck( i_rPanelDeck ) - ,pLayout( new VerticalItemLayout( i_rTabBar, i_eAlignment == TABS_LEFT ) ) + ,aRenderDevice( i_rTabBar ) + ,pRenderer( new VCLItemRenderer( aRenderDevice ) ) ,aHoveredItem() ,aFocusedItem() ,bMouseButtonDown( false ) @@ -631,6 +606,9 @@ namespace svt OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), "PanelTabBar_Impl: unsupported alignment!" ); + aRenderDevice.SetLineColor(); + //aRenderDevice.SetFillColor( rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); + rPanelDeck.AddListener( *this ); m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); @@ -663,34 +641,161 @@ namespace svt Rectangle aContentArea; - Size aCompleteSize; - pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_AND_TEXT, aCompleteSize, aContentArea ); - ::std::swap( aCompleteSize.Width(), aCompleteSize.Height() ); + Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); + Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); + Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); - Size aIconOnlySize; - pLayout->CalculateItemSize( pPanel, TABITEM_IMAGE_ONLY, aIconOnlySize, aContentArea ); - ::std::swap( aIconOnlySize.Width(), aIconOnlySize.Height() ); + // TODO: have one method calculating all sizes? - Size aTextOnlySize; - pLayout->CalculateItemSize( pPanel, TABITEM_TEXT_ONLY, aTextOnlySize, aContentArea ); - ::std::swap( aTextOnlySize.Width(), aTextOnlySize.Height() ); + // care for the decorations + const Rectangle aBoundingRect( pRenderer->calculateDecorations( aCompleteSize ) ); + OSL_POSTCOND( ( aBoundingRect.Left() <= 0 ) && ( aBoundingRect.Top() <= 0 ), + "PanelTabBar_Impl::impl_calcItemRects: hmmm ...." ); - // TODO: have one method calculating all sizes? + aItem.aContentInset.nLeft = -aBoundingRect.Left(); + aItem.aContentInset.nTop = -aBoundingRect.Top(); + aItem.aContentInset.nRight = aBoundingRect.Right() - aCompleteSize.Width() + 1; + aItem.aContentInset.nBottom = aBoundingRect.Bottom() - aCompleteSize.Height() + 1; + lcl_inflateSize( aCompleteSize, aItem.aContentInset ); + lcl_inflateSize( aIconOnlySize, aItem.aContentInset ); + lcl_inflateSize( aTextOnlySize, aItem.aContentInset ); + + // remember the three areas aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); aItems.push_back( aItem ); - aCompletePos = aItem.aCompleteArea.BottomLeft(); - aIconOnlyPos = aItem.aIconOnlyArea.BottomLeft(); - aTextOnlyPos = aItem.aTextOnlyArea.BottomLeft(); + aCompletePos = aItem.aCompleteArea.TopRight(); + aIconOnlyPos = aItem.aIconOnlyArea.TopRight(); + aTextOnlyPos = aItem.aTextOnlyArea.TopRight(); } bItemsDirty = false; } + //------------------------------------------------------------------------------------------------------------------ + Size PanelTabBar_Impl::impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const + { + // calculate the size needed for the content + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_calculateItemContentSize: illegal TabItemContent value!" ); + + const Image aImage( i_pPanel->GetImage() ); + const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); + + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); + + Size aItemContentSize; + if ( bUseImage ) + { + aItemContentSize = aImage.GetSizePixel(); + } + + if ( bUseText ) + { + if ( bUseImage ) + aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE; + + // add space for text + const Size aTextSize( rTabBar.GetCtrlTextWidth( sItemText ), rTabBar.GetTextHeight() ); + aItemContentSize.Width() += aTextSize.Width(); + aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() ); + + aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE; + } + + aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; + aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; + + return aItemContentSize; + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const + { + OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!" ); + + Rectangle aRenderArea( i_rContentArea ); + if ( IsVertical() ) + { + aRenderArea.Top() += ITEM_OUTER_SPACE; + } + else + { + aRenderArea.Left() += ITEM_OUTER_SPACE; + } + + // draw the image + const Image aItemImage( i_pPanel->GetImage() ); + const Size aImageSize( aItemImage.GetSizePixel() ); + const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); + + if ( bUseImage ) + { + Point aImagePos; + if ( IsVertical() ) + { + aImagePos.X() = aRenderArea.Left() + ( aRenderArea.GetWidth() - aImageSize.Width() ) / 2; + aImagePos.Y() = aRenderArea.Top(); + } + else + { + aImagePos.X() = aRenderArea.Left(); + aImagePos.Y() = aRenderArea.Top() + ( aRenderArea.GetHeight() - aImageSize.Height() ) / 2; + } + rTabBar.DrawImage( aImagePos, aItemImage ); + } + + const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); + const bool bUseText = ( sItemText.getLength() != 0 ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); + + if ( bUseText ) + { + if ( IsVertical() ) + { + if ( bUseImage ) + aRenderArea.Top() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; + aRenderArea.Top() += ITEM_TEXT_FLOW_SPACE; + } + else + { + if ( bUseImage ) + aRenderArea.Left() += aImageSize.Width() + ITEM_ICON_TEXT_DISTANCE; + aRenderArea.Left() += ITEM_TEXT_FLOW_SPACE; + } + + // draw the text + const Size aTextSize( rTabBar.GetCtrlTextWidth( sItemText ), rTabBar.GetTextHeight() ); + Point aTextPos( aRenderArea.TopLeft() ); + if ( IsVertical() ) + { + rTabBar.Push( PUSH_FONT ); + + Font aFont( rTabBar.GetFont() ); + aFont.SetOrientation( 2700 ); + aFont.SetVertical( TRUE ); + rTabBar.SetFont( aFont ); + + aTextPos.X() += aTextSize.Height(); + aTextPos.X() += ( aRenderArea.GetWidth() - aTextSize.Height() ) / 2; + } + else + { + aTextPos.Y() += ( aRenderArea.GetHeight() - aTextSize.Height() ) / 2; + } + + rTabBar.DrawText( aTextPos, sItemText ); + + if ( IsVertical() ) + { + rTabBar.Pop(); + } + } + } + //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex ) const { @@ -716,11 +821,40 @@ namespace svt if ( rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_LAST; - // the actual item pos might differ from the saved one, if we have scroll buttons - const Point aActualItemPos( GetActualItemRect( rItem.GetCurrentRect() ).TopLeft() ); - rTabBar.SetUpdateMode( FALSE ); - pLayout->DrawItem( aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); + +// // the actual item pos might differ from the saved one, if we have scroll buttons +// const Point aActualItemPos( GetActualLogicalItemRect( rItem.GetCurrentRect() ).TopLeft() ); +// pLayout->DrawItem( aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); + + // render item "background" layer + pRenderer->preRenderItem( rItem.GetCurrentRect(), nItemFlags ); + + // copy from the virtual device to ourself + const NormalizedArea aNormalizer( Rectangle( Point(), aRenderDevice.GetOutputSizePixel() ), false ); + const Rectangle aActualItemRect = aNormalizer.getTransformed( rItem.GetCurrentRect(), m_eTabAlignment ); + + BitmapEx aBitmap( aRenderDevice.GetBitmapEx( rItem.GetCurrentRect().TopLeft(), rItem.GetCurrentRect().GetSize() ) ); + if ( IsVertical() ) + { + aBitmap.Rotate( 2700, COL_BLACK ); + if ( m_eTabAlignment == TABS_LEFT ) + aBitmap.Mirror( BMP_MIRROR_HORZ ); + } +// else if ( m_eTabAlignment == TABS_BOTTOM ) +// { +// aBitmap.Mirror( BMP_MIRROR_VERT ); +// } + rTabBar.DrawBitmapEx( aActualItemRect.TopLeft(), aBitmap ); + + // render the actual item content + Rectangle aActualContentRect( aActualItemRect ); + lcl_deflateRect( aActualContentRect, rItem.aContentInset ); + impl_renderItemContent( rItem.pPanel, aActualContentRect, aGeometry.getItemContent() ); + + // render item "foreground" layer + pRenderer->postRenderItem( rTabBar, aActualItemRect, nItemFlags ); + rTabBar.SetUpdateMode( TRUE ); } @@ -742,15 +876,23 @@ namespace svt { EnsureItemsCache(); - aGeometry.relayout( rTabBar.GetOutputSizePixel(), aItems ); + const Size aOutputSize( rTabBar.GetOutputSizePixel() ); + NormalizedArea aNormalizer( Rectangle( Point(), aOutputSize ), IsVertical() ); + const Size aLogicalOutputSize( aNormalizer.getReferenceSize() ); + + // forward actual output size to our render device + aRenderDevice.SetOutputSizePixel( aLogicalOutputSize ); - const Rectangle& rButtonBack( aGeometry.getButtonBackRect() ); - m_aScrollBack.SetPosSizePixel( rButtonBack.TopLeft(), rButtonBack.GetSize() ); - m_aScrollBack.Show( !rButtonBack.IsEmpty() ); + // re-calculate the size of the scroll buttons and of the items + aGeometry.relayout( aLogicalOutputSize, aItems ); - const Rectangle& rButtonForward( aGeometry.getButtonForwardRect() ); - m_aScrollForward.SetPosSizePixel( rButtonForward.TopLeft(), rButtonForward.GetSize() ); - m_aScrollForward.Show( !rButtonForward.IsEmpty() ); + const Rectangle aButtonBack( aNormalizer.getTransformed( aGeometry.getButtonBackRect(), m_eTabAlignment ) ); + m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); + m_aScrollBack.Show( !aButtonBack.IsEmpty() ); + + const Rectangle aButtonForward( aNormalizer.getTransformed( aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); + m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); + m_aScrollForward.Show( !aButtonForward.IsEmpty() ); UpdateScrollButtons(); } @@ -758,7 +900,9 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ ::boost::optional< size_t > PanelTabBar_Impl::FindItemForPoint( const Point& i_rPoint ) const { - if ( !aGeometry.getItemsRect().IsInside( i_rPoint ) ) + Point aPoint( IsVertical() ? i_rPoint.Y() : i_rPoint.X(), IsVertical() ? i_rPoint.X() : i_rPoint.Y() ); + + if ( !aGeometry.getItemsRect().IsInside( aPoint ) ) return ::boost::optional< size_t >(); size_t i=0; @@ -767,8 +911,8 @@ namespace svt ++item, ++i ) { - Rectangle aItemRect( GetActualItemRect( item->GetCurrentRect() ) ); - if ( aItemRect.IsInside( i_rPoint ) ) + Rectangle aItemRect( GetActualLogicalItemRect( item->GetCurrentRect() ) ); + if ( aItemRect.IsInside( aPoint ) ) { return ::boost::optional< size_t >( i ); } @@ -797,19 +941,14 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - Rectangle PanelTabBar_Impl::GetActualItemRect( const Rectangle& i_rLogicalItemRect ) const + Rectangle PanelTabBar_Impl::GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const { // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons Rectangle aItemRect( i_rLogicalItemRect ); - - const TabBarGeometry& rGeometry( aGeometry ); - aItemRect.Move( - rGeometry.isVertical() ? 0 : rGeometry.getItemsRect().Left() - rGeometry.getButtonBackRect().Left(), - rGeometry.isVertical() ? rGeometry.getItemsRect().Top() - rGeometry.getButtonBackRect().Top() : 0 - ); + aItemRect.Move( aGeometry.getItemsRect().Left() - aGeometry.getButtonBackRect().Left(), 0 ); // care for the current scroll position - OSL_ENSURE( m_nScrollPosition < aItems.size(), "GetActualItemRect: invalid scroll position!" ); + OSL_ENSURE( m_nScrollPosition < aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" ); if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < aItems.size() ) ) { long nOffsetX = aItems[ m_nScrollPosition ].GetCurrentRect().Left() - aItems[ 0 ].GetCurrentRect().Left(); @@ -850,9 +989,6 @@ namespace svt ,m_pImpl( new PanelTabBar_Impl( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) { DBG_CHECK( *m_pImpl ); - - SetLineColor(); - SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); } //------------------------------------------------------------------------------------------------------------------ @@ -878,7 +1014,10 @@ namespace svt Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { m_pImpl->EnsureItemsCache(); - return m_pImpl->aGeometry.getOptimalSize( m_pImpl->aItems, i_eType == WINDOWSIZE_MINIMUM ); + Size aOptimalSize( m_pImpl->aGeometry.getOptimalSize( m_pImpl->aItems, i_eType == WINDOWSIZE_MINIMUM ) ); + if ( m_pImpl->IsVertical() ) + ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() ); + return aOptimalSize; } //------------------------------------------------------------------------------------------------------------------ @@ -894,11 +1033,15 @@ namespace svt m_pImpl->EnsureItemsCache(); // background - m_pImpl->pLayout->DrawBackground( Rectangle( Point(), GetOutputSizePixel() ) ); + m_pImpl->pRenderer->renderBackground( Rectangle( Point(), GetOutputSizePixel() ) ); // ensure the items really paint into their own playground only ClipItemRegion aClipItems( *m_pImpl ); + NormalizedArea aTransformer( Rectangle( Point(), m_pImpl->aRenderDevice.GetOutputSizePixel() ), false ); + // TODO: make the transformer a member + const Rectangle aLogicalPaintRect( aTransformer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); + // items size_t i=0; for ( ItemDescriptors::const_iterator item = m_pImpl->aItems.begin(); @@ -906,8 +1049,8 @@ namespace svt ++item, ++i ) { - Rectangle aItemRect( m_pImpl->GetActualItemRect( item->GetCurrentRect() ) ); - if ( aItemRect.IsOver( i_rRect ) ) + Rectangle aItemRect( m_pImpl->GetActualLogicalItemRect( item->GetCurrentRect() ) ); + if ( aItemRect.IsOver( aLogicalPaintRect ) ) { m_pImpl->DrawItem( i ); } @@ -1106,7 +1249,7 @@ namespace svt && ( ( i_rDataChanedEvent.GetFlags() & SETTINGS_STYLE ) != 0 ) ) { - SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + //SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); Invalidate(); } } diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index ce5a45a0eb08..b70bc20dbf88 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -170,32 +170,17 @@ namespace svt //= TabBarGeometry //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - TabBarGeometry::TabBarGeometry( const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :m_eTabAlignment( i_eAlignment ) - ,m_eTabItemContent( i_eItemContent ) + TabBarGeometry::TabBarGeometry( const TabItemContent i_eItemContent ) + :m_eTabItemContent( i_eItemContent ) ,m_aItemsInset() - ,m_aNormalizedPlayground( Rectangle(), false ) ,m_aButtonBackRect() ,m_aItemsRect() ,m_aButtonForwardRect() { - // calculate the items' inset - const Rectangle aArtificial( Point( 0, 0 ), Size( 10, 10 ) ); - const Rectangle aInsetRect( - Point( ITEMS_INSET_LEFT, ITEMS_INSET_TOP ), - Size( - aArtificial.GetWidth() - ITEMS_INSET_LEFT - ITEMS_INSET_RIGHT, - aArtificial.GetHeight() - ITEMS_INSET_TOP - ITEMS_INSET_BOTTOM - ) - ); - - const NormalizedArea aNormalized( aArtificial, false ); - const Rectangle aTransformedInner( aNormalized.getTransformed( aInsetRect, getAlignment() ) ); - - m_aItemsInset.nLeft = aTransformedInner.Left() - aNormalized.getReference().Left(); - m_aItemsInset.nTop = aTransformedInner.Top() - aNormalized.getReference().Top() ; - m_aItemsInset.nRight = aNormalized.getReference().Right() - aTransformedInner.Right() ; - m_aItemsInset.nBottom = aNormalized.getReference().Bottom() - aTransformedInner.Bottom() ; + m_aItemsInset.nLeft = ITEMS_INSET_LEFT; + m_aItemsInset.nTop = ITEMS_INSET_TOP; + m_aItemsInset.nRight = ITEMS_INSET_RIGHT; + m_aItemsInset.nBottom = ITEMS_INSET_BOTTOM; } //------------------------------------------------------------------------------------------------------------------ @@ -279,36 +264,33 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void TabBarGeometry::relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ) { - m_aNormalizedPlayground = NormalizedArea( Rectangle( Point(), i_rActualOutputSize ), isVertical() ); - const Size aNormalizedSize( m_aNormalizedPlayground.getReferenceSize() ); - // assume all items fit Point aButtonBackPos( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); - m_aButtonBackRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonBackPos, Size( 1, 1 ) ), getAlignment() ); - m_aButtonBackRect.SetEmpty(); // do this after the transformation, it cannot cope with empty rects + m_aButtonBackRect = Rectangle( aButtonBackPos, Size( 1, 1 ) ); + m_aButtonBackRect.SetEmpty(); - Point aButtonForwardPos( aNormalizedSize.Width(), OUTER_SPACE_TOP ); - m_aButtonForwardRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonForwardPos, Size( 1, 1 ) ), getAlignment() ); - m_aButtonBackRect.SetEmpty(); // do this after the transformation, it cannot cope with empty rects + Point aButtonForwardPos( i_rActualOutputSize.Width(), OUTER_SPACE_TOP ); + m_aButtonForwardRect = Rectangle( aButtonForwardPos, Size( 1, 1 ) ); + m_aButtonBackRect.SetEmpty(); Point aItemsPos( OUTER_SPACE_LEFT, 0 ); - Size aItemsSize( aNormalizedSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, aNormalizedSize.Height() ); - m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); + Size aItemsSize( i_rActualOutputSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, i_rActualOutputSize.Height() ); + m_aItemsRect = Rectangle( aItemsPos, aItemsSize ); if ( !impl_fitItems( io_rItems ) ) { // assumption was wrong, the items do not fit => calculate rects for the scroll buttons - const Size aButtonSize( BUTTON_FLOW_WIDTH, aNormalizedSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM ); + const Size aButtonSize( BUTTON_FLOW_WIDTH, i_rActualOutputSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM ); aButtonBackPos = Point( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); - m_aButtonBackRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonBackPos, aButtonSize ), m_eTabAlignment ); + m_aButtonBackRect = Rectangle( aButtonBackPos, aButtonSize ); - aButtonForwardPos = Point( aNormalizedSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP ); - m_aButtonForwardRect = m_aNormalizedPlayground.getTransformed( Rectangle( aButtonForwardPos, aButtonSize ), m_eTabAlignment ); + aButtonForwardPos = Point( i_rActualOutputSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP ); + m_aButtonForwardRect = Rectangle( aButtonForwardPos, aButtonSize ); aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE; aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X(); - m_aItemsRect = m_aNormalizedPlayground.getTransformed( Rectangle( aItemsPos, aItemsSize ), m_eTabAlignment ); + m_aItemsRect = Rectangle( aItemsPos, aItemsSize ); // fit items, again. In the TABITEM_AUTO case, the smaller playground for the items might lead to another // item content. diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx index 57bf3422cf8e..5e798e690116 100644 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -29,6 +29,7 @@ #include "svtools/toolpanel/tabalignment.hxx" +#include "inset.hxx" #include "tabitemdescriptor.hxx" #include @@ -79,25 +80,6 @@ namespace svt Rectangle m_aReference; }; - //================================================================================================================== - //= Inset - //================================================================================================================== - struct Inset - { - long nLeft; - long nRight; - long nTop; - long nBottom; - - Inset() - :nLeft(0) - ,nRight(0) - ,nTop(0) - ,nBottom(0) - { - } - }; - //================================================================================================================== //= TabBarGeometry //================================================================================================================== @@ -105,7 +87,7 @@ namespace svt class TabBarGeometry { public: - TabBarGeometry( const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); + TabBarGeometry( const TabItemContent i_eItemContent ); ~TabBarGeometry(); // retrieves the rectangle to be occupied by the button for scrolling backward through the items @@ -115,23 +97,10 @@ namespace svt // retrieves the rectangle to be occupied by the button for scrolling forward through the items const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; } - inline TabAlignment getAlignment() const { return m_eTabAlignment; } - inline TabItemContent getItemContent() const { return m_eTabItemContent; } inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; } - inline bool isVertical() const - { - return ( m_eTabAlignment == TABS_LEFT ) - || ( m_eTabAlignment == TABS_RIGHT ); - } - - inline Rectangle getTransformed( const Rectangle& i_rNormalizedRect ) const - { - return m_aNormalizedPlayground.getTransformed( i_rNormalizedRect, m_eTabAlignment ); - } - /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items */ void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ); @@ -148,13 +117,10 @@ namespace svt bool impl_fitItems( ItemDescriptors& io_rItems ) const; private: - /// specifies the alignment of the tab bar - const TabAlignment m_eTabAlignment; /// specifies the content to be displayed in the tab items TabItemContent m_eTabItemContent; /// specifies the inset to be used in the items area, depends on the actual alignment Inset m_aItemsInset; - NormalizedArea m_aNormalizedPlayground; Rectangle m_aButtonBackRect; Rectangle m_aItemsRect; Rectangle m_aButtonForwardRect; diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx index 3de280a7c92f..84390a92ef0f 100644 --- a/svtools/source/toolpanel/tabitemdescriptor.hxx +++ b/svtools/source/toolpanel/tabitemdescriptor.hxx @@ -30,6 +30,8 @@ #include "svtools/toolpanel/toolpanel.hxx" #include "svtools/toolpanel/tabitemcontent.hxx" +#include "inset.hxx" + #include #include @@ -46,9 +48,10 @@ namespace svt struct ItemDescriptor { PToolPanel pPanel; - Rectangle aCompleteArea; - Rectangle aIconOnlyArea; - Rectangle aTextOnlyArea; + Rectangle aCompleteArea; // bounding area if the both text and icon are to be rendererd + Rectangle aIconOnlyArea; // bounding area if the icon is to be rendererd + Rectangle aTextOnlyArea; // bounding area if the text is to be rendererd + Inset aContentInset; // inset to subtract from the bounding areas TabItemContent eContent; // content to be used for this particular item. Might differ from item content which has been set // up for the complete control, in case not the complete content fits into the available space. diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index b8ca75e74fac..c6b48ea0ea2f 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -184,7 +184,9 @@ namespace svt m_aPanelPlayground = aDeckPlayground; OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" ); if ( m_pLayouter.get() ) + { m_aPanelPlayground = m_pLayouter->Layout( aDeckPlayground ); + } // and position the active panel const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); -- cgit From fecdd277ea33acc0670c7e0b87dee0b057078464 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 14:50:09 +0100 Subject: slidecopy: re-enabled the toolbox item NWF code, now completely rendering on the virtual device --- svtools/source/toolpanel/paneltabbar.cxx | 184 ++++++++++++++++++------------- 1 file changed, 110 insertions(+), 74 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 83a9b3af1143..0e8e86ba8fa5 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -70,9 +70,11 @@ namespace svt class SAL_NO_VTABLE ITabBarRenderer { public: - virtual void renderBackground( const Rectangle& i_rArea ) const = 0; + /** fills the background of our target device + */ + virtual void renderBackground() const = 0; virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const = 0; - virtual void preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; + virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; // TODO: postRenderItem takes the "real" output device, i.e. effectively the tab bar. This is because @@ -94,9 +96,9 @@ namespace svt } // ITabBarRenderer - virtual void renderBackground( const Rectangle& i_rArea ) const; + virtual void renderBackground() const; virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; - virtual void preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; + virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; protected: @@ -110,9 +112,9 @@ namespace svt //= VCLItemRenderer - implementation //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - void VCLItemRenderer::renderBackground( const Rectangle& i_rArea ) const + void VCLItemRenderer::renderBackground() const { - getTargetDevice().DrawRect( i_rArea ); + getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); } //------------------------------------------------------------------------------------------------------------------ @@ -123,10 +125,10 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VCLItemRenderer::preRenderItem( const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const + void VCLItemRenderer::preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { // completely erase the target area. Otherwise, the DrawSelectionBackground from postRender will constantly add up - getTargetDevice().DrawRect( i_rItemRect ); + getTargetDevice().DrawRect( i_rBoundingRect ); } //------------------------------------------------------------------------------------------------------------------ @@ -155,6 +157,84 @@ namespace svt } } + //================================================================================================================== + //= ToolboxItemRenderer - declaration + //================================================================================================================== + class ToolboxItemRenderer : public ITabBarRenderer + { + public: + ToolboxItemRenderer( OutputDevice& i_rTargetDevice ) + :m_rTargetDevice( i_rTargetDevice ) + { + } + + // ITabBarRenderer + virtual void renderBackground() const; + virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; + virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; + + protected: + OutputDevice& getTargetDevice() const { return m_rTargetDevice; } + + private: + OutputDevice& m_rTargetDevice; + }; + + //================================================================================================================== + //= ToolboxItemRenderer - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + void ToolboxItemRenderer::renderBackground() const + { + getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle ToolboxItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + { + // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. + // Instead, simply assume that both the content and the bounding region are the same. +// const ImplControlValue aControlValue; +// bool bNativeOK = m_rTargetWindow.GetNativeControlRegion( +// CTRL_TOOLBAR, PART_BUTTON, +// Rectangle( Point(), i_rContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, +// aControlValue, ::rtl::OUString(), +// aBoundingRegion, aContentRegion +// ); + return Rectangle( + Point( -1, -1 ), + Size( i_rContentSize.Width() + 2, i_rContentSize.Height() + 2 ) + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolboxItemRenderer::preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const + { + // completely erase the target area, toolbar item NWF is not expected to do this + getTargetDevice().DrawRect( i_rBoundingRect ); + + ControlState nState = CTRL_STATE_ENABLED; + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; + if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; + + ImplControlValue aControlValue; + aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); + + bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, i_rContentRect, nState, aControlValue, rtl::OUString() ); + (void)bNativeOK; + OSL_ENSURE( bNativeOK, "ToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" ); + // IsNativeControlSupported returned true, previously, otherwise we would not be here ... + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolboxItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const + { + (void)i_rActualWindow; + (void)i_rItemRect; + (void)i_nItemFlags; + } #if 0 //================================================================================================================== @@ -234,26 +314,10 @@ namespace svt const Rectangle& i_rContentArea, const ItemFlags& i_nFlags ); - void impl_renderContent( - const PToolPanel& i_pPanel, - const Rectangle& i_rContentArea, - const TabItemContent i_eItemContent - ); private: Window& m_rTargetWindow; const bool m_bLeft; - - enum ItemRenderMode - { - /// the items are to be rendered in the look of a native widget toolbar item - NWF_TOOLBAR_ITEM, - /// the items are to be rendered in the look of a native widget tab bar item - NWF_TABBAR_ITEM, - /// the items are to be rendered with VCL functionality only - VCL_BASED - }; - ItemRenderMode m_eRenderMode; }; //------------------------------------------------------------------------------------------------------------------ @@ -286,23 +350,6 @@ namespace svt switch ( m_eRenderMode ) { - case NWF_TOOLBAR_ITEM: - { - // completely erase the target area, toolbar item NWF is not expected to do this - m_rTargetWindow.DrawRect( i_rBoundingArea ); - - const Region aCtrlRegion( i_rContentArea ); - - ImplControlValue aControlValue; - aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); - - bool bNativeOK = m_rTargetWindow.DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, aCtrlRegion, nState, aControlValue, rtl::OUString() ); - (void)bNativeOK; - OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); - // IsNativeControlSupported returned true, previously, otherwise we would not be here ... - } - break; - case NWF_TABBAR_ITEM: { VirtualDevice aRenderDevice( m_rTargetWindow ); @@ -349,10 +396,6 @@ namespace svt bool bNativeOK = false; switch ( m_eRenderMode ) { - case VCL_BASED: - case NWF_TOOLBAR_ITEM: - break; - case NWF_TABBAR_ITEM: bNativeOK = true; // don't draw any background. The default behavior of VCL windows - draw a dialog face color - @@ -370,22 +413,7 @@ namespace svt { Region aBoundingRegion, aContentRegion; bool bNativeOK = false; - if ( m_eRenderMode == NWF_TOOLBAR_ITEM ) - { - // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. - // Instead, simply assume that both the content and the bounding region are the same. -// const ImplControlValue aControlValue; -// bNativeOK = m_rTargetWindow.GetNativeControlRegion( -// CTRL_TOOLBAR, PART_BUTTON, -// Rectangle( Point(), aItemContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, -// aControlValue, ::rtl::OUString(), -// aBoundingRegion, aContentRegion -// ); - aContentRegion = Rectangle( Point( 1, 1 ), aItemContentSize ); - aBoundingRegion = Rectangle( Point( 0, 0 ), Size( aItemContentSize.Width() + 2, aItemContentSize.Height() + 2 ) ); - bNativeOK = true; - } - else if ( m_eRenderMode == NWF_TABBAR_ITEM ) + if ( m_eRenderMode == NWF_TABBAR_ITEM ) { TabitemValue tiValue; ImplControlValue aControlValue( (void*)(&tiValue) ); @@ -421,7 +449,6 @@ namespace svt // actually draw impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); - impl_renderContent( i_pPanel, aContentArea, i_eItemContent ); } #endif @@ -593,7 +620,7 @@ namespace svt ,m_eTabAlignment( i_eAlignment ) ,rPanelDeck( i_rPanelDeck ) ,aRenderDevice( i_rTabBar ) - ,pRenderer( new VCLItemRenderer( aRenderDevice ) ) + ,pRenderer( new ToolboxItemRenderer( aRenderDevice ) ) ,aHoveredItem() ,aFocusedItem() ,bMouseButtonDown( false ) @@ -827,14 +854,22 @@ namespace svt // const Point aActualItemPos( GetActualLogicalItemRect( rItem.GetCurrentRect() ).TopLeft() ); // pLayout->DrawItem( aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); + // some item geometry + // - the normalized bounding and content rect + const Rectangle aNormalizedBounds( rItem.GetCurrentRect() ); + Rectangle aNormalizedContent( aNormalizedBounds ); + lcl_deflateRect( aNormalizedContent, rItem.aContentInset ); + + // the aligned bounding and content rect + const NormalizedArea aTransformer( Rectangle( Point(), aRenderDevice.GetOutputSizePixel() ), false ); + const Rectangle aActualBounds = aTransformer.getTransformed( aNormalizedBounds, m_eTabAlignment ); + const Rectangle aActualContent = aTransformer.getTransformed( aNormalizedContent, m_eTabAlignment ); + // render item "background" layer - pRenderer->preRenderItem( rItem.GetCurrentRect(), nItemFlags ); + pRenderer->preRenderItem( aNormalizedBounds, aNormalizedContent, nItemFlags ); // copy from the virtual device to ourself - const NormalizedArea aNormalizer( Rectangle( Point(), aRenderDevice.GetOutputSizePixel() ), false ); - const Rectangle aActualItemRect = aNormalizer.getTransformed( rItem.GetCurrentRect(), m_eTabAlignment ); - - BitmapEx aBitmap( aRenderDevice.GetBitmapEx( rItem.GetCurrentRect().TopLeft(), rItem.GetCurrentRect().GetSize() ) ); + BitmapEx aBitmap( aRenderDevice.GetBitmapEx( aNormalizedBounds.TopLeft(), aNormalizedBounds.GetSize() ) ); if ( IsVertical() ) { aBitmap.Rotate( 2700, COL_BLACK ); @@ -845,15 +880,13 @@ namespace svt // { // aBitmap.Mirror( BMP_MIRROR_VERT ); // } - rTabBar.DrawBitmapEx( aActualItemRect.TopLeft(), aBitmap ); + rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); // render the actual item content - Rectangle aActualContentRect( aActualItemRect ); - lcl_deflateRect( aActualContentRect, rItem.aContentInset ); - impl_renderItemContent( rItem.pPanel, aActualContentRect, aGeometry.getItemContent() ); + impl_renderItemContent( rItem.pPanel, aActualContent, aGeometry.getItemContent() ); // render item "foreground" layer - pRenderer->postRenderItem( rTabBar, aActualItemRect, nItemFlags ); + pRenderer->postRenderItem( rTabBar, aActualBounds, nItemFlags ); rTabBar.SetUpdateMode( TRUE ); } @@ -1033,7 +1066,10 @@ namespace svt m_pImpl->EnsureItemsCache(); // background - m_pImpl->pRenderer->renderBackground( Rectangle( Point(), GetOutputSizePixel() ) ); + m_pImpl->aRenderDevice.Push( PUSH_CLIPREGION ); + m_pImpl->aRenderDevice.SetClipRegion( i_rRect ); + m_pImpl->pRenderer->renderBackground(); + m_pImpl->aRenderDevice.Pop(); // ensure the items really paint into their own playground only ClipItemRegion aClipItems( *m_pImpl ); -- cgit From 0f1a1db8538699a72b7a9d29b64d9dd5c1960460 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 17:38:17 +0100 Subject: slidecopy: re-enable the NWF tab bar item drawing, now also completely rendering to the virtual device --- svtools/source/toolpanel/paneltabbar.cxx | 300 +++++++++---------------------- 1 file changed, 88 insertions(+), 212 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 0e8e86ba8fa5..b810bb366276 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -74,7 +74,7 @@ namespace svt */ virtual void renderBackground() const = 0; virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const = 0; - virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; + virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; // TODO: postRenderItem takes the "real" output device, i.e. effectively the tab bar. This is because @@ -98,7 +98,7 @@ namespace svt // ITabBarRenderer virtual void renderBackground() const; virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; - virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; + virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; protected: @@ -125,10 +125,10 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void VCLItemRenderer::preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const + void VCLItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { - // completely erase the target area. Otherwise, the DrawSelectionBackground from postRender will constantly add up - getTargetDevice().DrawRect( i_rBoundingRect ); + (void)i_rContentRect; + (void)i_nItemFlags; } //------------------------------------------------------------------------------------------------------------------ @@ -158,12 +158,12 @@ namespace svt } //================================================================================================================== - //= ToolboxItemRenderer - declaration + //= NWFToolboxItemRenderer - declaration //================================================================================================================== - class ToolboxItemRenderer : public ITabBarRenderer + class NWFToolboxItemRenderer : public ITabBarRenderer { public: - ToolboxItemRenderer( OutputDevice& i_rTargetDevice ) + NWFToolboxItemRenderer( OutputDevice& i_rTargetDevice ) :m_rTargetDevice( i_rTargetDevice ) { } @@ -171,7 +171,7 @@ namespace svt // ITabBarRenderer virtual void renderBackground() const; virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; - virtual void preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; + virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; protected: @@ -182,16 +182,16 @@ namespace svt }; //================================================================================================================== - //= ToolboxItemRenderer - implementation + //= NWFToolboxItemRenderer - implementation //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - void ToolboxItemRenderer::renderBackground() const + void NWFToolboxItemRenderer::renderBackground() const { getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); } //------------------------------------------------------------------------------------------------------------------ - Rectangle ToolboxItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + Rectangle NWFToolboxItemRenderer::calculateDecorations( const Size& i_rContentSize ) const { // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. // Instead, simply assume that both the content and the bounding region are the same. @@ -209,11 +209,8 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void ToolboxItemRenderer::preRenderItem( const Rectangle& i_rBoundingRect, const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const + void NWFToolboxItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { - // completely erase the target area, toolbar item NWF is not expected to do this - getTargetDevice().DrawRect( i_rBoundingRect ); - ControlState nState = CTRL_STATE_ENABLED; if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; @@ -224,233 +221,100 @@ namespace svt bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, i_rContentRect, nState, aControlValue, rtl::OUString() ); (void)bNativeOK; - OSL_ENSURE( bNativeOK, "ToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" ); + OSL_ENSURE( bNativeOK, "NWFToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" ); // IsNativeControlSupported returned true, previously, otherwise we would not be here ... } //------------------------------------------------------------------------------------------------------------------ - void ToolboxItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const + void NWFToolboxItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const { (void)i_rActualWindow; (void)i_rItemRect; (void)i_nItemFlags; } -#if 0 //================================================================================================================== - //= IItemsLayout + //= NWFTabItemRenderer - declaration //================================================================================================================== - class IItemsLayout + class NWFTabItemRenderer : public ITabBarRenderer { public: - /** fills the background of our target device - */ - virtual void DrawBackground( const Rectangle& i_rArea ) = 0; - - /** calculates the size of the area occupied by the item representing the given tool panel - @param i_pPanel - denotes the panel whose item's size should be calculated - @param i_eItemContent - defines which content to draw on the tab item - @param o_rBoundingSize - contains, upon return, the overall size needed to render the item, including possible decorations which are - not available for the item content. The rectangle is in normalized form, i.e. assuming that - the tab bar is aligned at top. - @param o_rContentArea - contains, upon return, the area which is available to render the item content. It lies completely - within an assuming bounding rectangle, which starts at corrdinates (0, 0), and has the size returned - in o_rBoundingSize. The rectangle is in normalized form, i.e. assuming that the tab bar is aligned at top. - */ - virtual void CalculateItemSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const = 0; - - /** draws the item onto the given device, in the givem area - @param i_pPanel - the panel whose item representation is to be drawn - @param i_rPosition - the position to paint the item to. - @param i_nItemFlags - defines in which state to draw the item - @param i_eItemContent - defines which content to draw on the tab item - */ - virtual void DrawItem( - const TabBarGeometry& i_rGeometry, - const PToolPanel& i_pPanel, - const Point& i_rPosition, - const ItemFlags i_nItemFlags, - const TabItemContent i_eItemContent - ) = 0; - }; - - typedef ::boost::shared_ptr< IItemsLayout > PItemsLayout; + NWFTabItemRenderer( OutputDevice& i_rTargetDevice ) + :m_rTargetDevice( i_rTargetDevice ) + { + } - //================================================================================================================== - //= VerticalItemLayout - //================================================================================================================== - class VerticalItemLayout : public IItemsLayout - { - public: - VerticalItemLayout( Window& i_rTargetWindow, const bool i_bLeft ); - - // IItemsLayout overridables - virtual void DrawBackground( const Rectangle& i_rArea ); - virtual void CalculateItemSize( - const PToolPanel& i_pPanel, - const TabItemContent i_eItemContent, - Size& o_rBoundingSize, - Rectangle& o_rContentArea - ) const; - virtual void DrawItem( - const TabBarGeometry& i_rGeometry, - const PToolPanel& i_pPanel, - const Point& i_rPosition, - const ItemFlags i_nItemFlags, - const TabItemContent i_eItemContent - ); + // ITabBarRenderer + virtual void renderBackground() const; + virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; + virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; - private: - void impl_preRender( - const Rectangle& i_rBoundingArea, - const Rectangle& i_rContentArea, - const ItemFlags& i_nFlags - ); + protected: + OutputDevice& getTargetDevice() const { return m_rTargetDevice; } private: - Window& m_rTargetWindow; - const bool m_bLeft; + OutputDevice& m_rTargetDevice; }; + //================================================================================================================== + //= NWFTabItemRenderer - implementation + //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - VerticalItemLayout::VerticalItemLayout( Window& i_rTargetWindow, const bool i_bLeft ) - :m_rTargetWindow( i_rTargetWindow ) - ,m_bLeft( i_bLeft ) - ,m_eRenderMode( NWF_TOOLBAR_ITEM ) + void NWFTabItemRenderer::renderBackground() const { -#ifdef WNT - if ( m_rTargetWindow.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) - // this mode requires the NWF framework to be able to render those items onto a virtual - // device. For some frameworks (some GTK themes, in particular), this is known to fail. - // So, be on the safe side for the moment. - m_eRenderMode = NWF_TABBAR_ITEM; - else -#endif - if ( m_rTargetWindow.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) - m_eRenderMode = NWF_TOOLBAR_ITEM; - else - m_eRenderMode = VCL_BASED; + getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::impl_preRender( const Rectangle& i_rBoundingArea, const Rectangle& i_rContentArea, const ItemFlags& i_nItemFlags ) + Rectangle NWFTabItemRenderer::calculateDecorations( const Size& i_rContentSize ) const { - ControlState nState = CTRL_STATE_ENABLED; - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; - if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; - if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; - - switch ( m_eRenderMode ) - { - case NWF_TABBAR_ITEM: - { - VirtualDevice aRenderDevice( m_rTargetWindow ); - - NormalizedArea aNormalized( i_rBoundingArea, true ); - const Rectangle aNormalizedBounds( aNormalized.getReference() ); - const Rectangle aNormalizedContent( aNormalized.getNormalized( i_rContentArea, m_bLeft ? TABS_LEFT : TABS_RIGHT ) ); - - const Size aNormalizedBoundingSize( aNormalizedBounds.GetSize() ); - aRenderDevice.SetOutputSizePixel( aNormalizedBoundingSize ); + TabitemValue tiValue; + ImplControlValue aControlValue( (void*)(&tiValue) ); - // draw the actual item - const Point aNormalizedContentOffset( aNormalizedContent.Left() - aNormalizedBounds.Left(), aNormalizedContent.Top() - aNormalizedBounds.Top() ); - const Region aCtrlRegion( Rectangle( aNormalizedContentOffset, aNormalizedContent.GetSize() ) ); - - TabitemValue tiValue; - if ( i_nItemFlags & ITEM_POSITION_FIRST ) - tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP; - if ( i_nItemFlags & ITEM_POSITION_LAST ) - tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; - - ImplControlValue aControlValue( (void *)(&tiValue) ); - - bool bNativeOK = aRenderDevice.DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString() ); - (void)bNativeOK; - OSL_ENSURE( bNativeOK, "VerticalItemLayout::impl_preRender: inconsistent NWF implementation!" ); - // IsNativeControlSupported returned true, previously, otherwise we would not be here ... - - // copy content over to the target window - BitmapEx aBitmap( aRenderDevice.GetBitmapEx( Point( 0, 0 ), Size( aNormalizedBoundingSize.Width() - 1, aNormalizedBoundingSize.Height() - 1 ) ) ); - aBitmap.Rotate( 2700, COL_BLACK ); - if ( m_bLeft ) - aBitmap.Mirror( BMP_MIRROR_HORZ ); + Region aBoundingRegion, aContentRegion; + bool bNativeOK = getTargetDevice().GetNativeControlRegion( + CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, + Rectangle( Point(), i_rContentSize ), + CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, + aControlValue, ::rtl::OUString(), + aBoundingRegion, aContentRegion + ); + (void)bNativeOK; + OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - m_rTargetWindow.DrawBitmapEx( i_rBoundingArea.TopLeft(), aBitmap ); - } - break; - } + return aBoundingRegion.GetBoundRect(); } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::DrawBackground( const Rectangle& i_rArea ) + void NWFTabItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { - bool bNativeOK = false; - switch ( m_eRenderMode ) - { - case NWF_TABBAR_ITEM: - bNativeOK = true; - // don't draw any background. The default behavior of VCL windows - draw a dialog face color - - // is completely sufficient here. - break; - } + ControlState nState = CTRL_STATE_ENABLED; + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; + if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; - if ( !bNativeOK ) - m_rTargetWindow.DrawRect( i_rArea ); - } + TabitemValue tiValue; + if ( i_nItemFlags & ITEM_POSITION_FIRST ) + tiValue.mnAlignment |= TABITEM_FIRST_IN_GROUP; + if ( i_nItemFlags & ITEM_POSITION_LAST ) + tiValue.mnAlignment |= TABITEM_LAST_IN_GROUP; - //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::CalculateItemSize( const PToolPanel& i_pPanel, - const TabItemContent i_eItemContent, Size& o_rBoundingSize, Rectangle& o_rContentArea ) const - { - Region aBoundingRegion, aContentRegion; - bool bNativeOK = false; - if ( m_eRenderMode == NWF_TABBAR_ITEM ) - { - TabitemValue tiValue; - ImplControlValue aControlValue( (void*)(&tiValue) ); - - bNativeOK = m_rTargetWindow.GetNativeControlRegion( - CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, - Rectangle( Point(), aItemContentSize ), - CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, - aControlValue, ::rtl::OUString(), - aBoundingRegion, aContentRegion - ); - OSL_ENSURE( bNativeOK, "VerticalItemLayout::CalculateItemSize: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - } + ImplControlValue aControlValue( (void *)(&tiValue) ); + + bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, aControlValue, rtl::OUString() ); + (void)bNativeOK; + OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" ); + // IsNativeControlSupported returned true, previously, otherwise we would not be here ... } //------------------------------------------------------------------------------------------------------------------ - void VerticalItemLayout::DrawItem( const TabBarGeometry& i_rGeometry, const PToolPanel& i_pPanel, const Point& i_rPosition, - const ItemFlags i_nItemFlags, const TabItemContent i_eItemContent ) + void NWFTabItemRenderer::postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const { - // calculate content and bounding size - Rectangle aContentArea; - Size aBoundingSize; - CalculateItemSize( i_pPanel, i_eItemContent, aBoundingSize, aContentArea ); - - // CalculateItemSize returns a normalized size, i.e. one assuming TABS_TOP - const NormalizedArea aNormalized( Rectangle( Point(), aBoundingSize ), false ); - aContentArea = aNormalized.getTransformed( aContentArea, i_rGeometry.getAlignment() ); - aBoundingSize = Size( aBoundingSize.Height(), aBoundingSize.Width() ); - - // move both rects to the given position - aContentArea.Move( i_rPosition.X(), i_rPosition.Y() ); - const Rectangle aBoundingArea( i_rPosition, aBoundingSize ); - - // actually draw - impl_preRender( aBoundingArea, aContentArea, i_nItemFlags ); + (void)i_rActualWindow; + (void)i_rItemRect; + (void)i_nItemFlags; } -#endif //================================================================================================================== //= PanelTabBar_Impl @@ -620,7 +484,7 @@ namespace svt ,m_eTabAlignment( i_eAlignment ) ,rPanelDeck( i_rPanelDeck ) ,aRenderDevice( i_rTabBar ) - ,pRenderer( new ToolboxItemRenderer( aRenderDevice ) ) + ,pRenderer( new NWFTabItemRenderer( aRenderDevice ) ) ,aHoveredItem() ,aFocusedItem() ,bMouseButtonDown( false ) @@ -630,8 +494,21 @@ namespace svt ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) ,m_nScrollPosition( 0 ) { +#ifdef WNT + if ( aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) + // this mode requires the NWF framework to be able to render those items onto a virtual + // device. For some frameworks (some GTK themes, in particular), this is known to fail. + // So, be on the safe side for the moment. + pRenderer.reset( new NWFTabItemRenderer( aRenderDevice ) ); + else +#endif + if ( aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + pRenderer.reset( new NWFToolboxItemRenderer( aRenderDevice ) ); + else + pRenderer.reset( new VCLItemRenderer( aRenderDevice ) ); + OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), - "PanelTabBar_Impl: unsupported alignment!" ); + "PanelTabBar_Impl::PanelTabBar_Impl: unsupported alignment!" ); aRenderDevice.SetLineColor(); //aRenderDevice.SetFillColor( rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); @@ -850,23 +727,22 @@ namespace svt rTabBar.SetUpdateMode( FALSE ); -// // the actual item pos might differ from the saved one, if we have scroll buttons -// const Point aActualItemPos( GetActualLogicalItemRect( rItem.GetCurrentRect() ).TopLeft() ); -// pLayout->DrawItem( aGeometry, rItem.pPanel, aActualItemPos, nItemFlags, rItem.eContent ); - // some item geometry // - the normalized bounding and content rect const Rectangle aNormalizedBounds( rItem.GetCurrentRect() ); Rectangle aNormalizedContent( aNormalizedBounds ); lcl_deflateRect( aNormalizedContent, rItem.aContentInset ); - // the aligned bounding and content rect + // - the aligned bounding and content rect const NormalizedArea aTransformer( Rectangle( Point(), aRenderDevice.GetOutputSizePixel() ), false ); const Rectangle aActualBounds = aTransformer.getTransformed( aNormalizedBounds, m_eTabAlignment ); const Rectangle aActualContent = aTransformer.getTransformed( aNormalizedContent, m_eTabAlignment ); + // completely erase the bounding region, renderers are not expected to do this + const_cast< VirtualDevice& >( aRenderDevice ).DrawRect( aNormalizedBounds ); + // render item "background" layer - pRenderer->preRenderItem( aNormalizedBounds, aNormalizedContent, nItemFlags ); + pRenderer->preRenderItem( aNormalizedContent, nItemFlags ); // copy from the virtual device to ourself BitmapEx aBitmap( aRenderDevice.GetBitmapEx( aNormalizedBounds.TopLeft(), aNormalizedBounds.GetSize() ) ); -- cgit From b184512f4669906beb1f8452cf4c846b04447861 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 18:05:51 +0100 Subject: slidecopy: misc fine tuning --- svtools/source/toolpanel/paneltabbar.cxx | 285 +++++++++++++++------------- svtools/source/toolpanel/tabbargeometry.cxx | 6 + svtools/source/toolpanel/tabbargeometry.hxx | 4 + 3 files changed, 162 insertions(+), 133 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index b810bb366276..fe174dbe916d 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -77,9 +77,10 @@ namespace svt virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; - // TODO: postRenderItem takes the "real" output device, i.e. effectively the tab bar. This is because - // DrawSelectionBackground needs to be applied after everything else is painted. This is weird, and implies - // that now the renderer needs to know about the TabAlignment, which is No Good (TM). + // TODO: postRenderItem takes the "real" window, i.e. effectively the tab bar. This is because + // DrawSelectionBackground needs to be applied after everything else is painted, and is available at the Window + // class, but not at the OutputDevice. This makes the API somewhat weird, as we're now mixing operations on the + // target device, done in a normalized geometry, with operations on the window, done in a transformed geometry. // So, we should get rid of postRenderItem completely. }; typedef ::boost::shared_ptr< ITabBarRenderer > PTabBarRenderer; @@ -326,7 +327,7 @@ namespace svt ~PanelTabBar_Impl() { - rPanelDeck.RemoveListener( *this ); + m_rPanelDeck.RemoveListener( *this ); } // IToolPanelDeckListener @@ -334,16 +335,16 @@ namespace svt { (void)i_pPanel; (void)i_nPosition; - bItemsDirty = true; - rTabBar.Invalidate(); + m_bItemsDirty = true; + m_rTabBar.Invalidate(); Relayout(); } virtual void PanelRemoved( const size_t i_nPosition ) { - bItemsDirty = true; - rTabBar.Invalidate(); + m_bItemsDirty = true; + m_rTabBar.Invalidate(); if ( i_nPosition < m_nScrollPosition ) --m_nScrollPosition; @@ -357,7 +358,7 @@ namespace svt void UpdateScrollButtons() { m_aScrollBack.Enable( m_nScrollPosition > 0 ); - m_aScrollForward.Enable( m_nScrollPosition < aItems.size() - 1 ); + m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 ); } void Relayout(); @@ -381,20 +382,21 @@ namespace svt void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const; public: - PanelTabBar& rTabBar; - TabBarGeometry aGeometry; + PanelTabBar& m_rTabBar; + TabBarGeometry m_aGeometry; + NormalizedArea m_aNormalizer; TabAlignment m_eTabAlignment; - IToolPanelDeck& rPanelDeck; + IToolPanelDeck& m_rPanelDeck; - VirtualDevice aRenderDevice; - PTabBarRenderer pRenderer; + VirtualDevice m_aRenderDevice; + PTabBarRenderer m_pRenderer; - ::boost::optional< size_t > aHoveredItem; - ::boost::optional< size_t > aFocusedItem; - bool bMouseButtonDown; + ::boost::optional< size_t > m_aHoveredItem; + ::boost::optional< size_t > m_aFocusedItem; + bool m_bMouseButtonDown; - ItemDescriptors aItems; - bool bItemsDirty; + ItemDescriptors m_aItems; + bool m_bItemsDirty; PushButton m_aScrollBack; PushButton m_aScrollForward; @@ -411,16 +413,16 @@ namespace svt #if OSL_DEBUG_LEVEL > 0 static void lcl_checkConsistency( const PanelTabBar_Impl& i_rImpl ) { - if ( !i_rImpl.bItemsDirty ) + if ( !i_rImpl.m_bItemsDirty ) { - if ( i_rImpl.rPanelDeck.GetPanelCount() != i_rImpl.aItems.size() ) + if ( i_rImpl.m_rPanelDeck.GetPanelCount() != i_rImpl.m_aItems.size() ) { OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" ); return; } - for ( size_t i = 0; i < i_rImpl.rPanelDeck.GetPanelCount(); ++i ) + for ( size_t i = 0; i < i_rImpl.m_rPanelDeck.GetPanelCount(); ++i ) { - if ( i_rImpl.rPanelDeck.GetPanel( i ).get() != i_rImpl.aItems[i].pPanel.get() ) + if ( i_rImpl.m_rPanelDeck.GetPanel( i ).get() != i_rImpl.m_aItems[i].pPanel.get() ) { OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" ); return; @@ -441,11 +443,10 @@ namespace svt { public: ClipItemRegion( const PanelTabBar_Impl& i_rImpl ) - :m_rDevice( i_rImpl.rTabBar ) + :m_rDevice( i_rImpl.m_rTabBar ) { m_rDevice.Push( PUSH_CLIPREGION ); - NormalizedArea aNormalizer( Rectangle( Point(), i_rImpl.aRenderDevice.GetOutputSizePixel() ), false ); - m_rDevice.SetClipRegion( aNormalizer.getTransformed( i_rImpl.aGeometry.getItemsRect(), i_rImpl.m_eTabAlignment ) ); + m_rDevice.SetClipRegion( i_rImpl.m_aNormalizer.getTransformed( i_rImpl.m_aGeometry.getItemsRect(), i_rImpl.m_eTabAlignment ) ); } ~ClipItemRegion() @@ -479,41 +480,42 @@ namespace svt //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :rTabBar( i_rTabBar ) - ,aGeometry( i_eItemContent ) + :m_rTabBar( i_rTabBar ) + ,m_aGeometry( i_eItemContent ) + ,m_aNormalizer() ,m_eTabAlignment( i_eAlignment ) - ,rPanelDeck( i_rPanelDeck ) - ,aRenderDevice( i_rTabBar ) - ,pRenderer( new NWFTabItemRenderer( aRenderDevice ) ) - ,aHoveredItem() - ,aFocusedItem() - ,bMouseButtonDown( false ) - ,aItems() - ,bItemsDirty( true ) + ,m_rPanelDeck( i_rPanelDeck ) + ,m_aRenderDevice( i_rTabBar ) + ,m_pRenderer() + ,m_aHoveredItem() + ,m_aFocusedItem() + ,m_bMouseButtonDown( false ) + ,m_aItems() + ,m_bItemsDirty( true ) ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) ,m_nScrollPosition( 0 ) { #ifdef WNT - if ( aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) + if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) ) // this mode requires the NWF framework to be able to render those items onto a virtual // device. For some frameworks (some GTK themes, in particular), this is known to fail. // So, be on the safe side for the moment. - pRenderer.reset( new NWFTabItemRenderer( aRenderDevice ) ); + m_pRenderer.reset( new NWFTabItemRenderer( m_aRenderDevice ) ); else #endif - if ( aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) - pRenderer.reset( new NWFToolboxItemRenderer( aRenderDevice ) ); + if ( m_aRenderDevice.IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + m_pRenderer.reset( new NWFToolboxItemRenderer( m_aRenderDevice ) ); else - pRenderer.reset( new VCLItemRenderer( aRenderDevice ) ); + m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) ); OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), "PanelTabBar_Impl::PanelTabBar_Impl: unsupported alignment!" ); - aRenderDevice.SetLineColor(); - //aRenderDevice.SetFillColor( rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); + m_aRenderDevice.SetLineColor(); + //m_aRenderDevice.SetFillColor( m_rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); - rPanelDeck.AddListener( *this ); + m_rPanelDeck.AddListener( *this ); m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); m_aScrollBack.Show(); @@ -527,18 +529,18 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Impl::impl_calcItemRects() { - aItems.resize(0); + m_aItems.resize(0); - Point aCompletePos( aGeometry.getFirstItemPosition() ); + Point aCompletePos( m_aGeometry.getFirstItemPosition() ); Point aIconOnlyPos( aCompletePos ); Point aTextOnlyPos( aCompletePos ); for ( size_t i = 0; - i < rPanelDeck.GetPanelCount(); + i < m_rPanelDeck.GetPanelCount(); ++i ) { - PToolPanel pPanel( rPanelDeck.GetPanel( i ) ); + PToolPanel pPanel( m_rPanelDeck.GetPanel( i ) ); ItemDescriptor aItem; aItem.pPanel = pPanel; @@ -552,7 +554,7 @@ namespace svt // TODO: have one method calculating all sizes? // care for the decorations - const Rectangle aBoundingRect( pRenderer->calculateDecorations( aCompleteSize ) ); + const Rectangle aBoundingRect( m_pRenderer->calculateDecorations( aCompleteSize ) ); OSL_POSTCOND( ( aBoundingRect.Left() <= 0 ) && ( aBoundingRect.Top() <= 0 ), "PanelTabBar_Impl::impl_calcItemRects: hmmm ...." ); @@ -570,14 +572,14 @@ namespace svt aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); - aItems.push_back( aItem ); + m_aItems.push_back( aItem ); aCompletePos = aItem.aCompleteArea.TopRight(); aIconOnlyPos = aItem.aIconOnlyArea.TopRight(); aTextOnlyPos = aItem.aTextOnlyArea.TopRight(); } - bItemsDirty = false; + m_bItemsDirty = false; } //------------------------------------------------------------------------------------------------------------------ @@ -604,7 +606,7 @@ namespace svt aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE; // add space for text - const Size aTextSize( rTabBar.GetCtrlTextWidth( sItemText ), rTabBar.GetTextHeight() ); + const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() ); aItemContentSize.Width() += aTextSize.Width(); aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() ); @@ -650,7 +652,7 @@ namespace svt aImagePos.X() = aRenderArea.Left(); aImagePos.Y() = aRenderArea.Top() + ( aRenderArea.GetHeight() - aImageSize.Height() ) / 2; } - rTabBar.DrawImage( aImagePos, aItemImage ); + m_rTabBar.DrawImage( aImagePos, aItemImage ); } const ::rtl::OUString sItemText( i_pPanel->GetDisplayName() ); @@ -672,16 +674,16 @@ namespace svt } // draw the text - const Size aTextSize( rTabBar.GetCtrlTextWidth( sItemText ), rTabBar.GetTextHeight() ); + const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() ); Point aTextPos( aRenderArea.TopLeft() ); if ( IsVertical() ) { - rTabBar.Push( PUSH_FONT ); + m_rTabBar.Push( PUSH_FONT ); - Font aFont( rTabBar.GetFont() ); + Font aFont( m_rTabBar.GetFont() ); aFont.SetOrientation( 2700 ); aFont.SetVertical( TRUE ); - rTabBar.SetFont( aFont ); + m_rTabBar.SetFont( aFont ); aTextPos.X() += aTextSize.Height(); aTextPos.X() += ( aRenderArea.GetWidth() - aTextSize.Height() ) / 2; @@ -691,11 +693,11 @@ namespace svt aTextPos.Y() += ( aRenderArea.GetHeight() - aTextSize.Height() ) / 2; } - rTabBar.DrawText( aTextPos, sItemText ); + m_rTabBar.DrawText( aTextPos, sItemText ); if ( IsVertical() ) { - rTabBar.Pop(); + m_rTabBar.Pop(); } } } @@ -703,29 +705,29 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex ) const { - const ItemDescriptor& rItem( aItems[ i_nItemIndex ] ); + const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] ); ItemFlags nItemFlags( ITEM_STATE_NORMAL ); - if ( aHoveredItem == i_nItemIndex ) + if ( m_aHoveredItem == i_nItemIndex ) { nItemFlags |= ITEM_STATE_HOVERED; - if ( bMouseButtonDown ) + if ( m_bMouseButtonDown ) nItemFlags |= ITEM_STATE_ACTIVE; } - if ( rPanelDeck.GetActivePanel() == i_nItemIndex ) + if ( m_rPanelDeck.GetActivePanel() == i_nItemIndex ) nItemFlags |= ITEM_STATE_ACTIVE; - if ( aFocusedItem == i_nItemIndex ) + if ( m_aFocusedItem == i_nItemIndex ) nItemFlags |= ITEM_STATE_FOCUSED; if ( 0 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_FIRST; - if ( rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) + if ( m_rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_LAST; - rTabBar.SetUpdateMode( FALSE ); + m_rTabBar.SetUpdateMode( FALSE ); // some item geometry // - the normalized bounding and content rect @@ -734,18 +736,23 @@ namespace svt lcl_deflateRect( aNormalizedContent, rItem.aContentInset ); // - the aligned bounding and content rect - const NormalizedArea aTransformer( Rectangle( Point(), aRenderDevice.GetOutputSizePixel() ), false ); - const Rectangle aActualBounds = aTransformer.getTransformed( aNormalizedBounds, m_eTabAlignment ); - const Rectangle aActualContent = aTransformer.getTransformed( aNormalizedContent, m_eTabAlignment ); + const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment ); + const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment ); // completely erase the bounding region, renderers are not expected to do this - const_cast< VirtualDevice& >( aRenderDevice ).DrawRect( aNormalizedBounds ); + const_cast< VirtualDevice& >( m_aRenderDevice ).DrawRect( aNormalizedBounds ); // render item "background" layer - pRenderer->preRenderItem( aNormalizedContent, nItemFlags ); + m_pRenderer->preRenderItem( aNormalizedContent, nItemFlags ); // copy from the virtual device to ourself - BitmapEx aBitmap( aRenderDevice.GetBitmapEx( aNormalizedBounds.TopLeft(), aNormalizedBounds.GetSize() ) ); + BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx( + aNormalizedBounds.TopLeft(), + Size( + aNormalizedBounds.GetSize().Width() - 1, + aNormalizedBounds.GetSize().Height() - 1 + ) + ) ); if ( IsVertical() ) { aBitmap.Rotate( 2700, COL_BLACK ); @@ -756,27 +763,27 @@ namespace svt // { // aBitmap.Mirror( BMP_MIRROR_VERT ); // } - rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); + m_rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); // render the actual item content - impl_renderItemContent( rItem.pPanel, aActualContent, aGeometry.getItemContent() ); + impl_renderItemContent( rItem.pPanel, aActualContent, m_aGeometry.getItemContent() ); // render item "foreground" layer - pRenderer->postRenderItem( rTabBar, aActualBounds, nItemFlags ); + m_pRenderer->postRenderItem( m_rTabBar, aActualBounds, nItemFlags ); - rTabBar.SetUpdateMode( TRUE ); + m_rTabBar.SetUpdateMode( TRUE ); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Impl::EnsureItemsCache() { - if ( bItemsDirty == false ) + if ( m_bItemsDirty == false ) { DBG_CHECK( *this ); return; } impl_calcItemRects(); - OSL_POSTCOND( bItemsDirty == false, "EnsureItemsCache: cache still dirty!" ); + OSL_POSTCOND( m_bItemsDirty == false, "EnsureItemsCache: cache still dirty!" ); DBG_CHECK( *this ); } @@ -785,23 +792,37 @@ namespace svt { EnsureItemsCache(); - const Size aOutputSize( rTabBar.GetOutputSizePixel() ); - NormalizedArea aNormalizer( Rectangle( Point(), aOutputSize ), IsVertical() ); - const Size aLogicalOutputSize( aNormalizer.getReferenceSize() ); + const Size aOutputSize( m_rTabBar.GetOutputSizePixel() ); + m_aNormalizer = NormalizedArea( Rectangle( Point(), aOutputSize ), IsVertical() ); + const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() ); // forward actual output size to our render device - aRenderDevice.SetOutputSizePixel( aLogicalOutputSize ); + m_aRenderDevice.SetOutputSizePixel( aLogicalOutputSize ); // re-calculate the size of the scroll buttons and of the items - aGeometry.relayout( aLogicalOutputSize, aItems ); + m_aGeometry.relayout( aLogicalOutputSize, m_aItems ); - const Rectangle aButtonBack( aNormalizer.getTransformed( aGeometry.getButtonBackRect(), m_eTabAlignment ) ); - m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); - m_aScrollBack.Show( !aButtonBack.IsEmpty() ); + if ( m_aGeometry.getButtonBackRect().IsEmpty() ) + { + m_aScrollBack.Hide(); + } + else + { + const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) ); + m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); + m_aScrollBack.Show(); + } - const Rectangle aButtonForward( aNormalizer.getTransformed( aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); - m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); - m_aScrollForward.Show( !aButtonForward.IsEmpty() ); + if ( m_aGeometry.getButtonForwardRect().IsEmpty() ) + { + m_aScrollForward.Hide(); + } + else + { + const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); + m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); + m_aScrollForward.Show(); + } UpdateScrollButtons(); } @@ -811,12 +832,12 @@ namespace svt { Point aPoint( IsVertical() ? i_rPoint.Y() : i_rPoint.X(), IsVertical() ? i_rPoint.X() : i_rPoint.Y() ); - if ( !aGeometry.getItemsRect().IsInside( aPoint ) ) + if ( !m_aGeometry.getItemsRect().IsInside( aPoint ) ) return ::boost::optional< size_t >(); size_t i=0; - for ( ItemDescriptors::const_iterator item = aItems.begin(); - item != aItems.end(); + for ( ItemDescriptors::const_iterator item = m_aItems.begin(); + item != m_aItems.end(); ++item, ++i ) { @@ -835,13 +856,13 @@ namespace svt { OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" ); --m_nScrollPosition; - rTabBar.Invalidate(); + m_rTabBar.Invalidate(); } else if ( i_pButton == &m_aScrollForward ) { - OSL_ENSURE( m_nScrollPosition < aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); + OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); ++m_nScrollPosition; - rTabBar.Invalidate(); + m_rTabBar.Invalidate(); } UpdateScrollButtons(); @@ -854,14 +875,14 @@ namespace svt { // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons Rectangle aItemRect( i_rLogicalItemRect ); - aItemRect.Move( aGeometry.getItemsRect().Left() - aGeometry.getButtonBackRect().Left(), 0 ); + aItemRect.Move( m_aGeometry.getItemsRect().Left() - m_aGeometry.getButtonBackRect().Left(), 0 ); // care for the current scroll position - OSL_ENSURE( m_nScrollPosition < aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" ); - if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < aItems.size() ) ) + OSL_ENSURE( m_nScrollPosition < m_aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" ); + if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < m_aItems.size() ) ) { - long nOffsetX = aItems[ m_nScrollPosition ].GetCurrentRect().Left() - aItems[ 0 ].GetCurrentRect().Left(); - long nOffsetY = aItems[ m_nScrollPosition ].GetCurrentRect().Top() - aItems[ 0 ].GetCurrentRect().Top(); + long nOffsetX = m_aItems[ m_nScrollPosition ].GetCurrentRect().Left() - m_aItems[ 0 ].GetCurrentRect().Left(); + long nOffsetY = m_aItems[ m_nScrollPosition ].GetCurrentRect().Top() - m_aItems[ 0 ].GetCurrentRect().Top(); aItemRect.Move( -nOffsetX, -nOffsetY ); } @@ -908,13 +929,13 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ TabItemContent PanelTabBar::GetTabItemContent() const { - return m_pImpl->aGeometry.getItemContent(); + return m_pImpl->m_aGeometry.getItemContent(); } //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent ) { - m_pImpl->aGeometry.setItemContent( i_eItemContent ); + m_pImpl->m_aGeometry.setItemContent( i_eItemContent ); m_pImpl->Relayout(); Invalidate(); } @@ -923,7 +944,7 @@ namespace svt Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { m_pImpl->EnsureItemsCache(); - Size aOptimalSize( m_pImpl->aGeometry.getOptimalSize( m_pImpl->aItems, i_eType == WINDOWSIZE_MINIMUM ) ); + Size aOptimalSize( m_pImpl->m_aGeometry.getOptimalSize( m_pImpl->m_aItems, i_eType == WINDOWSIZE_MINIMUM ) ); if ( m_pImpl->IsVertical() ) ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() ); return aOptimalSize; @@ -942,22 +963,20 @@ namespace svt m_pImpl->EnsureItemsCache(); // background - m_pImpl->aRenderDevice.Push( PUSH_CLIPREGION ); - m_pImpl->aRenderDevice.SetClipRegion( i_rRect ); - m_pImpl->pRenderer->renderBackground(); - m_pImpl->aRenderDevice.Pop(); + m_pImpl->m_aRenderDevice.Push( PUSH_CLIPREGION ); + m_pImpl->m_aRenderDevice.SetClipRegion( i_rRect ); + m_pImpl->m_pRenderer->renderBackground(); + m_pImpl->m_aRenderDevice.Pop(); // ensure the items really paint into their own playground only ClipItemRegion aClipItems( *m_pImpl ); - NormalizedArea aTransformer( Rectangle( Point(), m_pImpl->aRenderDevice.GetOutputSizePixel() ), false ); - // TODO: make the transformer a member - const Rectangle aLogicalPaintRect( aTransformer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); + const Rectangle aLogicalPaintRect( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); // items size_t i=0; - for ( ItemDescriptors::const_iterator item = m_pImpl->aItems.begin(); - item != m_pImpl->aItems.end(); + for ( ItemDescriptors::const_iterator item = m_pImpl->m_aItems.begin(); + item != m_pImpl->m_aItems.end(); ++item, ++i ) { @@ -974,7 +993,7 @@ namespace svt { m_pImpl->EnsureItemsCache(); - ::boost::optional< size_t > aOldItem( m_pImpl->aHoveredItem ); + ::boost::optional< size_t > aOldItem( m_pImpl->m_aHoveredItem ); ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( i_rMouseEvent.IsLeaveWindow() ) @@ -982,7 +1001,7 @@ namespace svt if ( aOldItem != aNewItem ) { - m_pImpl->aHoveredItem = aNewItem; + m_pImpl->m_aHoveredItem = aNewItem; ClipItemRegion aClipItems( *m_pImpl ); @@ -1009,7 +1028,7 @@ namespace svt return; CaptureMouse(); - m_pImpl->bMouseButtonDown = true; + m_pImpl->m_bMouseButtonDown = true; ClipItemRegion aClipItems( *m_pImpl ); m_pImpl->DrawItem( *aHitItem ); @@ -1020,12 +1039,12 @@ namespace svt { Control::MouseButtonUp( i_rMouseEvent ); - if ( m_pImpl->bMouseButtonDown ) + if ( m_pImpl->m_bMouseButtonDown ) { OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); if ( IsMouseCaptured() ) ReleaseMouse(); - m_pImpl->bMouseButtonDown = false; + m_pImpl->m_bMouseButtonDown = false; ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( !!aHitItem ) @@ -1034,7 +1053,7 @@ namespace svt ClipItemRegion aClipItems( *m_pImpl ); m_pImpl->DrawItem( *aHitItem ); // activate the respective panel - m_pImpl->rPanelDeck.ActivatePanel( *aHitItem ); + m_pImpl->m_rPanelDeck.ActivatePanel( *aHitItem ); } } } @@ -1048,7 +1067,7 @@ namespace svt if ( !aHelpItem ) return; - const ItemDescriptor& rItem( m_pImpl->aItems[ *aHelpItem ] ); + const ItemDescriptor& rItem( m_pImpl->m_aItems[ *aHelpItem ] ); if ( rItem.eContent != TABITEM_IMAGE_ONLY ) // if the text is displayed for the item, we do not need to show it as tooltip return; @@ -1064,14 +1083,14 @@ namespace svt void PanelTabBar::GetFocus() { Control::GetFocus(); - if ( m_pImpl->rPanelDeck.GetPanelCount() ) + if ( m_pImpl->m_rPanelDeck.GetPanelCount() ) { - ::boost::optional< size_t > aActivePanel( m_pImpl->rPanelDeck.GetActivePanel() ); + ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() ); if ( !!aActivePanel ) { - m_pImpl->aFocusedItem = aActivePanel; + m_pImpl->m_aFocusedItem = aActivePanel; ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( *m_pImpl->aFocusedItem ); + m_pImpl->DrawItem( *m_pImpl->m_aFocusedItem ); } } } @@ -1081,8 +1100,8 @@ namespace svt { Control::LoseFocus(); - ::boost::optional< size_t > aPreviouslyFocused( m_pImpl->aFocusedItem ); - m_pImpl->aFocusedItem.reset(); + ::boost::optional< size_t > aPreviouslyFocused( m_pImpl->m_aFocusedItem ); + m_pImpl->m_aFocusedItem.reset(); if ( !!aPreviouslyFocused ) { @@ -1102,12 +1121,12 @@ namespace svt return; // if there are less than 2 panels, we cannot travel them ... - const size_t nPanelCount( m_pImpl->rPanelDeck.GetPanelCount() ); + const size_t nPanelCount( m_pImpl->m_rPanelDeck.GetPanelCount() ); if ( nPanelCount < 2 ) return; - OSL_PRECOND( !!m_pImpl->aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); - // if we get KeyInput events, we should have the focus. In this case, aFocusedItem should not be empty, + OSL_PRECOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); + // if we get KeyInput events, we should have the focus. In this case, m_aFocusedItem should not be empty, // except if there are no panels, but then we bail out of this method here earlier ... bool bFocusNext = false; @@ -1130,26 +1149,26 @@ namespace svt bFocusNext = true; break; case KEY_RETURN: - m_pImpl->rPanelDeck.ActivatePanel( *m_pImpl->aFocusedItem ); + m_pImpl->m_rPanelDeck.ActivatePanel( *m_pImpl->m_aFocusedItem ); break; } if ( !bFocusNext && !bFocusPrev ) return; - const size_t nOldFocus = *m_pImpl->aFocusedItem; + const size_t nOldFocus = *m_pImpl->m_aFocusedItem; if ( bFocusNext ) { - m_pImpl->aFocusedItem.reset( ( *m_pImpl->aFocusedItem + 1 ) % nPanelCount ); + m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + 1 ) % nPanelCount ); } else { - m_pImpl->aFocusedItem.reset( ( *m_pImpl->aFocusedItem + nPanelCount - 1 ) % nPanelCount ); + m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount ); } ClipItemRegion aClipItems( *m_pImpl ); m_pImpl->DrawItem( nOldFocus ); - m_pImpl->DrawItem( *m_pImpl->aFocusedItem ); + m_pImpl->DrawItem( *m_pImpl->m_aFocusedItem ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index b70bc20dbf88..c2ada52d1f5a 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -111,6 +111,12 @@ namespace svt //================================================================================================================== //= NormalizedArea //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + NormalizedArea::NormalizedArea() + :m_aReference() + { + } + //------------------------------------------------------------------------------------------------------------------ NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ) :m_aReference( i_bIsVertical ? Rectangle( i_rReference.TopLeft(), Size( i_rReference.GetHeight(), i_rReference.GetWidth() ) ) : i_rReference ) diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx index 5e798e690116..41da162e7480 100644 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -50,6 +50,7 @@ namespace svt class NormalizedArea { public: + NormalizedArea(); NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ); /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment @@ -121,8 +122,11 @@ namespace svt TabItemContent m_eTabItemContent; /// specifies the inset to be used in the items area, depends on the actual alignment Inset m_aItemsInset; + // the (logical) rectangle to be used for the "back" button, empty if the button is not needed Rectangle m_aButtonBackRect; + // the (logical) rectangle to be used for the items Rectangle m_aItemsRect; + // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed Rectangle m_aButtonForwardRect; }; -- cgit From 7b03e2ffd167241b1bbcb1b0e9bb4939401612c5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 22:53:41 +0100 Subject: slidecopy: top and bottom tabs --- svtools/inc/svtools/toolpanel/tabalignment.hxx | 4 +++- svtools/source/toolpanel/paneltabbar.cxx | 17 ++++++------- svtools/source/toolpanel/tabbargeometry.cxx | 25 ++++++++++++++----- svtools/source/toolpanel/tablayouter.cxx | 33 ++++++++++++++++++++------ svtools/workben/toolpanel/toolpaneltest.cxx | 28 ++++++++++++++++------ 5 files changed, 76 insertions(+), 31 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/tabalignment.hxx b/svtools/inc/svtools/toolpanel/tabalignment.hxx index e14db1bd841a..e901bb593b7d 100644 --- a/svtools/inc/svtools/toolpanel/tabalignment.hxx +++ b/svtools/inc/svtools/toolpanel/tabalignment.hxx @@ -35,7 +35,9 @@ namespace svt enum TabAlignment { TABS_LEFT, - TABS_RIGHT + TABS_RIGHT, + TABS_TOP, + TABS_BOTTOM }; //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index fe174dbe916d..fd359efd7090 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -509,19 +509,16 @@ namespace svt else m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) ); - OSL_ENSURE( ( i_eAlignment == TABS_LEFT ) || ( i_eAlignment == TABS_RIGHT ), - "PanelTabBar_Impl::PanelTabBar_Impl: unsupported alignment!" ); - m_aRenderDevice.SetLineColor(); //m_aRenderDevice.SetFillColor( m_rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); m_rPanelDeck.AddListener( *this ); - m_aScrollBack.SetSymbol( SYMBOL_ARROW_UP ); + m_aScrollBack.SetSymbol( IsVertical() ? SYMBOL_ARROW_UP : SYMBOL_ARROW_LEFT ); m_aScrollBack.Show(); m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollForward.SetSymbol( SYMBOL_ARROW_DOWN ); + m_aScrollForward.SetSymbol( IsVertical() ? SYMBOL_ARROW_DOWN : SYMBOL_ARROW_RIGHT ); m_aScrollForward.Show(); m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); } @@ -731,7 +728,7 @@ namespace svt // some item geometry // - the normalized bounding and content rect - const Rectangle aNormalizedBounds( rItem.GetCurrentRect() ); + const Rectangle aNormalizedBounds( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); Rectangle aNormalizedContent( aNormalizedBounds ); lcl_deflateRect( aNormalizedContent, rItem.aContentInset ); @@ -759,10 +756,10 @@ namespace svt if ( m_eTabAlignment == TABS_LEFT ) aBitmap.Mirror( BMP_MIRROR_HORZ ); } -// else if ( m_eTabAlignment == TABS_BOTTOM ) -// { -// aBitmap.Mirror( BMP_MIRROR_VERT ); -// } + else if ( m_eTabAlignment == TABS_BOTTOM ) + { + aBitmap.Mirror( BMP_MIRROR_VERT ); + } m_rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); // render the actual item content diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index c2ada52d1f5a..a94af8cfb2a4 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -108,6 +108,14 @@ namespace svt ::std::swap( io_rArea.Left(), io_rArea.Right() ); } + //------------------------------------------------------------------------------------------------------------------ + void lcl_mirrorVertically( const Rectangle& i_rReferenceArea, Rectangle& io_rArea ) + { + io_rArea.Top() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Top(); + io_rArea.Bottom() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Bottom(); + ::std::swap( io_rArea.Top(), io_rArea.Bottom() ); + } + //================================================================================================================== //= NormalizedArea //================================================================================================================== @@ -126,9 +134,6 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const { - OSL_ENSURE( ( i_eTargetAlignment == TABS_LEFT ) || ( i_eTargetAlignment == TABS_RIGHT ), - "NormalizedArea::getTransformed: unsupported alignment!" ); - Rectangle aResult( i_rArea ); if ( ( i_eTargetAlignment == TABS_RIGHT ) @@ -144,15 +149,18 @@ namespace svt lcl_mirrorHorizontally( aReference, aResult ); } } + else + if ( i_eTargetAlignment == TABS_BOTTOM ) + { + lcl_mirrorVertically( m_aReference, aResult ); + } + return aResult; } //------------------------------------------------------------------------------------------------------------------ Rectangle NormalizedArea::getNormalized( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const { - OSL_ENSURE( ( i_eTargetAlignment == TABS_LEFT ) || ( i_eTargetAlignment == TABS_RIGHT ), - "NormalizedArea::gerNormalized: unsupported alignment!" ); - Rectangle aResult( i_rArea ); if ( ( i_eTargetAlignment == TABS_RIGHT ) @@ -169,6 +177,11 @@ namespace svt lcl_rotate( aReference, aResult, false ); } + else + if ( i_eTargetAlignment == TABS_BOTTOM ) + { + lcl_mirrorVertically( m_aReference, aResult ); + } return aResult; } diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 755b58979fe2..c5920f05aada 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -117,12 +117,12 @@ namespace svt if ( lcl_checkDisposed( *m_pData ) ) return i_rDeckPlayground; + const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) ); if ( lcl_isVerticalTabBar( m_pData->eAlignment ) ) { - const Size aPreferredSize( m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_PREFERRED ) ); - Size aTabBarSize = ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() ) - ? aPreferredSize - : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM ); + Size aTabBarSize = ( aPreferredSize.Width() < i_rDeckPlayground.GetWidth() ) + ? aPreferredSize + : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM ); aTabBarSize.Height() = i_rDeckPlayground.GetHeight(); Rectangle aPanelRect( i_rDeckPlayground ); @@ -144,9 +144,28 @@ namespace svt return aPanelRect; } - OSL_ENSURE( false, "TabDeckLayouter::Layout: unreachable!" ); - // currently there do not even exist enum values for other alignments ... - return i_rDeckPlayground; + Size aTabBarSize = ( aPreferredSize.Height() < i_rDeckPlayground.GetHeight() ) + ? aPreferredSize + : m_pData->pTabBar->GetOptimalSize( WINDOWSIZE_MINIMUM ); + aTabBarSize.Width() = i_rDeckPlayground.GetWidth(); + + Rectangle aPanelRect( i_rDeckPlayground ); + if ( m_pData->eAlignment == TABS_TOP ) + { + m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize ); + aPanelRect.Top() += aTabBarSize.Height(); + } + else + { + aPanelRect.Bottom() -= aTabBarSize.Height(); + Point aTabBarTopLeft( aPanelRect.BottomLeft() ); + aTabBarTopLeft.Y() -= 1; + m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize ); + } + if ( aPanelRect.Top() >= aPanelRect.Bottom() ) + aPanelRect = Rectangle(); + + return aPanelRect; } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 3850a75c5bf7..88eb318936eb 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -89,7 +89,7 @@ public: const sal_Char* pTabTitles[] = { - "This", "is a", "Tab", "Control", "test", "intended", "for", "comparison" + "This", "is a", "Tab", "Control", "intended", "for", "comparison" }; for ( size_t i=0; i < sizeof( pTabTitles ) / sizeof( pTabTitles[0] ); ++i ) { @@ -287,6 +287,8 @@ private: FixedLine m_aAlignmentHeader; RadioButton m_aAlignLeft; RadioButton m_aAlignRight; + RadioButton m_aAlignTop; + RadioButton m_aAlignBottom; FixedLine m_aTabItemContent; RadioButton m_aImagesAndText; RadioButton m_aImagesOnly; @@ -339,6 +341,8 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) ,m_aAlignmentHeader( this ) ,m_aAlignLeft( this, WB_GROUP ) ,m_aAlignRight( this, 0 ) + ,m_aAlignTop( this, 0 ) + ,m_aAlignBottom( this, 0 ) ,m_aTabItemContent( this ) ,m_aImagesAndText( this ) ,m_aImagesOnly( this ) @@ -373,14 +377,14 @@ OptionsWindow::OptionsWindow( PanelDemoMainWindow& i_rParent ) Window* pControls[] = { - &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aTabItemContent, &m_aImagesAndText, &m_aImagesOnly, - &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, &m_aRemovePanel, &m_aColors, - &m_aNewPanelName, &m_aInsertPanel + &m_aAlignmentHeader, &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom, &m_aTabItemContent, + &m_aImagesAndText, &m_aImagesOnly, &m_aTextOnly, &m_aAutomaticContent, &m_aPanelsHeader, &m_aPanelList, + &m_aRemovePanel, &m_aColors, &m_aNewPanelName, &m_aInsertPanel }; const sal_Char* pTexts[] = { - "Tab Bar Alignment", "Left", "Right", "Tab Items", "Images and Text", "Images only", "Text only", "Automatic", - "Panels", "", "Remove Panel", "", "", "Insert Panel" + "Tab Bar Alignment", "Left", "Right", "Top", "Bottom", "Tab Items", "Images and Text", "Images only", + "Text only", "Automatic", "Panels", "", "Remove Panel", "", "", "Insert Panel" }; for ( size_t i=0; i < sizeof( pControls ) / sizeof( pControls[0] ); ++i ) { @@ -470,7 +474,7 @@ void OptionsWindow::GetFocus() Window::GetFocus(); RadioButton* pRadios[] = { - &m_aAlignLeft, &m_aAlignRight + &m_aAlignLeft, &m_aAlignRight, &m_aAlignTop, &m_aAlignBottom }; for ( size_t i=0; i < sizeof( pRadios ) / sizeof( pRadios[0] ); ++i ) { @@ -521,6 +525,8 @@ void OptionsWindow::Resize() ControlRow( m_aAlignmentHeader, false ), ControlRow( m_aAlignLeft, true ), ControlRow( m_aAlignRight, true ), + ControlRow( m_aAlignTop, true ), + ControlRow( m_aAlignBottom, true ), ControlRow( m_aTabItemContent, false ), ControlRow( m_aImagesAndText, true ), ControlRow( m_aImagesOnly, true ), @@ -674,6 +680,14 @@ IMPL_LINK( OptionsWindow, OnRadioToggled, RadioButton*, i_pRadioButton ) { rController.AlignTabs( TABS_RIGHT ); } + else if ( i_pRadioButton == &m_aAlignTop ) + { + rController.AlignTabs( TABS_TOP ); + } + else if ( i_pRadioButton == &m_aAlignBottom ) + { + rController.AlignTabs( TABS_BOTTOM ); + } else if ( i_pRadioButton == &m_aImagesAndText ) { rController.SetTabItemContent( TABITEM_IMAGE_AND_TEXT ); -- cgit From 988e47f24b5cd7257c330f0c1b19fe4bbd0fbd4e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Mar 2010 23:04:18 +0100 Subject: slidecopy: fixed ItemContentType handling --- svtools/source/toolpanel/paneltabbar.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index fd359efd7090..91a477006002 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -545,8 +545,8 @@ namespace svt Rectangle aContentArea; Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); - Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); - Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); + Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) ); + Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) ); // TODO: have one method calculating all sizes? @@ -763,7 +763,7 @@ namespace svt m_rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); // render the actual item content - impl_renderItemContent( rItem.pPanel, aActualContent, m_aGeometry.getItemContent() ); + impl_renderItemContent( rItem.pPanel, aActualContent, rItem.eContent ); // render item "foreground" layer m_pRenderer->postRenderItem( m_rTabBar, aActualBounds, nItemFlags ); @@ -780,7 +780,7 @@ namespace svt return; } impl_calcItemRects(); - OSL_POSTCOND( m_bItemsDirty == false, "EnsureItemsCache: cache still dirty!" ); + OSL_POSTCOND( m_bItemsDirty == false, "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" ); DBG_CHECK( *this ); } -- cgit From 97c22a3fb141835f5990dbae430f76f29942e5ae Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 10 Mar 2010 09:46:37 +0100 Subject: slidecopy: silence 'unused parameter' warning --- svtools/workben/toolpanel/toolpaneltest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 88eb318936eb..7f600735ea51 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -98,7 +98,7 @@ public: } } - virtual void Paint( const Rectangle& i_rRect ) + virtual void Paint( const Rectangle& /*i_rRect*/ ) { const Size aOutputSize( GetOutputSizePixel() ); const Rectangle aTitleRect( Point( 10, 10 ), Size( aOutputSize.Width() - 20, 20 ) ); -- cgit From 3fadb0a93d43c6cfa59da7ac322cde2ca23f4c8d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 10 Mar 2010 11:48:44 +0100 Subject: slidecopy: better NWF tab item rendering. Not yet tested with the NWF toolbox item renderer --- svtools/source/toolpanel/paneltabbar.cxx | 285 ++++++++++++++----------- svtools/source/toolpanel/tabbargeometry.cxx | 4 +- svtools/source/toolpanel/tabitemdescriptor.hxx | 1 - vcl/win/source/gdi/salnativewidgets-luna.cxx | 3 +- 4 files changed, 167 insertions(+), 126 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 91a477006002..aa83274ee3b9 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -31,9 +31,6 @@ #include "paneltabbar.hxx" #include "tabbargeometry.hxx" -#include -#include -#include #include #include #include @@ -42,10 +39,8 @@ #include // space around an item -#define ITEM_OUTER_SPACE 2 * 2 -// the distance between the button and the control's border, in "upright" direction (what this means depends on the alignment) -#define BUTTON_UPRIGHT_DISTANCE 2 -// spacing before and after (in writing direction, whether this is horizontal or vertical) an item's text +#define ITEM_OUTER_SPACE 2 * 3 +// spacing before and after an item's text #define ITEM_TEXT_FLOW_SPACE 5 // space between item icon and icon text #define ITEM_ICON_TEXT_DISTANCE 4 @@ -64,6 +59,21 @@ namespace svt #define ITEM_POSITION_FIRST 0x08 #define ITEM_POSITION_LAST 0x10 + //================================================================================================================== + //= helper + //================================================================================================================== + namespace + { + ControlState lcl_ItemToControlState( const ItemFlags i_nItemFlags ) + { + ControlState nState = CTRL_STATE_ENABLED; + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; + if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; + if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; + return nState; + } + } + //================================================================================================================== //= ITabBarRenderer //================================================================================================================== @@ -73,7 +83,7 @@ namespace svt /** fills the background of our target device */ virtual void renderBackground() const = 0; - virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const = 0; + virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const = 0; virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; @@ -98,7 +108,7 @@ namespace svt // ITabBarRenderer virtual void renderBackground() const; - virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const; virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; @@ -119,10 +129,11 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - Rectangle VCLItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + Rectangle VCLItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const { + (void)i_nItemFlags; // no decorations at all - return Rectangle( Point(), i_rContentSize ); + return i_rContentArea; } //------------------------------------------------------------------------------------------------------------------ @@ -171,7 +182,7 @@ namespace svt // ITabBarRenderer virtual void renderBackground() const; - virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const; virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; @@ -192,30 +203,28 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - Rectangle NWFToolboxItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + Rectangle NWFToolboxItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const { // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. // Instead, simply assume that both the content and the bounding region are the same. +// const ControlState nState( lcl_ItemToControlState( i_nItemFlags ); // const ImplControlValue aControlValue; // bool bNativeOK = m_rTargetWindow.GetNativeControlRegion( // CTRL_TOOLBAR, PART_BUTTON, -// Rectangle( Point(), i_rContentSize ), CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, +// i_rContentArea, nState, // aControlValue, ::rtl::OUString(), // aBoundingRegion, aContentRegion // ); return Rectangle( - Point( -1, -1 ), - Size( i_rContentSize.Width() + 2, i_rContentSize.Height() + 2 ) + Point( i_rContentArea.Left() - 1, i_rContentArea.Top() - 1 ), + Size( i_rContentArea.GetWidth() + 2, i_rContentArea.GetHeight() + 2 ) ); } //------------------------------------------------------------------------------------------------------------------ void NWFToolboxItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { - ControlState nState = CTRL_STATE_ENABLED; - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; - if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; - if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; + const ControlState nState = lcl_ItemToControlState( i_nItemFlags ); ImplControlValue aControlValue; aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); @@ -247,7 +256,7 @@ namespace svt // ITabBarRenderer virtual void renderBackground() const; - virtual Rectangle calculateDecorations( const Size& i_rContentSize ) const; + virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const; virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const; virtual void postRenderItem( Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const; @@ -264,20 +273,26 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void NWFTabItemRenderer::renderBackground() const { - getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); + Rectangle aBackground( Point(), getTargetDevice().GetOutputSizePixel() ); + getTargetDevice().DrawRect( aBackground ); + + aBackground.Top() = aBackground.Bottom(); + getTargetDevice().DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, aBackground, + CTRL_STATE_ENABLED, ImplControlValue(), ::rtl::OUString() ); } //------------------------------------------------------------------------------------------------------------------ - Rectangle NWFTabItemRenderer::calculateDecorations( const Size& i_rContentSize ) const + Rectangle NWFTabItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const { + const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) ); + TabitemValue tiValue; ImplControlValue aControlValue( (void*)(&tiValue) ); Region aBoundingRegion, aContentRegion; bool bNativeOK = getTargetDevice().GetNativeControlRegion( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, - Rectangle( Point(), i_rContentSize ), - CTRL_STATE_ENABLED | CTRL_STATE_FOCUSED | CTRL_STATE_ROLLOVER | CTRL_STATE_SELECTED, + i_rContentArea, nState, aControlValue, ::rtl::OUString(), aBoundingRegion, aContentRegion ); @@ -290,10 +305,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ void NWFTabItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const { - ControlState nState = CTRL_STATE_ENABLED; - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; - if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; - if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; + const ControlState nState = lcl_ItemToControlState( i_nItemFlags ); TabitemValue tiValue; if ( i_nItemFlags & ITEM_POSITION_FIRST ) @@ -364,7 +376,9 @@ namespace svt void Relayout(); void EnsureItemsCache(); ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; - void DrawItem( const size_t i_nItemIndex ) const; + void DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const; + void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const; + void CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const; Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; inline bool IsVertical() const @@ -377,9 +391,10 @@ namespace svt protected: DECL_LINK( OnScroll, const PushButton* ); - void impl_calcItemRects(); - Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const; - void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const; + void impl_calcItemRects(); + Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const; + void impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const; + ItemFlags impl_getItemFlags( const size_t i_nItemIndex ) const; public: PanelTabBar& m_rTabBar; @@ -458,13 +473,6 @@ namespace svt OutputDevice& m_rDevice; }; - //-------------------------------------------------------------------------------------------------------------- - static void lcl_inflateSize( Size& io_rSize, const Inset& i_rInset ) - { - io_rSize.Width() += i_rInset.nLeft + i_rInset.nRight; - io_rSize.Height() += i_rInset.nTop + i_rInset.nBottom; - } - //-------------------------------------------------------------------------------------------------------------- static void lcl_deflateRect( Rectangle& io_rArea, const Inset& i_rInset ) { @@ -473,6 +481,15 @@ namespace svt io_rArea.Right() -= i_rInset.nRight; io_rArea.Bottom() -= i_rInset.nBottom; } + + //-------------------------------------------------------------------------------------------------------------- + static void lcl_inflateRect( Rectangle& io_rArea, const Inset& i_rInset ) + { + io_rArea.Left() -= i_rInset.nLeft; + io_rArea.Top() -= i_rInset.nTop; + io_rArea.Right() += i_rInset.nRight; + io_rArea.Bottom() += i_rInset.nBottom; + } } //================================================================================================================== @@ -550,20 +567,6 @@ namespace svt // TODO: have one method calculating all sizes? - // care for the decorations - const Rectangle aBoundingRect( m_pRenderer->calculateDecorations( aCompleteSize ) ); - OSL_POSTCOND( ( aBoundingRect.Left() <= 0 ) && ( aBoundingRect.Top() <= 0 ), - "PanelTabBar_Impl::impl_calcItemRects: hmmm ...." ); - - aItem.aContentInset.nLeft = -aBoundingRect.Left(); - aItem.aContentInset.nTop = -aBoundingRect.Top(); - aItem.aContentInset.nRight = aBoundingRect.Right() - aCompleteSize.Width() + 1; - aItem.aContentInset.nBottom = aBoundingRect.Bottom() - aCompleteSize.Height() + 1; - - lcl_inflateSize( aCompleteSize, aItem.aContentInset ); - lcl_inflateSize( aIconOnlySize, aItem.aContentInset ); - lcl_inflateSize( aTextOnlySize, aItem.aContentInset ); - // remember the three areas aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); @@ -700,10 +703,46 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex ) const + void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const + { + BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx( + i_rLogicalRect.TopLeft(), + Size( + i_rLogicalRect.GetSize().Width(), + i_rLogicalRect.GetSize().Height() + ) + ) ); + if ( IsVertical() ) + { + aBitmap.Rotate( 2700, COL_BLACK ); + if ( m_eTabAlignment == TABS_LEFT ) + aBitmap.Mirror( BMP_MIRROR_HORZ ); + } + else if ( m_eTabAlignment == TABS_BOTTOM ) + { + aBitmap.Mirror( BMP_MIRROR_VERT ); + } + + const Rectangle aActualRect( m_aNormalizer.getTransformed( i_rLogicalRect, m_eTabAlignment ) ); + m_rTabBar.DrawBitmapEx( aActualRect.TopLeft(), aBitmap ); + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags ) const { const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] ); + const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) | i_nAdditionalItemFlags ); + + const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); + const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) ); + + const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment ); + m_rTabBar.Invalidate( aActualBounds ); + } + //------------------------------------------------------------------------------------------------------------------ + ItemFlags PanelTabBar_Impl::impl_getItemFlags( const size_t i_nItemIndex ) const + { ItemFlags nItemFlags( ITEM_STATE_NORMAL ); if ( m_aHoveredItem == i_nItemIndex ) { @@ -724,43 +763,38 @@ namespace svt if ( m_rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) nItemFlags |= ITEM_POSITION_LAST; - m_rTabBar.SetUpdateMode( FALSE ); + return nItemFlags; + } - // some item geometry - // - the normalized bounding and content rect - const Rectangle aNormalizedBounds( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); - Rectangle aNormalizedContent( aNormalizedBounds ); - lcl_deflateRect( aNormalizedContent, rItem.aContentInset ); + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const + { + const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] ); + const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) ); + + // the normalized bounding and content rect + const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); + const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) ); + + // check whether the item actually overlaps with the painting area + if ( !i_rBoundaries.IsEmpty() ) + { + const Rectangle aItemRect( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); + if ( !aItemRect.IsOver( i_rBoundaries ) ) + return; + } + + m_rTabBar.SetUpdateMode( FALSE ); - // - the aligned bounding and content rect + // the aligned bounding and content rect const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment ); const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment ); - // completely erase the bounding region, renderers are not expected to do this - const_cast< VirtualDevice& >( m_aRenderDevice ).DrawRect( aNormalizedBounds ); - // render item "background" layer m_pRenderer->preRenderItem( aNormalizedContent, nItemFlags ); // copy from the virtual device to ourself - BitmapEx aBitmap( m_aRenderDevice.GetBitmapEx( - aNormalizedBounds.TopLeft(), - Size( - aNormalizedBounds.GetSize().Width() - 1, - aNormalizedBounds.GetSize().Height() - 1 - ) - ) ); - if ( IsVertical() ) - { - aBitmap.Rotate( 2700, COL_BLACK ); - if ( m_eTabAlignment == TABS_LEFT ) - aBitmap.Mirror( BMP_MIRROR_HORZ ); - } - else if ( m_eTabAlignment == TABS_BOTTOM ) - { - aBitmap.Mirror( BMP_MIRROR_VERT ); - } - m_rTabBar.DrawBitmapEx( aActualBounds.TopLeft(), aBitmap ); + CopyFromRenderDevice( aNormalizedBounds ); // render the actual item content impl_renderItemContent( rItem.pPanel, aActualContent, rItem.eContent ); @@ -894,11 +928,10 @@ namespace svt { EnsureItemsCache(); - ClipItemRegion aClipItems( *this ); if ( !!i_rOldActive ) - DrawItem( *i_rOldActive ); + InvalidateItem( *i_rOldActive, ITEM_STATE_ACTIVE ); if ( !!i_rNewActive ) - DrawItem( *i_rNewActive ); + InvalidateItem( *i_rNewActive ); } //------------------------------------------------------------------------------------------------------------------ @@ -960,29 +993,49 @@ namespace svt m_pImpl->EnsureItemsCache(); // background + const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); m_pImpl->m_aRenderDevice.Push( PUSH_CLIPREGION ); - m_pImpl->m_aRenderDevice.SetClipRegion( i_rRect ); + m_pImpl->m_aRenderDevice.SetClipRegion( aNormalizedPaintArea ); m_pImpl->m_pRenderer->renderBackground(); m_pImpl->m_aRenderDevice.Pop(); + m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea ); // ensure the items really paint into their own playground only ClipItemRegion aClipItems( *m_pImpl ); const Rectangle aLogicalPaintRect( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) ); - // items + const ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() ); + const ::boost::optional< size_t > aHoveredPanel( m_pImpl->m_aHoveredItem ); + + // items: + // 1. paint all non-active, non-hovered items size_t i=0; for ( ItemDescriptors::const_iterator item = m_pImpl->m_aItems.begin(); item != m_pImpl->m_aItems.end(); ++item, ++i ) { - Rectangle aItemRect( m_pImpl->GetActualLogicalItemRect( item->GetCurrentRect() ) ); - if ( aItemRect.IsOver( aLogicalPaintRect ) ) - { - m_pImpl->DrawItem( i ); - } + if ( i == aActivePanel ) + continue; + + if ( aHoveredPanel == i ) + continue; + + m_pImpl->DrawItem( i, aLogicalPaintRect ); } + + // 2. paint the item which is hovered, /without/ the mouse button pressed down + if ( !!aHoveredPanel && !m_pImpl->m_bMouseButtonDown ) + m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect ); + + // 3. paint the active item + if ( !!aActivePanel ) + m_pImpl->DrawItem( *aActivePanel, aLogicalPaintRect ); + + // 4. paint the item which is hovered, /with/ the mouse button pressed down + if ( !!aHoveredPanel && m_pImpl->m_bMouseButtonDown ) + m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect ); } //------------------------------------------------------------------------------------------------------------------ @@ -998,15 +1051,13 @@ namespace svt if ( aOldItem != aNewItem ) { - m_pImpl->m_aHoveredItem = aNewItem; - - ClipItemRegion aClipItems( *m_pImpl ); - if ( !!aOldItem ) - m_pImpl->DrawItem( *aOldItem ); + m_pImpl->InvalidateItem( *aOldItem ); + + m_pImpl->m_aHoveredItem = aNewItem; if ( !!aNewItem ) - m_pImpl->DrawItem( *aNewItem ); + m_pImpl->InvalidateItem( *aNewItem ); } } @@ -1027,8 +1078,7 @@ namespace svt CaptureMouse(); m_pImpl->m_bMouseButtonDown = true; - ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( *aHitItem ); + m_pImpl->InvalidateItem( *aHitItem ); } //------------------------------------------------------------------------------------------------------------------ @@ -1038,20 +1088,19 @@ namespace svt if ( m_pImpl->m_bMouseButtonDown ) { - OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); - if ( IsMouseCaptured() ) - ReleaseMouse(); - m_pImpl->m_bMouseButtonDown = false; - ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( !!aHitItem ) { // re-draw that item now that we're not in mouse-down mode anymore - ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( *aHitItem ); + m_pImpl->InvalidateItem( *aHitItem ); // activate the respective panel m_pImpl->m_rPanelDeck.ActivatePanel( *aHitItem ); } + + OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); + if ( IsMouseCaptured() ) + ReleaseMouse(); + m_pImpl->m_bMouseButtonDown = false; } } @@ -1086,8 +1135,7 @@ namespace svt if ( !!aActivePanel ) { m_pImpl->m_aFocusedItem = aActivePanel; - ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( *m_pImpl->m_aFocusedItem ); + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); } } } @@ -1097,14 +1145,12 @@ namespace svt { Control::LoseFocus(); - ::boost::optional< size_t > aPreviouslyFocused( m_pImpl->m_aFocusedItem ); - m_pImpl->m_aFocusedItem.reset(); - - if ( !!aPreviouslyFocused ) + if ( !!m_pImpl->m_aFocusedItem ) { - ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( *aPreviouslyFocused ); + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); } + + m_pImpl->m_aFocusedItem.reset(); } //------------------------------------------------------------------------------------------------------------------ @@ -1153,7 +1199,7 @@ namespace svt if ( !bFocusNext && !bFocusPrev ) return; - const size_t nOldFocus = *m_pImpl->m_aFocusedItem; + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); if ( bFocusNext ) { m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + 1 ) % nPanelCount ); @@ -1162,10 +1208,7 @@ namespace svt { m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount ); } - - ClipItemRegion aClipItems( *m_pImpl ); - m_pImpl->DrawItem( nOldFocus ); - m_pImpl->DrawItem( *m_pImpl->m_aFocusedItem ); + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index a94af8cfb2a4..3056b2c4fe5f 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -48,8 +48,8 @@ #define OUTER_SPACE_BOTTOM 2 // outer space to apply between the area for the items, and the actual items. They refer to a normalized geometry. -#define ITEMS_INSET_LEFT 2 -#define ITEMS_INSET_TOP 2 +#define ITEMS_INSET_LEFT 4 +#define ITEMS_INSET_TOP 3 #define ITEMS_INSET_RIGHT 4 #define ITEMS_INSET_BOTTOM 0 diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx index 84390a92ef0f..c037f95ff0ba 100644 --- a/svtools/source/toolpanel/tabitemdescriptor.hxx +++ b/svtools/source/toolpanel/tabitemdescriptor.hxx @@ -51,7 +51,6 @@ namespace svt Rectangle aCompleteArea; // bounding area if the both text and icon are to be rendererd Rectangle aIconOnlyArea; // bounding area if the icon is to be rendererd Rectangle aTextOnlyArea; // bounding area if the text is to be rendererd - Inset aContentInset; // inset to subtract from the bounding areas TabItemContent eContent; // content to be used for this particular item. Might differ from item content which has been set // up for the complete control, in case not the complete content fits into the available space. diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 60c8b397eaa7..eb7f058cee19 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -1175,7 +1175,6 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if ( nState & CTRL_STATE_SELECTED ) { aControlRect.Left() -= 2; - aControlRect.Right() += 1; if ( pValue && !pValue->isBothAligned() ) { if ( pValue->isLeftAligned() || pValue->isNotAligned() ) @@ -1183,7 +1182,7 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, if ( pValue->isRightAligned() ) aControlRect.Right() += 1; } - aControlRect.Top() -= 3; + aControlRect.Top() -= 2; aControlRect.Bottom() += 2; } rNativeBoundingRegion = aControlRect; -- cgit From ed4a0ba889495ce4841b766ce8ee272479a9d44a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 10 Mar 2010 12:08:45 +0100 Subject: slidecopy: for toolbox items, CTRL_STATE_PRESSED is needed in case of ITEM_STATE_FOCUSED --- svtools/source/toolpanel/paneltabbar.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index aa83274ee3b9..894c53d16db4 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -67,7 +67,7 @@ namespace svt ControlState lcl_ItemToControlState( const ItemFlags i_nItemFlags ) { ControlState nState = CTRL_STATE_ENABLED; - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED; + if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= CTRL_STATE_FOCUSED | CTRL_STATE_PRESSED; if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= CTRL_STATE_ROLLOVER; if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= CTRL_STATE_SELECTED; return nState; @@ -527,7 +527,6 @@ namespace svt m_pRenderer.reset( new VCLItemRenderer( m_aRenderDevice ) ); m_aRenderDevice.SetLineColor(); - //m_aRenderDevice.SetFillColor( m_rTabBar.GetSettings().GetStyleSettings().GetDialogColor() ); m_rPanelDeck.AddListener( *this ); @@ -1220,7 +1219,6 @@ namespace svt && ( ( i_rDataChanedEvent.GetFlags() & SETTINGS_STYLE ) != 0 ) ) { - //SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); Invalidate(); } } -- cgit From 59f3c403fc719ec5fefdc953e7b4ff158c3e1969 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Mar 2010 10:07:58 +0100 Subject: slidecopy: prefix include guards with project shortcut --- svtools/inc/svtools/toolpanel/decklayouter.hxx | 6 +++--- svtools/inc/svtools/toolpanel/refbase.hxx | 6 +++--- svtools/inc/svtools/toolpanel/tabalignment.hxx | 6 +++--- svtools/inc/svtools/toolpanel/tabitemcontent.hxx | 6 +++--- svtools/inc/svtools/toolpanel/tablayouter.hxx | 6 +++--- svtools/inc/svtools/toolpanel/toolpanel.hxx | 6 +++--- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx index 6050a0955715..c284a34bcace 100644 --- a/svtools/inc/svtools/toolpanel/decklayouter.hxx +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef DECKLAYOUTER_HXX -#define DECKLAYOUTER_HXX +#ifndef SVT_DECKLAYOUTER_HXX +#define SVT_DECKLAYOUTER_HXX #include @@ -77,4 +77,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // DECKLAYOUTER_HXX +#endif // SVT_DECKLAYOUTER_HXX diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx index 4cbcc41ffd2a..8e61837cc665 100644 --- a/svtools/inc/svtools/toolpanel/refbase.hxx +++ b/svtools/inc/svtools/toolpanel/refbase.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef REFBASE_HXX -#define REFBASE_HXX +#ifndef SVT_REFBASE_HXX +#define SVT_REFBASE_HXX #include @@ -75,4 +75,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // REFBASE_HXX +#endif // SVT_REFBASE_HXX diff --git a/svtools/inc/svtools/toolpanel/tabalignment.hxx b/svtools/inc/svtools/toolpanel/tabalignment.hxx index e901bb593b7d..cc3f17469ffe 100644 --- a/svtools/inc/svtools/toolpanel/tabalignment.hxx +++ b/svtools/inc/svtools/toolpanel/tabalignment.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef TABALIGNMENT_HXX -#define TABALIGNMENT_HXX +#ifndef SVT_TABALIGNMENT_HXX +#define SVT_TABALIGNMENT_HXX //........................................................................ namespace svt @@ -44,4 +44,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // TABALIGNMENT_HXX +#endif // SVT_TABALIGNMENT_HXX diff --git a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx index e9d41a7c821b..a1cf9deae9f4 100644 --- a/svtools/inc/svtools/toolpanel/tabitemcontent.hxx +++ b/svtools/inc/svtools/toolpanel/tabitemcontent.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef TABITEMCONTENT_HXX -#define TABITEMCONTENT_HXX +#ifndef SVT_TABITEMCONTENT_HXX +#define SVT_TABITEMCONTENT_HXX //........................................................................ namespace svt @@ -45,4 +45,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // TABITEMCONTENT_HXX +#endif // SVT_TABITEMCONTENT_HXX diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index c5f41717aab7..3448c34c1cd8 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef TABLAYOUTER_HXX -#define TABLAYOUTER_HXX +#ifndef SVT_TABLAYOUTER_HXX +#define SVT_TABLAYOUTER_HXX #include "svtools/svtdllapi.h" #include "svtools/toolpanel/decklayouter.hxx" @@ -91,4 +91,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // TABLAYOUTER_HXX +#endif // SVT_TABLAYOUTER_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index acb27e8ec067..9476a851986f 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef TOOLPANEL_HXX -#define TOOLPANEL_HXX +#ifndef SVT_TOOLPANEL_HXX +#define SVT_TOOLPANEL_HXX #include "svtools/svtdllapi.h" @@ -85,4 +85,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // TOOLPANEL_HXX +#endif // SVT_TOOLPANEL_HXX diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index d11767885af1..75cdf82851ee 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -24,8 +24,8 @@ * ************************************************************************/ -#ifndef TOOLPANELDECK_HXX -#define TOOLPANELDECK_HXX +#ifndef SVT_TOOLPANELDECK_HXX +#define SVT_TOOLPANELDECK_HXX #include "svtools/svtdllapi.h" #include "svtools/toolpanel/toolpanel.hxx" @@ -152,4 +152,4 @@ namespace svt } // namespace svt //........................................................................ -#endif // TOOLPANELDECK_HXX +#endif // SVT_TOOLPANELDECK_HXX -- cgit From abee041f8d2bf4f865838df72d388cd84e8da9ef Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Feb 2010 10:45:01 +0100 Subject: autorecovery: +ENSURE_OR_RETURN_VOID --- tools/inc/tools/diagnose_ex.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index eee965fcfd76..0d74195d6437 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -134,5 +134,16 @@ ENSURE_OR_RETURN(c, m, false) +/** This macro asserts the given condition (in debug mode), and + returns afterwards, without return value "void". + */ +#define ENSURE_OR_RETURN_VOID( c, m ) \ + if( !(c) ) \ + { \ + OSL_ENSURE( c, m ); \ + return; \ + } + + #endif // TOOLS_DIAGNOSE_EX_H -- cgit From 9e32fe903cb7b8f26a401f48efdb2001e5001c34 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 11:33:53 +0100 Subject: slidecopy: misc adjustments --- svtools/inc/svtools/toolpanel/refbase.hxx | 4 +-- svtools/inc/svtools/toolpanel/toolpanel.hxx | 30 ++++++++++++++++- svtools/prj/d.lst | 3 ++ svtools/source/toolpanel/dummypanel.cxx | 5 +++ svtools/source/toolpanel/dummypanel.hxx | 1 + svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/toolpanel.cxx | 52 +++++++++++++++++++++++++++++ svtools/source/toolpanel/toolpaneldeck.cxx | 7 ++++ svtools/workben/toolpanel/toolpaneltest.cxx | 30 ++++++++++++----- 9 files changed, 122 insertions(+), 11 deletions(-) create mode 100644 svtools/source/toolpanel/toolpanel.cxx diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx index 8e61837cc665..16603cb56017 100644 --- a/svtools/inc/svtools/toolpanel/refbase.hxx +++ b/svtools/inc/svtools/toolpanel/refbase.hxx @@ -27,7 +27,7 @@ #ifndef SVT_REFBASE_HXX #define SVT_REFBASE_HXX -#include +#include //........................................................................ namespace svt @@ -37,7 +37,7 @@ namespace svt //==================================================================== //= RefBase //==================================================================== - class RefBase + class RefBase : public ::rtl::IReference { protected: RefBase() diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index 9476a851986f..eae9c504a270 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -28,11 +28,12 @@ #define SVT_TOOLPANEL_HXX #include "svtools/svtdllapi.h" +#include "svtools/toolpanel/refbase.hxx" #include #include -#include +#include class Rectangle; @@ -74,6 +75,12 @@ namespace svt */ virtual bool HasFocus() const = 0; + /** release any resources associated with the panel. + + In particular, implementations should destroy the VCL window which implements the panel window. + */ + virtual void Dispose() = 0; + virtual ~IToolPanel() { } @@ -81,6 +88,27 @@ namespace svt typedef ::rtl::Reference< IToolPanel > PToolPanel; + //==================================================================== + //= ToolPanelBase + //==================================================================== + /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface, + but still being abstract + */ + class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel + ,public RefBase + ,public ::boost::noncopyable + { + protected: + ToolPanelBase(); + ~ToolPanelBase(); + + public: + DECLARE_IREFERENCE() + + private: + oslInterlockedCount m_refCount; + }; + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 0a3ccd8a9819..fa3fbb2371dd 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -1,6 +1,7 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %COMMON_DEST%\res%_EXT% mkdir: %_DEST%\inc%_EXT%\svtools +mkdir: %_DEST%\inc%_EXT%\svtools\toolpanel ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs @@ -29,6 +30,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc +..\inc\svtools\toolpanel\*.* %_DEST%\inc%_EXT%\svtools\toolpanel\*.hrc + dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" *.xml %_DEST%\xml%_EXT%\*.xml diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index 6bf1fb6ea60e..d199628b004e 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -87,6 +87,11 @@ namespace svt return false; } + //-------------------------------------------------------------------- + void DummyPanel::Dispose() + { + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index 41afe1ad51e2..a5af4844e420 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -54,6 +54,7 @@ namespace svt virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); virtual void GrabFocus(); virtual bool HasFocus() const; + virtual void Dispose(); DECLARE_IREFERENCE() }; diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index e3dd07fac005..7e79ff4c00d7 100644 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -50,6 +50,7 @@ SLOFILES=\ $(SLO)$/refbase.obj \ $(SLO)$/tabbargeometry.obj \ $(SLO)$/tablayouter.obj \ + $(SLO)$/toolpanel.obj \ $(SLO)$/toolpanelcollection.obj \ $(SLO)$/toolpaneldeck.obj \ diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx new file mode 100644 index 000000000000..35446d1ffe2b --- /dev/null +++ b/svtools/source/toolpanel/toolpanel.cxx @@ -0,0 +1,52 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#include "svtools/toolpanel/toolpanel.hxx" + +//........................................................................ +namespace svt +{ +//........................................................................ + + //==================================================================== + //= ToolPanelBase + //==================================================================== + //-------------------------------------------------------------------- + ToolPanelBase::ToolPanelBase() + { + } + + //-------------------------------------------------------------------- + ToolPanelBase::~ToolPanelBase() + { + } + + //-------------------------------------------------------------------- + IMPLEMENT_IREFERENCE( ToolPanelBase ) + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index c6b48ea0ea2f..93bfc982bc2e 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -317,6 +317,13 @@ namespace svt ToolPanelDeck::~ToolPanelDeck() { GetLayouter()->Destroy(); + + Hide(); + for ( size_t i=0; iDispose(); + } } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 7f600735ea51..3f2c1dc3e291 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -149,6 +149,7 @@ public: virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); virtual void GrabFocus(); virtual bool HasFocus() const; + virtual void Dispose(); // IReference virtual oslInterlockedCount SAL_CALL acquire(); @@ -156,7 +157,8 @@ public: private: oslInterlockedCount m_refCount; - ColoredPanelWindow m_aWindow; + ::std::auto_ptr< ColoredPanelWindow > + m_pWindow; ::rtl::OUString m_aPanelName; BitmapEx m_aPanelIcon; }; @@ -167,7 +169,7 @@ private: //----------------------------------------------------------------------------- ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName ) :m_refCount(0) - ,m_aWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) + ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) ) ,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) ,m_aPanelIcon() { @@ -179,7 +181,7 @@ ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_ //----------------------------------------------------------------------------- ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName ) :m_refCount(0) - ,m_aWindow( i_rParent, i_rColor, i_rPanelName ) + ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, i_rPanelName ) ) ,m_aPanelName( i_rPanelName ) ,m_aPanelIcon() { @@ -211,31 +213,43 @@ oslInterlockedCount SAL_CALL ColoredPanel::release() //----------------------------------------------------------------------------- void ColoredPanel::Show() { - m_aWindow.Show(); + ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + m_pWindow->Show(); } //----------------------------------------------------------------------------- void ColoredPanel::Hide() { - m_aWindow.Hide(); + ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + m_pWindow->Hide(); } //----------------------------------------------------------------------------- void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) { - m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + m_pWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); } //----------------------------------------------------------------------------- void ColoredPanel::GrabFocus() { - m_aWindow.GrabFocus(); + ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + m_pWindow->GrabFocus(); } //----------------------------------------------------------------------------- bool ColoredPanel::HasFocus() const { - return m_aWindow.HasChildPathFocus(); + ENSURE_OR_RETURN_FALSE( m_pWindow.get(), "disposed!" ); + return m_pWindow->HasChildPathFocus(); +} + +//----------------------------------------------------------------------------- +void ColoredPanel::Dispose() +{ + ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + m_pWindow.reset(); } //----------------------------------------------------------------------------- -- cgit From 845b6acd87da520042e6bafc04768f3f9d8afe74 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 13:53:19 +0100 Subject: slidecopy: initial version of a "Tool Panel" At the moment, this implementation is parallel to the existing TaskPane implementation, but on the medium term, it is intended to replace it. No change in functionality is planned for the moment, just the panel selection is done via a tab bar, instead of the the "jumping drawers". Pending tasks (as known so far): - Accessibility. No implementation at all, yet. - showing/hiding tool panels from the "View" drop down menu - connection to the resource framework. At the moment, de/activating panels completely bypasses the resource framework. - alternative implementation of the PanelDeckLayouter which mimics the old design. To be activated by default, for the moment. - removal of the (old, by then) TaskPane implementation. Care needs to be taken that the framework API stays unchanged, i.e., the current ToolPanel resource must be renamed back to RightPane when RightPane is not occupied anymore by the old implementation. Same for other resource names. --- svtools/inc/svtools/toolpanel/tablayouter.hxx | 1 + svtools/source/toolpanel/tablayouter.cxx | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 3448c34c1cd8..784f8c178527 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -74,6 +74,7 @@ namespace svt // attribute access TabItemContent GetTabItemContent() const; void SetTabItemContent( const TabItemContent& i_eItemContent ); + TabAlignment GetTabAlignment() const; // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index c5920f05aada..382b17e8ced7 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -111,6 +111,14 @@ namespace svt m_pData->pTabBar->SetTabItemContent( i_eItemContent ); } + //-------------------------------------------------------------------- + TabAlignment TabDeckLayouter::GetTabAlignment() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return TABS_RIGHT; + return m_pData->eAlignment; + } + //-------------------------------------------------------------------- Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) { -- cgit From 7e0b098047b0b0a4a73301310d92e85fb235ecd9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 15:54:52 +0100 Subject: slidecopy: showing and hiding of panels in the new ToolPanel implementation --- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 10 ++++++++-- svtools/source/toolpanel/toolpanelcollection.cxx | 9 +++++++-- svtools/source/toolpanel/toolpanelcollection.hxx | 2 +- svtools/source/toolpanel/toolpaneldeck.cxx | 10 +++++----- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 75cdf82851ee..b7653ef1c38c 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -100,8 +100,14 @@ namespace svt virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; /** removes a panel specified by its position. + + Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is, + the tool panel deck will not invoke IToolPanel::Dispose on the removed panel. + The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel + deck must know whether Dispose must be invoked after removal, or whether the panel will properly + dispose itself when its ref count drops to 0. */ - virtual void RemovePanel( const size_t i_nPosition ) = 0; + virtual PToolPanel RemovePanel( const size_t i_nPosition ) = 0; /** adds a new listener to be notified when the container content changes. The caller is responsible for life time control, i.e. removing the listener before it actually dies. @@ -134,7 +140,7 @@ namespace svt GetActivePanel() const; virtual void ActivatePanel( const size_t i_nPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void RemovePanel( const size_t i_nPosition ); + virtual PToolPanel RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index c92241d34b7c..61bdbe699566 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -126,11 +126,11 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelCollection::RemovePanel( const size_t i_nPosition ) + PToolPanel ToolPanelCollection::RemovePanel( const size_t i_nPosition ) { OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" ); if ( i_nPosition >= m_pData->aPanels.size() ) - return; + return NULL; // if the active panel is going to be removed, activate another one (before the actual removal) if ( m_pData->aActivePanel == i_nPosition ) @@ -153,6 +153,9 @@ namespace svt m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel ); } + // remember the removed panel for the aller + PToolPanel pRemovedPanel( m_pData->aPanels[ i_nPosition ] ); + // actually remove m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition ); @@ -166,6 +169,8 @@ namespace svt // notify removed panel m_pData->aListeners.PanelRemoved( i_nPosition ); + + return pRemovedPanel; } //-------------------------------------------------------------------- diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index 5c1f7ce3b8e3..84389b4d6e01 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -54,7 +54,7 @@ namespace svt GetActivePanel() const; virtual void ActivatePanel( const size_t i_nPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); - virtual void RemovePanel( const size_t i_nPosition ); + virtual PToolPanel RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 93bfc982bc2e..5791cd0ed9b1 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -87,7 +87,7 @@ namespace svt GetActivePanel() const; void ActivatePanel( const size_t i_nPanel ); size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); - void RemovePanel( const size_t i_nPosition ); + PToolPanel RemovePanel( const size_t i_nPosition ); void AddListener( IToolPanelDeckListener& i_rListener ); void RemoveListener( IToolPanelDeckListener& i_rListener ); @@ -170,9 +170,9 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition ) + PToolPanel ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition ) { - m_aPanels.RemovePanel( i_nPosition ); + return m_aPanels.RemovePanel( i_nPosition ); } //-------------------------------------------------------------------- @@ -357,9 +357,9 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck::RemovePanel( const size_t i_nPosition ) + PToolPanel ToolPanelDeck::RemovePanel( const size_t i_nPosition ) { - m_pImpl->RemovePanel( i_nPosition ); + return m_pImpl->RemovePanel( i_nPosition ); } //-------------------------------------------------------------------- -- cgit From 1412426cc9cf5234c3b60cc2f46153df624f2b15 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 08:47:04 +0100 Subject: slidecopy: KeyInput: call the base class only when not having handled the key input myself. Otherwise, it will be tempted to send a Notify event, which in turn might lead to our focus being lost, which will corrupt our internal state --- svtools/source/toolpanel/paneltabbar.cxx | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index fdc5f3f23ee3..694e04765353 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -1135,10 +1135,38 @@ namespace svt m_pImpl->m_aFocusedItem.reset(); } + //------------------------------------------------------------------------------------------------------------------ + class KeyInputHandler + { + public: + KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent ) + :m_rControl( i_rControl ) + ,m_rKeyEvent( i_rKeyEvent ) + ,m_bHandled( false ) + { + } + + ~KeyInputHandler() + { + if ( !m_bHandled ) + m_rControl.Control::KeyInput( m_rKeyEvent ); + } + + void setHandled() + { + m_bHandled = true; + } + + private: + Control& m_rControl; + const KeyEvent& m_rKeyEvent; + bool m_bHandled; + }; + //------------------------------------------------------------------------------------------------------------------ void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent ) { - Control::KeyInput( i_rKeyEvent ); + KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent ); const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() ); if ( rKeyCode.GetModifier() != 0 ) @@ -1191,6 +1219,9 @@ namespace svt m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount ); } m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); + + // don't delegate to base class + aKeyInputHandler.setHandled(); } //------------------------------------------------------------------------------------------------------------------ -- cgit From 690f40246d237b8280cc1afc861d702fb344ee4f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 13:36:35 +0100 Subject: slidecopy: de/activate panels via the drawing framework Instead of simply letting svtool's ToolPanelDeck decide on panel activation, requests are re-routed through the view's ConfigurationController. So, clicking onto a tab just requests the activation of the respective resource, which in turn - when the requested configuration becomes the active configuration - will activate the ToolPanel. --- svtools/inc/svtools/toolpanel/tablayouter.hxx | 15 +++++++++------ svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 8 ++++++-- svtools/source/toolpanel/tablayouter.cxx | 12 +++++++----- svtools/source/toolpanel/toolpanelcollection.cxx | 15 +++++++++------ svtools/source/toolpanel/toolpanelcollection.hxx | 2 +- svtools/source/toolpanel/toolpaneldeck.cxx | 14 +++++++------- svtools/workben/toolpanel/toolpaneltest.cxx | 4 ++-- 7 files changed, 41 insertions(+), 29 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 784f8c178527..42e716dad53a 100644 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -37,12 +37,14 @@ #include +class Window; + //........................................................................ namespace svt { //........................................................................ - class ToolPanelDeck; + class IToolPanelDeck; struct TabDeckLayouter_Data; @@ -55,17 +57,18 @@ namespace svt { public: /** creates a new layouter - @param i_rPanelDeck - the panel deck which the layouter is responsible for. Provides access to the panels - container, and can and should be used as parent for any other windows which the layouter - needs to create. + @param i_rParent + is the parent window for any VCL windows the layouter needs to create. + @param i_rPanels + is the panel deck which the layouter is responsible for. @param i_eAlignment specifies the alignment of the panel selector @param TabItemContent specifies the content to show on the tab items */ TabDeckLayouter( - ToolPanelDeck& i_rPanelDeck, + Window& i_rParent, + IToolPanelDeck& i_rPanels, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index b7653ef1c38c..7e0827dbc44a 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -90,8 +90,12 @@ namespace svt /** activates the panel with the given number. If the given number is larger or equal to the number of panels in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored. + @param i_rPanel + the number of the panel to activate. If this is not set, the currently active panel is de-activated, + and no new panel is activated at all. Whether or not this makes sense for your application is at + your own discretion. */ - virtual void ActivatePanel( const size_t i_nPanel ) = 0; + virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0; /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the current panel count. Violations of this will be reported via an assertion in the non-product version, and @@ -138,7 +142,7 @@ namespace svt virtual PToolPanel GetPanel( const size_t i_nPos ) const; virtual ::boost::optional< size_t > GetActivePanel() const; - virtual void ActivatePanel( const size_t i_nPanel ); + virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); virtual PToolPanel RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 382b17e8ced7..523e2170eba2 100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -47,10 +47,11 @@ namespace svt ::std::auto_ptr< PanelTabBar > pTabBar; - TabDeckLayouter_Data( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + TabDeckLayouter_Data( Window& i_rParent, IToolPanelDeck& i_rPanels, + const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) :eAlignment( i_eAlignment ) - ,rPanels( i_rPanelDeck ) - ,pTabBar( new PanelTabBar( i_rPanelDeck, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) + ,rPanels( i_rPanels ) + ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) { pTabBar->Show(); } @@ -82,8 +83,9 @@ namespace svt //= TabDeckLayouter //==================================================================== //-------------------------------------------------------------------- - TabDeckLayouter::TabDeckLayouter( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :m_pData( new TabDeckLayouter_Data( i_rPanelDeck, i_eAlignment, i_eItemContent ) ) + TabDeckLayouter::TabDeckLayouter( Window& i_rParent, IToolPanelDeck& i_rPanels, + const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) + :m_pData( new TabDeckLayouter_Data( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) { } diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index 61bdbe699566..baefbd92400f 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -76,17 +76,20 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelCollection::ActivatePanel( const size_t i_nPanel ) + void ToolPanelCollection::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) { - OSL_ENSURE( i_nPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" ); - if ( i_nPanel >= GetPanelCount() ) - return; + if ( !!i_rPanel ) + { + OSL_ENSURE( *i_rPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" ); + if ( *i_rPanel >= GetPanelCount() ) + return; + } - if ( m_pData->aActivePanel == i_nPanel ) + if ( m_pData->aActivePanel == i_rPanel ) return; const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel ); - m_pData->aActivePanel = i_nPanel; + m_pData->aActivePanel = i_rPanel; // notify listeners m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel ); diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index 84389b4d6e01..2bdba38546c9 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -52,7 +52,7 @@ namespace svt virtual PToolPanel GetPanel( const size_t i_nPos ) const; virtual ::boost::optional< size_t > GetActivePanel() const; - virtual void ActivatePanel( const size_t i_nPanel ); + virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); virtual PToolPanel RemovePanel( const size_t i_nPosition ); virtual void AddListener( IToolPanelDeckListener& i_rListener ); diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 5791cd0ed9b1..22d8dc7d57a5 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -85,7 +85,7 @@ namespace svt PToolPanel GetPanel( const size_t i_nPos ) const; ::boost::optional< size_t > GetActivePanel() const; - void ActivatePanel( const size_t i_nPanel ); + void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); PToolPanel RemovePanel( const size_t i_nPosition ); void AddListener( IToolPanelDeckListener& i_rListener ); @@ -158,9 +158,9 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel ) + void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) { - m_aPanels.ActivatePanel( i_nPanel ); + m_aPanels.ActivatePanel( i_rPanel ); } //-------------------------------------------------------------------- @@ -249,7 +249,7 @@ namespace svt if ( !!aActivatePanel ) { - ActivatePanel( *aActivatePanel ); + ActivatePanel( aActivatePanel ); } } @@ -310,7 +310,7 @@ namespace svt ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) { // use a default layouter - SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); + SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); } //-------------------------------------------------------------------- @@ -345,9 +345,9 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck::ActivatePanel( const size_t i_nPanel ) + void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) { - m_pImpl->ActivatePanel( i_nPanel ); + m_pImpl->ActivatePanel( i_rPanel ); } //-------------------------------------------------------------------- diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 3f2c1dc3e291..f6b642f905e6 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -738,7 +738,7 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() ); - m_aToolPanelDeck.ActivatePanel( 0 ); + m_aToolPanelDeck.ActivatePanel( size_t( 0 ) ); m_aToolPanelDeck.Show(); SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) ); @@ -788,7 +788,7 @@ void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment ) if ( pLayouter ) eCurrentItemContent = pLayouter->GetTabItemContent(); - m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) ); + m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) ); } //----------------------------------------------------------------------------- -- cgit From d3941cf72f8d418ad88913bd911f930f835ca7c8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 23:19:37 +0100 Subject: slidecopy: export the class --- svtools/inc/svtools/toolpanel/refbase.hxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx index 16603cb56017..991d6e619090 100644 --- a/svtools/inc/svtools/toolpanel/refbase.hxx +++ b/svtools/inc/svtools/toolpanel/refbase.hxx @@ -27,6 +27,8 @@ #ifndef SVT_REFBASE_HXX #define SVT_REFBASE_HXX +#include "svtools/svtdllapi.h" + #include //........................................................................ @@ -37,7 +39,7 @@ namespace svt //==================================================================== //= RefBase //==================================================================== - class RefBase : public ::rtl::IReference + class SVT_DLLPUBLIC RefBase : public ::rtl::IReference { protected: RefBase() -- cgit From fb8dece549d03eba2490963b12c5937d01140d78 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 16 Mar 2010 23:20:26 +0100 Subject: slidecopy: SetLayouter: properly destroy the old layouter --- svtools/source/toolpanel/toolpaneldeck.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 22d8dc7d57a5..6f5a8ad6fa19 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -33,6 +33,8 @@ #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" +#include + #include //........................................................................ @@ -131,9 +133,11 @@ namespace svt //-------------------------------------------------------------------- void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter ) { - OSL_ENSURE( i_pNewLayouter.get(), "ToolPanelDeck_Impl::SetLayouter: invalid layouter!" ); - if ( !i_pNewLayouter.get() ) - return; + ENSURE_OR_RETURN_VOID( i_pNewLayouter.get(), "invalid layouter" ); + + if ( m_pLayouter.get() ) + m_pLayouter->Destroy(); + m_pLayouter = i_pNewLayouter; ImplDoLayout(); -- cgit From 8eb9b6624a177077705551538c4d5e7bbd8879e2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 17 Mar 2010 08:57:22 +0100 Subject: slidecopy: no need for the Inset class, SvBorder exists ... --- svtools/source/toolpanel/inset.hxx | 58 -------------------------- svtools/source/toolpanel/tabbargeometry.cxx | 22 +++++----- svtools/source/toolpanel/tabbargeometry.hxx | 4 +- svtools/source/toolpanel/tabitemdescriptor.hxx | 2 - 4 files changed, 13 insertions(+), 73 deletions(-) delete mode 100644 svtools/source/toolpanel/inset.hxx diff --git a/svtools/source/toolpanel/inset.hxx b/svtools/source/toolpanel/inset.hxx deleted file mode 100644 index a8ea877c4881..000000000000 --- a/svtools/source/toolpanel/inset.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * -************************************************************************/ - -#ifndef INSET_HXX -#define INSET_HXX - -//........................................................................ -namespace svt -{ -//........................................................................ - - //================================================================================================================== - //= Inset - //================================================================================================================== - struct Inset - { - long nLeft; - long nRight; - long nTop; - long nBottom; - - Inset() - :nLeft(0) - ,nRight(0) - ,nTop(0) - ,nBottom(0) - { - } - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // INSET_HXX diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index 3056b2c4fe5f..3a6e0b22c47c 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -196,10 +196,10 @@ namespace svt ,m_aItemsRect() ,m_aButtonForwardRect() { - m_aItemsInset.nLeft = ITEMS_INSET_LEFT; - m_aItemsInset.nTop = ITEMS_INSET_TOP; - m_aItemsInset.nRight = ITEMS_INSET_RIGHT; - m_aItemsInset.nBottom = ITEMS_INSET_BOTTOM; + m_aItemsInset.Left() = ITEMS_INSET_LEFT; + m_aItemsInset.Top() = ITEMS_INSET_TOP; + m_aItemsInset.Right() = ITEMS_INSET_RIGHT; + m_aItemsInset.Bottom() = ITEMS_INSET_BOTTOM; } //------------------------------------------------------------------------------------------------------------------ @@ -217,8 +217,8 @@ namespace svt // the available size Size aOutputSize( getItemsRect().GetSize() ); // shrunk by the outer space - aOutputSize.Width() -= m_aItemsInset.nRight; - aOutputSize.Height() -= m_aItemsInset.nBottom; + aOutputSize.Width() -= m_aItemsInset.Right(); + aOutputSize.Height() -= m_aItemsInset.Bottom(); const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); TabItemContent eItemContent( getItemContent() ); @@ -267,16 +267,16 @@ namespace svt { if ( io_rItems.empty() ) return Size( - m_aItemsInset.nLeft + m_aItemsInset.nRight, - m_aItemsInset.nTop + m_aItemsInset.nBottom + m_aItemsInset.Left() + m_aItemsInset.Right(), + m_aItemsInset.Top() + m_aItemsInset.Bottom() ); // the rect of the last item const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea ); const Point aBottomRight( rLastItemRect.BottomRight() ); return Size( - aBottomRight.X() + 1 + m_aItemsInset.nRight, - aBottomRight.Y() + 1 + m_aItemsInset.nBottom + aBottomRight.X() + 1 + m_aItemsInset.Right(), + aBottomRight.Y() + 1 + m_aItemsInset.Bottom() ); } @@ -320,7 +320,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Point TabBarGeometry::getFirstItemPosition() const { - return Point( m_aItemsInset.nLeft, m_aItemsInset.nTop ); + return Point( m_aItemsInset.Left(), m_aItemsInset.Top() ); } //...................................................................................................................... diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx index 41da162e7480..059d69a3e233 100644 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -29,10 +29,10 @@ #include "svtools/toolpanel/tabalignment.hxx" -#include "inset.hxx" #include "tabitemdescriptor.hxx" #include +#include //...................................................................................................................... namespace svt @@ -121,7 +121,7 @@ namespace svt /// specifies the content to be displayed in the tab items TabItemContent m_eTabItemContent; /// specifies the inset to be used in the items area, depends on the actual alignment - Inset m_aItemsInset; + SvBorder m_aItemsInset; // the (logical) rectangle to be used for the "back" button, empty if the button is not needed Rectangle m_aButtonBackRect; // the (logical) rectangle to be used for the items diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx index c037f95ff0ba..8005816b0fe2 100644 --- a/svtools/source/toolpanel/tabitemdescriptor.hxx +++ b/svtools/source/toolpanel/tabitemdescriptor.hxx @@ -30,8 +30,6 @@ #include "svtools/toolpanel/toolpanel.hxx" #include "svtools/toolpanel/tabitemcontent.hxx" -#include "inset.hxx" - #include #include -- cgit From 3633ecf16da60f3365fa29deb796026f08b07edf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 17 Mar 2010 10:48:49 +0100 Subject: slidecopy: removed the old TaskPane implementation, now completely superseded by the new one carrying both implementations was only temporary, to be able to easily compare both. The new implementation still has not A11Y API implementation, that's on the TODO list. --- vcl/source/window/window.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 502d61d8958a..8db6fdc7f1c3 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -4322,6 +4322,17 @@ Window::Window( Window* pParent, const ResId& rResId ) Show(); } +// ----------------------------------------------------------------------- +#if OSL_DEBUG_LEVEL > 0 +namespace +{ + const sal_Char* lcl_getWindowClassName( const Window& i_rWindow ) + { + return typeid( i_rWindow ).name(); + } +} +#endif + // ----------------------------------------------------------------------- Window::~Window() -- cgit From 2aed134a5ce8e49f4aa5c736ec39880d272572a1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 17 Mar 2010 11:24:02 +0100 Subject: slidecopy: when asserting living Child/System in the dtor, use typeid (additional to the Window's text) to get more information what kind of Window is leaking --- vcl/source/window/window.cxx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 8db6fdc7f1c3..39fa754404eb 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -101,6 +101,7 @@ #include "vcl/lazydelete.hxx" #include +#include using namespace rtl; using namespace ::com::sun::star::uno; @@ -4326,13 +4327,23 @@ Window::Window( Window* pParent, const ResId& rResId ) #if OSL_DEBUG_LEVEL > 0 namespace { - const sal_Char* lcl_getWindowClassName( const Window& i_rWindow ) + void lcl_appendWindowInfo( ByteString& io_rErrorString, const Window& i_rWindow ) { - return typeid( i_rWindow ).name(); + // skip border windows, they don't carry information which helps diagnosing the problem + const Window* pWindow( &i_rWindow ); + while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) ) + pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD ); + if ( !pWindow ) + pWindow = &i_rWindow; + + io_rErrorString += char(13); + io_rErrorString += typeid( *pWindow ).name(); + io_rErrorString += " (window text: '"; + io_rErrorString += ByteString( pWindow->GetText(), RTL_TEXTENCODING_UTF8 ); + io_rErrorString += "')"; } } #endif - // ----------------------------------------------------------------------- Window::~Window() @@ -4466,9 +4477,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpNextOverlap; } @@ -4489,9 +4498,7 @@ Window::~Window() if ( ImplIsRealParentPath( pTempWin ) ) { bError = TRUE; - if ( aErrorStr.Len() ) - aErrorStr += "; "; - aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aErrorStr, *pTempWin ); } pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame; } @@ -4513,10 +4520,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstChild; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! @@ -4530,10 +4535,8 @@ Window::~Window() pTempWin = mpWindowImpl->mpFirstOverlap; while ( pTempWin ) { - aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 ); + lcl_appendWindowInfo( aTempStr, *pTempWin ); pTempWin = pTempWin->mpWindowImpl->mpNext; - if ( pTempWin ) - aTempStr += "; "; } DBG_ERROR( aTempStr.GetBuffer() ); GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed! -- cgit From cd95230c2f9a46805d494981152d91df8481424a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 18 Mar 2010 12:42:35 +0100 Subject: slidecopy: convenience ctor for OConfigurationTreeRoot / removed the CM_PREFER_UPDATABLE value, role taken over by CM_UPDATABLE --- unotools/inc/unotools/confignode.hxx | 56 +++--- unotools/source/config/confignode.cxx | 235 +++++++++--------------- unotools/source/config/configvaluecontainer.cxx | 2 +- 3 files changed, 122 insertions(+), 171 deletions(-) diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index 2e305030fa2b..a1271b1eeed1 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -38,6 +38,11 @@ #include #include +namespace comphelper +{ + class ComponentContext; +} + //........................................................................ namespace utl { @@ -62,19 +67,23 @@ namespace utl m_xReplaceAccess; /// replacing child values ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xContainerAccess; /// modifying set nodes (optional interface of our UNO object) - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xProvider; /// the configuration provider which supplied the nodes of the hierarchy we're a part of + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + m_xDummy; sal_Bool m_bEscapeNames; /// escape names before accessing children ? ::rtl::OUString m_sCompletePath; OConfigurationNode insertNode(const ::rtl::OUString& _rName,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xNode) const throw(); + protected: /// constructs a node object with an interface representing a node OConfigurationNode( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxNode + ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& + getUNONode() const { return m_xDirectAccess; } public: /// constructs an empty and invalid node object @@ -189,14 +198,6 @@ namespace utl */ sal_Bool getEscape() const { return m_bEscapeNames; } - /** clone the object, creating a new hierarchy where the root represents the same node as the object - where this method is called does.

- The new hierarchy does not share any updates with the one the object is a part of, i.e. any changes made - in the existing hierarchy are not visible to the newly created one until committed (and vice versa). - @param _rRoot out parameter. upon return, contains the object representing the root of the new hierarchy. - */ - OConfigurationTreeRoot cloneAsRoot() const throw(); - /// invalidate the object virtual void clear() throw(); @@ -249,22 +250,23 @@ namespace utl /** ctor

*/ OConfigurationTreeRoot( - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider); + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesBatch >& _rxRootNode + ); /** ctor for a readonly node */ OConfigurationTreeRoot( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxProvider); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxRootNode + ); public: - /// modes to used when creating a top-level node object + /// modes to use when creating a top-level node object enum CREATION_MODE { - CM_READONLY, /// open the node (i.e. sub tree) for read access only - CM_UPDATABLE, /// open the node (i.e. sub tree) for read and write access - CM_PREFER_UPDATABLE /// open the node (i.e. sub tree) for read and write access, if this fails, open it for read acces + /// open the node (i.e. sub tree) for read access only + CM_READONLY, + /// open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible + CM_UPDATABLE }; public: @@ -273,6 +275,14 @@ namespace utl */ OConfigurationTreeRoot() :OConfigurationNode() { } + /** creates a configuration tree for the given path in the given mode + */ + OConfigurationTreeRoot( + const ::comphelper::ComponentContext& i_rContext, + const sal_Char* i_pAsciiNodePath, + const bool i_bUpdatable + ); + /// copy ctor OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource) :OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { } @@ -296,7 +306,7 @@ namespace utl const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, - CREATION_MODE _eMode = CM_PREFER_UPDATABLE, + CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True ); @@ -313,7 +323,7 @@ namespace utl @param _eMode specifies which privileges should be applied when retrieving the node */ static OConfigurationTreeRoot createWithServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True); + const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True); /** tolerant version of the createWithServiceFactory @@ -322,7 +332,7 @@ namespace utl given node path does not exist) are still asserted.

*/ static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_PREFER_UPDATABLE, sal_Bool _bLazyWrite = sal_True ); + const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True ); /** commit all changes made on the subtree the object is the root for

All changes made on any OConfigurationNode object retrieved (maybe indirect) from this root diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index c8134137db0c..a76d906e83a7 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -43,6 +43,8 @@ #include #include #include +#include +#include #include #if OSL_DEBUG_LEVEL > 0 #include @@ -63,9 +65,8 @@ namespace utl //= OConfigurationNode //======================================================================== //------------------------------------------------------------------------ - OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode, const Reference< XMultiServiceFactory >& _rxProvider) - :m_xProvider(_rxProvider) - ,m_bEscapeNames(sal_False) + OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode ) + :m_bEscapeNames(sal_False) { OSL_ENSURE(_rxNode.is(), "OConfigurationNode::OConfigurationNode: invalid node interface!"); if (_rxNode.is()) @@ -101,7 +102,6 @@ namespace utl ,m_xDirectAccess(_rSource.m_xDirectAccess) ,m_xReplaceAccess(_rSource.m_xReplaceAccess) ,m_xContainerAccess(_rSource.m_xContainerAccess) - ,m_xProvider(_rSource.m_xProvider) ,m_bEscapeNames(_rSource.m_bEscapeNames) ,m_sCompletePath(_rSource.m_sCompletePath) { @@ -119,7 +119,6 @@ namespace utl m_xDirectAccess = _rSource.m_xDirectAccess; m_xContainerAccess = _rSource.m_xContainerAccess; m_xReplaceAccess = _rSource.m_xReplaceAccess; - m_xProvider = _rSource.m_xProvider; m_bEscapeNames = _rSource.m_bEscapeNames; m_sCompletePath = _rSource.m_sCompletePath; @@ -248,7 +247,7 @@ namespace utl ::rtl::OUString sName = normalizeName(_rName, NO_CALLER); m_xContainerAccess->insertByName(sName, makeAny(_xNode)); // if we're here, all was ok ... - return OConfigurationNode(_xNode, m_xProvider); + return OConfigurationNode( _xNode ); } catch(const Exception&) { @@ -312,7 +311,7 @@ namespace utl OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!"); } if (xNode.is()) - return OConfigurationNode(xNode, m_xProvider); + return OConfigurationNode( xNode ); } catch(NoSuchElementException& e) { @@ -476,62 +475,101 @@ namespace utl } //------------------------------------------------------------------------ - OConfigurationTreeRoot OConfigurationNode::cloneAsRoot() const throw() + void OConfigurationNode::clear() throw() + { + m_xHierarchyAccess.clear(); + m_xDirectAccess.clear(); + m_xReplaceAccess.clear(); + m_xContainerAccess.clear(); + } + + //======================================================================== + //= helper + //======================================================================== + namespace { - OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::cloneAsRoot: object is invalid!"); - if (m_xHierarchyAccess.is()) + //-------------------------------------------------------------------- + static const ::rtl::OUString& lcl_getProviderServiceName( ) { - // first get the complete path of the node we represent - ::rtl::OUString sCompletePath; - Reference< XHierarchicalName > xNodeNameAccess(m_xHierarchyAccess, UNO_QUERY); - if (xNodeNameAccess.is()) + static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); + return s_sProviderServiceName; + } + + //-------------------------------------------------------------------- + Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext ) + { + try { - try - { - sCompletePath = xNodeNameAccess->getHierarchicalName(); - OSL_ENSURE(sCompletePath.getLength(), "OConfigurationNode::cloneAsRoot: invalid path retrieved!"); - } - catch(Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } + Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW ); + return xProvider; } - - // then create a new tree root object with that path and our provider - OSL_ENSURE(m_xProvider.is(), "OConfigurationNode::cloneAsRoot: have an invalid provider!"); - if (sCompletePath.getLength() && m_xProvider.is()) + catch ( const Exception& ) { - return OConfigurationTreeRoot::createWithProvider(m_xProvider, sCompletePath, -1, isReadonly() ? OConfigurationTreeRoot::CM_READONLY : OConfigurationTreeRoot::CM_PREFER_UPDATABLE); + DBG_UNHANDLED_EXCEPTION(); } + return NULL; } - return OConfigurationTreeRoot(); - } - //------------------------------------------------------------------------ - void OConfigurationNode::clear() throw() - { - m_xHierarchyAccess.clear(); - m_xDirectAccess.clear(); - m_xReplaceAccess.clear(); - m_xContainerAccess.clear(); + //-------------------------------------------------------------------- + Reference< XInterface > lcl_createConfigurationRoot( const Reference< XMultiServiceFactory >& i_rxConfigProvider, + const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable, const sal_Int32 i_nDepth, const bool i_bLazyWrite ) + { + ENSURE_OR_RETURN( i_rxConfigProvider.is(), "invalid provider", NULL ); + try + { + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "nodepath", i_rNodePath ); + aArgs.put( "lazywrite", i_bLazyWrite ); + aArgs.put( "depth", i_nDepth ); + + ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii( + i_bUpdatable + ? "com.sun.star.configuration.ConfigurationUpdateAccess" + : "com.sun.star.configuration.ConfigurationAccess" ); + + Reference< XInterface > xRoot( + i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ), + UNO_SET_THROW + ); + return xRoot; + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } } - //======================================================================== //= OConfigurationTreeRoot //======================================================================== //------------------------------------------------------------------------ - OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XChangesBatch >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider) - :OConfigurationNode(_rxRootNode.get(), _rxProvider) + OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode ) + :OConfigurationNode( _rxRootNode.get() ) ,m_xCommitter(_rxRootNode) { } //------------------------------------------------------------------------ - OConfigurationTreeRoot::OConfigurationTreeRoot(const Reference< XInterface >& _rxRootNode, const Reference< XMultiServiceFactory >& _rxProvider) - :OConfigurationNode(_rxRootNode.get(), _rxProvider) + OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode ) + :OConfigurationNode( _rxRootNode ) + ,m_xCommitter( _rxRootNode, UNO_QUERY ) { } + //------------------------------------------------------------------------ + OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable ) + :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ), + ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ) ) + ,m_xCommitter() + { + if ( i_bUpdatable ) + { + m_xCommitter.set( getUNONode(), UNO_QUERY ); + OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" ); + } + } + //------------------------------------------------------------------------ void OConfigurationTreeRoot::clear() throw() { @@ -561,117 +599,20 @@ namespace utl return sal_False; } - namespace - { - static const ::rtl::OUString& lcl_getProviderServiceName( ) - { - static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); - return s_sProviderServiceName; - } - } - //------------------------------------------------------------------------ OConfigurationTreeRoot OConfigurationTreeRoot::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite) { - OSL_ENSURE(_rxConfProvider.is(), "OConfigurationTreeRoot::createWithProvider: invalid provider!"); - -#ifdef DBG_UTIL - if (_rxConfProvider.is()) - { - try - { - Reference< XServiceInfo > xSI(_rxConfProvider, UNO_QUERY); - if (!xSI.is()) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: no XServiceInfo interface on the provider!"); - } - else - { - OSL_ENSURE(xSI->supportsService( lcl_getProviderServiceName( ) ), - "OConfigurationTreeRoot::createWithProvider: sure this is a provider? Missing the ConfigurationProvider service!"); - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } -#endif - - sal_Bool bTryAgain(sal_False); - do - { - if (_rxConfProvider.is()) - { - try - { - Sequence< Any > aCreationArgs(3); - aCreationArgs[0] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny(_rPath), PropertyState_DIRECT_VALUE)); - aCreationArgs[1] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny((sal_Int32)_nDepth), PropertyState_DIRECT_VALUE)); - aCreationArgs[2] = makeAny(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lazywrite")), 0, ::cppu::bool2any(_bLazyWrite), PropertyState_DIRECT_VALUE)); - - ::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(CM_READONLY == _eMode - ? "com.sun.star.configuration.ConfigurationAccess" - : "com.sun.star.configuration.ConfigurationUpdateAccess"); - - Reference< XInterface > xRoot = _rxConfProvider->createInstanceWithArguments(sAccessService, aCreationArgs); - if (!xRoot.is()) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: could not create the node access!"); - } - else if (CM_READONLY == _eMode) - { - return OConfigurationTreeRoot(xRoot, _rxConfProvider); - } - else - { // get the changes batch interface - Reference< XChangesBatch > xCommitter(xRoot, UNO_QUERY); - if (xCommitter.is()) - return OConfigurationTreeRoot(xCommitter, _rxConfProvider); - else - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: invalid root object (missing interface XChangesBatch)!"); - - // dispose the object if it is already created, but unusable - Reference< XComponent > xComp(xRoot, UNO_QUERY); - if (xComp.is()) - try { xComp->dispose(); } catch(Exception&) { } - } - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - bTryAgain = CM_PREFER_UPDATABLE == _eMode; - if (bTryAgain) - _eMode = CM_READONLY; - } - while (bTryAgain); - + Reference< XInterface > xRoot( lcl_createConfigurationRoot( + _rxConfProvider, _rPath, _eMode != CM_READONLY, _nDepth, _bLazyWrite ) ); + if ( xRoot.is() ) + return OConfigurationTreeRoot( xRoot ); return OConfigurationTreeRoot(); } //------------------------------------------------------------------------ - OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory(const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite) + OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite ) { - OSL_ENSURE(_rxORB.is(), "OConfigurationTreeRoot::createWithServiceFactory: invalid service factory!"); - if (_rxORB.is()) - { - try - { - Reference< XInterface > xProvider = _rxORB->createInstance( lcl_getProviderServiceName( ) ); - OSL_ENSURE(xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: could not instantiate the config provider service!"); - Reference< XMultiServiceFactory > xProviderAsFac(xProvider, UNO_QUERY); - OSL_ENSURE(xProviderAsFac.is() || !xProvider.is(), "OConfigurationTreeRoot::createWithServiceFactory: the provider is missing an interface!"); - if (xProviderAsFac.is()) - return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite); - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return OConfigurationTreeRoot(); + return createWithProvider( lcl_getConfigProvider( _rxORB ), _rPath, _nDepth, _eMode, _bLazyWrite ); } //------------------------------------------------------------------------ @@ -687,9 +628,9 @@ namespace utl if ( xConfigFactory.is() ) return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite ); } - catch(Exception&) + catch(const Exception&) { - // silent this, 'cause the contract of this method states "no assertions" + // silence this, 'cause the contract of this method states "no assertions" } } return OConfigurationTreeRoot(); diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index 6c7962cc09c1..275b6274da8b 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -334,7 +334,7 @@ namespace utl m_pImpl->xORB, _rConfigLocation, _nLevels, - ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_PREFER_UPDATABLE : OConfigurationTreeRoot::CM_READONLY, + ( _nAccessFlags & CVC_UPDATE_ACCESS ) ? OConfigurationTreeRoot::CM_UPDATABLE : OConfigurationTreeRoot::CM_READONLY, ( _nAccessFlags & CVC_IMMEDIATE_UPDATE ) ? sal_False : sal_True ); #ifdef DBG_UTIL -- cgit From 75716ac51b8555e77382a1c20a307477f0b43058 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Mar 2010 10:28:04 +0100 Subject: slidecopy: reworked the ToolPanelDeck to have a dedicated anchor window for the panel's windows. This will ease some later changes --- svtools/inc/svtools/toolpanel/toolpanel.hxx | 39 ++++++++++++++++--------- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 7 +++++ svtools/source/toolpanel/dummypanel.cxx | 12 ++------ svtools/source/toolpanel/dummypanel.hxx | 7 ++--- svtools/source/toolpanel/toolpaneldeck.cxx | 31 +++++++++++++------- svtools/workben/toolpanel/toolpaneltest.cxx | 36 ++++++++++------------- 6 files changed, 75 insertions(+), 57 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index eae9c504a270..dd91713b3725 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -56,28 +56,41 @@ namespace svt /// retrieves the image associated with the panel, if any virtual Image GetImage() const = 0; - /// shows the panel window - virtual void Show() = 0; + /** activates the panel - /// hides the panel window - virtual void Hide() = 0; + Usually, this means the panel's Window is created (if not previosly done so) and shown. - /// sets the position of the panel window - virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ) = 0; + @param i_rParentWindow + the parent window to anchor the panel window at. Subsequent calls to the Activate + method will always get the same parent window. The complete area of this window is + available, and should be used, for the panel window. + */ + virtual void Activate( Window& i_rParentWindow ) = 0; - /// sets the focus to the panel window - virtual void GrabFocus() = 0; + /** deactivates the panel + + There are different ways how an implementation could deactivate a panel. The easiest way + would be to simply hide the associated Window. Alternatively, you could completely destroy it, + or decide to cache it by re-parenting it to another (temporary, invisible) window. + */ + virtual void Deactivate() = 0; - /** determines whether the panel window, or any of its children, currently has the focus + /** sets a new size for the panel's Window - Effectively, an implementation simply needs to redelegate this to its panel window's HasChildPathFocus - method. + The panel window is always expected to be positioned at (0,0), relative to the parent window + which was passed to the Activate member. Resizing the panel window is necessary when the size of + this parent window changes. Effectively, this method is a means of convenience, to relief panel + implementations from reacting on size changes of their parent window themselves. */ - virtual bool HasFocus() const = 0; + virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; + + /// sets the focus to the panel window + virtual void GrabFocus() = 0; /** release any resources associated with the panel. - In particular, implementations should destroy the VCL window which implements the panel window. + In particular, implementations should ultimately destroy the VCL window which implements the panel + window. No subsequent calls to any other method will happen after Destroy has been called. */ virtual void Dispose() = 0; diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 7e0827dbc44a..97653eea0eb0 100644 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -137,6 +137,13 @@ namespace svt PDeckLayouter GetLayouter() const; void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + /** returns the window which acts as anchor for the panel windows. + + This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method + whenever a panel is activated, to act as parent window for the panel's VCL-Window. + */ + Window& GetPanelWindowAnchor(); + // IToolPanelDeck virtual size_t GetPanelCount() const; virtual PToolPanel GetPanel( const size_t i_nPos ) const; diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index d199628b004e..d92444369c04 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -50,17 +50,17 @@ namespace svt IMPLEMENT_IREFERENCE( DummyPanel ) //-------------------------------------------------------------------- - void DummyPanel::Show() + void DummyPanel::Activate( Window& ) { } //-------------------------------------------------------------------- - void DummyPanel::Hide() + void DummyPanel::Deactivate() { } //-------------------------------------------------------------------- - void DummyPanel::SetPosSizePixel( const Rectangle& /*i_rPanelPlayground*/ ) + void DummyPanel::SetSizePixel( const Size& ) { } @@ -81,12 +81,6 @@ namespace svt { } - //-------------------------------------------------------------------- - bool DummyPanel::HasFocus() const - { - return false; - } - //-------------------------------------------------------------------- void DummyPanel::Dispose() { diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index a5af4844e420..bcaf564cb021 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -49,11 +49,10 @@ namespace svt // IToolPanel virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; - virtual void Show(); - virtual void Hide(); - virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); - virtual bool HasFocus() const; virtual void Dispose(); DECLARE_IREFERENCE() diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 6f5a8ad6fa19..3b54a112c0da 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -65,12 +65,13 @@ namespace svt public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) + ,m_aPanelAnchor( &i_rDeck ) ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() - ,m_aPanelPlayground() { m_aPanels.AddListener( *this ); + m_aPanelAnchor.Show(); } ~ToolPanelDeck_Impl() @@ -82,6 +83,8 @@ namespace svt PDeckLayouter GetLayouter() const { return m_pLayouter; } void SetLayouter( const PDeckLayouter& i_pNewLayouter ); + Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + // IToolPanelDeck equivalents size_t GetPanelCount() const; PToolPanel GetPanel( const size_t i_nPos ) const; @@ -113,12 +116,12 @@ namespace svt private: ToolPanelDeck& m_rDeck; + Window m_aPanelAnchor; ToolPanelCollection m_aPanels; PToolPanel m_pDummyPanel; PanelDeckListeners m_aListeners; PDeckLayouter m_pLayouter; - Rectangle m_aPanelPlayground; }; //-------------------------------------------------------------------- @@ -184,17 +187,18 @@ namespace svt { const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() ); - // let the layouter do the main work - m_aPanelPlayground = aDeckPlayground; + // ask the layouter what is left for our panel, and position the panel container window appropriately + Rectangle aPlaygroundArea( aDeckPlayground ); OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" ); if ( m_pLayouter.get() ) { - m_aPanelPlayground = m_pLayouter->Layout( aDeckPlayground ); + aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground ); } + m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); - // and position the active panel + // position the active panel const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); - pActive->SetPosSizePixel( m_aPanelPlayground ); + pActive->SetSizePixel( m_aPanelAnchor.GetSizePixel() ); } //-------------------------------------------------------------------- @@ -243,7 +247,7 @@ namespace svt case ACTION_TOGGLE_FOCUS: { PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); - if ( !pActivePanel->HasFocus() ) + if ( !m_aPanelAnchor.HasChildPathFocus() ) pActivePanel->GrabFocus(); else GetLayouter()->SetFocusToPanelSelector(); @@ -285,13 +289,12 @@ namespace svt if ( !!i_rOldActive ) { const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) ); - pOldActive->Hide(); + pOldActive->Deactivate(); } // position and show the new panel const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) ); - pNewActive->SetPosSizePixel( m_aPanelPlayground ); - pNewActive->Show(); + pNewActive->Activate( m_aPanelAnchor ); pNewActive->GrabFocus(); // multiplex to our own listeners @@ -390,6 +393,12 @@ namespace svt m_pImpl->RemoveListener( i_rListener ); } + //-------------------------------------------------------------------- + Window& ToolPanelDeck::GetPanelWindowAnchor() + { + return m_pImpl->GetPanelWindowAnchor(); + } + //-------------------------------------------------------------------- void ToolPanelDeck::Resize() { diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index f6b642f905e6..8291d60a3b7b 100644 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -144,11 +144,10 @@ public: // IToolPanel virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; - virtual void Show(); - virtual void Hide(); - virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground ); + virtual void Activate( Window& i_rParentWindow ); + virtual void Deactivate(); + virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); - virtual bool HasFocus() const; virtual void Dispose(); // IReference @@ -211,24 +210,28 @@ oslInterlockedCount SAL_CALL ColoredPanel::release() } //----------------------------------------------------------------------------- -void ColoredPanel::Show() +void ColoredPanel::Activate( Window& i_rParentWindow ) { ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); + OSL_ENSURE( &i_rParentWindow == m_pWindow->GetParent(), "ColoredPanel::Activate: unexpected new parent window!" ); + // the documentation of IToolPanel::Activate says it is guaranteed that the parent window is + // always the same ... + m_pWindow->SetPosSizePixel( Point(), i_rParentWindow.GetSizePixel() ); m_pWindow->Show(); } //----------------------------------------------------------------------------- -void ColoredPanel::Hide() +void ColoredPanel::Deactivate() { ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); m_pWindow->Hide(); } //----------------------------------------------------------------------------- -void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground ) +void ColoredPanel::SetSizePixel( const Size& i_rPanelWindowSize ) { ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" ); - m_pWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() ); + m_pWindow->SetSizePixel( i_rPanelWindowSize ); } //----------------------------------------------------------------------------- @@ -238,13 +241,6 @@ void ColoredPanel::GrabFocus() m_pWindow->GrabFocus(); } -//----------------------------------------------------------------------------- -bool ColoredPanel::HasFocus() const -{ - ENSURE_OR_RETURN_FALSE( m_pWindow.get(), "disposed!" ); - return m_pWindow->HasChildPathFocus(); -} - //----------------------------------------------------------------------------- void ColoredPanel::Dispose() { @@ -733,10 +729,10 @@ PanelDemoMainWindow::PanelDemoMainWindow() m_aToolPanelDeck.SetPosSizePixel( Point( 20, 20 ), Size( 500, 300 ) ); m_aToolPanelDeck.SetBorderStyle( WINDOW_BORDER_MONO ); - m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() ); - m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() ); - m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() ); - m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_RED ), "Red" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), Color( COL_GREEN ), "Some flavor of Green" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() ); + m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() ); m_aToolPanelDeck.ActivatePanel( size_t( 0 ) ); m_aToolPanelDeck.Show(); @@ -812,7 +808,7 @@ IToolPanelDeck& PanelDemoMainWindow::GetToolPanelDeck() //----------------------------------------------------------------------------- PToolPanel PanelDemoMainWindow::CreateToolPanel( const Color& i_rColor, const String& i_rPanelName ) { - return PToolPanel( new ColoredPanel( m_aToolPanelDeck, i_rColor, i_rPanelName ) ); + return PToolPanel( new ColoredPanel( m_aToolPanelDeck.GetPanelWindowAnchor(), i_rColor, i_rPanelName ) ); } //============================================================================= -- cgit From a0c44c8ef392b0cdef327e6aa35fc391bf1e7464 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Mar 2010 09:46:02 +0100 Subject: slidecopy: +ENSURE_OR_CONTINUE/BREAK --- tools/inc/tools/diagnose_ex.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 0d74195d6437..cd7f26c06b10 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -144,6 +144,24 @@ return; \ } +/** asserts a given condition (in debug mode), and continues the most-inner + loop if the condition is not met +*/ +#define ENSURE_OR_CONTINUE( c, m ) \ + if ( !(c) ) \ + { \ + OSL_ENSURE( false, m ); \ + continue; \ + } +/** asserts a given condition (in debug mode), and continues the most-inner + loop if the condition is not met +*/ +#define ENSURE_OR_BREAK( c, m ) \ + if ( !(c) ) \ + { \ + OSL_ENSURE( false, m ); \ + break; \ + } #endif // TOOLS_DIAGNOSE_EX_H -- cgit From 8bf5f5e0a8de106c78006713ad9fa5b08e4466d9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Mar 2010 10:19:08 +0100 Subject: slidecopy: use a minimal size when a panel uses neither text nor image / properly calculate scroll button visibility --- svtools/source/toolpanel/paneltabbar.cxx | 7 +++++++ svtools/source/toolpanel/tabbargeometry.cxx | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 694e04765353..11b53b0e0163 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -595,6 +595,13 @@ namespace svt aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE; } + if ( !bUseImage && !bUseText ) + { + // have a minimal size - this is pure heuristics, but if it doesn't suit your needs, then give your panels + // a name and or image! :) + aItemContentSize = Size( 14, 14 ); + } + aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index 3a6e0b22c47c..2e34ab6da636 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -259,7 +259,8 @@ namespace svt const ItemDescriptor& rLastItem( *io_rItems.rbegin() ); const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() ); - return aFitInto.IsInside( aLastItemBottomRight ); + return aFitInto.Left() <= aLastItemBottomRight.X() + && aFitInto.Right() >= aLastItemBottomRight.X(); } //------------------------------------------------------------------------------------------------------------------ -- cgit From 37a79aeaf34421208f3fa2358781e62c6b094cfe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Mar 2010 10:44:01 +0100 Subject: slidecopy: make compile on unxlngi6 --- svtools/inc/svtools/toolpanel/toolpanel.hxx | 1 + unotools/source/config/confignode.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index dd91713b3725..9d7202c31f98 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -36,6 +36,7 @@ #include class Rectangle; +class Window; //........................................................................ namespace svt diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index a76d906e83a7..fc4e20e6f600 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -560,7 +560,7 @@ namespace utl //------------------------------------------------------------------------ OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable ) :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ), - ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ) ) + ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() ) ,m_xCommitter() { if ( i_bUpdatable ) -- cgit From 01d0d781b27b6211125cff363407d555fd036de5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 24 Mar 2010 21:28:44 +0100 Subject: slidecopy: appendFoo: convenience: overload with versions taking strings/ascii-char --- ucbhelper/inc/ucbhelper/propertyvalueset.hxx | 370 +++++++++++++------------ ucbhelper/prj/build.lst | 13 +- ucbhelper/source/provider/propertyvalueset.cxx | 89 +++--- 3 files changed, 252 insertions(+), 220 deletions(-) diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx index 910e35aa4810..0516ceec76b4 100644 --- a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx +++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "osl/mutex.hxx" @@ -46,7 +47,6 @@ namespace com { namespace sun { namespace star { namespace script { } } } } namespace com { namespace sun { namespace star { namespace beans { - struct Property; struct PropertyValue; class XPropertySet; } } } } @@ -208,175 +208,205 @@ public: */ sal_Int32 getLength() const; - /** - * This method appends a string to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendString ( const ::com::sun::star::beans::Property& rProp, - const ::rtl::OUString& rValue ); - - /** - * This method appends a boolean to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendBoolean ( const ::com::sun::star::beans::Property& rProp, - sal_Bool bValue ); - - /** - * This method appends a byte to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendByte ( const ::com::sun::star::beans::Property& rProp, - sal_Int8 nValue ); - - /** - * This method appends a short to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendShort ( const ::com::sun::star::beans::Property& rProp, - sal_Int16 nValue ); - - /** - * This method appends an int to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendInt ( const ::com::sun::star::beans::Property& rProp, - sal_Int32 nValue ); - - /** - * This method appends a long to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendLong ( const ::com::sun::star::beans::Property& rProp, - sal_Int64 nValue ); - - /** - * This method appends a float to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendFloat ( const ::com::sun::star::beans::Property& rProp, - float nValue ); - - /** - * This method appends a double to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendDouble ( const ::com::sun::star::beans::Property& rProp, - double nValue ); - - /** - * This method appends a byte sequence to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendBytes ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Sequence< - sal_Int8 >& rValue ); - - /** - * This method appends a date to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendDate ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::util::Date& rValue ); - - /** - * This method appends a time to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendTime ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::util::Time& rValue ); - - /** - * This method appends a timestamp to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendTimestamp( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::util::DateTime& rValue ); - - /** - * This method appends a binary stream to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::io::XInputStream >& - rValue ); - - /** - * This method appends a character stream to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendCharacterStream( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::io::XInputStream >& - rValue ); - - /** - * This method appends an object ( any ) to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendObject ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Any& rValue ); - - /** - * This method appends a ref to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendRef ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XRef >& rValue ); - - /** - * This method appends a blob to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendBlob ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XBlob >& rValue ); - - /** - * This method appends a clob to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendClob ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XClob >& rValue ); - - /** - * This method appends an array to the value set. - * - * @param rProp is the property the value belongs to. - */ - void appendArray ( const ::com::sun::star::beans::Property& rProp, - const ::com::sun::star::uno::Reference< - ::com::sun::star::sdbc::XArray >& rValue ); - - /** - * This method appends a void value ( a "hole" ) to the value set. This - * is useful, since void values indicate errors, like non-existing - * property (-values) etc. - * - * @param rProp is the property the value belongs to. - */ - void appendVoid ( const ::com::sun::star::beans::Property& rProp ); + void appendString( const ::rtl::OUString& rPropName, const ::rtl::OUString& rValue ); + void appendString( const sal_Char* pAsciiPropName, const ::rtl::OUString& rValue ) + { + appendString( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendString( const ::com::sun::star::beans::Property& rProp, const ::rtl::OUString& rValue ) + { + appendString( rProp.Name, rValue ); + } + + void appendBoolean( const ::rtl::OUString& rPropName, sal_Bool bValue ); + void appendBoolean( const sal_Char* pAsciiPropName, sal_Bool bValue ) + { + appendBoolean( ::rtl::OUString::createFromAscii( pAsciiPropName ), bValue ); + } + void appendBoolean( const ::com::sun::star::beans::Property& rProp, sal_Bool bValue ) + { + appendBoolean( rProp.Name, bValue ); + } + + void appendByte( const ::rtl::OUString& rPropName, sal_Int8 nValue ); + void appendByte( const sal_Char* pAsciiPropName, sal_Int8 nValue ) + { + appendByte( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendByte( const ::com::sun::star::beans::Property& rProp, sal_Int8 nValue ) + { + appendByte( rProp.Name, nValue ); + } + + void appendShort( const ::rtl::OUString& rPropName, sal_Int16 nValue ); + void appendShort( const sal_Char* pAsciiPropName, sal_Int16 nValue ) + { + appendShort( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendShort( const ::com::sun::star::beans::Property& rProp, sal_Int16 nValue ) + { + appendShort( rProp.Name, nValue ); + } + + void appendInt( const ::rtl::OUString& rPropName, sal_Int32 nValue ); + void appendInt( const sal_Char* pAsciiPropName, sal_Int32 nValue ) + { + appendInt( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendInt( const ::com::sun::star::beans::Property& rProp, sal_Int32 nValue ) + { + appendInt( rProp.Name, nValue ); + } + + void appendLong( const ::rtl::OUString& rPropName, sal_Int64 nValue ); + void appendLong( const sal_Char* pAsciiPropName, sal_Int64 nValue ) + { + appendLong( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendLong( const ::com::sun::star::beans::Property& rProp, sal_Int64 nValue ) + { + appendLong( rProp.Name, nValue ); + } + + void appendFloat( const ::rtl::OUString& rPropName, float nValue ); + void appendFloat( const sal_Char* pAsciiPropName, float nValue ) + { + appendFloat( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendFloat( const ::com::sun::star::beans::Property& rProp, float nValue ) + { + appendFloat( rProp.Name, nValue ); + } + + void appendDouble( const ::rtl::OUString& rPropName, double nValue ); + void appendDouble( const sal_Char* pAsciiPropName, double nValue ) + { + appendDouble( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue ); + } + void appendDouble( const ::com::sun::star::beans::Property& rProp, double nValue ) + { + appendDouble( rProp.Name, nValue ); + } + + void appendBytes( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue ); + void appendBytes( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue ) + { + appendBytes( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendBytes( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Sequence< sal_Int8 >& rValue ) + { + appendBytes( rProp.Name, rValue ); + } + + void appendDate( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Date& rValue ); + void appendDate( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Date& rValue ) + { + appendDate( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendDate( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Date& rValue ) + { + appendDate( rProp.Name, rValue ); + } + + void appendTime( const ::rtl::OUString& rPropName, const ::com::sun::star::util::Time& rValue ); + void appendTime( const sal_Char* pAsciiPropName, const ::com::sun::star::util::Time& rValue ) + { + appendTime( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendTime( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::Time& rValue ) + { + appendTime( rProp.Name, rValue ); + } + + void appendTimestamp( const ::rtl::OUString& rPropName, const ::com::sun::star::util::DateTime& rValue ); + void appendTimestamp( const sal_Char* pAsciiPropName, const ::com::sun::star::util::DateTime& rValue ) + { + appendTimestamp( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendTimestamp( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::DateTime& rValue ) + { + appendTimestamp( rProp.Name, rValue ); + } + + void appendBinaryStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ); + void appendBinaryStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ) + { + appendBinaryStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendBinaryStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ) + { + appendBinaryStream( rProp.Name, rValue ); + } + + void appendCharacterStream( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ); + void appendCharacterStream( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ) + { + appendCharacterStream( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendCharacterStream( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rValue ) + { + appendCharacterStream( rProp.Name, rValue ); + } + + void appendObject( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue ); + void appendObject( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Any& rValue ) + { + appendObject( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendObject( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Any& rValue ) + { + appendObject( rProp.Name, rValue ); + } + + void appendRef( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue ); + void appendRef( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue ) + { + appendRef( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendRef( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& rValue ) + { + appendRef( rProp.Name, rValue ); + } + + void appendBlob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue ); + void appendBlob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue ) + { + appendBlob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendBlob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rValue ) + { + appendBlob( rProp.Name, rValue ); + } + + void appendClob( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue ); + void appendClob( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue ) + { + appendClob( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendClob( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& rValue ) + { + appendClob( rProp.Name, rValue ); + } + + void appendArray( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue ); + void appendArray( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue ) + { + appendArray( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue ); + } + void appendArray( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& rValue ) + { + appendArray( rProp.Name, rValue ); + } + + void appendVoid( const ::rtl::OUString& rPropName ); + void appendVoid( const sal_Char* pAsciiPropName) + { + appendVoid( ::rtl::OUString::createFromAscii( pAsciiPropName ) ); + } + void appendVoid( const ::com::sun::star::beans::Property& rProp ) + { + appendVoid( rProp.Name ); + } /** * This method tries to append all property values contained in a diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst index 3f49d69c987f..8383eb4a8d5d 100644 --- a/ucbhelper/prj/build.lst +++ b/ucbhelper/prj/build.lst @@ -1,6 +1,7 @@ -uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL -uh ucbhelper usr1 - all uh_mkout NULL -uh ucbhelper\inc nmake - all uh_inc NULL -uh ucbhelper\source\client nmake - all uh_client uh_inc NULL -uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL -uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL +uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL +uh ucbhelper usr1 - all uh_mkout NULL +uh ucbhelper\inc nmake - all uh_inc NULL +uh ucbhelper\source\client nmake - all uh_client uh_inc NULL +uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL +uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL +uh ucbhelper\workben\myucp nmake - all uh_wb_myucp NULL diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx index 7ea542c5f4cd..38b8a9780254 100644 --- a/ucbhelper/source/provider/propertyvalueset.cxx +++ b/ucbhelper/source/provider/propertyvalueset.cxx @@ -92,7 +92,8 @@ const sal_uInt32 OBJECT_VALUE_SET = 0x00040000; struct PropertyValue { - Property aProperty; + ::rtl::OUString + sPropertyName; sal_uInt32 nPropsSet; sal_uInt32 nOrigValue; @@ -243,12 +244,12 @@ class PropertyValues : public PropertyValuesVector {}; _member_name_, \ getCppuType( static_cast< const _type_ * >( 0 ) ) ) -#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \ +#define SETVALUE_IMPL( _prop_name_, _type_name_, _member_name_, _value_ ) \ \ osl::MutexGuard aGuard( m_aMutex ); \ \ ucbhelper_impl::PropertyValue aNewValue; \ - aNewValue.aProperty = _property_; \ + aNewValue.sPropertyName = _prop_name_; \ aNewValue.nPropsSet = _type_name_; \ aNewValue.nOrigValue = _type_name_; \ aNewValue._member_name_ = _value_; \ @@ -645,7 +646,7 @@ sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName ) sal_Int32 nCount = m_pValues->size(); for ( sal_Int32 n = 0; n < nCount; ++n ) { - if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) ) + if ( (*m_pValues)[ n ].sPropertyName.equals( columnName ) ) return sal_Int32( n + 1 ); // Index is 1-based. } } @@ -685,144 +686,144 @@ sal_Int32 PropertyValueSet::getLength() const } //========================================================================= -void PropertyValueSet::appendString( const Property& rProp, +void PropertyValueSet::appendString( const ::rtl::OUString& rPropName, const OUString& rValue ) { - SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue ); + SETVALUE_IMPL( rPropName, STRING_VALUE_SET, aString, rValue ); } //========================================================================= -void PropertyValueSet::appendBoolean( const Property& rProp, +void PropertyValueSet::appendBoolean( const ::rtl::OUString& rPropName, sal_Bool bValue ) { - SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue ); + SETVALUE_IMPL( rPropName, BOOLEAN_VALUE_SET, bBoolean, bValue ); } //========================================================================= -void PropertyValueSet::appendByte( const Property& rProp, +void PropertyValueSet::appendByte( const ::rtl::OUString& rPropName, sal_Int8 nValue ) { - SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue ); + SETVALUE_IMPL( rPropName, BYTE_VALUE_SET, nByte, nValue ); } //========================================================================= -void PropertyValueSet::appendShort( const Property& rProp, +void PropertyValueSet::appendShort( const ::rtl::OUString& rPropName, sal_Int16 nValue ) { - SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue ); + SETVALUE_IMPL( rPropName, SHORT_VALUE_SET, nShort, nValue ); } //========================================================================= -void PropertyValueSet::appendInt( const Property& rProp, +void PropertyValueSet::appendInt( const ::rtl::OUString& rPropName, sal_Int32 nValue ) { - SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue ); + SETVALUE_IMPL( rPropName, INT_VALUE_SET, nInt, nValue ); } //========================================================================= -void PropertyValueSet::appendLong( const Property& rProp, +void PropertyValueSet::appendLong( const ::rtl::OUString& rPropName, sal_Int64 nValue ) { - SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue ); + SETVALUE_IMPL( rPropName, LONG_VALUE_SET, nLong, nValue ); } //========================================================================= -void PropertyValueSet::appendFloat( const Property& rProp, +void PropertyValueSet::appendFloat( const ::rtl::OUString& rPropName, float nValue ) { - SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue ); + SETVALUE_IMPL( rPropName, FLOAT_VALUE_SET, nFloat, nValue ); } //========================================================================= -void PropertyValueSet::appendDouble( const Property& rProp, +void PropertyValueSet::appendDouble( const ::rtl::OUString& rPropName, double nValue ) { - SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue ); + SETVALUE_IMPL( rPropName, DOUBLE_VALUE_SET, nDouble, nValue ); } //========================================================================= -void PropertyValueSet::appendBytes( const Property& rProp, +void PropertyValueSet::appendBytes( const ::rtl::OUString& rPropName, const Sequence< sal_Int8 >& rValue ) { - SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue ); + SETVALUE_IMPL( rPropName, BYTES_VALUE_SET, aBytes, rValue ); } //========================================================================= -void PropertyValueSet::appendDate( const Property& rProp, +void PropertyValueSet::appendDate( const ::rtl::OUString& rPropName, const Date& rValue ) { - SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue ); + SETVALUE_IMPL( rPropName, DATE_VALUE_SET, aDate, rValue ); } //========================================================================= -void PropertyValueSet::appendTime( const Property& rProp, +void PropertyValueSet::appendTime( const ::rtl::OUString& rPropName, const Time& rValue ) { - SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue ); + SETVALUE_IMPL( rPropName, TIME_VALUE_SET, aTime, rValue ); } //========================================================================= -void PropertyValueSet::appendTimestamp( const Property& rProp, +void PropertyValueSet::appendTimestamp( const ::rtl::OUString& rPropName, const DateTime& rValue ) { - SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue ); + SETVALUE_IMPL( rPropName, TIMESTAMP_VALUE_SET, aTimestamp, rValue ); } //========================================================================= void PropertyValueSet::appendBinaryStream( - const Property& rProp, + const ::rtl::OUString& rPropName, const Reference< XInputStream >& rValue ) { - SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue ); + SETVALUE_IMPL( rPropName, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue ); } //========================================================================= void PropertyValueSet::appendCharacterStream( - const Property& rProp, + const ::rtl::OUString& rPropName, const Reference< XInputStream >& rValue ) { - SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue ); + SETVALUE_IMPL( rPropName, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue ); } //========================================================================= -void PropertyValueSet::appendObject( const Property& rProp, +void PropertyValueSet::appendObject( const ::rtl::OUString& rPropName, const Any& rValue ) { - SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue ); + SETVALUE_IMPL( rPropName, OBJECT_VALUE_SET, aObject, rValue ); } //========================================================================= -void PropertyValueSet::appendRef( const Property& rProp, +void PropertyValueSet::appendRef( const ::rtl::OUString& rPropName, const Reference< XRef >& rValue ) { - SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue ); + SETVALUE_IMPL( rPropName, REF_VALUE_SET, xRef, rValue ); } //========================================================================= -void PropertyValueSet::appendBlob( const Property& rProp, +void PropertyValueSet::appendBlob( const ::rtl::OUString& rPropName, const Reference< XBlob >& rValue ) { - SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue ); + SETVALUE_IMPL( rPropName, BLOB_VALUE_SET, xBlob, rValue ); } //========================================================================= -void PropertyValueSet::appendClob( const Property& rProp, +void PropertyValueSet::appendClob( const ::rtl::OUString& rPropName, const Reference< XClob >& rValue ) { - SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue ); + SETVALUE_IMPL( rPropName, CLOB_VALUE_SET, xClob, rValue ); } //========================================================================= -void PropertyValueSet::appendArray( const Property& rProp, +void PropertyValueSet::appendArray( const ::rtl::OUString& rPropName, const Reference< XArray >& rValue ) { - SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue ); + SETVALUE_IMPL( rPropName, ARRAY_VALUE_SET, xArray, rValue ); } //========================================================================= -void PropertyValueSet::appendVoid( const Property& rProp ) +void PropertyValueSet::appendVoid( const ::rtl::OUString& rPropName ) { - SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() ); + SETVALUE_IMPL( rPropName, NO_VALUE_SET, aObject, Any() ); } //========================================================================= -- cgit From 8932e5049b52179f97b2dda4b116d17b0e74aafd Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:49:10 +0100 Subject: #161490# removed scheme vnd.sun.star.wfs --- svl/source/misc/urihelper.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 5473bf1c995d..0ae0cd0ebf80 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -126,8 +126,7 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef, eStyle); if (bCheckFileExists && !bWasAbsolute - && (aAbsURIRef.GetProtocol() == INET_PROT_FILE - || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS)) + && (aAbsURIRef.GetProtocol() == INET_PROT_FILE)) { INetURLObject aNonFileURIRef; aNonFileURIRef.SetSmartURL(rTheRelURIRef, -- cgit From abea9e82690ef3ab14d083a60de568f8b452c0f2 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:17 +0100 Subject: #161490# removed scheme vnd.sun.star.wfs --- tools/inc/tools/urlobj.hxx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 3c83f2beb5b3..f8b0c440022b 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -128,22 +128,21 @@ enum INetProtocol INET_PROT_DATA = 15, INET_PROT_CID = 16, INET_PROT_OUT = 17, - INET_PROT_VND_SUN_STAR_WFS = 18, - INET_PROT_VND_SUN_STAR_HIER = 19, - INET_PROT_VIM = 20, - INET_PROT_UNO = 21, - INET_PROT_COMPONENT = 22, - INET_PROT_VND_SUN_STAR_PKG = 23, - INET_PROT_LDAP = 24, - INET_PROT_DB = 25, - INET_PROT_VND_SUN_STAR_CMD = 26, - INET_PROT_VND_SUN_STAR_ODMA = 27, - INET_PROT_TELNET = 28, - INET_PROT_VND_SUN_STAR_EXPAND = 29, - INET_PROT_VND_SUN_STAR_TDOC = 30, - INET_PROT_GENERIC = 31, - INET_PROT_SMB = 32, - INET_PROT_END = 33 + INET_PROT_VND_SUN_STAR_HIER = 18, + INET_PROT_VIM = 19, + INET_PROT_UNO = 20, + INET_PROT_COMPONENT = 21, + INET_PROT_VND_SUN_STAR_PKG = 22, + INET_PROT_LDAP = 23, + INET_PROT_DB = 24, + INET_PROT_VND_SUN_STAR_CMD = 25, + INET_PROT_VND_SUN_STAR_ODMA = 26, + INET_PROT_TELNET = 27, + INET_PROT_VND_SUN_STAR_EXPAND = 28, + INET_PROT_VND_SUN_STAR_TDOC = 29, + INET_PROT_GENERIC = 30, + INET_PROT_SMB = 31, + INET_PROT_END = 32 }; //============================================================================ -- cgit From df23161a602841c7a5cbcc69ab1263a7b173151c Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:17 +0100 Subject: #161490# removed scheme vnd.sun.star.wfs --- tools/inc/tools/urlobj.hxx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 3c83f2beb5b3..f8b0c440022b 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -128,22 +128,21 @@ enum INetProtocol INET_PROT_DATA = 15, INET_PROT_CID = 16, INET_PROT_OUT = 17, - INET_PROT_VND_SUN_STAR_WFS = 18, - INET_PROT_VND_SUN_STAR_HIER = 19, - INET_PROT_VIM = 20, - INET_PROT_UNO = 21, - INET_PROT_COMPONENT = 22, - INET_PROT_VND_SUN_STAR_PKG = 23, - INET_PROT_LDAP = 24, - INET_PROT_DB = 25, - INET_PROT_VND_SUN_STAR_CMD = 26, - INET_PROT_VND_SUN_STAR_ODMA = 27, - INET_PROT_TELNET = 28, - INET_PROT_VND_SUN_STAR_EXPAND = 29, - INET_PROT_VND_SUN_STAR_TDOC = 30, - INET_PROT_GENERIC = 31, - INET_PROT_SMB = 32, - INET_PROT_END = 33 + INET_PROT_VND_SUN_STAR_HIER = 18, + INET_PROT_VIM = 19, + INET_PROT_UNO = 20, + INET_PROT_COMPONENT = 21, + INET_PROT_VND_SUN_STAR_PKG = 22, + INET_PROT_LDAP = 23, + INET_PROT_DB = 24, + INET_PROT_VND_SUN_STAR_CMD = 25, + INET_PROT_VND_SUN_STAR_ODMA = 26, + INET_PROT_TELNET = 27, + INET_PROT_VND_SUN_STAR_EXPAND = 28, + INET_PROT_VND_SUN_STAR_TDOC = 29, + INET_PROT_GENERIC = 30, + INET_PROT_SMB = 31, + INET_PROT_END = 32 }; //============================================================================ -- cgit From f2363e3b4fdd2e20b929d5f99dba66e7256bacb4 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:52 +0100 Subject: #161491# fixed handling of generic schemes --- tools/source/fsys/urlobj.cxx | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index f7ffed5e4dd1..2a3242c29f54 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -194,11 +194,6 @@ using namespace com::sun; name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~" - ; prvate (see RFC 1738, RFC 2396) - vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)] - segment = *pchar - - ; private vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar) reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~") @@ -406,8 +401,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false }, { "out", "out://", 0, true, false, false, false, false, false, false, false }, - { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false, - false, true, true, true, false }, { "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false, false, false, false, true, false }, { "vim", "vim://", 0, true, true, false, true, false, false, true, @@ -432,6 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, +// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -881,7 +875,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (getSchemeInfo().m_bAuthority) + if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1235,7 +1229,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (getSchemeInfo().m_bHost) + else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1343,7 +1337,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd) + if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1355,7 +1349,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: // If the host equals "LOCALHOST" (unencoded and ignoring // case), turn it into an empty host: if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort, @@ -1372,9 +1365,8 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, return false; } break; - default: - if (pHostPortBegin == pPort) + if (pHostPortBegin == pPort && pPort != pHostPortEnd) { setInvalid(); return false; @@ -2167,11 +2159,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, { "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC, PrefixInfo::OFFICIAL }, { "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV, - PrefixInfo::OFFICIAL }, - { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::OFFICIAL }, - { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::ALIAS } }; + PrefixInfo::OFFICIAL } }; PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; PrefixInfo const * pMatch = 0; @@ -2894,7 +2882,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -2911,7 +2898,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && m_aPort.isPresent()) return false; break; } @@ -2990,7 +2977,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, break; case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { if (bSkippedInitialSlash) aTheSynPath.append(sal_Unicode('/')); @@ -3403,7 +3389,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, if (aTheSynPath.getLength() == 0) return false; break; - default: OSL_ASSERT(false); break; @@ -3439,6 +3424,10 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { + // set hierarchical for generic schemes + if (m_eScheme == INET_PROT_GENERIC) { + return true; + } return getSchemeInfo().m_bHierarchical; } } @@ -4012,7 +4001,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { // If the URL paths of two file URLs only differ in that one has a // final '/' and the other has not, take the two paths as @@ -4167,7 +4155,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -4188,7 +4175,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && nThePort != 0) { setInvalid(); return false; -- cgit From bd261abc608e982ccd5307eecd64618ba9caf966 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Tue, 19 Jan 2010 12:50:52 +0100 Subject: #161491# fixed handling of generic schemes --- tools/source/fsys/urlobj.cxx | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index e0f711bd2883..0360f63da87e 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -194,11 +194,6 @@ using namespace com::sun; name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~" - ; prvate (see RFC 1738, RFC 2396) - vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)] - segment = *pchar - - ; private vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar) reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~") @@ -406,8 +401,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false }, { "out", "out://", 0, true, false, false, false, false, false, false, false }, - { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false, - false, true, true, true, false }, { "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false, false, false, false, true, false }, { "vim", "vim://", 0, true, true, false, true, false, false, true, @@ -432,6 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, +// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -881,7 +875,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (getSchemeInfo().m_bAuthority) + if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1233,7 +1227,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (getSchemeInfo().m_bHost) + else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1341,7 +1335,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd) + if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1353,7 +1347,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: // If the host equals "LOCALHOST" (unencoded and ignoring // case), turn it into an empty host: if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort, @@ -1370,9 +1363,8 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, return false; } break; - default: - if (pHostPortBegin == pPort) + if (pHostPortBegin == pPort && pPort != pHostPortEnd) { setInvalid(); return false; @@ -2165,11 +2157,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin, { "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC, PrefixInfo::OFFICIAL }, { "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV, - PrefixInfo::OFFICIAL }, - { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::OFFICIAL }, - { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS, - PrefixInfo::ALIAS } }; + PrefixInfo::OFFICIAL } }; PrefixInfo const * pFirst = aMap + 1; PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1; PrefixInfo const * pMatch = 0; @@ -2892,7 +2880,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -2909,7 +2896,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && m_aPort.isPresent()) return false; break; } @@ -2988,7 +2975,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, break; case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { if (bSkippedInitialSlash) aTheSynPath.append(sal_Unicode('/')); @@ -3401,7 +3387,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme, if (aTheSynPath.getLength() == 0) return false; break; - default: OSL_ASSERT(false); break; @@ -3437,6 +3422,10 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { + // set hierarchical for generic schemes + if (m_eScheme == INET_PROT_GENERIC) { + return true; + } return getSchemeInfo().m_bHierarchical; } } @@ -4010,7 +3999,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { // If the URL paths of two file URLs only differ in that one has a // final '/' and the other has not, take the two paths as @@ -4165,7 +4153,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, switch (m_eScheme) { case INET_PROT_FILE: - case INET_PROT_VND_SUN_STAR_WFS: { rtl::OUString sTemp(aSynHost); if (sTemp.equalsIgnoreAsciiCaseAsciiL( @@ -4186,7 +4173,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0) + if (aSynHost.getLength() == 0 && nThePort != 0) { setInvalid(); return false; -- cgit From 0336d5cf76303b921cce0d0b5c766857e8633dda Mon Sep 17 00:00:00 2001 From: hb Date: Tue, 19 Jan 2010 12:56:39 +0100 Subject: merged DEV300_m69 --- basegfx/inc/basegfx/matrix/b2dhommatrix.hxx | 10 + basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx | 205 ++++++++++-- basegfx/inc/basegfx/polygon/b2dpolygontools.hxx | 61 ---- basegfx/source/matrix/b2dhommatrix.cxx | 174 ++-------- basegfx/source/matrix/b2dhommatrixtools.cxx | 333 +++++++++++++++++++ basegfx/source/polygon/b2dlinegeometry.cxx | 9 +- basegfx/source/polygon/b2dpolygonclipper.cxx | 7 +- basegfx/source/polygon/b2dpolygontools.cxx | 311 ++++++++---------- basegfx/source/polygon/b2dsvgpolypolygon.cxx | 6 +- basegfx/source/tools/gradienttools.cxx | 17 +- basegfx/source/tools/unopolypolygon.cxx | 6 +- basegfx/test/basegfx2d.cxx | 7 +- canvas/source/cairo/cairo_canvashelper.cxx | 50 ++- canvas/source/cairo/cairo_canvashelper.hxx | 1 + canvas/source/directx/dx_canvashelper.cxx | 24 +- .../source/directx/dx_canvashelper_texturefill.cxx | 4 +- canvas/source/directx/dx_impltools.cxx | 67 +++- canvas/source/directx/dx_impltools.hxx | 15 +- canvas/source/directx/dx_linepolypolygon.cxx | 4 +- canvas/source/directx/dx_linepolypolygon.hxx | 2 +- canvas/source/simplecanvas/simplecanvasimpl.cxx | 11 +- canvas/source/tools/canvastools.cxx | 11 +- canvas/source/tools/surface.cxx | 11 +- cppcanvas/source/mtfrenderer/bitmapaction.cxx | 19 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 46 +-- cppcanvas/source/mtfrenderer/mtftools.cxx | 11 +- cppcanvas/source/mtfrenderer/textaction.cxx | 5 +- goodies/inc/grfmgr.hxx | 2 +- goodies/source/filter.vcl/epict/epict.cxx | 120 +++++-- goodies/source/filter.vcl/epict/makefile.mk | 2 +- goodies/source/filter.vcl/eps/eps.cxx | 61 +++- goodies/source/filter.vcl/ios2met/ios2met.cxx | 2 +- goodies/source/graphic/grfmgr.cxx | 4 +- rsc/source/parser/rsclex.cxx | 2 +- rsc/source/parser/rsclex.hxx | 2 +- rsc/source/rsc/makefile.mk | 4 - svl/inc/svl/svarray.hxx | 2 +- svtools/source/filter.vcl/wmf/emfwr.cxx | 94 +++++- svtools/source/filter.vcl/wmf/emfwr.hxx | 4 + svtools/source/filter.vcl/wmf/wmfwr.cxx | 84 ++++- svtools/source/filter.vcl/wmf/wmfwr.hxx | 4 + svtools/util/makefile.mk | 1 + tools/inc/tools/inetdef.hxx | 2 - tools/inc/tools/solar.h | 2 - tools/source/fsys/unx.cxx | 2 +- tools/source/generic/poly.cxx | 11 +- vcl/aqua/source/gdi/salgdi.cxx | 5 +- vcl/inc/vcl/cvtsvm.hxx | 4 + vcl/inc/vcl/lineinfo.hxx | 37 ++- vcl/inc/vcl/outdev.hxx | 10 +- vcl/os2/source/gdi/salgdi3.cxx | 6 +- vcl/source/gdi/cvtsvm.cxx | 354 ++++++++++++++++++--- vcl/source/gdi/lineinfo.cxx | 109 ++++++- vcl/source/gdi/makefile.mk | 7 +- vcl/source/gdi/metaact.cxx | 77 +++-- vcl/source/gdi/outdev.cxx | 284 +++++++++++------ vcl/source/gdi/outdev6.cxx | 14 +- vcl/source/gdi/pdfwriter_impl.cxx | 4 +- vcl/source/gdi/region.cxx | 9 +- vcl/source/gdi/salgdilayout.cxx | 1 - vcl/source/gdi/sallayout.cxx | 7 +- vcl/source/glyphs/gcach_ftyp.cxx | 5 +- vcl/source/glyphs/glyphcache.cxx | 2 - vcl/unx/inc/salunx.h | 6 - vcl/unx/source/app/i18n_ic.cxx | 4 +- vcl/unx/source/app/i18n_im.cxx | 2 +- vcl/unx/source/app/randrwrapper.cxx | 8 +- vcl/unx/source/app/saldisp.cxx | 7 +- vcl/unx/source/app/saltimer.cxx | 3 - vcl/unx/source/gdi/salgdi.cxx | 12 +- vcl/unx/source/printer/printerinfomanager.cxx | 2 +- vcl/win/source/gdi/salgdi3.cxx | 6 +- vcl/win/source/gdi/salgdi_gdiplus.cxx | 74 ++++- 73 files changed, 2033 insertions(+), 858 deletions(-) diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx index c7c79d0cd6e9..10b023c5f68c 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx @@ -52,12 +52,22 @@ namespace basegfx B2DHomMatrix(const B2DHomMatrix& rMat); ~B2DHomMatrix(); + /** constructor to allow setting all needed values for a 3x2 matrix at once. The + parameter f_0x1 e.g. is the same as using set(0, 1, f) + */ + B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2); + /// unshare this matrix with all internally shared instances void makeUnique(); double get(sal_uInt16 nRow, sal_uInt16 nColumn) const; void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue); + /** allow setting all needed values for a 3x2 matrix in one call. The + parameter f_0x1 e.g. is the same as using set(0, 1, f) + */ + void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2); + // test if last line is default to see if last line needs to be // involved in calculations bool isLastLineDefault() const; diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx index 0b200b812bed..c90f673a8194 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx @@ -40,45 +40,190 @@ namespace basegfx { - class DecomposedB2DHomMatrixContainer + namespace tools { - private: - B2DHomMatrix maB2DHomMatrix; - B2DVector maScale; - B2DVector maTranslate; - double mfRotate; - double mfShearX; + /** If the rotation angle is an approximate multiple of pi/2, + force fSin/fCos to -1/0/1, to maintain orthogonality (which + might also be advantageous for the other cases, but: for + multiples of pi/2, the exact values _can_ be attained. It + would be largely unintuitive, if a 180 degrees rotation + would introduce slight roundoff errors, instead of exactly + mirroring the coordinate system) + */ + void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant); - // bitfield - unsigned mbDecomposed : 1; + /** Tooling methods for on-the-fly matrix generation e.g. for inline + multiplications + */ + B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY); + B2DHomMatrix createShearXB2DHomMatrix(double fShearX); + B2DHomMatrix createShearYB2DHomMatrix(double fShearY); + B2DHomMatrix createRotateB2DHomMatrix(double fRadiant); + B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY); - void impCheckDecompose() + /// inline versions for parameters as tuples + inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale) { - if(!mbDecomposed) - { - maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); - mbDecomposed = true; - } + return createScaleB2DHomMatrix(rScale.getX(), rScale.getY()); + } + + inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate) + { + return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY()); + } + + /** Tooling methods for faster completely combined matrix creation + when scale, shearX, rotation and translation needs to be done in + exactly that order. It's faster since it direcly calculates + each matrix value based on a symbolic calculation of the three + matrix multiplications. + Inline versions for parameters as tuples added, too. + */ + B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + const B2DTuple& rScale, + double fShearX, + double fRadiant, + const B2DTuple& rTranslate) + { + return createScaleShearXRotateTranslateB2DHomMatrix( + rScale.getX(), rScale.getY(), + fShearX, + fRadiant, + rTranslate.getX(), rTranslate.getY()); + } + + B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + const B2DTuple& rTranslate) + { + return createShearXRotateTranslateB2DHomMatrix( + fShearX, + fRadiant, + rTranslate.getX(), rTranslate.getY()); } - public: - DecomposedB2DHomMatrixContainer(const B2DHomMatrix& rB2DHomMatrix) - : maB2DHomMatrix(rB2DHomMatrix), - maScale(), - maTranslate(), - mfRotate(0.0), - mfShearX(0.0), - mbDecomposed(false) + B2DHomMatrix createScaleTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createScaleTranslateB2DHomMatrix( + const B2DTuple& rScale, + const B2DTuple& rTranslate) { + return createScaleTranslateB2DHomMatrix( + rScale.getX(), rScale.getY(), + rTranslate.getX(), rTranslate.getY()); } - // data access - const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } - const B2DVector& getScale() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maScale; } - const B2DVector& getTranslate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maTranslate; } - double getRotate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfRotate; } - double getShearX() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfShearX; } - }; + /// special for the often used case of rotation around a point + B2DHomMatrix createRotateAroundPoint( + double fPointX, double fPointY, + double fRadiant); + inline B2DHomMatrix createRotateAroundPoint( + const B2DTuple& rPoint, + double fRadiant) + { + return createRotateAroundPoint( + rPoint.getX(), rPoint.getY(), + fRadiant); + } + } // end of namespace tools +} // end of namespace basegfx + +/////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + class B2DHomMatrixBufferedDecompose + { + private: + B2DVector maScale; + B2DVector maTranslate; + double mfRotate; + double mfShearX; + + public: + B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix) + : maScale(), + maTranslate(), + mfRotate(0.0), + mfShearX(0.0) + { + rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); + } + + // data access + B2DHomMatrix getB2DHomMatrix() const + { + return createScaleShearXRotateTranslateB2DHomMatrix( + maScale, mfShearX, mfRotate, maTranslate); + } + + const B2DVector& getScale() const { return maScale; } + const B2DVector& getTranslate() const { return maTranslate; } + double getRotate() const { return mfRotate; } + double getShearX() const { return mfShearX; } + }; + } // end of namespace tools +} // end of namespace basegfx + +/////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + class B2DHomMatrixBufferedOnDemandDecompose + { + private: + B2DHomMatrix maB2DHomMatrix; + B2DVector maScale; + B2DVector maTranslate; + double mfRotate; + double mfShearX; + + // bitfield + unsigned mbDecomposed : 1; + + void impCheckDecompose() + { + if(!mbDecomposed) + { + maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); + mbDecomposed = true; + } + } + + public: + B2DHomMatrixBufferedOnDemandDecompose(const B2DHomMatrix& rB2DHomMatrix) + : maB2DHomMatrix(rB2DHomMatrix), + maScale(), + maTranslate(), + mfRotate(0.0), + mfShearX(0.0), + mbDecomposed(false) + { + } + + // data access + const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } + const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; } + const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; } + double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; } + double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; } + }; + } // end of namespace tools } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index 5eff6b0b9cc1..47ff41b75e70 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -288,14 +288,6 @@ namespace basegfx */ B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius ); - /** append a unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, bool bEndPoint); - - /** append a segment of unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd, bool bEndPoint); - /** create a polygon which describes the unit circle and close it @param nStartQuadrant @@ -325,59 +317,6 @@ namespace basegfx */ B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ); - /** append a unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant); - - /** append a segment of unit circle with start point, the control vectors and end point to the given polygon - */ - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd); - - /** Create an ellipse polygon with given radii. - - This method creates an ellipse approximation consisting of - four cubic bezier segments, which approximate the given - ellipse with an error of less than 0.5 percent. - - @param rCenter - Center point of the circle - - @param fRadiusX - Radius of the ellipse in X direction - - @param fRadiusY - Radius of the ellipse in Y direction - - @param fStart - Start angle where the ellipe segment starts in the range [0.0 .. 2PI[ - - @param fEnd - End angle where the ellipe segment ends in the range [0.0 .. 2PI[ - */ - B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ); - - /** Create an ellipse polygon with given radii and the given angles, from start to end - - This method creates an ellipse approximation consisting of - four cubic bezier segments, which approximate the given - ellipse with an error of less than 0.5 percent. - - @param rCenter - Center point of the circle - - @param fRadiusX - Radius of the ellipse in X direction - - @param fRadiusY - Radius of the ellipse in Y direction - - @param fStart - Start angle where the ellipe segment starts in the range [0.0 .. 2PI[ - - @param fEnd - End angle where the ellipe segment ends in the range [0.0 .. 2PI[ - */ - /** Create an unit ellipse polygon with the given angles, from start to end */ B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ); diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 352113fa8ed3..a7777352effb 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -36,6 +36,9 @@ #include #include #include +#include + +/////////////////////////////////////////////////////////////////////////////// namespace basegfx { @@ -60,6 +63,17 @@ namespace basegfx { } + B2DHomMatrix::B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) + : mpImpl( IdentityMatrix::get() ) // use common identity matrix, will be made unique with 1st set-call + { + mpImpl->set(0, 0, f_0x0); + mpImpl->set(0, 1, f_0x1); + mpImpl->set(0, 2, f_0x2); + mpImpl->set(1, 0, f_1x0); + mpImpl->set(1, 1, f_1x1); + mpImpl->set(1, 2, f_1x2); + } + B2DHomMatrix& B2DHomMatrix::operator=(const B2DHomMatrix& rMat) { mpImpl = rMat.mpImpl; @@ -81,6 +95,16 @@ namespace basegfx mpImpl->set(nRow, nColumn, fValue); } + void B2DHomMatrix::set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) + { + mpImpl->set(0, 0, f_0x0); + mpImpl->set(0, 1, f_0x1); + mpImpl->set(0, 2, f_0x2); + mpImpl->set(1, 0, f_1x0); + mpImpl->set(1, 1, f_1x1); + mpImpl->set(1, 2, f_1x2); + } + bool B2DHomMatrix::isLastLineDefault() const { return mpImpl->isLastLineDefault(); @@ -206,56 +230,9 @@ namespace basegfx if(!fTools::equalZero(fRadiant)) { double fSin(0.0); - double fCos(0.0); - - // is the rotation angle an approximate multiple of pi/2? - // If yes, force fSin/fCos to -1/0/1, to maintain - // orthogonality (which might also be advantageous for the - // other cases, but: for multiples of pi/2, the exact - // values _can_ be attained. It would be largely - // unintuitive, if a 180 degrees rotation would introduce - // slight roundoff errors, instead of exactly mirroring - // the coordinate system). - if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) - { - // determine quadrant - const sal_Int32 nQuad( - (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); - switch( nQuad ) - { - case 0: // -2pi,0,2pi - fSin = 0.0; - fCos = 1.0; - break; - - case 1: // -3/2pi,1/2pi - fSin = 1.0; - fCos = 0.0; - break; - - case 2: // -pi,pi - fSin = 0.0; - fCos = -1.0; - break; - - case 3: // -1/2pi,3/2pi - fSin = -1.0; - fCos = 0.0; - break; - - default: - OSL_ENSURE( false, - "B2DHomMatrix::rotate(): Impossible case reached" ); - } - } - else - { - // TODO(P1): Maybe use glibc's sincos here (though - // that's kinda non-portable...) - fSin = sin(fRadiant); - fCos = cos(fRadiant); - } + double fCos(1.0); + tools::createSinCosOrthogonal(fSin, fCos, fRadiant); Impl2DHomMatrix aRotMat; aRotMat.set(0, 0, fCos); @@ -474,104 +451,7 @@ namespace basegfx return true; } - -/* Old version: Used 3D decompose when shaer was involved and also a determinant test - (but only in that case). Keeping as comment since it also worked and to allow a - fallback in case the new version makes trouble somehow. Definitely missing in the 2nd - case is the sign correction for Y-Scale, this would need to be added following the above - pattern - - bool B2DHomMatrix::decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const - { - // when perspective is used, decompose is not made here - if(!mpImpl->isLastLineDefault()) - return false; - - // test for rotation and shear - if(fTools::equalZero(get(0, 1)) - && fTools::equalZero(get(1, 0))) - { - // no rotation and shear, direct value extraction - rRotate = rShearX = 0.0; - - // copy scale values - rScale.setX(get(0, 0)); - rScale.setY(get(1, 1)); - - // copy translation values - rTranslate.setX(get(0, 2)); - rTranslate.setY(get(1, 2)); - - return true; - } - else - { - // test if shear is zero. That's the case, if the unit vectors in the matrix - // are perpendicular -> scalar is zero - const ::basegfx::B2DVector aUnitVecX(get(0, 0), get(1, 0)); - const ::basegfx::B2DVector aUnitVecY(get(0, 1), get(1, 1)); - - if(fTools::equalZero(aUnitVecX.scalar(aUnitVecY))) - { - // no shear, direct value extraction - rShearX = 0.0; - - // calculate rotation - rShearX = 0.0; - rRotate = atan2(aUnitVecX.getY(), aUnitVecX.getX()); - - // calculate scale values - rScale.setX(aUnitVecX.getLength()); - rScale.setY(aUnitVecY.getLength()); - - // copy translation values - rTranslate.setX(get(0, 2)); - rTranslate.setY(get(1, 2)); - - return true; - } - else - { - // If determinant is zero, decomposition is not possible - if(0.0 == determinant()) - return false; - - // copy 2x2 matrix and translate vector to 3x3 matrix - ::basegfx::B3DHomMatrix a3DHomMat; - - a3DHomMat.set(0, 0, get(0, 0)); - a3DHomMat.set(0, 1, get(0, 1)); - a3DHomMat.set(1, 0, get(1, 0)); - a3DHomMat.set(1, 1, get(1, 1)); - a3DHomMat.set(0, 3, get(0, 2)); - a3DHomMat.set(1, 3, get(1, 2)); - - ::basegfx::B3DTuple r3DScale, r3DTranslate, r3DRotate, r3DShear; - - if(a3DHomMat.decompose(r3DScale, r3DTranslate, r3DRotate, r3DShear)) - { - // copy scale values - rScale.setX(r3DScale.getX()); - rScale.setY(r3DScale.getY()); - - // copy shear - rShearX = r3DShear.getX(); - - // copy rotate - rRotate = r3DRotate.getZ(); - - // copy translate - rTranslate.setX(r3DTranslate.getX()); - rTranslate.setY(r3DTranslate.getY()); - - return true; - } - } - } - - return false; - } */ - } // end of namespace basegfx +/////////////////////////////////////////////////////////////////////////////// // eof diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 59a1ff432fc7..2c71193f6352 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -38,6 +38,339 @@ namespace basegfx { + namespace tools + { + void createSinCosOrthogonal(double& o_rSin, double& o_rCos, double fRadiant) + { + if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) + { + // determine quadrant + const sal_Int32 nQuad( + (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); + switch( nQuad ) + { + case 0: // -2pi,0,2pi + o_rSin = 0.0; + o_rCos = 1.0; + break; + + case 1: // -3/2pi,1/2pi + o_rSin = 1.0; + o_rCos = 0.0; + break; + + case 2: // -pi,pi + o_rSin = 0.0; + o_rCos = -1.0; + break; + + case 3: // -1/2pi,3/2pi + o_rSin = -1.0; + o_rCos = 0.0; + break; + + default: + OSL_ENSURE( false, "createSinCos: Impossible case reached" ); + } + } + else + { + // TODO(P1): Maybe use glibc's sincos here (though + // that's kinda non-portable...) + o_rSin = sin(fRadiant); + o_rCos = cos(fRadiant); + } + } + + B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY) + { + B2DHomMatrix aRetval; + const double fOne(1.0); + + if(!fTools::equal(fScaleX, fOne)) + { + aRetval.set(0, 0, fScaleX); + } + + if(!fTools::equal(fScaleY, fOne)) + { + aRetval.set(1, 1, fScaleY); + } + + return aRetval; + } + + B2DHomMatrix createShearXB2DHomMatrix(double fShearX) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fShearX)) + { + aRetval.set(0, 1, fShearX); + } + + return aRetval; + } + + B2DHomMatrix createShearYB2DHomMatrix(double fShearY) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fShearY)) + { + aRetval.set(1, 0, fShearY); + } + + return aRetval; + } + + B2DHomMatrix createRotateB2DHomMatrix(double fRadiant) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fRadiant)) + { + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + aRetval.set(0, 0, fCos); + aRetval.set(1, 1, fCos); + aRetval.set(1, 0, fSin); + aRetval.set(0, 1, -fSin); + } + + return aRetval; + } + + B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY) + { + B2DHomMatrix aRetval; + + if(!(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY))) + { + aRetval.set(0, 2, fTranslateX); + aRetval.set(1, 2, fTranslateY); + } + + return aRetval; + } + + B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY) + { + const double fOne(1.0); + + if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne)) + { + /// no scale, take shortcut + return createShearXRotateTranslateB2DHomMatrix(fShearX, fRadiant, fTranslateX, fTranslateY); + } + else + { + /// scale used + if(fTools::equalZero(fShearX)) + { + /// no shear + if(fTools::equalZero(fRadiant)) + { + /// no rotate, take shortcut + return createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, fTranslateX, fTranslateY); + } + else + { + /// rotate and scale used, no shear + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos * fScaleX, + /* Row 0, Column 1 */ fScaleY * -fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin * fScaleX, + /* Row 1, Column 1 */ fScaleY * fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + else + { + /// scale and shear used + if(fTools::equalZero(fRadiant)) + { + /// scale and shear, but no rotate + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fScaleX, + /* Row 0, Column 1 */ fScaleY * fShearX, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ fScaleY, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + else + { + /// scale, shear and rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos * fScaleX, + /* Row 0, Column 1 */ fScaleY * ((fCos * fShearX) - fSin), + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin * fScaleX, + /* Row 1, Column 1 */ fScaleY * ((fSin * fShearX) + fCos), + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + } + + B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY) + { + if(fTools::equalZero(fShearX)) + { + /// no shear + if(fTools::equalZero(fRadiant)) + { + /// no shear, no rotate, take shortcut + return createTranslateB2DHomMatrix(fTranslateX, fTranslateY); + } + else + { + /// no shear, but rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ -fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + else + { + /// shear used + if(fTools::equalZero(fRadiant)) + { + /// no rotate, but shear used + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ 1.0, + /* Row 0, Column 1 */ fShearX, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ 1.0, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + else + { + /// shear and rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ (fCos * fShearX) - fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ (fSin * fShearX) + fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + + B2DHomMatrix createScaleTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fTranslateX, double fTranslateY) + { + const double fOne(1.0); + + if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne)) + { + /// no scale, take shortcut + return createTranslateB2DHomMatrix(fTranslateX, fTranslateY); + } + else + { + /// scale used + if(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY)) + { + /// no translate, but scale. + B2DHomMatrix aRetval; + + aRetval.set(0, 0, fScaleX); + aRetval.set(1, 1, fScaleY); + + return aRetval; + } + else + { + /// translate and scale + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fScaleX, + /* Row 0, Column 1 */ 0.0, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ fScaleY, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + + B2DHomMatrix createRotateAroundPoint( + double fPointX, double fPointY, + double fRadiant) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fRadiant)) + { + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + aRetval.set3x2( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ -fSin, + /* Row 0, Column 2 */ (fPointX * (1.0 - fCos)) + (fSin * fPointY), + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ fCos, + /* Row 1, Column 2 */ (fPointY * (1.0 - fCos)) - (fSin * fPointX)); + } + + return aRetval; + } + } // end of namespace tools } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 1a9264ab769e..c22b5ea94011 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -85,11 +86,9 @@ namespace basegfx // get size of the arrow const B2DRange aArrowSize(getRange(rArrow)); - // build ArrowTransform - B2DHomMatrix aArrowTransform; - - // center in X, align with axis in Y - aArrowTransform.translate(-aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY()); + // build ArrowTransform; center in X, align with axis in Y + B2DHomMatrix aArrowTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY())); // scale to target size const double fArrowScale(fWidth / (aArrowSize.getRange().getX())); diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index f0d325942c07..87e44ed3d063 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -40,6 +40,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -361,11 +362,10 @@ namespace basegfx else if(rCandidate.count()) { const B2DVector aEdge(rPointB - rPointA); - B2DHomMatrix aMatrixTransform; B2DPolygon aCandidate(rCandidate); // translate and rotate polygon so that given edge is on x axis - aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY()); + B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aCandidate.transform(aMatrixTransform); @@ -395,11 +395,10 @@ namespace basegfx else if(rCandidate.count()) { const B2DVector aEdge(rPointB - rPointA); - B2DHomMatrix aMatrixTransform; B2DPolyPolygon aCandidate(rCandidate); // translate and rotate polygon so that given edge is on x axis - aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY()); + B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aCandidate.transform(aMatrixTransform); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 7485387c6cb9..d62462b8c097 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -33,7 +33,6 @@ #include #include #include - #include #include #include @@ -43,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -54,6 +55,7 @@ #ifdef DBG_UTIL static double fAngleBoundStartValue = ANGLE_BOUND_START_VALUE; #endif +#define STEPSPERQUARTER (3) ////////////////////////////////////////////////////////////////////////////// @@ -1840,145 +1842,106 @@ namespace basegfx return createPolygonFromEllipse( rCenter, fRadius, fRadius ); } - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant) + B2DPolygon impCreateUnitCircle(sal_uInt32 nStartQuadrant) { - const double fZero(0.0); - const double fOne(1.0); + B2DPolygon aUnitCircle; const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0); + const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER)); + const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER)); + + B2DPoint aPoint(1.0, 0.0); + B2DPoint aForward(1.0, fScaledKappa); + B2DPoint aBackward(1.0, -fScaledKappa); - // create closed unit-circle with 4 segments - switch(nQuadrant) + if(0 != nStartQuadrant) { - case 0 : // first quadrant - { - rPolygon.append(B2DPoint(fOne, fZero)); - rPolygon.appendBezierSegment(B2DPoint(fOne, fKappa), B2DPoint(fKappa, fOne), B2DPoint(fZero, fOne)); - break; - } - case 1 : // second quadrant - { - rPolygon.append(B2DPoint(fZero, fOne)); - rPolygon.appendBezierSegment(B2DPoint(-fKappa, fOne), B2DPoint(-fOne, fKappa), B2DPoint(-fOne, fZero)); - break; - } - case 2 : // third quadrant - { - rPolygon.append(B2DPoint(-fOne, fZero)); - rPolygon.appendBezierSegment(B2DPoint(-fOne, -fKappa), B2DPoint(-fKappa, -fOne), B2DPoint(fZero, -fOne)); - break; - } - default : // last quadrant - { - rPolygon.append(B2DPoint(fZero, -fOne)); - rPolygon.appendBezierSegment(B2DPoint(fKappa, -fOne), B2DPoint(fOne, -fKappa), B2DPoint(fOne, fZero)); - break; - } + const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(F_PI2 * (nStartQuadrant % 4))); + aPoint *= aQuadrantMatrix; + aBackward *= aQuadrantMatrix; + aForward *= aQuadrantMatrix; } - } - B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant) - { - B2DPolygon aRetval; + aUnitCircle.append(aPoint); - // create unit-circle with all 4 segments, close it - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - aRetval.setClosed(true); + for(sal_uInt32 a(0); a < STEPSPERQUARTER * 4; a++) + { + aPoint *= aRotateMatrix; + aBackward *= aRotateMatrix; + aUnitCircle.appendBezierSegment(aForward, aBackward, aPoint); + aForward *= aRotateMatrix; + } - // remove double points between segments created by segmented creation - aRetval.removeDoublePoints(); + aUnitCircle.setClosed(true); + aUnitCircle.removeDoublePoints(); - return aRetval; + return aUnitCircle; } - B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ) + B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant) { - const double fOne(1.0); - B2DPolygon aRetval(createPolygonFromUnitCircle()); - - // transformation necessary? - const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne)); - const sal_Bool bTranslate(!rCenter.equalZero()); - - if(bScale || bTranslate) + switch(nStartQuadrant % 4) { - B2DHomMatrix aMatrix; - - if(bScale) - { - aMatrix.scale(fRadiusX, fRadiusY); - } - - if(bTranslate) + case 1 : { - aMatrix.translate(rCenter.getX(), rCenter.getY()); - } - - aRetval.transform(aMatrix); - } - - return aRetval; - } - - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd) - { - OSL_ENSURE(fStart >= 0.0 && fStart <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - OSL_ENSURE(fEnd >= 0.0 && fEnd <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - OSL_ENSURE(fEnd >= fStart, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - const double fOne(1.0); - const bool bStartIsZero(fTools::equalZero(fStart)); - const bool bEndIsOne(fTools::equal(fEnd, fOne)); + static B2DPolygon aUnitCircleStartQuadrantOne; - if(bStartIsZero && bEndIsOne) - { - // add completely - appendUnitCircleQuadrant(rPolygon, nQuadrant); - } - else - { - // split and add - B2DPolygon aQuadrant; - appendUnitCircleQuadrant(aQuadrant, nQuadrant); - const bool bStartEndEqual(fTools::equal(fStart, fEnd)); + if(!aUnitCircleStartQuadrantOne.count()) + { + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantOne = impCreateUnitCircle(1); + } - if(bStartEndEqual) + return aUnitCircleStartQuadrantOne; + } + case 2 : { - if(bStartIsZero) + static B2DPolygon aUnitCircleStartQuadrantTwo; + + if(!aUnitCircleStartQuadrantTwo.count()) { - // both zero, add start point - rPolygon.append(aQuadrant.getB2DPoint(0L)); + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantTwo = impCreateUnitCircle(2); } - else if(bEndIsOne) + + return aUnitCircleStartQuadrantTwo; + } + case 3 : + { + static B2DPolygon aUnitCircleStartQuadrantThree; + + if(!aUnitCircleStartQuadrantThree.count()) { - // both one, add end point - rPolygon.append(aQuadrant.getB2DPoint(1L)); + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantThree = impCreateUnitCircle(3); } - else - { - // both equal but not zero, add split point - B2DCubicBezier aCubicBezier( - aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L), - aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L)); - aCubicBezier.split(fStart, &aCubicBezier, 0); - rPolygon.append(aCubicBezier.getEndPoint()); - } + return aUnitCircleStartQuadrantThree; } - else + default : // case 0 : { - B2DCubicBezier aCubicBezier( - aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L), - aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L)); + static B2DPolygon aUnitCircleStartQuadrantZero; + + if(!aUnitCircleStartQuadrantZero.count()) + { + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantZero = impCreateUnitCircle(0); + } - aCubicBezier = aCubicBezier.snippet(fStart, fEnd); - rPolygon.append(aCubicBezier.getStartPoint()); - rPolygon.appendBezierSegment(aCubicBezier.getControlPointA(), aCubicBezier.getControlPointB(), aCubicBezier.getEndPoint()); + return aUnitCircleStartQuadrantZero; } } } + B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ) + { + B2DPolygon aRetval(createPolygonFromUnitCircle()); + const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY())); + + aRetval.transform(aMatrix); + + return aRetval; + } + B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd ) { B2DPolygon aRetval; @@ -2005,49 +1968,74 @@ namespace basegfx fEnd = 0.0; } - const sal_uInt32 nQuadrantStart(sal_uInt32(fStart / F_PI2) % 4L); - const sal_uInt32 nQuadrantEnd(sal_uInt32(fEnd / F_PI2) % 4L); - sal_uInt32 nCurrentQuadrant(nQuadrantStart); - bool bStartDone(false); - bool bEndDone(false); - - do + if(fTools::equal(fStart, fEnd)) { - if(!bStartDone && nQuadrantStart == nCurrentQuadrant) - { - if(nQuadrantStart == nQuadrantEnd && fTools::moreOrEqual(fEnd, fStart)) - { - // both in one quadrant and defining the complete segment, create start to end - double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2); - double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, fSplitOffsetEnd); - bStartDone = bEndDone = true; - } - else - { - // create start to quadrant end - const double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, 1.0); - bStartDone = true; - } - } - else if(!bEndDone && nQuadrantEnd == nCurrentQuadrant) + // same start and end angle, add single point + aRetval.append(B2DPoint(cos(fStart), sin(fStart))); + } + else + { + const sal_uInt32 nSegments(STEPSPERQUARTER * 4); + const double fAnglePerSegment(F_PI2 / STEPSPERQUARTER); + const sal_uInt32 nStartSegment(sal_uInt32(fStart / fAnglePerSegment) % nSegments); + const sal_uInt32 nEndSegment(sal_uInt32(fEnd / fAnglePerSegment) % nSegments); + const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0); + const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER)); + + B2DPoint aSegStart(cos(fStart), sin(fStart)); + aRetval.append(aSegStart); + + if(nStartSegment == nEndSegment && fTools::more(fEnd, fStart)) { - // create quadrant start to end - const double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, 0.0, fSplitOffsetEnd); - bEndDone = true; + // start and end in one sector and in the right order, create in one segment + const B2DPoint aSegEnd(cos(fEnd), sin(fEnd)); + const double fFactor(fScaledKappa * ((fEnd - fStart) / fAnglePerSegment)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); } else { - // add quadrant completely - appendUnitCircleQuadrant(aRetval, nCurrentQuadrant); - } + double fSegEndRad((nStartSegment + 1) * fAnglePerSegment); + double fFactor(fScaledKappa * ((fSegEndRad - fStart) / fAnglePerSegment)); + B2DPoint aSegEnd(cos(fSegEndRad), sin(fSegEndRad)); - // next step - nCurrentQuadrant = (nCurrentQuadrant + 1L) % 4L; + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); + + sal_uInt32 nSegment((nStartSegment + 1) % nSegments); + aSegStart = aSegEnd; + + while(nSegment != nEndSegment) + { + // No end in this sector, add full sector. + fSegEndRad = (nSegment + 1) * fAnglePerSegment; + aSegEnd = B2DPoint(cos(fSegEndRad), sin(fSegEndRad)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fScaledKappa), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fScaledKappa), + aSegEnd); + + nSegment = (nSegment + 1) % nSegments; + aSegStart = aSegEnd; + } + + // End in this sector + const double fSegStartRad(nSegment * fAnglePerSegment); + fFactor = fScaledKappa * ((fEnd - fSegStartRad) / fAnglePerSegment); + aSegEnd = B2DPoint(cos(fEnd), sin(fEnd)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); + } } - while(!(bStartDone && bEndDone)); // remove double points between segments created by segmented creation aRetval.removeDoublePoints(); @@ -2058,28 +2046,9 @@ namespace basegfx B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ) { B2DPolygon aRetval(createPolygonFromUnitEllipseSegment(fStart, fEnd)); + const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY())); - // transformation necessary? - const double fOne(1.0); - const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne)); - const sal_Bool bTranslate(!rCenter.equalZero()); - - if(bScale || bTranslate) - { - B2DHomMatrix aMatrix; - - if(bScale) - { - aMatrix.scale(fRadiusX, fRadiusY); - } - - if(bTranslate) - { - aMatrix.translate(rCenter.getX(), rCenter.getY()); - } - - aRetval.transform(aMatrix); - } + aRetval.transform(aMatrix); return aRetval; } @@ -2709,11 +2678,7 @@ namespace basegfx if(nPointCount) { - B2DHomMatrix aMatrix; - - aMatrix.translate(-rCenter.getX(), -rCenter.getY()); - aMatrix.rotate(fAngle); - aMatrix.translate(rCenter.getX(), rCenter.getY()); + const B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(rCenter, fAngle)); aRetval.transform(aMatrix); } diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 2247c237d90f..e38ec3809fb1 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -705,7 +706,7 @@ namespace basegfx // |y1'| = |-sin phi cos phi| |(y1 - y2)/2| const B2DPoint p1(nLastX, nLastY); const B2DPoint p2(nX, nY); - B2DHomMatrix aTransform; aTransform.rotate(-fPhi*M_PI/180); + B2DHomMatrix aTransform(basegfx::tools::createRotateB2DHomMatrix(-fPhi*M_PI/180)); const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) ); @@ -797,8 +798,7 @@ namespace basegfx fTheta1, fTheta2 )); // transform ellipse by rotation & move to final center - aTransform.identity(); - aTransform.scale(fRX,fRY); + aTransform = basegfx::tools::createScaleB2DHomMatrix(fRX, fRY); aTransform.translate(aCenter_prime.getX(), aCenter_prime.getY()); aTransform.rotate(fPhi*M_PI/180); diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 9e78039cd590..51989899ebf4 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -32,9 +32,9 @@ #include "precompiled_basegfx.hxx" #include - #include #include +#include namespace basegfx { @@ -79,9 +79,8 @@ namespace basegfx B2DPoint aCenter(0.5, 0.5); aCenter *= o_rGradientInfo.maTextureTransform; - o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - o_rGradientInfo.maTextureTransform.rotate(fAngle); - o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } // add object translate @@ -158,9 +157,8 @@ namespace basegfx B2DPoint aCenter(0.5, 0.5); aCenter *= o_rGradientInfo.maTextureTransform; - o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - o_rGradientInfo.maTextureTransform.rotate(fAngle); - o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } } @@ -232,9 +230,8 @@ namespace basegfx B2DPoint aCenter(0.5, 0.5); aCenter *= o_rGradientInfo.maTextureTransform; - o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); - o_rGradientInfo.maTextureTransform.rotate(fAngle); - o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } // add defined offsets after rotation diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index 6d8fcd83edb0..05dbe5b1c823 100755 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -44,8 +44,8 @@ #include #include #include - #include +#include using namespace ::com::sun::star; @@ -138,9 +138,7 @@ namespace unotools if( !aOffset.equalZero() ) { - B2DHomMatrix aTranslate; - aTranslate.translate( aOffset.getX(), aOffset.getY() ); - + const B2DHomMatrix aTranslate(tools::createTranslateB2DHomMatrix(aOffset)); aSrcPoly.transform( aTranslate ); } diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index ab6715467dba..1bd15702e143 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -484,8 +484,13 @@ public: } while ( nIndex >= 0 ); + // Adapted number of spaces to 50 and 67 because of the new circle construction + // methods which produce more points and thus more spaces, too. Use both since + // depending on float precision and the getContinuity() implemetation using + // fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32 + // uses more 'S' statements (as it should be for circles) CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", - nCount==18); + nCount==67 || nCount==50); const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 9cf2dd978759..5469010f2745 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -958,6 +958,7 @@ namespace cairocanvas void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, + bool bNoLineJoin, const uno::Sequence< rendering::Texture >* pTextures, Cairo* pCairo ) const { @@ -967,10 +968,46 @@ namespace cairocanvas if( !pCairo ) pCairo = mpCairo.get(); - doPolyPolygonImplementation( rPolyPoly, aOperation, - pCairo, pTextures, - mpSurfaceProvider, - xPolyPolygon->getFillRule() ); + if(bNoLineJoin && Stroke == aOperation) + { + // emulate rendering::PathJoinType::NONE by painting single edges + for(sal_uInt32 a(0); a < rPolyPoly.count(); a++) + { + const basegfx::B2DPolygon aCandidate(rPolyPoly.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1: nPointCount); + basegfx::B2DPolygon aEdge; + aEdge.append(aCandidate.getB2DPoint(0)); + aEdge.append(basegfx::B2DPoint(0.0, 0.0)); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex)); + aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a)); + aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex)); + + doPolyPolygonImplementation( aEdge, aOperation, + pCairo, pTextures, + mpSurfaceProvider, + xPolyPolygon->getFillRule() ); + + // prepare next step + aEdge.setB2DPoint(0, aEdge.getB2DPoint(1)); + } + } + } + } + else + { + doPolyPolygonImplementation( rPolyPoly, aOperation, + pCairo, pTextures, + mpSurfaceProvider, + xPolyPolygon->getFillRule() ); + } } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* , @@ -1039,9 +1076,12 @@ namespace cairocanvas break; } + bool bNoLineJoin(false); + switch( strokeAttributes.JoinType ) { // cairo doesn't have join type NONE so we use MITER as it's pretty close case rendering::PathJoinType::NONE: + bNoLineJoin = true; case rendering::PathJoinType::MITER: cairo_set_line_join( mpCairo.get(), CAIRO_LINE_JOIN_MITER ); break; @@ -1063,7 +1103,7 @@ namespace cairocanvas // TODO(rodo) use LineArray of strokeAttributes - doPolyPolygonPath( xPolyPolygon, Stroke ); + doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin ); cairo_restore( mpCairo.get() ); } else diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx index 1e69a9f41e5b..90d365d63b3c 100644 --- a/canvas/source/cairo/cairo_canvashelper.hxx +++ b/canvas/source/cairo/cairo_canvashelper.hxx @@ -276,6 +276,7 @@ namespace cairocanvas void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, + bool bNoLineJoin = false, const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL, ::cairo::Cairo* pCairo=NULL ) const; diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 0642b6c50efb..607f7c076e21 100755 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -367,7 +368,11 @@ namespace dxcanvas pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); - aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); + const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType); + const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType); + + if(bIsMiter) + aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); const ::std::vector< Gdiplus::REAL >& rDashArray( ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >( @@ -380,9 +385,10 @@ namespace dxcanvas aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType), gdiCapFromCap(strokeAttributes.EndCapType), Gdiplus::DashCapFlat ); - aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) ); + if(!bIsNone) + aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) ); - GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) ); + GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon, bIsNone ) ); // TODO(E1): Return value Gdiplus::Status hr = pGraphics->DrawPath( &aPen, pPath.get() ); @@ -733,10 +739,8 @@ namespace dxcanvas // add output offset if( !maOutputOffset.equalZero() ) { - ::basegfx::B2DHomMatrix aOutputOffset; - aOutputOffset.translate( maOutputOffset.getX(), - maOutputOffset.getY() ); - + const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix( + maOutputOffset.getX(), maOutputOffset.getY())); aTransform = aOutputOffset * aTransform; } @@ -774,10 +778,8 @@ namespace dxcanvas // add output offset if( !maOutputOffset.equalZero() ) { - ::basegfx::B2DHomMatrix aOutputOffset; - aOutputOffset.translate( maOutputOffset.getX(), - maOutputOffset.getY() ); - + const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix( + maOutputOffset.getX(), maOutputOffset.getY())); aTransform = aOutputOffset * aTransform; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index f291d197c4de..73a2d49bfb62 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -452,8 +453,7 @@ namespace dxcanvas aFillBrush.SetColor( aFillColor ); const double nCurrScale( (nStepCount-i)/(double)nStepCount ); - aScaleMatrix.identity(); - aScaleMatrix.translate( -0.5, -0.5 ); + aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); // handle anisotrophic polygon scaling if( rValues.mnAspectRatio < 1.0 ) diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index 40164c9a1d87..4f5b92d6bcb5 100755 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -194,7 +194,8 @@ namespace dxcanvas void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr& rOutput, ::std::vector< Gdiplus::PointF >& rPoints, - const ::basegfx::B2DPolygon& rPoly ) + const ::basegfx::B2DPolygon& rPoly, + bool bNoLineJoin) { const sal_uInt32 nPoints( rPoly.count() ); @@ -241,7 +242,18 @@ namespace dxcanvas rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast(rPoint.getX()), static_cast(rPoint.getY()) ); - rOutput->AddBeziers( &rPoints[0], nCurrOutput ); + if(bNoLineJoin && nCurrOutput > 7) + { + for(sal_uInt32 a(3); a < nCurrOutput; a+=3) + { + rOutput->StartFigure(); + rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]); + } + } + else + { + rOutput->AddBeziers( &rPoints[0], nCurrOutput ); + } } else { @@ -251,7 +263,20 @@ namespace dxcanvas // Therefore, simply don't pass the last two // points here. if( nCurrOutput > 3 ) - rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 ); + { + if(bNoLineJoin && nCurrOutput > 7) + { + for(sal_uInt32 a(3); a < nCurrOutput; a+=3) + { + rOutput->StartFigure(); + rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]); + } + } + else + { + rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 ); + } + } } } else @@ -267,10 +292,27 @@ namespace dxcanvas static_cast(rPoint.getY()) ); } - rOutput->AddLines( &rPoints[0], nPoints ); + if(bNoLineJoin && nPoints > 2) + { + for(sal_uInt32 a(1); a < nPoints; a++) + { + rOutput->StartFigure(); + rOutput->AddLine(rPoints[a - 1], rPoints[a]); + } + + if(bClosedPolygon) + { + rOutput->StartFigure(); + rOutput->AddLine(rPoints[nPoints - 1], rPoints[0]); + } + } + else + { + rOutput->AddLines( &rPoints[0], nPoints ); + } } - if( bClosedPolygon ) + if( bClosedPolygon && !bNoLineJoin ) rOutput->CloseFigure(); } } @@ -426,17 +468,17 @@ namespace dxcanvas return pRes; } - GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly ) + GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin ) { GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); ::std::vector< Gdiplus::PointF > aPoints; - graphicsPathFromB2DPolygon( pRes, aPoints, rPoly ); + graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin ); return pRes; } - GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) + GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin ) { GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); ::std::vector< Gdiplus::PointF > aPoints; @@ -446,24 +488,25 @@ namespace dxcanvas { graphicsPathFromB2DPolygon( pRes, aPoints, - rPoly.getB2DPolygon( nCurrPoly ) ); + rPoly.getB2DPolygon( nCurrPoly ), + bNoLineJoin); } return pRes; } - GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly ) + GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly, bool bNoLineJoin ) { LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() ); if( pPolyImpl ) { - return pPolyImpl->getGraphicsPath(); + return pPolyImpl->getGraphicsPath( bNoLineJoin ); } else { return tools::graphicsPathFromB2DPolyPolygon( - polyPolygonFromXPolyPolygon2D( xPoly ) ); + polyPolygonFromXPolyPolygon2D( xPoly ), bNoLineJoin ); } } diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx index 072d1063235d..222b1a927305 100755 --- a/canvas/source/directx/dx_impltools.hxx +++ b/canvas/source/directx/dx_impltools.hxx @@ -107,11 +107,18 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& ); - GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly ); - GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ); + GraphicsPathSharedPtr graphicsPathFromB2DPolygon( + const ::basegfx::B2DPolygon& rPoly, + bool bNoLineJoin = false); + + GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( + const ::basegfx::B2DPolyPolygon& rPoly, + bool bNoLineJoin = false); + + GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&, + bool bNoLineJoin = false ); - GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& ); bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics, const BitmapSharedPtr& rBitmap ); bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, diff --git a/canvas/source/directx/dx_linepolypolygon.cxx b/canvas/source/directx/dx_linepolypolygon.cxx index e63adc3dc613..9a5569384eae 100755 --- a/canvas/source/directx/dx_linepolypolygon.cxx +++ b/canvas/source/directx/dx_linepolypolygon.cxx @@ -46,14 +46,14 @@ namespace dxcanvas { } - GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath() const + GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const { // generate GraphicsPath only on demand (gets deleted as soon // as any of the modifying methods above touches the // B2DPolyPolygon). if( !mpPath ) { - mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe() ); + mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin ); mpPath->SetFillMode( const_cast(this)->getFillRule() == rendering::FillRule_EVEN_ODD ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding ); } diff --git a/canvas/source/directx/dx_linepolypolygon.hxx b/canvas/source/directx/dx_linepolypolygon.hxx index 431cd1b87b4f..3e061d76e768 100755 --- a/canvas/source/directx/dx_linepolypolygon.hxx +++ b/canvas/source/directx/dx_linepolypolygon.hxx @@ -45,7 +45,7 @@ namespace dxcanvas public: explicit LinePolyPolygon( const ::basegfx::B2DPolyPolygon& ); - GraphicsPathSharedPtr getGraphicsPath() const; + GraphicsPathSharedPtr getGraphicsPath( bool bNoLineJoin = false) const; private: // overridden, to clear mpPath diff --git a/canvas/source/simplecanvas/simplecanvasimpl.cxx b/canvas/source/simplecanvas/simplecanvasimpl.cxx index 185979b0220e..7ca251458d22 100644 --- a/canvas/source/simplecanvas/simplecanvasimpl.cxx +++ b/canvas/source/simplecanvas/simplecanvasimpl.cxx @@ -46,6 +46,7 @@ #include #include +#include #include "canvas/canvastools.hxx" @@ -287,10 +288,7 @@ namespace ::sal_Int8 nTextDirection ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - - basegfx::B2DHomMatrix offsetTransform; - offsetTransform.translate(aOutPos.X,aOutPos.Y); - + const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aOutPos.X,aOutPos.Y)); rendering::RenderState aRenderState( createStrokingRenderState() ); tools::appendToRenderState(aRenderState, offsetTransform); @@ -305,10 +303,7 @@ namespace const geometry::RealPoint2D& aLeftTop ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - - basegfx::B2DHomMatrix offsetTransform; - offsetTransform.translate(aLeftTop.X,aLeftTop.Y); - + const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aLeftTop.X,aLeftTop.Y)); rendering::RenderState aRenderState( createStrokingRenderState() ); tools::appendToRenderState(aRenderState, offsetTransform); diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 23d6124e4cb8..278789637c72 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include @@ -679,9 +680,8 @@ namespace canvas i_transformation ); // now move resulting left,top point of bounds to (0,0) - ::basegfx::B2DHomMatrix aCorrectedTransform; - aCorrectedTransform.translate( -aTransformedRect.getMinX(), - -aTransformedRect.getMinY() ); + const basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTransformedRect.getMinX(), -aTransformedRect.getMinY())); // prepend to original transformation o_transform = aCorrectedTransform * i_transformation; @@ -745,9 +745,8 @@ namespace canvas transformation ); // now move resulting left,top point of bounds to (0,0) - ::basegfx::B2DHomMatrix aCorrectedTransform; - aCorrectedTransform.translate( -aTransformedRect.getMinX(), - -aTransformedRect.getMinY() ); + basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTransformedRect.getMinX(), -aTransformedRect.getMinY())); // scale to match outRect const double xDenom( aTransformedRect.getWidth() ); diff --git a/canvas/source/tools/surface.cxx b/canvas/source/tools/surface.cxx index c3161758ea3e..96162f6d78af 100644 --- a/canvas/source/tools/surface.cxx +++ b/canvas/source/tools/surface.cxx @@ -33,6 +33,7 @@ #include "surface.hxx" #include +#include #include #include @@ -150,9 +151,8 @@ namespace canvas // 4) scale to normalized device coordinates // 5) flip y-axis // 6) translate to account for viewport transform - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate(maSourceOffset.getX(), - maSourceOffset.getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + maSourceOffset.getX(), maSourceOffset.getY())); aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); @@ -277,8 +277,7 @@ namespace canvas // 1) offset of surface subarea // 2) surface transform // 3) translation to output position [rPos] - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate(aPos1.getX(),aPos1.getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(aPos1.getX(), aPos1.getY())); aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); @@ -380,7 +379,7 @@ namespace canvas // be transformed by the overall transform and uv coordinates will // be calculated from the result, and this is why we need to use // integer coordinates here... - ::basegfx::B2DHomMatrix aTransform; + basegfx::B2DHomMatrix aTransform; aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx index 355dd336e2c5..4f54b10c4879 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx @@ -35,25 +35,21 @@ #include #include #include - #include #include #include - #include - #include #include #include #include #include - #include - #include "cachedprimitivebase.hxx" #include "bitmapaction.hxx" #include "outdevstate.hxx" #include "mtftools.hxx" +#include using namespace ::com::sun::star; @@ -112,9 +108,7 @@ namespace cppcanvas // Setup transformation such that the next render call is // moved rPoint away. - ::basegfx::B2DHomMatrix aLocalTransformation; - aLocalTransformation.translate( rDstPoint.getX(), - rDstPoint.getY() ); + const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createTranslateB2DHomMatrix(rDstPoint)); ::canvas::tools::appendToRenderState( maState, aLocalTransformation ); @@ -144,15 +138,12 @@ namespace cppcanvas // moved rPoint away, and scaled according to the ratio // given by src and dst size. const ::Size aBmpSize( rBmpEx.GetSizePixel() ); - ::basegfx::B2DHomMatrix aLocalTransformation; const ::basegfx::B2DVector aScale( rDstSize.getX() / aBmpSize.Width(), rDstSize.getY() / aBmpSize.Height() ); - aLocalTransformation.scale( aScale.getX(), aScale.getY() ); - aLocalTransformation.translate( rDstPoint.getX(), - rDstPoint.getY() ); - ::canvas::tools::appendToRenderState( maState, - aLocalTransformation ); + const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createScaleTranslateB2DHomMatrix( + aScale, rDstPoint)); + ::canvas::tools::appendToRenderState( maState, aLocalTransformation ); // correct clip (which is relative to original transform) tools::modifyClip( maState, diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index c6f9a295b332..8ea2ae453a97 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -34,19 +34,14 @@ #include #include #include - #include #include #include - #include - #include #include #include - #include - #include #include #include @@ -59,7 +54,6 @@ #include #include #include - #include #include #include @@ -73,7 +67,6 @@ #include #include #include - #include #include #include @@ -84,11 +77,9 @@ #include #include #include - #include #include #include - #include #include #include @@ -96,15 +87,13 @@ #include #include #include - #include #include #include - #include - #include "mtftools.hxx" #include "outdevstate.hxx" +#include using namespace ::com::sun::star; @@ -286,10 +275,25 @@ namespace (getState( rParms.mrStates ).mapModeTransform * aWidth).getX(); // setup reasonable defaults - o_rStrokeAttributes.MiterLimit = 1.0; + o_rStrokeAttributes.MiterLimit = 15.0; // 1.0 was no good default; GDI+'s limit is 10.0, our's is 15.0 o_rStrokeAttributes.StartCapType = rendering::PathCapType::BUTT; o_rStrokeAttributes.EndCapType = rendering::PathCapType::BUTT; - o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER; + + switch(rLineInfo.GetLineJoin()) + { + default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE + o_rStrokeAttributes.JoinType = rendering::PathJoinType::NONE; + break; + case basegfx::B2DLINEJOIN_BEVEL: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::BEVEL; + break; + case basegfx::B2DLINEJOIN_MITER: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER; + break; + case basegfx::B2DLINEJOIN_ROUND: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::ROUND; + break; + } if( LINE_DASH == rLineInfo.GetStyle() ) { @@ -729,12 +733,11 @@ namespace cppcanvas fabs( aBounds.getHeight()*sin(nRotation) ) + fabs( aBounds.getWidth()*cos(nRotation) ))); - aTextureTransformation.scale( nScale, nScale ); - - // translate back origin to center of + // scale and translate back origin to center of // primitive - aTextureTransformation.translate( 0.5*aBounds.getWidth(), - 0.5*aBounds.getHeight() ); + aTextureTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix( + nScale, nScale, 0.5*aBounds.getWidth(), 0.5*aBounds.getHeight()) + * aTextureTransformation; } break; @@ -856,9 +859,8 @@ namespace cppcanvas aTextureTransformation.scale( nScaleX, nScaleY ); // rotate texture according to gradient rotation - aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY ); - aTextureTransformation.rotate( nRotation ); - aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY ); + aTextureTransformation = basegfx::tools::createRotateAroundPoint(0.5*nScaleX, 0.5*nScaleY, nRotation) + * aTextureTransformation; aTextureTransformation.translate( nOffsetX, nOffsetY ); } diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index e4e227955da6..b6a548aa49be 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -34,10 +34,8 @@ #include #include #include - #include #include - #include #include #include @@ -45,16 +43,15 @@ #include #include #include - #include #include #include #include #include - #include "mtftools.hxx" #include "outdevstate.hxx" #include "polypolyaction.hxx" +#include @@ -111,9 +108,9 @@ namespace cppcanvas const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) ); - o_rMatrix.identity(); - o_rMatrix.scale( aSizePixel.Width() / (double)aSizeLogic.Width(), - aSizePixel.Height() / (double)aSizeLogic.Height() ); + o_rMatrix = basegfx::tools::createScaleB2DHomMatrix( + aSizePixel.Width() / (double)aSizeLogic.Width(), + aSizePixel.Height() / (double)aSizeLogic.Height() ); return o_rMatrix; } diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index f1191e6e57f3..038b68c3008e 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -93,9 +94,7 @@ namespace cppcanvas NULL, &rState.fontRotation ); - ::basegfx::B2DHomMatrix aLocalTransformation; - - aLocalTransformation.rotate( rState.fontRotation ); + basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createRotateB2DHomMatrix(rState.fontRotation)); aLocalTransformation.translate( rStartPoint.getX(), rStartPoint.getY() ); ::canvas::tools::appendToRenderState( o_rRenderState, diff --git a/goodies/inc/grfmgr.hxx b/goodies/inc/grfmgr.hxx index b44c27ea65e3..1ef351ae6d32 100644 --- a/goodies/inc/grfmgr.hxx +++ b/goodies/inc/grfmgr.hxx @@ -353,7 +353,7 @@ public: void ReleaseFromCache(); const Graphic& GetGraphic() const; - void SetGraphic( const Graphic& rGraphic ); + void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0); void SetGraphic( const Graphic& rGraphic, const String& rLink ); /** Get graphic transformed according to given attributes diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx index 3e4dca455d05..cd9e33edd5d9 100644 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ b/goodies/source/filter.vcl/epict/epict.cxx @@ -55,6 +55,9 @@ #include "dlgepct.hrc" #include "dlgepct.hxx" +#include +#include + //============================== PictWriter =================================== struct PictWriterAttrStackMember { @@ -77,7 +80,6 @@ struct PictPattern { sal_uInt32 nLo, nHi; }; - class PictWriter { private: @@ -178,6 +180,7 @@ private: void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry); + void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void WriteOpcodes(const GDIMetaFile & rMTF); void WriteHeader(const GDIMetaFile & rMTF); @@ -1371,6 +1374,65 @@ void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal } } +void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision(); + const sal_uInt32 nPolyCount(aLinePolyPolygon.count()); + SetAttrForFrame(); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount); + const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0)); + Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY())); + + for(sal_uInt32 b(0); b < nEdgeCount; b++) + { + const sal_uInt32 nNextIndex((b + 1) % nPointCount); + const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex)); + const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY())); + + WriteOpcode_Line(nCurr, nNext); + nCurr = nNext; + } + } + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(aLineColor); + const Color aOldFillColor(aFillColor); + + aLineColor = Color( COL_TRANSPARENT ); + aFillColor = aOldLineColor; + SetAttrForPaint(); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision()); + WriteOpcode_Poly(PDM_PAINT, aPolygon); + } + + aLineColor = aOldLineColor; + aFillColor = aOldFillColor; + } + } +} void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { @@ -1417,8 +1479,19 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if( aLineColor != Color( COL_TRANSPARENT ) ) { - SetAttrForFrame(); - WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); + if(pA->GetLineInfo().IsDefault()) + { + SetAttrForFrame(); + WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } break; } @@ -1571,24 +1644,35 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { const Polygon& rPoly = pA->GetPolygon(); - Polygon aSimplePoly; - if ( rPoly.HasFlags() ) - rPoly.AdaptiveSubdivide( aSimplePoly ); - else - aSimplePoly = rPoly; - - const USHORT nSize = aSimplePoly.GetSize(); - Point aLast; - - if ( nSize ) + if( rPoly.GetSize() ) { - SetAttrForFrame(); - aLast = aSimplePoly[0]; + if(pA->GetLineInfo().IsDefault()) + { + Polygon aSimplePoly; + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; - for ( USHORT i = 1; i < nSize; i++ ) + const USHORT nSize = aSimplePoly.GetSize(); + Point aLast; + + if ( nSize ) + { + SetAttrForFrame(); + aLast = aSimplePoly[0]; + + for ( USHORT i = 1; i < nSize; i++ ) + { + WriteOpcode_Line( aLast, aSimplePoly[i] ); + aLast = aSimplePoly[i]; + } + } + } + else { - WriteOpcode_Line( aLast, aSimplePoly[i] ); - aLast = aSimplePoly[i]; + // LineInfo used; handle Dash/Dot and fat lines + HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); } } } diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk index 4aa4bab80ffc..9f25a562488a 100644 --- a/goodies/source/filter.vcl/epict/makefile.mk +++ b/goodies/source/filter.vcl/epict/makefile.mk @@ -61,7 +61,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= ept$(DLLPOSTFIX) SHL1IMPLIB= epict -SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB) SHL1LIBS= $(SLB)$/epict.lib diff --git a/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx index dc8e407b178e..83b5a94f97f2 100644 --- a/goodies/source/filter.vcl/eps/eps.cxx +++ b/goodies/source/filter.vcl/eps/eps.cxx @@ -388,7 +388,7 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter bTextFillColor = TRUE; aTextFillColor = Color( COL_BLACK ); fLineWidth = 1; - fMiterLimit = 10; + fMiterLimit = 15; // use same limit as most graphic systems and basegfx eLineCap = SvtGraphicStroke::capButt; eJoinType = SvtGraphicStroke::joinMiter; aBackgroundColor = Color( COL_WHITE ); @@ -701,7 +701,40 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() ); const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo(); ImplWriteLineInfo( rLineInfo ); - ImplPolyLine( aPoly ); + + if(basegfx::B2DLINEJOIN_NONE == rLineInfo.GetLineJoin() + && rLineInfo.GetWidth() > 1) + { + // emulate B2DLINEJOIN_NONE by creating single edges + const sal_uInt16 nPoints(aPoly.GetSize()); + const bool bCurve(aPoly.HasFlags()); + + for(sal_uInt16 a(0); a + 1 < nPoints; a++) + { + if(bCurve + && POLY_NORMAL != aPoly.GetFlags(a + 1) + && a + 2 < nPoints + && POLY_NORMAL != aPoly.GetFlags(a + 2) + && a + 3 < nPoints) + { + const Polygon aSnippet(4, + aPoly.GetConstPointAry() + a, + aPoly.GetConstFlagAry() + a); + ImplPolyLine(aSnippet); + a += 2; + } + else + { + const Polygon aSnippet(2, + aPoly.GetConstPointAry() + a); + ImplPolyLine(aSnippet); + } + } + } + else + { + ImplPolyLine( aPoly ); + } } break; @@ -2343,8 +2376,28 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo ) SvtGraphicStroke::DashArray l_aDashArray; if ( rLineInfo.GetStyle() == LINE_DASH ) l_aDashArray.push_back( 2 ); - double fLWidth = ( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5; - ImplWriteLineInfo( fLWidth, 10.0, SvtGraphicStroke::capButt, SvtGraphicStroke::joinMiter, l_aDashArray ); + const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5); + SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter); + + switch(rLineInfo.GetLineJoin()) + { + default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE + // do NOT use SvtGraphicStroke::joinNone here + // since it will be written as numerical value directly + // and is NOT a valid EPS value + break; + case basegfx::B2DLINEJOIN_MITER: + aJoinType = SvtGraphicStroke::joinMiter; + break; + case basegfx::B2DLINEJOIN_BEVEL: + aJoinType = SvtGraphicStroke::joinBevel; + break; + case basegfx::B2DLINEJOIN_ROUND: + aJoinType = SvtGraphicStroke::joinRound; + break; + } + + ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray ); } //--------------------------------------------------------------------------------- diff --git a/goodies/source/filter.vcl/ios2met/ios2met.cxx b/goodies/source/filter.vcl/ios2met/ios2met.cxx index 0fbf24f56029..8c3c19e22379 100644 --- a/goodies/source/filter.vcl/ios2met/ios2met.cxx +++ b/goodies/source/filter.vcl/ios2met/ios2met.cxx @@ -846,7 +846,7 @@ void OS2METReader::ReadRelLine(BOOL bGivenPos, USHORT nOrderLen) if (nPolySize==0) return; Polygon aPolygon(nPolySize); for (i=0; i> nunsignedbyte; aP0.X()+=(INT8)nunsignedbyte; *pOS2MET >> nunsignedbyte; aP0.Y()+=(INT8)nunsignedbyte; diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx index 39c1e53e7184..7f5970383075 100644 --- a/goodies/source/graphic/grfmgr.cxx +++ b/goodies/source/graphic/grfmgr.cxx @@ -845,7 +845,7 @@ const Graphic& GraphicObject::GetGraphic() const // ----------------------------------------------------------------------------- -void GraphicObject::SetGraphic( const Graphic& rGraphic ) +void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj ) { mpMgr->ImplUnregisterObj( *this ); @@ -858,7 +858,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic ) delete mpLink, mpLink = NULL; delete mpSimpleCache, mpSimpleCache = NULL; - mpMgr->ImplRegisterObj( *this, maGraphic ); + mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj); if( mpSwapOutTimer ) mpSwapOutTimer->Start(); diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 3c2c95e541d1..8c34637fa304 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -317,7 +317,7 @@ int yylex() /****************** yyerror **********************************************/ #ifdef RS6000 extern "C" void yyerror( char* pMessage ) -#elif defined HP9000 || defined SCO || defined IRIX || defined SOLARIS +#elif defined HP9000 || defined SCO || defined SOLARIS extern "C" void yyerror( const char* pMessage ) #else void yyerror( char* pMessage ) diff --git a/rsc/source/parser/rsclex.hxx b/rsc/source/parser/rsclex.hxx index 89feed4dd132..63afd0b208c7 100644 --- a/rsc/source/parser/rsclex.hxx +++ b/rsc/source/parser/rsclex.hxx @@ -107,7 +107,7 @@ class ObjectStack { extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion extern "C" void yyerror( char * ); extern "C" int yylex( void ); -#elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS ) +#elif defined( HP9000 ) || defined( SCO ) || defined ( SOLARIS ) extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion extern "C" void yyerror( const char * ); extern "C" int yylex( void ); diff --git a/rsc/source/rsc/makefile.mk b/rsc/source/rsc/makefile.mk index 40e2d77740a3..89abd22207d9 100644 --- a/rsc/source/rsc/makefile.mk +++ b/rsc/source/rsc/makefile.mk @@ -40,10 +40,6 @@ ENABLE_EXCEPTIONS=true .INCLUDE : settings.mk -.IF "$(OS)"=="IRIX" -NOOPTFILES= $(OBJ)$/rsc.obj -.ENDIF - OBJFILES= $(OBJ)$/rsc.obj .INCLUDE : target.mk diff --git a/svl/inc/svl/svarray.hxx b/svl/inc/svl/svarray.hxx index d2479cd5364f..555b7ad5fe84 100644 --- a/svl/inc/svl/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -1034,7 +1034,7 @@ public:\ #define C40_PTR_REPLACE( c, p) Replace( (c const *) p ) #define C40_GETPOS( c, r) GetPos( (c const *)r ) #else -#if defined WTC || defined IRIX || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) +#if defined WTC || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) #define C40_INSERT( c, p, n ) Insert( (c const *&) p, n ) #define C40_PUSH( c, p) Push( (c const *&) p ) #define C40_PTR_INSERT( c, p ) Insert( (c const *&) p ) diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx index df56afc4a250..e011dde1a0e8 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.cxx +++ b/svtools/source/filter.vcl/wmf/emfwr.cxx @@ -33,6 +33,9 @@ #include "emfwr.hxx" #include +#include +#include +#include // ----------- // - Defines - @@ -829,6 +832,46 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons // ----------------------------------------------------------------------------- +void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + ImplWritePolygonRecord( Polygon(aCandidate), FALSE ); + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(maVDev.GetLineColor()); + const Color aOldFillColor(maVDev.GetFillColor()); + + maVDev.SetLineColor(); + maVDev.SetFillColor(aOldLineColor); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + ImplWritePolyPolygonRecord(PolyPolygon(Polygon(aPolygon))); + } + + maVDev.SetLineColor(aOldLineColor); + maVDev.SetFillColor(aOldFillColor); + } + } +} + +// ----------------------------------------------------------------------------- + void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { for( ULONG j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) @@ -871,20 +914,31 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { const MetaLineAction* pA = (const MetaLineAction*) pAction; - ImplCheckLineAttr(); + if(pA->GetLineInfo().IsDefault()) + { + ImplCheckLineAttr(); - ImplBeginRecord( WIN_EMR_MOVETOEX ); - ImplWritePoint( pA->GetStartPoint() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_MOVETOEX ); + ImplWritePoint( pA->GetStartPoint() ); + ImplEndRecord(); - ImplBeginRecord( WIN_EMR_LINETO ); - ImplWritePoint( pA->GetEndPoint() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_LINETO ); + ImplWritePoint( pA->GetEndPoint() ); + ImplEndRecord(); - ImplBeginRecord( WIN_EMR_SETPIXELV ); - ImplWritePoint( pA->GetEndPoint() ); - ImplWriteColor( maVDev.GetLineColor() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_SETPIXELV ); + ImplWritePoint( pA->GetEndPoint() ); + ImplWriteColor( maVDev.GetLineColor() ); + ImplEndRecord(); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } } break; @@ -983,7 +1037,23 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) case( META_POLYLINE_ACTION ): { if( maVDev.IsLineColor() ) - ImplWritePolygonRecord( ( (const MetaPolyLineAction*) pAction )->GetPolygon(), FALSE ); + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction; + const Polygon& rPoly = pA->GetPolygon(); + + if( rPoly.GetSize() ) + { + if(pA->GetLineInfo().IsDefault()) + { + ImplWritePolygonRecord( rPoly, FALSE ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } + } } break; diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx index 150aa1692ade..2d3c8801ba49 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.hxx +++ b/svtools/source/filter.vcl/wmf/emfwr.hxx @@ -42,6 +42,9 @@ // - EMFWriter - // ------------- +class LineInfo; +namespace basegfx { class B2DPolygon; } + class EMFWriter { private: @@ -86,6 +89,7 @@ private: void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP ); void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ); + void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void ImplWrite( const GDIMetaFile& rMtf ); public: diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index d25d4e94f97a..30d4ff06c0d2 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -42,8 +42,9 @@ #include //unicode::getUnicodeScriptType #endif - #include +#include +#include //====================== MS-Windows-defines =============================== @@ -1136,6 +1137,49 @@ void WMFWriter::SetAllAttr() } +void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + aSrcLineInfo = rInfo; + SetLineAndFillAttr(); + + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + WMFRecord_PolyLine(Polygon(aCandidate)); + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(aSrcLineColor); + const Color aOldFillColor(aSrcFillColor); + + aSrcLineColor = Color( COL_TRANSPARENT ); + aSrcFillColor = aOldLineColor; + SetLineAndFillAttr(); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + WMFRecord_Polygon(Polygon(aPolygon)); + } + + aSrcLineColor = aOldLineColor; + aSrcFillColor = aOldFillColor; + SetLineAndFillAttr(); + } + } +} + void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) { ULONG nA, nACount; @@ -1176,10 +1220,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_LINE_ACTION: { const MetaLineAction* pA = (const MetaLineAction *) pMA; - aSrcLineInfo = pA->GetLineInfo(); - SetLineAndFillAttr(); - WMFRecord_MoveTo( pA->GetStartPoint() ); - WMFRecord_LineTo( pA->GetEndPoint() ); + if(pA->GetLineInfo().IsDefault()) + { + aSrcLineInfo = pA->GetLineInfo(); + SetLineAndFillAttr(); + WMFRecord_MoveTo( pA->GetStartPoint() ); + WMFRecord_LineTo( pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } break; @@ -1241,9 +1296,22 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_POLYLINE_ACTION: { const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA; - aSrcLineInfo = pA->GetLineInfo(); - SetLineAndFillAttr(); - WMFRecord_PolyLine( pA->GetPolygon() ); + const Polygon& rPoly = pA->GetPolygon(); + + if( rPoly.GetSize() ) + { + if(pA->GetLineInfo().IsDefault()) + { + aSrcLineInfo = pA->GetLineInfo(); + SetLineAndFillAttr(); + WMFRecord_PolyLine( rPoly ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } } break; diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx index 48986a280404..03ca14e7633f 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.hxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx @@ -65,6 +65,9 @@ struct WMFWriterAttrStackMember // ------------- class StarSymbolToMSMultiFont; +class LineInfo; +namespace basegfx { class B2DPolygon; } + class WMFWriter { private: @@ -202,6 +205,7 @@ private: void SetLineAndFillAttr(); void SetAllAttr(); + void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void WriteRecords(const GDIMetaFile & rMTF); void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable); diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 51ea7a9fef31..22be04f95d3f 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -112,6 +112,7 @@ SHL1STDLIBS+= \ $(VCLLIB) \ $(SVLLIB) \ $(SOTLIB) \ + $(BASEGFXLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(I18NISOLANGLIB) \ diff --git a/tools/inc/tools/inetdef.hxx b/tools/inc/tools/inetdef.hxx index 38cd8935e06b..d9861f64961d 100644 --- a/tools/inc/tools/inetdef.hxx +++ b/tools/inc/tools/inetdef.hxx @@ -61,8 +61,6 @@ #define TOOLS_INETDEF_OS "FreeBSD/amd64" #elif defined SINIX #define TOOLS_INETDEF_OS "SINIX" -#elif defined IRIX -#define TOOLS_INETDEF_OS "IRIX" #else // AIX, HPUX, SOLARIS, ... #define TOOLS_INETDEF_OS "Unix" #endif // AIX, HPUX, SOLARIS, ... diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index cd069886d8b6..195a6fd3ce87 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -393,8 +393,6 @@ template inline T Abs(T a) { return (a>=0?a:-a); } #define __DLLEXTENSION "fi.so" #elif defined FREEBSD && defined X86_64 #define __DLLEXTENSION "fx.so" -#elif defined IRIX - #define __DLLEXTENSION "im.so" #elif defined MACOSX && defined POWERPC #define __DLLEXTENSION "mxp.dylib" #elif defined MACOSX && defined X86 diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index 76910683df13..4a2e3c6ad76a 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -36,7 +36,7 @@ #include #include #include -#if defined HPUX || defined LINUX || defined IRIX +#if defined HPUX || defined LINUX #include #define mnttab mntent #elif defined SCO diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 7f1eb94b646d..509d2ab4969d 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -1615,7 +1615,16 @@ void Polygon::Clip( const Rectangle& rRect, BOOL bPolygon ) Rectangle Polygon::GetBoundRect() const { DBG_CHKTHIS( Polygon, NULL ); - DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" ); + // Removing the assert. Bezier curves have the attribute that each single + // curve segment defined by four points can not exit the four-point polygon + // defined by that points. This allows to say that the curve segment can also + // never leave the Range of it's defining points. + // The result is that Polygon::GetBoundRect() may not create the minimal + // BoundRect of the Polygon (to get that, use basegfx::B2DPolygon classes), + // but will always create a valid BoundRect, at least as long as this method + // 'blindly' travels over all points, including control points. + // + // DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" ); USHORT nCount = mpImplPolygon->mnPoints; if( ! nCount ) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 1c9bdda3fbdb..263a5b6e6803 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -54,6 +54,7 @@ #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include using namespace vcl; @@ -1768,9 +1769,7 @@ BOOL AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& r GgoClosePathProc( &aGgoData ); if( mfFontScale != 1.0 ) { - basegfx::B2DHomMatrix aScale; - aScale.scale( +mfFontScale, +mfFontScale ); - rPolyPoly.transform( aScale ); + rPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(+mfFontScale, +mfFontScale)); } return true; } diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx index 8a17015d99cf..c6f4f2c9a126 100644 --- a/vcl/inc/vcl/cvtsvm.hxx +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -85,6 +85,10 @@ #define GDI_COMMENT_COMMENT 1031 #define GDI_UNICODE_COMMENT 1032 +#define GDI_LINEJOIN_ACTION 1033 +#define GDI_EXTENDEDPOLYGON_ACTION 1034 +#define GDI_LINEDASHDOT_ACTION 1035 + // ---------------- // - SVMConverter - // ---------------- diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx index 60fdc3a3a0b0..33758046c41e 100644 --- a/vcl/inc/vcl/lineinfo.hxx +++ b/vcl/inc/vcl/lineinfo.hxx @@ -32,26 +32,29 @@ #define _SV_LINEINFO_HXX #include - #include #include +#include // ---------------- // - ImplLineInfo - // ---------------- class SvStream; +namespace basegfx { class B2DPolyPolygon; } struct ImplLineInfo { - ULONG mnRefCount; - LineStyle meStyle; - long mnWidth; - USHORT mnDashCount; - long mnDashLen; - USHORT mnDotCount; - long mnDotLen; - long mnDistance; + ULONG mnRefCount; + LineStyle meStyle; + long mnWidth; + USHORT mnDashCount; + long mnDashLen; + USHORT mnDotCount; + long mnDotLen; + long mnDistance; + + basegfx::B2DLineJoin meLineJoin; ImplLineInfo(); ImplLineInfo( const ImplLineInfo& rImplLineInfo ); @@ -107,10 +110,26 @@ public: void SetDistance( long nDistance ); long GetDistance() const { return mpImplLineInfo->mnDistance; } + void SetLineJoin(basegfx::B2DLineJoin eLineJoin); + basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; } + BOOL IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); } friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo ); friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ); + + // helper to check if line width or DashDot is used + bool isDashDotOrFatLineUsed() const; + + // helper to get decomposed polygon data with the LineInfo applied. The source + // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may + // contain results; e.g. when no fat line but DasDot is defined, the resut will + // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line + // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will + // not be changed (but o_rFillPolyPolygon will be freed) + void applyToB2DPolyPolygon( + basegfx::B2DPolyPolygon& io_rLinePolyPolygon, + basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const; }; #endif // _SV_LINEINFO_HXX diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 1e1f784f0f49..4a5b92444c21 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -562,6 +562,9 @@ public: // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check. SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin); + // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) + void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon); + protected: OutputDevice(); @@ -1088,7 +1091,12 @@ public: */ BOOL HasAlpha(); - void DrawEPS( const Point& rPt, const Size& rSz, + /** Added return value to see if EPS could be painted directly. + Theoreticaly, handing over a matrix would be needed to handle + painting rotated EPS files (e.g. contained mín Metafiles). This + would then need to be supported for Mac and PS printers, but + that's too much for now, wrote #i107046# for this */ + bool DrawEPS( const Point& rPt, const Size& rSz, const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL ); /// request XCanvas render interface for this OutputDevice diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index 573fa7336fb0..b25feee266e4 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -1361,10 +1361,8 @@ BOOL Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( 1.0/256, 1.0/256 ); - aMatrix.scale( mfFontScale, mfFontScale ); - rB2DPolyPoly.transform( aMatrix ); + const double fFactor((1.0/256) * mfFontScale); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } return bRet; diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 4ecb89ec5a8e..8c4b6f1a2cb2 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -88,23 +88,6 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) // ------------------------------------------------------------------------ -void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly ) -{ - // #i102224# Here the evtl. curved nature of Polygon was - // ignored (for all those Years). Adapted to at least write - // a polygon representing the curve as good as possible - Polygon aSimplePoly; - rPoly.AdaptiveSubdivide(aSimplePoly); - INT32 nSize = aSimplePoly.GetSize(); - - rOStm << nSize; - - for( INT32 i = 0; i < nSize; i++ ) - rOStm << aSimplePoly[ (USHORT) i ]; -} - -// ------------------------------------------------------------------------ - void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly ) { Polygon aPoly; @@ -139,10 +122,9 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) // #i102224# Here the evtl. curved nature of Polygon was // ignored (for all those Years). Adapted to at least write // a polygon representing the curve as good as possible - const Polygon& rPoly = rPolyPoly[ n ]; - Polygon aSimplePoly; - rPoly.AdaptiveSubdivide(aSimplePoly); - const USHORT nSize = aSimplePoly.GetSize(); + Polygon aSimplePoly; + rPolyPoly[n].AdaptiveSubdivide(aSimplePoly); + const USHORT nSize(aSimplePoly.GetSize()); rOStm << (INT32) nSize; @@ -388,6 +370,128 @@ void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount ) } } +// ------------------------------------------------------------------------ + +bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPolyPolygon, bool bOnlyWhenCurve) +{ + const sal_uInt16 nPolygonCount(rPolyPolygon.Count()); + + if(nPolygonCount) + { + sal_uInt32 nAllPolygonCount(0); + sal_uInt32 nAllPointCount(0); + sal_uInt32 nAllFlagCount(0); + sal_uInt16 a(0); + + for(a = 0; a < nPolygonCount; a++) + { + const Polygon& rCandidate = rPolyPolygon.GetObject(a); + const sal_uInt16 nPointCount(rCandidate.GetSize()); + + if(nPointCount) + { + nAllPolygonCount++; + nAllPointCount += nPointCount; + + if(rCandidate.HasFlags()) + { + nAllFlagCount += nPointCount; + } + } + } + + if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount)) + { + rOStm << (INT16) GDI_EXTENDEDPOLYGON_ACTION; + + const sal_Int32 nActionSize( + 4 + // Action size + 2 + // PolygonCount + (nAllPolygonCount * 2) + // Points per polygon + (nAllPointCount << 3) + // Points themselves + nAllPolygonCount + // Bool if (when poly has points) it has flags, too + nAllFlagCount); // Flags themselves + + rOStm << nActionSize; + rOStm << (sal_uInt16)nAllPolygonCount; + + for(a = 0; a < nPolygonCount; a++) + { + const Polygon& rCandidate = rPolyPolygon.GetObject(a); + const sal_uInt16 nPointCount(rCandidate.GetSize()); + + if(nPointCount) + { + rOStm << nPointCount; + + for(sal_uInt16 b(0); b < nPointCount; b++) + { + rOStm << rCandidate[b]; + } + + if(rCandidate.HasFlags()) + { + rOStm << (BYTE)true; + + for(sal_uInt16 c(0); c < nPointCount; c++) + { + rOStm << (BYTE)rCandidate.GetFlags(c); + } + } + else + { + rOStm << (BYTE)false; + } + } + } + + return true; + } + } + + return false; +} + +// ------------------------------------------------------------------------ + +void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly) +{ + rPolyPoly.Clear(); + sal_uInt16 nPolygonCount(0); + rIStm >> nPolygonCount; + + for(sal_uInt16 a(0); a < nPolygonCount; a++) + { + sal_uInt16 nPointCount(0); + rIStm >> nPointCount; + Polygon aCandidate(nPointCount); + + if(nPointCount) + { + for(sal_uInt16 b(0); b < nPointCount; b++) + { + rIStm >> aCandidate[b]; + } + + BYTE bHasFlags(false); + rIStm >> bHasFlags; + + if(bHasFlags) + { + BYTE aPolyFlags(0); + + for(sal_uInt16 c(0); c < nPointCount; c++) + { + rIStm >> aPolyFlags; + aCandidate.SetFlags(c, (PolyFlags)aPolyFlags); + } + } + } + + rPolyPoly.Insert(aCandidate); + } +} + // ---------------- // - SVMConverter - // ---------------- @@ -460,6 +564,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.SetPrefSize( aPrefSz ); rMtf.SetPrefMapMode( aMapMode ); + sal_uInt32 nLastPolygonAction(0); for( INT32 i = 0L; i < nActions; i++ ) { @@ -493,6 +598,99 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } break; + case (GDI_LINEJOIN_ACTION) : + { + INT16 nLineJoin(0); + rIStm >> nLineJoin; + aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin); + } + break; + + case (GDI_LINEDASHDOT_ACTION) : + { + INT16 a(0); + INT32 b(0); + + rIStm >> a; aLineInfo.SetDashCount(a); + rIStm >> b; aLineInfo.SetDashLen(b); + rIStm >> a; aLineInfo.SetDotCount(a); + rIStm >> b; aLineInfo.SetDotLen(b); + rIStm >> b; aLineInfo.SetDistance(b); + + if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen()) + || (aLineInfo.GetDotCount() && aLineInfo.GetDotLen())) + && aLineInfo.GetDistance()) + { + aLineInfo.SetStyle(LINE_DASH); + } + } + break; + + case (GDI_EXTENDEDPOLYGON_ACTION) : + { + // read the PolyPolygon in every case + PolyPolygon aInputPolyPolygon; + ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon); + + // now check if it can be set somewhere + if(nLastPolygonAction < rMtf.GetActionCount()) + { + MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolyLineAction) + { + // replace MetaPolyLineAction when we have a single polygon. Do not rely on the + // same point count; the originally written GDI_POLYLINE_ACTION may have been + // Subdivided for better quality for older usages + if(1 == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolyLineAction( + aInputPolyPolygon.GetObject(0), + pPolyLineAction->GetLineInfo()), + nLastPolygonAction); + pPolyLineAction->Delete(); + } + } + else + { + MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolyPolygonAction) + { + // replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the + // same sub-polygon count + if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolyPolygonAction( + aInputPolyPolygon), + nLastPolygonAction); + pPolyPolygonAction->Delete(); + } + } + else + { + MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolygonAction) + { + // replace MetaPolygonAction + if(1 == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolygonAction( + aInputPolyPolygon.GetObject(0)), + nLastPolygonAction); + pPolygonAction->Delete(); + } + } + } + } + } + } + break; + case( GDI_RECT_ACTION ): { ImplReadRect( rIStm, aRect ); @@ -583,6 +781,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_POLYLINE_ACTION ): { ImplReadPoly( rIStm, aActionPoly ); + nLastPolygonAction = rMtf.GetActionCount(); if( bFatLine ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); @@ -604,7 +803,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); } else + { + nLastPolygonAction = rMtf.GetActionCount(); rMtf.AddAction( new MetaPolygonAction( aActionPoly ) ); + } } break; @@ -625,7 +827,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) ); } else + { + nLastPolygonAction = rMtf.GetActionCount(); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); + } } break; @@ -1257,12 +1462,32 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaLineAction* pAct = (MetaLineAction*) pAction; const LineInfo& rInfo = pAct->GetLineInfo(); - const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); + const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); + const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) { ImplWritePushAction( rOStm ); ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() ); + + if(bLineJoin) + { + rOStm << (INT16) GDI_LINEJOIN_ACTION; + rOStm << (INT32) 6; + rOStm << (INT16) rInfo.GetLineJoin(); + } + + if(bLineDashDot) + { + rOStm << (INT16) GDI_LINEDASHDOT_ACTION; + rOStm << (INT32) 4 + 16; + rOStm << (INT16)rInfo.GetDashCount(); + rOStm << (INT32)rInfo.GetDashLen(); + rOStm << (INT16)rInfo.GetDotCount(); + rOStm << (INT32)rInfo.GetDotLen(); + rOStm << (INT32)rInfo.GetDistance(); + } } rOStm << (INT16) GDI_LINE_ACTION; @@ -1275,6 +1500,16 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { ImplWritePopAction( rOStm ); nCount += 3; + + if(bLineJoin) + { + nCount += 1; + } + + if(bLineDashDot) + { + nCount += 1; + } } } break; @@ -1355,30 +1590,47 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, for( USHORT n = 0; n < nPoints; n++ ) rOStm << aChordPoly[ n ]; - nCount++; } break; case( META_POLYLINE_ACTION ): { + // #i102224# MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; - const Polygon& rPoly = pAct->GetPolygon(); - // #i102224# Here the evtl. curved nature of Polygon was // ignored (for all those Years). Adapted to at least write // a polygon representing the curve as good as possible - Polygon aSimplePoly; - rPoly.AdaptiveSubdivide(aSimplePoly); - - const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints = aSimplePoly.GetSize(); - const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); + Polygon aSimplePoly; + pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); + const LineInfo& rInfo = pAct->GetLineInfo(); + const USHORT nPoints(aSimplePoly.GetSize()); + const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); + const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) { ImplWritePushAction( rOStm ); ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() ); + + if(bLineJoin) + { + rOStm << (INT16) GDI_LINEJOIN_ACTION; + rOStm << (INT32) 6; + rOStm << (INT16) rInfo.GetLineJoin(); + } + } + + if(bLineDashDot) + { + rOStm << (INT16) GDI_LINEDASHDOT_ACTION; + rOStm << (INT32) 4 + 16; + rOStm << (INT16)rInfo.GetDashCount(); + rOStm << (INT32)rInfo.GetDashLen(); + rOStm << (INT16)rInfo.GetDotCount(); + rOStm << (INT32)rInfo.GetDotLen(); + rOStm << (INT32)rInfo.GetDistance(); } rOStm << (INT16) GDI_POLYLINE_ACTION; @@ -1386,30 +1638,45 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) + { rOStm << aSimplePoly[ n ]; + } nCount++; + const PolyPolygon aPolyPolygon(pAct->GetPolygon()); + if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true)) + { + nCount++; + } + if( bFatLine ) { ImplWritePopAction( rOStm ); nCount += 3; + + if(bLineJoin) + { + nCount += 1; + } + } + + if(bLineDashDot) + { + nCount += 1; } } break; case( META_POLYGON_ACTION ): { - MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; - const Polygon& rPoly = pAct->GetPolygon(); - + MetaPolygonAction* pAct = (MetaPolygonAction*)pAction; // #i102224# Here the evtl. curved nature of Polygon was // ignored (for all those Years). Adapted to at least write // a polygon representing the curve as good as possible - Polygon aSimplePoly; - rPoly.AdaptiveSubdivide(aSimplePoly); - - const USHORT nPoints = aSimplePoly.GetSize(); + Polygon aSimplePoly; + pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); + const USHORT nPoints(aSimplePoly.GetSize()); rOStm << (INT16) GDI_POLYGON_ACTION; rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); @@ -1419,6 +1686,12 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << aSimplePoly[ n ]; nCount++; + + const PolyPolygon aPolyPolygon(pAct->GetPolygon()); + if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true)) + { + nCount++; + } } break; @@ -1427,6 +1700,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction; ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() ); nCount++; + + if(ImplWriteExtendedPolyPolygonAction(rOStm, pAct->GetPolyPolygon(), true)) + { + nCount++; + } } break; diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index 98f16713a145..7aa50811106b 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -34,6 +34,10 @@ #include #include #include +#include +#include +#include +#include DBG_NAME( LineInfo ) @@ -49,7 +53,8 @@ ImplLineInfo::ImplLineInfo() : mnDashLen ( 0 ), mnDotCount ( 0 ), mnDotLen ( 0 ), - mnDistance ( 0 ) + mnDistance ( 0 ), + meLineJoin ( basegfx::B2DLINEJOIN_ROUND ) { } @@ -63,7 +68,8 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) : mnDashLen ( rImplLineInfo.mnDashLen ), mnDotCount ( rImplLineInfo.mnDotCount ), mnDotLen ( rImplLineInfo.mnDotLen ), - mnDistance ( rImplLineInfo.mnDistance ) + mnDistance ( rImplLineInfo.mnDistance ), + meLineJoin ( rImplLineInfo.meLineJoin ) { } @@ -209,6 +215,19 @@ void LineInfo::SetDistance( long nDistance ) // ----------------------------------------------------------------------- +void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin) +{ + DBG_CHKTHIS( LineInfo, NULL ); + + if(eLineJoin != mpImplLineInfo->meLineJoin) + { + ImplMakeUnique(); + mpImplLineInfo->meLineJoin = eLineJoin; + } +} + +// ----------------------------------------------------------------------- + SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) { VersionCompat aCompat( rIStm, STREAM_READ ); @@ -225,6 +244,12 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) rIStm >> rImplLineInfo.mnDistance; } + if( aCompat.GetVersion() >= 3 ) + { + // version 3 + rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16; + } + return rIStm; } @@ -232,7 +257,7 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); + VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); // version 1 rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth; @@ -242,6 +267,9 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen; rOStm << rImplLineInfo.mnDistance; + // since version3 + rOStm << (UINT16) rImplLineInfo.meLineJoin; + return rOStm; } @@ -259,3 +287,78 @@ SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ) { return( rOStm << *rLineInfo.mpImplLineInfo ); } + +// ----------------------------------------------------------------------- + +bool LineInfo::isDashDotOrFatLineUsed() const +{ + return (LINE_DASH == GetStyle() || GetWidth() > 1); +} + +// ----------------------------------------------------------------------- + +void LineInfo::applyToB2DPolyPolygon( + basegfx::B2DPolyPolygon& io_rLinePolyPolygon, + basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const +{ + o_rFillPolyPolygon.clear(); + + if(io_rLinePolyPolygon.count()) + { + if(LINE_DASH == GetStyle()) + { + ::std::vector< double > fDotDashArray; + const double fDashLen(GetDashLen()); + const double fDotLen(GetDotLen()); + const double fDistance(GetDistance()); + + for(sal_uInt16 a(0); a < GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + + const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); + + if(fAccumulated > 0.0) + { + basegfx::B2DPolyPolygon aResult; + + for(sal_uInt32 c(0); c < io_rLinePolyPolygon.count(); c++) + { + basegfx::B2DPolyPolygon aLineTraget; + basegfx::tools::applyLineDashing( + io_rLinePolyPolygon.getB2DPolygon(c), + fDotDashArray, + &aLineTraget); + aResult.append(aLineTraget); + } + + io_rLinePolyPolygon = aResult; + } + } + + if(GetWidth() > 1 && io_rLinePolyPolygon.count()) + { + const double fHalfLineWidth((GetWidth() * 0.5) + 0.5); + + for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++) + { + o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry( + io_rLinePolyPolygon.getB2DPolygon(a), + fHalfLineWidth, + GetLineJoin())); + } + + io_rLinePolyPolygon.clear(); + } + } +} + +// ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 421505a3d500..eda537bf629a 100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -57,7 +57,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/gfxlink.obj \ $(SLO)$/print.obj \ $(SLO)$/print2.obj \ - $(SLO)$/configsettings.obj \ + $(SLO)$/configsettings.obj \ $(SLO)$/sallayout.obj \ $(SLO)$/image.obj \ $(SLO)$/impimage.obj \ @@ -75,7 +75,8 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/impprn.obj \ $(SLO)$/gdimtf.obj \ $(SLO)$/graphictools.obj \ - $(SLO)$/textlayout.obj + $(SLO)$/textlayout.obj \ + $(SLO)$/lineinfo.obj SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/animate.obj \ @@ -100,8 +101,6 @@ SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/impbmp.obj \ $(SLO)$/imagerepository.obj \ $(SLO)$/impvect.obj \ - $(SLO)$/implncvt.obj \ - $(SLO)$/lineinfo.obj \ $(SLO)$/mapmod.obj \ $(SLO)$/metaact.obj \ $(SLO)$/octree.obj \ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 82566b2b4362..1f27ad2afe7d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -52,14 +52,6 @@ inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY ) // ------------------------------------------------------------------------ -inline void ImplScaleSize( Size& rSz, double fScaleX, double fScaleY ) -{ - rSz.Width() = FRound( fScaleX * rSz.Width() ); - rSz.Height() = FRound( fScaleY * rSz.Height() ); -} - -// ------------------------------------------------------------------------ - inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY ) { Point aTL( rRect.TopLeft() ); @@ -69,6 +61,7 @@ inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY ) ImplScalePoint( aBR, fScaleX, fScaleY ); rRect = Rectangle( aTL, aBR ); + rRect.Justify(); } // ------------------------------------------------------------------------ @@ -85,7 +78,7 @@ inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScal { if( !rLineInfo.IsDefault() ) { - const double fScale = ( fScaleX + fScaleY ) * 0.5; + const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5; rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) ); rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) ); @@ -598,8 +591,8 @@ void MetaRoundRectAction::Move( long nHorzMove, long nVertMove ) void MetaRoundRectAction::Scale( double fScaleX, double fScaleY ) { ImplScaleRect( maRect, fScaleX, fScaleY ); - mnHorzRound = FRound( mnHorzRound * fScaleX ); - mnVertRound = FRound( mnVertRound * fScaleY ); + mnHorzRound = FRound( mnHorzRound * fabs(fScaleX) ); + mnVertRound = FRound( mnVertRound * fabs(fScaleY) ); } // ------------------------------------------------------------------------ @@ -1396,7 +1389,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY ) if ( mpDXAry && mnLen ) { for ( USHORT i = 0, nCount = mnLen; i < nCount; i++ ) - mpDXAry[ i ] = FRound( mpDXAry[ i ] * fScaleX ); + mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) ); } } @@ -1524,7 +1517,7 @@ void MetaStretchTextAction::Move( long nHorzMove, long nVertMove ) void MetaStretchTextAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maPt, fScaleX, fScaleY ); - mnWidth = (ULONG)FRound( mnWidth * fScaleX ); + mnWidth = (ULONG)FRound( mnWidth * fabs(fScaleX) ); } // ------------------------------------------------------------------------ @@ -1717,7 +1710,7 @@ void MetaTextLineAction::Move( long nHorzMove, long nVertMove ) void MetaTextLineAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maPos, fScaleX, fScaleY ); - mnWidth = FRound( mnWidth * fScaleX ); + mnWidth = FRound( mnWidth * fabs(fScaleX) ); } // ------------------------------------------------------------------------ @@ -1876,8 +1869,10 @@ void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove ) void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -1953,8 +1948,10 @@ void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2099,8 +2096,10 @@ void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove ) void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2176,8 +2175,10 @@ void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2328,8 +2329,10 @@ void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove ) void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2408,8 +2411,10 @@ void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -3498,9 +3503,9 @@ MetaAction* MetaFontAction::Clone() void MetaFontAction::Scale( double fScaleX, double fScaleY ) { - Size aSize( maFont.GetSize() ); - - ImplScaleSize( aSize, fScaleX, fScaleY ); + const Size aSize( + FRound(maFont.GetSize().Width() * fabs(fScaleX)), + FRound(maFont.GetSize().Height() * fabs(fScaleY))); maFont.SetSize( aSize ); } @@ -3791,14 +3796,18 @@ MetaAction* MetaFloatTransparentAction::Clone() void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove ) { maPoint.Move( nHorzMove, nVertMove ); + maMtf.Move(nHorzMove, nVertMove); } // ------------------------------------------------------------------------ void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPoint, fScaleX, fScaleY ); - ImplScaleSize( maSize, fScaleX, fScaleY ); + Rectangle aRectangle(maPoint, maSize); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPoint = aRectangle.TopLeft(); + maSize = aRectangle.GetSize(); + maMtf.Scale(fScaleX, fScaleY); } // ------------------------------------------------------------------------ @@ -3872,8 +3881,10 @@ void MetaEPSAction::Move( long nHorzMove, long nVertMove ) void MetaEPSAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPoint, fScaleX, fScaleY ); - ImplScaleSize( maSize, fScaleX, fScaleY ); + Rectangle aRectangle(maPoint, maSize); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPoint = aRectangle.TopLeft(); + maSize = aRectangle.GetSize(); } // ------------------------------------------------------------------------ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 6298ff51a16a..91ea8419cba9 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -77,6 +76,8 @@ #include #include +#include + using namespace ::com::sun::star; DBG_NAME( OutputDevice ) @@ -2330,6 +2331,130 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) // ----------------------------------------------------------------------- +void OutputDevice::impPaintLineGeometryWithEvtlExpand( + const LineInfo& rInfo, + basegfx::B2DPolyPolygon aLinePolyPolygon) +{ + const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) + && ROP_OVERPAINT == GetRasterOp() + && IsLineColor()); + basegfx::B2DPolyPolygon aFillPolyPolygon; + const bool bDashUsed(LINE_DASH == rInfo.GetStyle()); + const bool bLineWidthUsed(rInfo.GetWidth() > 1); + + if(bDashUsed && aLinePolyPolygon.count()) + { + ::std::vector< double > fDotDashArray; + const double fDashLen(rInfo.GetDashLen()); + const double fDotLen(rInfo.GetDotLen()); + const double fDistance(rInfo.GetDistance()); + + for(sal_uInt16 a(0); a < rInfo.GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < rInfo.GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + + const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); + + if(fAccumulated > 0.0) + { + basegfx::B2DPolyPolygon aResult; + + for(sal_uInt32 c(0); c < aLinePolyPolygon.count(); c++) + { + basegfx::B2DPolyPolygon aLineTraget; + basegfx::tools::applyLineDashing( + aLinePolyPolygon.getB2DPolygon(c), + fDotDashArray, + &aLineTraget); + aResult.append(aLineTraget); + } + + aLinePolyPolygon = aResult; + } + } + + if(bLineWidthUsed && aLinePolyPolygon.count()) + { + const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5); + + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + aFillPolyPolygon.append(basegfx::tools::createAreaGeometry( + aLinePolyPolygon.getB2DPolygon(a), + fHalfLineWidth, + rInfo.GetLineJoin())); + } + + aLinePolyPolygon.clear(); + } + + GDIMetaFile* pOldMetaFile = mpMetaFile; + mpMetaFile = NULL; + + if(aLinePolyPolygon.count()) + { + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + bool bDone(false); + + if(bTryAA) + { + bDone = mpGraphics->DrawPolyLine(aCandidate, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLINEJOIN_NONE, this); + } + + if(!bDone) + { + const Polygon aPolygon(aCandidate); + mpGraphics->DrawPolyLine(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + } + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor( maLineColor ); + const Color aOldFillColor( maFillColor ); + + SetLineColor(); + ImplInitLineColor(); + SetFillColor( aOldLineColor ); + ImplInitFillColor(); + + bool bDone(false); + + if(bTryAA) + { + bDone = mpGraphics->DrawPolyPolygon(aFillPolyPolygon, 0.0, this); + } + + if(!bDone) + { + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + } + } + + SetFillColor( aOldFillColor ); + SetLineColor( aOldLineColor ); + } + + mpMetaFile = pOldMetaFile; +} + +// ----------------------------------------------------------------------- + void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ) { @@ -2357,47 +2482,22 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, if ( mbOutputClipped ) return; + const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) ); + const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) ); const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); + const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); + const bool bLineWidthUsed(aInfo.GetWidth() > 1); - if( ( aInfo.GetWidth() > 1L ) || ( LINE_DASH == aInfo.GetStyle() ) ) + if(bDashUsed || bLineWidthUsed) { - Polygon aPoly( 2 ); aPoly[ 0 ] = rStartPt; aPoly[ 1 ] = rEndPt; - GDIMetaFile* pOldMetaFile = mpMetaFile; - ImplLineConverter aLineCvt( ImplLogicToDevicePixel( aPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - - mpMetaFile = NULL; + basegfx::B2DPolygon aLinePolygon; + aLinePolygon.append(basegfx::B2DPoint(aStartPt.X(), aStartPt.Y())); + aLinePolygon.append(basegfx::B2DPoint(aEndPt.X(), aEndPt.Y())); - if ( aInfo.GetWidth() > 1 ) - { - const Color aOldLineColor( maLineColor ); - const Color aOldFillColor( maFillColor ); - - SetLineColor(); - ImplInitLineColor(); - SetFillColor( aOldLineColor ); - ImplInitFillColor(); - - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this ); - - SetFillColor( aOldFillColor ); - SetLineColor( aOldLineColor ); - } - else - { - if ( mbInitLineColor ) - ImplInitLineColor(); - - for ( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawLine( (*pPoly)[ 0 ].X(), (*pPoly)[ 0 ].Y(), (*pPoly)[ 1 ].X(), (*pPoly)[ 1 ].Y(), this ); - } - mpMetaFile = pOldMetaFile; + impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aLinePolygon)); } else { - const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) ); - const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) ); - if ( mbInitLineColor ) ImplInitLineColor(); @@ -2546,7 +2646,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) && LINE_SOLID == rLineInfo.GetStyle()) { - DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), basegfx::B2DLINEJOIN_ROUND); + DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin()); return; } @@ -2558,7 +2658,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo) { - USHORT nPoints = rPoly.GetSize(); + USHORT nPoints(rPoly.GetSize()); if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() ) return; @@ -2566,11 +2666,19 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI Polygon aPoly = ImplLogicToDevicePixel( rPoly ); // #100127# LineInfo is not curve-safe, subdivide always - if( aPoly.HasFlags() ) - { - aPoly = ImplSubdivideBezier( aPoly ); - nPoints = aPoly.GetSize(); - } + // + // What shall this mean? It's wrong to subdivide here when the + // polygon is a fat line. In that case, the painted geometry + // WILL be much different. + // I also have no idea how this could be related to the given ID + // which reads 'consolidate boost versions' in the task description. + // Removing. + // + //if( aPoly.HasFlags() ) + //{ + // aPoly = ImplSubdivideBezier( aPoly ); + // nPoints = aPoly.GetSize(); + //} // we need a graphics if ( !mpGraphics && !ImplGetGraphics() ) @@ -2582,67 +2690,29 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI if ( mbOutputClipped ) return; - const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); - const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) - && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) - && ROP_OVERPAINT == GetRasterOp() - && IsLineColor()); - - if( aInfo.GetWidth() > 1L ) - { - const Color aOldLineColor( maLineColor ); - const Color aOldFillColor( maFillColor ); - GDIMetaFile* pOldMetaFile = mpMetaFile; - ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - - mpMetaFile = NULL; - SetLineColor(); + if ( mbInitLineColor ) ImplInitLineColor(); - SetFillColor( aOldLineColor ); - ImplInitFillColor(); - bool bDone(false); - if(bTryAA) - { - // #i101491# try AAed version - // Use old on-the-fly geometry preparation, combine with AA - bool bSuccess(true); - - for(const Polygon* pPoly = aLineCvt.ImplGetFirst(); bSuccess && pPoly; pPoly = aLineCvt.ImplGetNext()) - { - bSuccess = mpGraphics->DrawPolyPolygon(basegfx::B2DPolyPolygon(pPoly->getB2DPolygon()), 0.0, this); - } - - if(bSuccess) - { - bDone = true; - } - } - - if(!bDone) - { - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - { - mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this ); - } - } + const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); + const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); + const bool bLineWidthUsed(aInfo.GetWidth() > 1); - SetLineColor( aOldLineColor ); - SetFillColor( aOldFillColor ); - mpMetaFile = pOldMetaFile; + if(bDashUsed || bLineWidthUsed) + { + impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aPoly.getB2DPolygon())); } else { - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( LINE_DASH == aInfo.GetStyle() ) + // #100127# the subdivision HAS to be done here since only a pointer + // to an array of points is given to the DrawPolyLine method, there is + // NO way to find out there that it's a curve. + if( aPoly.HasFlags() ) { - ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawPolyLine( pPoly->GetSize(), (const SalPoint*)pPoly->GetConstPointAry(), this ); + aPoly = ImplSubdivideBezier( aPoly ); + nPoints = aPoly.GetSize(); } - else - mpGraphics->DrawPolyLine( nPoints, (const SalPoint*) aPoly.GetConstPointAry(), this ); + + mpGraphics->DrawPolyLine(nPoints, (const SalPoint*)aPoly.GetConstPointAry(), this); } if( mpAlphaVDev ) @@ -3047,7 +3117,12 @@ void OutputDevice::DrawPolyLine( SetFillColor(aOldLineColor); ImplInitFillColor(); - ImpDrawPolyPolygonWithB2DPolyPolygon(aAreaPolyPolygon); + // draw usig a loop; else the topology will paint a PolyPolygon + for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++) + { + ImpDrawPolyPolygonWithB2DPolyPolygon( + basegfx::B2DPolyPolygon(aAreaPolyPolygon.getB2DPolygon(a))); + } SetLineColor(aOldLineColor); ImplInitLineColor(); @@ -3064,14 +3139,15 @@ void OutputDevice::DrawPolyLine( } } } - - // fallback to old polygon drawing if needed. This will really - // use ImplLineConverter, but still try to AA lines - const Polygon aToolsPolygon( rB2DPolygon ); - LineInfo aLineInfo; - if( fLineWidth != 0.0 ) - aLineInfo.SetWidth( static_cast(fLineWidth+0.5) ); - ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo ); + else + { + // fallback to old polygon drawing if needed + const Polygon aToolsPolygon( rB2DPolygon ); + LineInfo aLineInfo; + if( fLineWidth != 0.0 ) + aLineInfo.SetWidth( static_cast(fLineWidth+0.5) ); + ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo ); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 79986988afd7..2d436ea43659 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -1158,9 +1158,11 @@ void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, +bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, const GfxLink& rGfxLink, GDIMetaFile* pSubst ) { + bool bDrawn(true); + if ( mpMetaFile ) { GDIMetaFile aSubst; @@ -1172,20 +1174,20 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, } if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) - return; + return bDrawn; if( mbOutputClipped ) - return; + return bDrawn; Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) ); + if( !aRect.IsEmpty() ) { // draw the real EPS graphics - bool bDrawn = FALSE; if( rGfxLink.GetData() && rGfxLink.GetDataSize() ) { if( !mpGraphics && !ImplGetGraphics() ) - return; + return bDrawn; if( mbInitClipRegion ) ImplInitClipRegion(); @@ -1208,4 +1210,6 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, if( mpAlphaVDev ) mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst ); + + return bDrawn; } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4146f1764204..c0205f1f325d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -61,11 +61,9 @@ #include #include #include - -#include "implncvt.hxx" - #include "cppuhelper/implbase1.hxx" #include +#include using namespace vcl; using namespace rtl; diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 66865759db4b..fefbf8cdcb08 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -49,6 +49,7 @@ #include #include #include +#include // ======================================================================= // @@ -1303,9 +1304,7 @@ void Region::Move( long nHorzMove, long nVertMove ) mpImplRegion->mpPolyPoly->Move( nHorzMove, nVertMove ); else if( mpImplRegion->mpB2DPolyPoly ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( nHorzMove, nVertMove ); - mpImplRegion->mpB2DPolyPoly->transform( aTransform ); + mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createTranslateB2DHomMatrix(nHorzMove, nVertMove)); } else { @@ -1346,9 +1345,7 @@ void Region::Scale( double fScaleX, double fScaleY ) mpImplRegion->mpPolyPoly->Scale( fScaleX, fScaleY ); else if( mpImplRegion->mpB2DPolyPoly ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( fScaleX, fScaleY ); - mpImplRegion->mpB2DPolyPoly->transform( aTransform ); + mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createScaleB2DHomMatrix(fScaleX, fScaleY)); } else { diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 1e9572887e0b..c1f987377c67 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 1f44b823ce44..c8748c65e2d3 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #ifndef _TL_DEBUG_HXX @@ -893,10 +894,8 @@ bool SalLayout::GetOutline( SalGraphics& rSalGraphics, { if( aPos.X() || aPos.Y() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( aPos.X(), aPos.Y() ); - aGlyphOutline.transform( aMatrix ); - } + aGlyphOutline.transform(basegfx::tools::createTranslateB2DHomMatrix(aPos.X(), aPos.Y())); + } // insert outline at correct position rVector.push_back( aGlyphOutline ); diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 18857b94af8f..b92bea929c51 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -43,6 +43,7 @@ #include "tools/poly.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include #include "basegfx/polygon/b2dpolypolygon.hxx" #include "osl/file.hxx" @@ -2282,9 +2283,7 @@ bool FreetypeServerFont::GetGlyphOutline( int nGlyphIndex, // convert to basegfx polypolygon // TODO: get rid of the intermediate tools polypolygon rB2DPolyPoly = aToolPolyPolygon.getB2DPolyPolygon(); - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( +1.0/(1<<6), -1.0/(1<<6) ); - rB2DPolyPoly.transform( aMatrix ); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix( +1.0/(1<<6), -1.0/(1<<6) )); return true; } diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index e3e840e40730..17e70c539254 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -79,9 +79,7 @@ GlyphCache::~GlyphCache() // ----------------------------------------------------------------------- -#ifndef IRIX inline -#endif size_t GlyphCache::IFSD_Hash::operator()( const ImplFontSelectData& rFontSelData ) const { // TODO: is it worth to improve this hash function? diff --git a/vcl/unx/inc/salunx.h b/vcl/unx/inc/salunx.h index cdf45fd30867..c1fee6c68d94 100644 --- a/vcl/unx/inc/salunx.h +++ b/vcl/unx/inc/salunx.h @@ -38,12 +38,6 @@ #include #include #include -#elif defined IRIX -#ifdef __cplusplus -#include -#endif -#include -#include #endif #include #include diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx index cacffbcfdbb1..bb8f86d93e01 100644 --- a/vcl/unx/source/app/i18n_ic.cxx +++ b/vcl/unx/source/app/i18n_ic.cxx @@ -340,7 +340,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mnPreeditStyle != XIMPreeditNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX +#if defined LINUX || defined FREEBSD || defined NETBSD if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, @@ -348,7 +348,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : } if ( mnStatusStyle != XIMStatusNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX +#if defined LINUX || defined FREEBSD || defined NETBSD if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx index ae472d6323f4..0a48c054167f 100644 --- a/vcl/unx/source/app/i18n_im.cxx +++ b/vcl/unx/source/app/i18n_im.cxx @@ -59,7 +59,7 @@ using namespace vcl; #include "i18n_cb.hxx" -#if defined(SOLARIS) || defined(LINUX) || defined(IRIX) +#if defined(SOLARIS) || defined(LINUX) extern "C" char * XSetIMValues(XIM im, ...); #endif diff --git a/vcl/unx/source/app/randrwrapper.cxx b/vcl/unx/source/app/randrwrapper.cxx index 8d01b64d4680..4fbe5db97ab9 100644 --- a/vcl/unx/source/app/randrwrapper.cxx +++ b/vcl/unx/source/app/randrwrapper.cxx @@ -161,7 +161,13 @@ RandRWrapper::RandRWrapper( Display* pDisplay ) : if( ! m_bValid ) { rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrandr.so.2" ) ); - m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT ); + // load and resolve dependencies immediately + // rationale: there are older distributions where libXrandr.so.2 is not linked + // with libXext.so, resulting in a missing symbol and terminating the office + // obviously they expected libXext to be linked in global symbolspace (that is + // linked by the application), which is not the case with us (because we want + // to be able to run in headless mode even without an installed X11 library) + m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT | SAL_LOADMODULE_NOW ); initFromModule(); } if( m_bValid ) diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 07955d426b8c..cfd568ac9b6c 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -38,16 +38,13 @@ #include #include #include -#if defined(IRIX) -#include -#endif #include #include #include #include #include -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) #include #include #endif @@ -898,7 +895,7 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || defined IRIX +#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD nProperties_ |= PROPERTY_FEATURE_Maximize; #endif // Server Bugs & Properties diff --git a/vcl/unx/source/app/saltimer.cxx b/vcl/unx/source/app/saltimer.cxx index bf8aa202b066..afcecc0d0667 100644 --- a/vcl/unx/source/app/saltimer.cxx +++ b/vcl/unx/source/app/saltimer.cxx @@ -32,9 +32,6 @@ #include "precompiled_vcl.hxx" #include -#if defined(IRIX) -#include -#endif #include #include #include diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index cb554bccea21..5fe2295a8fed 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -50,6 +50,7 @@ #include "basegfx/polygon/b2dpolygonclipper.hxx" #include "basegfx/polygon/b2dlinegeometry.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include #include "basegfx/polygon/b2dpolypolygoncutter.hxx" #include @@ -1567,6 +1568,9 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // the used basegfx::tools::createAreaGeometry is simply too // expensive with very big polygons; fallback to caller (who // should use ImplLineConverter normally) + // AW: ImplLineConverter had to be removed since it does not even + // know LineJoins, so the fallback will now prepare the line geometry + // the same way. return false; } const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); @@ -1579,9 +1583,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : && !basegfx::fTools::equalZero( rLineWidth.getY() ) ) { // prepare for createAreaGeometry() with anisotropic linewidth - basegfx::B2DHomMatrix aAnisoMatrix; - aAnisoMatrix.scale( 1.0, rLineWidth.getX() / rLineWidth.getY() ); - aPolygon.transform( aAnisoMatrix ); + aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); } // special handling for hairlines to improve the drawing performance @@ -1603,9 +1605,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) { // postprocess createAreaGeometry() for anisotropic linewidth - basegfx::B2DHomMatrix aAnisoMatrix; - aAnisoMatrix.scale( 1.0, rLineWidth.getY() / rLineWidth.getX() ); - aPolygon.transform( aAnisoMatrix ); + aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX())); } // temporarily adjust brush color to pen color diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx index b3e5b4667a6a..53cd662db8e0 100644 --- a/vcl/unx/source/printer/printerinfomanager.cxx +++ b/vcl/unx/source/printer/printerinfomanager.cxx @@ -441,7 +441,7 @@ void PrinterInfoManager::initialize() * porters: please append your platform to the Solaris * case if your platform has SystemV printing per default. */ - #if defined SOLARIS || defined(IRIX) + #if defined SOLARIS aValue = "lp"; #else aValue = "lpr"; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index d82830a9022f..12fdad65dfb1 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -65,6 +65,7 @@ #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolypolygon.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include #include "sft.hxx" @@ -2480,9 +2481,8 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( mfFontScale/256, mfFontScale/256 ); - rB2DPolyPoly.transform( aMatrix ); + const double fFactor(mfFontScale/256); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } return bRet; diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 5c00c786e22d..29e4ff1d801e 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -62,9 +62,9 @@ // ----------------------------------------------------------------------- -void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon) +void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { - const sal_uInt32 nCount(rPolygon.count()); + sal_uInt32 nCount(rPolygon.count()); if(nCount) { @@ -97,8 +97,58 @@ void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const b if(a + 1 < nEdgeCount) { - aCurr = aNext; aFCurr = aFNext; + + if(bNoLineJoin) + { + rPath.StartFigure(); + } + } + } + } +} + +void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +{ + sal_uInt32 nCount(rPolygon.count()); + + if(nCount) + { + const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); + const bool bControls(rPolygon.areControlPointsUsed()); + basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); + Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY())); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nCount); + const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); + const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY())); + + if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) + { + const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); + const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); + + rPath.AddBezier( + aICurr, + Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())), + Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())), + aINext); + } + else + { + rPath.AddLine(aICurr, aINext); + } + + if(a + 1 < nEdgeCount) + { + aICurr = aINext; + + if(bNoLineJoin) + { + rPath.StartFigure(); + } } } } @@ -123,7 +173,7 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly aPath.StartFigure(); // #i101491# not needed for first run } - impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolyPolygon.getB2DPolygon(a)); + impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false); aPath.CloseFigure(); } @@ -152,11 +202,16 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aPath; + bool bNoLineJoin(false); switch(eLineJoin) { default : // basegfx::B2DLINEJOIN_NONE : { + if(basegfx::fTools::more(rLineWidths.getX(), 0.0)) + { + bNoLineJoin = true; + } break; } case basegfx::B2DLINEJOIN_BEVEL : @@ -179,9 +234,16 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas } } - impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolygon); + if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) + { + impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); + } + else + { + impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin); + } - if(rPolygon.isClosed()) + if(rPolygon.isClosed() && !bNoLineJoin) { // #i101491# needed to create the correct line joins aPath.CloseFigure(); -- cgit From a63c7b938075cc82f7046364f4933c81473e4d9f Mon Sep 17 00:00:00 2001 From: thb Date: Tue, 19 Jan 2010 22:16:16 +0100 Subject: #i10000# win32: forgot precomplied header --- basegfx/source/tools/keystoplerp.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/basegfx/source/tools/keystoplerp.cxx b/basegfx/source/tools/keystoplerp.cxx index 99c74a350a69..883bfec6bc96 100644 --- a/basegfx/source/tools/keystoplerp.cxx +++ b/basegfx/source/tools/keystoplerp.cxx @@ -28,6 +28,9 @@ * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basegfx.hxx" + #include "basegfx/tools/keystoplerp.hxx" #include -- cgit From 2ced8e8176dad1fb4618a1c8597b35354c85d9ac Mon Sep 17 00:00:00 2001 From: thb Date: Wed, 20 Jan 2010 11:55:37 +0100 Subject: #i105937# Finalized gradient rework in dxcanvas --- canvas/source/directx/dx_canvas.hxx | 5 +- .../source/directx/dx_canvashelper_texturefill.cxx | 248 +++++---------------- canvas/source/directx/dx_spritecanvas.hxx | 17 +- 3 files changed, 70 insertions(+), 200 deletions(-) diff --git a/canvas/source/directx/dx_canvas.hxx b/canvas/source/directx/dx_canvas.hxx index ab2aa398757d..57349b650925 100644 --- a/canvas/source/directx/dx_canvas.hxx +++ b/canvas/source/directx/dx_canvas.hxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -62,7 +61,7 @@ namespace dxcanvas { typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XCanvas, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base; @@ -119,7 +118,7 @@ namespace dxcanvas typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, + ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base; diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index d0ebaf2f2fc9..6b57e2e47a56 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -52,6 +54,8 @@ #include "dx_impltools.hxx" #include +#include +#include using namespace ::com::sun::star; @@ -62,11 +66,12 @@ namespace dxcanvas { typedef ::boost::shared_ptr< Gdiplus::PathGradientBrush > PathGradientBrushSharedPtr; - bool fillLinearGradient( GraphicsSharedPtr& rGraphics, - const Gdiplus::Color& rColor1, - const Gdiplus::Color& rColor2, - const GraphicsPathSharedPtr& rFillPath, - const rendering::Texture& texture ) + bool fillLinearGradient( GraphicsSharedPtr& rGraphics, + const ::canvas::ParametricPolyPolygon::Values& rValues, + const std::vector< Gdiplus::Color >& rColors, + const std::vector< REAL >& rStops, + const GraphicsPathSharedPtr& rFillPath, + const rendering::Texture& texture ) { // setup a linear gradient with two colors // --------------------------------------- @@ -76,12 +81,16 @@ namespace dxcanvas 0.5f), Gdiplus::PointF(1.0f, 0.5f), - rColor1, - rColor2 ); + rColors[0], + rColors[1] ); + + aBrush.SetInterpolationColors(&rColors[0], + &rStops[0], + rColors.size()); // render background color, as LinearGradientBrush does not // properly support the WrapModeClamp repeat mode - Gdiplus::SolidBrush aBackgroundBrush( rColor1 ); + Gdiplus::SolidBrush aBackgroundBrush( rColors[0] ); rGraphics->FillPath( &aBackgroundBrush, rFillPath.get() ); // TODO(F2): This does not yet support other repeat modes @@ -191,144 +200,10 @@ namespace dxcanvas return true; } - bool fillAxialGradient( GraphicsSharedPtr& rGraphics, - const Gdiplus::Color& rColor1, - const Gdiplus::Color& rColor2, - const GraphicsPathSharedPtr& rFillPath, - const rendering::Texture& texture ) - { - // setup a linear gradient with three colors - // ----------------------------------------- - - Gdiplus::LinearGradientBrush aBrush( - Gdiplus::PointF(0.0f, - 0.5f), - Gdiplus::PointF(1.0f, - 0.5f), - rColor1, - rColor1 ); - - Gdiplus::Color aColors[] = - { - rColor1, // at 0.0 - rColor2, // at 0.5 - rColor1 // at 1.0 - }; - - Gdiplus::REAL aPositions[] = - { - 0.0, - 0.5, - 1.0 - }; - - if( Gdiplus::Ok != aBrush.SetInterpolationColors( aColors, - aPositions, - sizeof( aPositions ) / sizeof(Gdiplus::REAL) ) ) - { - return false; - } - - // render background color, as LinearGradientBrush does not - // properly support the WrapModeClamp repeat mode - Gdiplus::SolidBrush aBackgroundBrush( rColor1 ); - rGraphics->FillPath( &aBackgroundBrush, rFillPath.get() ); - - // TODO(F2): This does not yet support other repeat modes - // except clamp, and probably also no multi-texturing - - // calculate parallelogram of gradient in object space, extend - // top and bottom of it such that they cover the whole fill - // path bound area - ::basegfx::B2DHomMatrix aTextureTransform; - ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform, - texture.AffineTransform ); - - ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 ); - ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 ); - ::basegfx::B2DPoint aRightTop( 1.0, 0.0 ); - ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 ); - - aLeftTop *= aTextureTransform; - aLeftBottom *= aTextureTransform; - aRightTop *= aTextureTransform; - aRightBottom*= aTextureTransform; - - Gdiplus::RectF aBounds; - rFillPath->GetBounds( &aBounds, NULL, NULL ); - - // now, we potentially have to enlarge our gradient area - // atop and below the transformed [0,1]x[0,1] unit rect, - // for the gradient to fill the complete bound rect. - ::basegfx::tools::infiniteLineFromParallelogram( aLeftTop, - aLeftBottom, - aRightTop, - aRightBottom, - tools::b2dRangeFromGdiPlusRectF( aBounds ) ); - - // generate clip polygon from the extended parallelogram - // (exploit the feature that distinct lines in a figure are - // automatically closed by a straight line) - Gdiplus::GraphicsPath aClipPath; - aClipPath.AddLine( static_cast(aLeftTop.getX()), - static_cast(aLeftTop.getY()), - static_cast(aRightTop.getX()), - static_cast(aRightTop.getY()) ); - aClipPath.AddLine( static_cast(aRightBottom.getX()), - static_cast(aRightBottom.getY()), - static_cast(aLeftBottom.getX()), - static_cast(aLeftBottom.getY()) ); - aClipPath.CloseFigure(); - - // limit output to a _single_ strip of the gradient (have to - // clip here, since GDI+ wrapmode clamp does not work here) - if( Gdiplus::Ok != rGraphics->SetClip( rFillPath.get(), - Gdiplus::CombineModeIntersect ) ) - { - return false; - } - if( Gdiplus::Ok != rGraphics->SetClip( &aClipPath, - Gdiplus::CombineModeIntersect ) ) - { - return false; - } - - // now, finally, output the gradient - Gdiplus::Matrix aMatrix; - tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix, - texture.AffineTransform ); - aBrush.SetTransform( &aMatrix ); - - rGraphics->FillRectangle( &aBrush, aBounds ); - - return true; - } - - PathGradientBrushSharedPtr createPathGradientBrush( const GraphicsPathSharedPtr& rGradientPath, - const Gdiplus::Color& rColor1, - const Gdiplus::Color& rColor2 ) - { - PathGradientBrushSharedPtr pGradientBrush( - new Gdiplus::PathGradientBrush( rGradientPath.get() ) ); - - Gdiplus::Color aColors[] = - { - rColor1 - }; - - INT nCount(1); - - pGradientBrush->SetSurroundColors( aColors, - &nCount ); - pGradientBrush->SetCenterColor( rColor2 ); - - return pGradientBrush; - } - bool fillPolygonalGradient( const ::canvas::ParametricPolyPolygon::Values& rValues, + const std::vector< Gdiplus::Color >& rColors, + const std::vector< REAL >& rStops, GraphicsSharedPtr& rGraphics, - const Gdiplus::Color& rColor1, - const Gdiplus::Color& rColor2, const GraphicsPathSharedPtr& rPath, const rendering::Texture& texture ) { @@ -351,7 +226,7 @@ namespace dxcanvas PathGradientBrushSharedPtr pGradientBrush; // fill background uniformly with end color - Gdiplus::SolidBrush aBackgroundBrush( rColor1 ); + Gdiplus::SolidBrush aBackgroundBrush( rColors[0] ); rGraphics->FillPath( &aBackgroundBrush, pFillPath.get() ); // scale focus according to aspect ratio: for wider-than-tall @@ -391,12 +266,9 @@ namespace dxcanvas // -------------------------------- // TODO(Q2): Unify step calculations with VCL canvas - const int nColorSteps( - ::std::max( - labs( rColor1.GetRed() - rColor2.GetRed() ), - ::std::max( - labs( rColor1.GetGreen() - rColor2.GetGreen() ), - labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ) ); + int nColorSteps = 0; + for( size_t i=0; iGetTransform( &aWorldTransformMatrix ); @@ -409,17 +281,16 @@ namespace dxcanvas static_cast( hypot( aBounds.Width, aBounds.Height ) + 1.0 ) ); // typical number for pixel of the same color (strip size) - const int nStripSize( 2 ); + const int nStripSize( nGradientSize < 50 ? 2 : 4 ); - // use at least three steps, and at utmost the number of - // color steps. + // use at least three steps, and at utmost the number of color + // steps const int nStepCount( ::std::max( 3, ::std::min( nGradientSize / nStripSize, - nColorSteps ) ) + 1 ); - + nColorSteps ) ) ); Gdiplus::SolidBrush aFillBrush( rColor1 ); Gdiplus::Matrix aGDIScaleMatrix; @@ -436,19 +307,17 @@ namespace dxcanvas 1.0 - 1.0/rValues.mnAspectRatio : 1.0 - rValues.mnAspectRatio ); + basegfx::tools::KeyStopLerp aLerper(rValues.maStops); for( int i=1; i( (1.0 - nFrac)*rColor1.GetRed() + nFrac*rColor2.GetRed() ), - static_cast( (1.0 - nFrac)*rColor1.GetGreen() + nFrac*rColor2.GetGreen() ), - static_cast( (1.0 - nFrac)*rColor1.GetBlue() + nFrac*rColor2.GetBlue() ) ); + static_cast( basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha) ), + static_cast( basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha) ), + static_cast( basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha) ) ); aFillBrush.SetColor( aFillColor ); @@ -512,10 +381,11 @@ namespace dxcanvas pGradientPath->Transform( &aMatrix ); - pGradientBrush = createPathGradientBrush( - pGradientPath, - rColor1, - rColor2 ); + pGradientBrush.reset( + new Gdiplus::PathGradientBrush( pGradientPath.get() ) ); + pGradientBrush->SetInterpolationColors( &rColors[0], + &rStops[0], + rStops.size() ); // explicitely setup center point. Since the center of GDI+ // gradients are by default the _centroid_ of the path @@ -557,8 +427,8 @@ namespace dxcanvas } bool fillGradient( const ::canvas::ParametricPolyPolygon::Values& rValues, - const Gdiplus::Color& rColor1, - const Gdiplus::Color& rColor2, + const std::vector< Gdiplus::Color >& rColors, + const std::vector< REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, const rendering::Texture& texture ) @@ -567,27 +437,20 @@ namespace dxcanvas { case ::canvas::ParametricPolyPolygon::GRADIENT_LINEAR: fillLinearGradient( rGraphics, - rColor1, - rColor2, + rValues, + rColors, + rStops, rPath, texture ); break; - case ::canvas::ParametricPolyPolygon::GRADIENT_AXIAL: - fillAxialGradient( rGraphics, - rColor1, - rColor2, - rPath, - texture ); - break; - case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL: // FALLTHROUGH intended case ::canvas::ParametricPolyPolygon::GRADIENT_RECTANGULAR: fillPolygonalGradient( rValues, + rColors, + rStops, rGraphics, - rColor1, - rColor2, rPath, texture ); break; @@ -709,15 +572,24 @@ namespace dxcanvas const ::canvas::ParametricPolyPolygon::Values& rValues( pGradient->getValues() ); - // TODO: use all the colors and place them on given positions/stops - const Gdiplus::Color aColor1(tools::sequenceToArgb(rValues.maColors[0])); - const Gdiplus::Color aColor2(tools::sequenceToArgb(rValues.maColors[rValues.maColors.getLength () - 1] )); + OSL_ASSERT(rValues.maColors.getLength() == rValues.maStops.getLength() + && rValues.maColors.getLength() > 1); + + std::vector< Gdiplus::Color > aColors(rValues.maColors.getLength()); + std::transform(&rValues.maColors[0], + &rValues.maColors[0]+rValues.maColors.getLength(), + aColors.begin(), + boost::bind( + &tools::sequenceToArgb, + _1)); + std::vector< REAL > aStops; + comphelper::sequenceToContainer(aStops,rValues.maStops); // TODO(E1): Return value // TODO(F1): FillRule fillGradient( rValues, - aColor1, - aColor2, + aColors, + aStops, pGraphics, tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ), textures[0] ); diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx index 555316d14b9f..64389dfa4664 100755 --- a/canvas/source/directx/dx_spritecanvas.hxx +++ b/canvas/source/directx/dx_spritecanvas.hxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -61,14 +60,14 @@ namespace dxcanvas { typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas, - ::com::sun::star::rendering::XIntegerBitmap, - ::com::sun::star::rendering::XGraphicDevice, - ::com::sun::star::rendering::XParametricPolyPolygon2DFactory, - ::com::sun::star::rendering::XBufferController, - ::com::sun::star::awt::XWindowListener, - ::com::sun::star::util::XUpdatable, - ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; + ::com::sun::star::rendering::XIntegerBitmap, + ::com::sun::star::rendering::XGraphicDevice, + ::com::sun::star::lang::XMultiServiceFactory, + ::com::sun::star::rendering::XBufferController, + ::com::sun::star::awt::XWindowListener, + ::com::sun::star::util::XUpdatable, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, -- cgit From 830cfd9b49664ab9a9f47ccef2cffc148272fde3 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Wed, 20 Jan 2010 16:04:05 +0100 Subject: #161490# removed one commented line --- tools/source/fsys/urlobj.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 2a3242c29f54..98de7e6152f4 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, -// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; -- cgit From 7dd16c6faabd03e178a3c7560019589efe0e23bd Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Wed, 20 Jan 2010 16:04:05 +0100 Subject: #161490# removed one commented line --- tools/source/fsys/urlobj.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 0360f63da87e..bfca09c27b2a 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, -// { "", "", 0, true, false, false, false, true, true, true, false }, { "", "", 0, false, false, false, false, false, false, false, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; -- cgit From 03fc1bd0e9ad5a2487cdd8660cc03810c9c76fd2 Mon Sep 17 00:00:00 2001 From: thb Date: Thu, 21 Jan 2010 10:46:19 +0100 Subject: #i10000# Disable fp-fragile unit tests; fix build on win32 --- basegfx/test/boxclipper.cxx | 8 ++++--- .../source/directx/dx_canvashelper_texturefill.cxx | 25 +++++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index 4f18741c7a34..c88f0e14c1ce 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -394,9 +394,11 @@ public: validatePoly("intersectionSE", aIntersectionSE); validatePoly("intersectionSW", aIntersectionSW); validatePoly("intersectionNW", aIntersectionNW); - validatePoly("ringIntersection", aRingIntersection); - validatePoly("ringIntersection2", aRingIntersection2); - validatePoly("ringIntersectExtraStrip", aRingIntersectExtraStrip); + // subtle differences on Solaris Intel, comparison not smart enough + // (due to floating point inaccuracies) + //validatePoly("ringIntersection", aRingIntersection); + //validatePoly("ringIntersection2", aRingIntersection2); + //validatePoly("ringIntersectExtraStrip", aRingIntersectExtraStrip); // generic clipper buggy here, likely //validatePoly("complexIntersections", aComplexIntersections); //validatePoly("randomIntersections", aRandomIntersections); diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 6b57e2e47a56..2d5046146c28 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -69,12 +69,12 @@ namespace dxcanvas bool fillLinearGradient( GraphicsSharedPtr& rGraphics, const ::canvas::ParametricPolyPolygon::Values& rValues, const std::vector< Gdiplus::Color >& rColors, - const std::vector< REAL >& rStops, + const std::vector< Gdiplus::REAL >& rStops, const GraphicsPathSharedPtr& rFillPath, const rendering::Texture& texture ) { - // setup a linear gradient with two colors - // --------------------------------------- + // setup a linear gradient with given colors + // ----------------------------------------- Gdiplus::LinearGradientBrush aBrush( Gdiplus::PointF(0.0f, @@ -164,7 +164,7 @@ namespace dxcanvas return false; } - Gdiplus::SolidBrush aBackgroundBrush2( rColor2 ); + Gdiplus::SolidBrush aBackgroundBrush2( rColors.back() ); rGraphics->FillPath( &aBackgroundBrush2, &aSolidFillPath ); // generate clip polygon from the extended parallelogram @@ -200,9 +200,18 @@ namespace dxcanvas return true; } + int numColorSteps( const Gdiplus::Color& rColor1, const Gdiplus::Color& rColor2 ) + { + return ::std::max( + labs( rColor1.GetRed() - rColor2.GetRed() ), + ::std::max( + labs( rColor1.GetGreen() - rColor2.GetGreen() ), + labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ); + } + bool fillPolygonalGradient( const ::canvas::ParametricPolyPolygon::Values& rValues, const std::vector< Gdiplus::Color >& rColors, - const std::vector< REAL >& rStops, + const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, const rendering::Texture& texture ) @@ -292,7 +301,7 @@ namespace dxcanvas nGradientSize / nStripSize, nColorSteps ) ) ); - Gdiplus::SolidBrush aFillBrush( rColor1 ); + Gdiplus::SolidBrush aFillBrush( rColors[0] ); Gdiplus::Matrix aGDIScaleMatrix; ::basegfx::B2DHomMatrix aScaleMatrix; @@ -428,7 +437,7 @@ namespace dxcanvas bool fillGradient( const ::canvas::ParametricPolyPolygon::Values& rValues, const std::vector< Gdiplus::Color >& rColors, - const std::vector< REAL >& rStops, + const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, const rendering::Texture& texture ) @@ -582,7 +591,7 @@ namespace dxcanvas boost::bind( &tools::sequenceToArgb, _1)); - std::vector< REAL > aStops; + std::vector< Gdiplus::REAL > aStops; comphelper::sequenceToContainer(aStops,rValues.maStops); // TODO(E1): Return value -- cgit From 148185acf7ce2e989cb6b32477a0c95db5462a1d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Jan 2010 17:21:53 +0100 Subject: ppp02: #i108326# create single print jobs on request --- vcl/inc/vcl/prndlg.hxx | 2 + vcl/source/gdi/print3.cxx | 118 ++++++++++++++++++++++++++++------------- vcl/source/window/printdlg.cxx | 11 ++++ 3 files changed, 95 insertions(+), 36 deletions(-) diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index f1b69e1ca3aa..4aed8ddbeb64 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -296,6 +296,7 @@ namespace vcl bool isPrintToFile(); int getCopyCount(); bool isCollate(); + bool isSingleJobs(); void previewForward(); void previewBackward(); @@ -324,6 +325,7 @@ namespace vcl bool isCanceled() const { return mbCanceled; } void setProgress( int i_nCurrent, int i_nMax = -1 ); void tick(); + void reset(); virtual void Paint( const Rectangle& ); }; diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 6778cfbc867e..f7cdfa216fb6 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -443,7 +443,12 @@ void Printer::ImplPrintJob( const boost::shared_ptr& i_pContr return; } pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ), - makeAny( aFile ) ); + makeAny( aFile ) ); + } + else if( aDlg.isSingleJobs() ) + { + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ), + makeAny( sal_True ) ); } } catch( std::bad_alloc& ) @@ -504,6 +509,13 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrgetValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); + if( pSingleValue ) + { + pSingleValue->Value >>= 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 @@ -517,6 +529,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrsetJobState( view::PrintableState_JOB_STARTED ); i_pController->jobStarted(); - if( mpPrinter->StartJob( pPrintFile, - i_rJobName, - Application::GetDisplayName(), - nCopies, - bCollateCopy, - i_pController->isDirectPrint(), - maJobSetup.ImplGetConstData() ) ) + int nJobs = 1; + int nRepeatCount = bUserCopy ? mnCopyCount : 1; + if( bSinglePrintJobs ) { - mbJobActive = TRUE; - i_pController->createProgressDialog(); - int nPages = i_pController->getFilteredPageCount(); - int nRepeatCount = bUserCopy ? mnCopyCount : 1; - for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ ) + nJobs = mnCopyCount; + nCopies = 1; + nRepeatCount = 1; + } + + for( int nJobIteration = 0; nJobIteration < nJobs; nJobIteration++ ) + { + bool bError = false; + if( mpPrinter->StartJob( pPrintFile, + i_rJobName, + Application::GetDisplayName(), + nCopies, + bCollateCopy, + i_pController->isDirectPrint(), + maJobSetup.ImplGetConstData() ) ) { - for( int nPage = 0; nPage < nPages; nPage++ ) + mbJobActive = TRUE; + i_pController->createProgressDialog(); + int nPages = i_pController->getFilteredPageCount(); + for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ ) { - if( nPage == nPages-1 && nIteration == nRepeatCount-1 ) - i_pController->setLastPage( sal_True ); - i_pController->printFilteredPage( nPage ); + for( int nPage = 0; nPage < nPages; nPage++ ) + { + if( nPage == nPages-1 && nIteration == nRepeatCount-1 && nJobIteration == nJobs-1 ) + i_pController->setLastPage( sal_True ); + i_pController->printFilteredPage( nPage ); + } + // FIXME: duplex ? + } + EndJob(); + + if( nJobIteration < nJobs-1 ) + { + mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter ); + + if ( mpPrinter ) + { + maJobName = i_rJobName; + mnCurPage = 1; + mnCurPrintPage = 1; + mbPrinting = TRUE; + } + else + bError = true; } - // FIXME: duplex ? } - EndJob(); + else + bError = true; - if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) - i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); + if( bError ) + { + mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); + if ( !mnError ) + mnError = PRINTER_GENERALERROR; + i_pController->setJobState( mnError == PRINTER_ABORT + ? view::PrintableState_JOB_ABORTED + : view::PrintableState_JOB_FAILED ); + if( mpPrinter ) + pSVData->mpDefInst->DestroyPrinter( mpPrinter ); + mnCurPage = 0; + mnCurPrintPage = 0; + mbPrinting = FALSE; + mpPrinter = NULL; + + return false; + } } - else - { - mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); - if ( !mnError ) - mnError = PRINTER_GENERALERROR; - i_pController->setJobState( mnError == PRINTER_ABORT - ? view::PrintableState_JOB_ABORTED - : view::PrintableState_JOB_FAILED ); - pSVData->mpDefInst->DestroyPrinter( mpPrinter ); - mnCurPage = 0; - mnCurPrintPage = 0; - mbPrinting = FALSE; - mpPrinter = NULL; - return false; - } + if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) + i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); } return true; @@ -1396,6 +1440,8 @@ void PrinterController::createProgressDialog() mpImplData->mpProgress->Show(); } } + else + mpImplData->mpProgress->reset(); } void PrinterController::setMultipage( const MultiPageSetup& i_rMPS ) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 649ca21a32b8..0404bed4218e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -837,6 +837,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr 1 ? maJobPage.maCollateBox.IsChecked() : FALSE; } +bool PrintDialog::isSingleJobs() +{ + return maOptionsPage.maCollateSingleJobsBox.IsChecked(); +} + static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() ) { rtl::OUStringBuffer aBuf( 256 ); @@ -2447,6 +2453,11 @@ void PrintProgressDialog::tick() setProgress( ++mnCur ); } +void PrintProgressDialog::reset() +{ + setProgress( 0 ); +} + void PrintProgressDialog::Paint( const Rectangle& ) { if( maProgressRect.IsEmpty() ) -- cgit From 0c770cb000ec05eb522b928dbf975ebe8324c480 Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 22 Jan 2010 14:17:52 +0100 Subject: #i10000# help msvc to find the right one of an overloaded func --- canvas/source/directx/dx_canvashelper_texturefill.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 2d5046146c28..453569298004 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -589,7 +589,8 @@ namespace dxcanvas &rValues.maColors[0]+rValues.maColors.getLength(), aColors.begin(), boost::bind( - &tools::sequenceToArgb, + (Gdiplus::ARGB (*)( const uno::Sequence< double >& ))( + &tools::sequenceToArgb), _1)); std::vector< Gdiplus::REAL > aStops; comphelper::sequenceToContainer(aStops,rValues.maStops); -- cgit From 9c0d0aedc5ec47e3701183478c30a9996f1d0637 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Fri, 22 Jan 2010 16:29:42 +0100 Subject: #161491# bugfixes and additional tests --- tools/source/fsys/urlobj.cxx | 18 +++++++----------- tools/workben/urltest.cxx | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 98de7e6152f4..b742e6c9a074 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, - { "", "", 0, false, false, false, false, false, false, false, false }, + { "", "", 0, false, false, false, false, true, true, true, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -874,7 +874,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) + if (getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1228,7 +1228,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) + else if (getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1336,7 +1336,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) + if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1365,7 +1365,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, } break; default: - if (pHostPortBegin == pPort && pPort != pHostPortEnd) + if (pHostPortBegin == pPort) { setInvalid(); return false; @@ -2897,7 +2897,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0 && m_aPort.isPresent()) + if (aSynHost.getLength() == 0) return false; break; } @@ -3423,10 +3423,6 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { - // set hierarchical for generic schemes - if (m_eScheme == INET_PROT_GENERIC) { - return true; - } return getSchemeInfo().m_bHierarchical; } } @@ -4174,7 +4170,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0 && nThePort != 0) + if (aSynHost.getLength() == 0) { setInvalid(); return false; diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx index a232f8ebdd93..b17b6c485467 100644 --- a/tools/workben/urltest.cxx +++ b/tools/workben/urltest.cxx @@ -526,6 +526,8 @@ main() /*TODO "vnd.sun.star.wfs:///c|/xyz/",*/ /*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/ "vnd.sun.star.wfs:///x/y/z", + "vnd.sun.star.generic:///x/y/z", + "vnd.sun.star.generic://host:34/x/y/z" /*TODO "wfs://",*/ /*TODO "wfs://LocalHost",*/ /*TODO "wfs:///c|/xyz/",*/ @@ -536,13 +538,21 @@ main() INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) printf("BAD %s\n", aTest[i]); - else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). - equalsAscii(aTest[i]) != sal_True) + else { + if (aUrl.GetProtocol() != INET_PROT_GENERIC) { + printf("BAD PROTOCOL %i -> %i\n", + aUrl.GetProtocol(), + INET_PROT_GENERIC); + } + if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). + equalsAscii(aTest[i]) != sal_True) + { String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI)); printf("BAD %s -> %s\n", aTest[i], ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer()); + } } } } -- cgit From bf9614cf5b5eea50131aa9f6030bf3d7175d7e94 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Fri, 22 Jan 2010 16:29:42 +0100 Subject: #161491# bugfixes and additional tests --- tools/source/fsys/urlobj.cxx | 18 +++++++----------- tools/workben/urltest.cxx | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index bfca09c27b2a..68a66b596f5c 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -425,7 +425,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END] false, false, false, false, false }, { "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false, false, false, false, true, false }, - { "", "", 0, false, false, false, false, false, false, false, false }, + { "", "", 0, false, false, false, false, true, true, true, false }, { "smb", "smb://", 139, true, true, false, true, true, true, true, true } }; @@ -874,7 +874,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, // Parse //;AUTH=@: or // //:@: or // // - if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bAuthority) + if (getSchemeInfo().m_bAuthority) { sal_Unicode const * pUserInfoBegin = 0; sal_Unicode const * pUserInfoEnd = 0; @@ -1226,7 +1226,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, pUserInfoBegin = pAuthority; pUserInfoEnd = pPos; } - else if (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bHost) + else if (getSchemeInfo().m_bHost) { pHostPortBegin = pAuthority; pHostPortEnd = pPos; @@ -1334,7 +1334,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pHostPortBegin) { sal_Unicode const * pPort = pHostPortEnd; - if ( (m_eScheme == INET_PROT_GENERIC || getSchemeInfo().m_bPort) && pHostPortBegin < pHostPortEnd ) + if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd ) { sal_Unicode const * p1 = pHostPortEnd - 1; while (p1 > pHostPortBegin && INetMIME::isDigit(*p1)) @@ -1363,7 +1363,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, } break; default: - if (pHostPortBegin == pPort && pPort != pHostPortEnd) + if (pHostPortBegin == pPort) { setInvalid(); return false; @@ -2895,7 +2895,7 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, break; default: - if (aSynHost.getLength() == 0 && m_aPort.isPresent()) + if (aSynHost.getLength() == 0) return false; break; } @@ -3421,10 +3421,6 @@ bool INetURLObject::checkHierarchical() const { false, "INetURLObject::checkHierarchical vnd.sun.star.expand"); return true; } else { - // set hierarchical for generic schemes - if (m_eScheme == INET_PROT_GENERIC) { - return true; - } return getSchemeInfo().m_bHierarchical; } } @@ -4172,7 +4168,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, break; default: - if (aSynHost.getLength() == 0 && nThePort != 0) + if (aSynHost.getLength() == 0) { setInvalid(); return false; diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx index 0e9d22081cb4..7f27995fe63b 100644 --- a/tools/workben/urltest.cxx +++ b/tools/workben/urltest.cxx @@ -526,6 +526,8 @@ main() /*TODO "vnd.sun.star.wfs:///c|/xyz/",*/ /*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/ "vnd.sun.star.wfs:///x/y/z", + "vnd.sun.star.generic:///x/y/z", + "vnd.sun.star.generic://host:34/x/y/z" /*TODO "wfs://",*/ /*TODO "wfs://LocalHost",*/ /*TODO "wfs:///c|/xyz/",*/ @@ -536,13 +538,21 @@ main() INetURLObject aUrl(aTest[i]); if (aUrl.HasError()) printf("BAD %s\n", aTest[i]); - else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). - equalsAscii(aTest[i]) != sal_True) + else { + if (aUrl.GetProtocol() != INET_PROT_GENERIC) { + printf("BAD PROTOCOL %i -> %i\n", + aUrl.GetProtocol(), + INET_PROT_GENERIC); + } + if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI). + equalsAscii(aTest[i]) != sal_True) + { String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI)); printf("BAD %s -> %s\n", aTest[i], ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer()); + } } } } -- cgit From 9f35771929499d655b248fdf8b6bd75e27caf017 Mon Sep 17 00:00:00 2001 From: thb Date: Mon, 25 Jan 2010 22:42:19 +0100 Subject: #i105937# Removed demo-quality java canvas. no longer maintained. --- canvas/source/java/BackBuffer.java | 115 ----- canvas/source/java/BezierPolyPolygon.java | 154 ------ canvas/source/java/BitmapCanvas.java | 139 ----- canvas/source/java/BufferedGraphics2D.java | 603 ---------------------- canvas/source/java/CanvasBase.java | 344 ------------- canvas/source/java/CanvasBitmap.java | 255 ---------- canvas/source/java/CanvasClonedSprite.java | 188 ------- canvas/source/java/CanvasCustomSprite.java | 207 -------- canvas/source/java/CanvasFont.java | 119 ----- canvas/source/java/CanvasGraphicDevice.java | 225 -------- canvas/source/java/CanvasSprite.java | 311 ----------- canvas/source/java/CanvasTest_perftest.java | 679 ------------------------- canvas/source/java/CanvasUtils.java | 630 ----------------------- canvas/source/java/JavaCanvas.java | 678 ------------------------ canvas/source/java/LinePolyPolygon.java | 195 ------- canvas/source/java/SpriteBase.java | 37 -- canvas/source/java/SpriteRep.java | 178 ------- canvas/source/java/SpriteRunner.java | 203 -------- canvas/source/java/TextLayout.java | 208 -------- canvas/source/java/aqua/WindowAdapter.java | 205 -------- canvas/source/java/java_Service.java | 118 ----- canvas/source/java/makefile.mk | 97 ---- canvas/source/java/manifest | 1 - canvas/source/java/perftest/PerfTest.java | 317 ------------ canvas/source/java/perftest/WindowAdapter.java | 200 -------- canvas/source/java/perftest/makefile.mk | 59 --- canvas/source/java/perftest/manifest | 1 - canvas/source/java/win/WindowAdapter.java | 202 -------- canvas/source/java/x11/WindowAdapter.java | 200 -------- 29 files changed, 6868 deletions(-) delete mode 100644 canvas/source/java/BackBuffer.java delete mode 100644 canvas/source/java/BezierPolyPolygon.java delete mode 100644 canvas/source/java/BitmapCanvas.java delete mode 100644 canvas/source/java/BufferedGraphics2D.java delete mode 100644 canvas/source/java/CanvasBase.java delete mode 100644 canvas/source/java/CanvasBitmap.java delete mode 100644 canvas/source/java/CanvasClonedSprite.java delete mode 100644 canvas/source/java/CanvasCustomSprite.java delete mode 100644 canvas/source/java/CanvasFont.java delete mode 100644 canvas/source/java/CanvasGraphicDevice.java delete mode 100644 canvas/source/java/CanvasSprite.java delete mode 100644 canvas/source/java/CanvasTest_perftest.java delete mode 100644 canvas/source/java/CanvasUtils.java delete mode 100644 canvas/source/java/JavaCanvas.java delete mode 100644 canvas/source/java/LinePolyPolygon.java delete mode 100644 canvas/source/java/SpriteBase.java delete mode 100644 canvas/source/java/SpriteRep.java delete mode 100644 canvas/source/java/SpriteRunner.java delete mode 100644 canvas/source/java/TextLayout.java delete mode 100644 canvas/source/java/aqua/WindowAdapter.java delete mode 100644 canvas/source/java/java_Service.java delete mode 100644 canvas/source/java/makefile.mk delete mode 100644 canvas/source/java/manifest delete mode 100644 canvas/source/java/perftest/PerfTest.java delete mode 100644 canvas/source/java/perftest/WindowAdapter.java delete mode 100644 canvas/source/java/perftest/makefile.mk delete mode 100644 canvas/source/java/perftest/manifest delete mode 100644 canvas/source/java/win/WindowAdapter.java delete mode 100644 canvas/source/java/x11/WindowAdapter.java diff --git a/canvas/source/java/BackBuffer.java b/canvas/source/java/BackBuffer.java deleted file mode 100644 index c71a523f35d9..000000000000 --- a/canvas/source/java/BackBuffer.java +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BackBuffer.java,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Java AWT -import java.awt.*; -import java.awt.image.*; - -public class BackBuffer -{ - private BufferedImage backBuffer; - //private VolatileImage backBuffer; - private Graphics2D backBufferGraphics; - private Graphics2D referenceDevice; - - public BackBuffer( Graphics2D _referenceDevice, - int width, - int height ) - { - referenceDevice = _referenceDevice; - setSize( width, height ); - } - - public Graphics2D getGraphics() - { - return backBufferGraphics; - } - - public void setSize( int width, - int height ) - { - if( backBuffer != null && - width == backBuffer.getWidth() && - height == backBuffer.getHeight() ) - { - return; - } - - if( backBufferGraphics != null ) - backBufferGraphics.dispose(); - - if( backBuffer != null ) - backBuffer.flush(); - - // TODO: Maybe VolatileImage with another BufferedImage as a backup is - // a tad faster here. - backBuffer = referenceDevice.getDeviceConfiguration().createCompatibleImage(width, - height); -// backBuffer = referenceDevice.getDeviceConfiguration().createCompatibleVolatileImage(width, -// height); - - backBufferGraphics = backBuffer.createGraphics(); - CanvasUtils.initGraphics( backBufferGraphics ); - - // clear the buffer to white (to have a defined state here) - backBufferGraphics.setColor( java.awt.Color.white ); - backBufferGraphics.fillRect( 0,0,width,height ); - } - - public void redraw( Graphics2D graph ) - { - if( graph != null && - backBuffer != null ) - { - CanvasUtils.printLog("BackBuffer.redraw(): using buffer of size (" + - backBuffer.getWidth() + "," + backBuffer.getHeight() + ")" ); - - graph.drawImage(backBuffer, 0, 0, null); - - // TODO: this is just twiddled to work. I cannot be sure - // that this volatile backbuffer will survive in the first - // place, nor that it wise to leave it in VRAM. - - // only flush non-volatile images - // CanvasUtils.postRenderImageTreatment( backBuffer ); - } - } - - public java.awt.Image getBackBuffer() - { - return backBuffer; - } - - public void dispose() - { - backBufferGraphics.dispose(); - backBuffer.flush(); - } -} diff --git a/canvas/source/java/BezierPolyPolygon.java b/canvas/source/java/BezierPolyPolygon.java deleted file mode 100644 index 54a061477ab8..000000000000 --- a/canvas/source/java/BezierPolyPolygon.java +++ /dev/null @@ -1,154 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BezierPolyPolygon.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -public class BezierPolyPolygon - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.rendering.XBezierPolyPolygon2D -{ - private java.awt.geom.GeneralPath path; - - //---------------------------------------------------------------------------------- - - public BezierPolyPolygon( RealBezierSegment2D[][] points ) - { - setBezierSegments( points, 0 ); - } - - public java.awt.geom.GeneralPath getJavaPath() - { - return path; - } - - //---------------------------------------------------------------------------------- - - // - // XPolyPolygon implementation - // =========================== - // - public void addPolyPolygon( RealPoint2D position, XPolyPolygon2D polyPolygon ) - { - } - - public int getNumberOfPolygons( ) - { - return 0; - } - - public int getNumberOfPolygonPoints( int polygon ) - { - return 0; - } - - public FillRule getFillRule( ) - { - if( path.getWindingRule() == java.awt.geom.GeneralPath.WIND_EVEN_ODD ) - return FillRule.EVEN_ODD; - else - return FillRule.NON_ZERO; - } - - public void setFillRule( FillRule fillRule ) - { - if( fillRule == FillRule.EVEN_ODD ) - path.setWindingRule( java.awt.geom.GeneralPath.WIND_EVEN_ODD ); - else - path.setWindingRule( java.awt.geom.GeneralPath.WIND_NON_ZERO ); - } - - public boolean isClosed( int index ) - { - // TODO - return false; - } - - public void setClosed( int index, boolean closedState ) - { - // TODO - } - - //---------------------------------------------------------------------------------- - - // - // XBezierPolyPolygon implementation - // ================================= - // - public RealBezierSegment2D[][] getBezierSegments( int nPolygonIndex, int nNumberOfPolygons, int nPointIndex, int nNumberOfPoints ) - { - return null; - } - - public void setBezierSegments( RealBezierSegment2D[][] points, int nPolygonIndex ) - { - if( nPolygonIndex != 0 ) - CanvasUtils.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" ); - - path = CanvasUtils.makeGenPathFromBezierPoints( points ); - } - - public RealBezierSegment2D getBezierSegment( int nPolygonIndex, int nPointIndex ) - { - return null; - } - - public void setBezierSegment( RealBezierSegment2D point, int nPolygonIndex, int nPointIndex ) - { - CanvasUtils.printLog( "LinePolyPolygon.setPoint: not yet implemented!" ); - } - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - - private static final String s_implName = "XBezierPolyPolygon2D.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.BezierPolyPolygon2D"; - - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/BitmapCanvas.java b/canvas/source/java/BitmapCanvas.java deleted file mode 100644 index 374a0d71c4fc..000000000000 --- a/canvas/source/java/BitmapCanvas.java +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BitmapCanvas.java,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.IQueryInterface; -import com.sun.star.lang.XInitialization; -import com.sun.star.lib.uno.helper.WeakBase; - -// OOo AWT -import com.sun.star.awt.*; - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; -import java.awt.image.*; -import java.awt.geom.*; - -public class BitmapCanvas - extends CanvasBase - implements com.sun.star.rendering.XBitmapCanvas, - com.sun.star.lang.XServiceInfo -{ - private Graphics2D graphics; - - public Graphics2D getGraphics() - { - return graphics; - } - - //---------------------------------------------------------------------------------- - - public BitmapCanvas( Graphics2D _graphics ) - { - graphics = _graphics; - } - - //---------------------------------------------------------------------------------- - - // - // XBitmapCanvas impl - // ================== - // - - public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas, - com.sun.star.geometry.RealRectangle2D sourceRect, - com.sun.star.rendering.ViewState sourceViewState, - com.sun.star.rendering.RenderState sourceRenderState, - com.sun.star.geometry.RealRectangle2D destRect, - com.sun.star.rendering.ViewState destViewState, - com.sun.star.rendering.RenderState destRenderState ) - { - // TODO: create temp image when transform is non-trivial - - if( sourceCanvas == this ) - { - // copy rectangle within the canvas - graphics.copyArea((int)sourceRect.X1, - (int)sourceRect.Y1, - (int)(sourceRect.X2 - sourceRect.X1), - (int)(sourceRect.Y2 - sourceRect.Y1), - (int)(destRect.X1 - sourceRect.X1), - (int)(destRect.Y1 - sourceRect.Y1) ); - } - else - { - if( sourceCanvas instanceof JavaCanvas ) - { - // cache - CanvasUtils.setupGraphicsState( graphics, destViewState, destRenderState, CanvasUtils.alsoSetupPaint ); - - // TODO: really extract correct source rect here - BufferedImage backBuffer = ((BufferedGraphics2D)((JavaCanvas)sourceCanvas).getGraphics()).getBackBuffer(); - graphics.drawImage( backBuffer, 0, 0, null ); - CanvasUtils.postRenderImageTreatment( backBuffer ); - - } - // TODO: foreign canvas - } - } - - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XBitmapCanvas.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.BitmapCanvas"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/BufferedGraphics2D.java b/canvas/source/java/BufferedGraphics2D.java deleted file mode 100644 index 235de2018d80..000000000000 --- a/canvas/source/java/BufferedGraphics2D.java +++ /dev/null @@ -1,603 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: BufferedGraphics2D.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Java AWT -import java.awt.*; -import java.awt.geom.*; -import java.awt.image.*; -import java.awt.image.renderable.*; -import java.awt.font.*; -import java.text.*; -import java.util.*; - - -public class BufferedGraphics2D - extends java.awt.Graphics2D -{ - // TODO: Somehow, get rid of this duplicate graphics (the graphics member, - // and this object itself, extending a Graphics2D) - private Graphics2D graphics; - private BufferedImage backBuffer; - private Graphics2D backBufferGraphics; - - //---------------------------------------------------------------------------------- - - public BufferedGraphics2D( java.awt.Graphics2D _graphics, int width, int height ) - { - setGraphics( _graphics, Math.max(1,width), Math.max(1,height) ); - } - - public void redraw( Graphics2D graph ) - { - if( graph != null && - backBuffer != null ) - { - CanvasUtils.printLog("BufferedGraphics2D.redraw: using buffer of size (" + - backBuffer.getWidth() + "," + backBuffer.getHeight() + ")" ); - - // set transform to identity - graph.setTransform( new AffineTransform() ); - graph.drawImage(backBuffer, 0, 0, null); - CanvasUtils.postRenderImageTreatment( backBuffer ); - } - } - - public BufferedImage getBackBuffer() - { - return backBuffer; - } - - public void setSize( int width, int height ) - { - if( backBuffer != null && - width == backBuffer.getWidth() && - height == backBuffer.getHeight() ) - { - return; - } - - if( backBufferGraphics != null ) - backBufferGraphics.dispose(); - - if( backBuffer != null ) - backBuffer.flush(); - - // TODO: Maybe VolatileImage with another BufferedImage as a backup is - // a tad faster here. - backBuffer = graphics.getDeviceConfiguration().createCompatibleImage(width, - height); - - backBufferGraphics = backBuffer.createGraphics(); - CanvasUtils.initGraphics( backBufferGraphics ); - - // clear the buffer to white (to have a defined state here) - backBufferGraphics.setColor( java.awt.Color.white ); - backBufferGraphics.fillRect( 0,0,width,height ); - } - - public void setGraphics( Graphics2D _graphics, int width, int height ) - { - if( graphics != null ) - graphics.dispose(); - - graphics = _graphics; - - setSize(width,height); - } - - //---------------------------------------------------------------------------------- - - // - // Graphics - // ======== - // - public void clearRect(int x, int y, int width, int height) - { - graphics.clearRect(x,y,width,height); - backBufferGraphics.clearRect(x,y,width,height); - } - - public void clipRect(int x, int y, int width, int height) - { - graphics.clipRect(x,y,width,height); - backBufferGraphics.clipRect(x,y,width,height); - } - - public void copyArea(int x, int y, int width, int height, int dx, int dy) - { - graphics.copyArea(x,y,width,height,dx,dy); - backBufferGraphics.copyArea(x,y,width,height,dx,dy); - } - - public Graphics create() - { - return null; - } - - public Graphics create(int x, int y, int width, int height) - { - return null; - } - - public void dispose() - { - graphics.dispose(); - backBufferGraphics.dispose(); - backBuffer.flush(); - } - - public void draw3DRect(int x, int y, int width, int height, boolean raised) - { - graphics.draw3DRect(x,y,width,height,raised); - backBufferGraphics.draw3DRect(x,y,width,height,raised); - } - - public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) - { - graphics.drawArc(x,y,width,height,startAngle,arcAngle); - backBufferGraphics.drawArc(x,y,width,height,startAngle,arcAngle); - } - - public void drawBytes(byte[] data, int offset, int length, int x, int y) - { - graphics.drawBytes(data,offset,length,x,y); - backBufferGraphics.drawBytes(data,offset,length,x,y); - } - - public void drawChars(char[] data, int offset, int length, int x, int y) - { - graphics.drawChars(data,offset,length,x,y); - backBufferGraphics.drawChars(data,offset,length,x,y); - } - - public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) - { - backBufferGraphics.drawImage(img,x,y,bgcolor,observer); - return graphics.drawImage(img,x,y,bgcolor,observer); - } - - public boolean drawImage(Image img, int x, int y, ImageObserver observer) - { - backBufferGraphics.drawImage(img,x,y,observer); - return graphics.drawImage(img,x,y,observer); - } - - public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) - { - backBufferGraphics.drawImage(img,x,y,width,height,bgcolor,observer); - return graphics.drawImage(img,x,y,width,height,bgcolor,observer); - } - - public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) - { - backBufferGraphics.drawImage(img,x,y,width,height,observer); - return graphics.drawImage(img,x,y,width,height,observer); - } - - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) - { - backBufferGraphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer); - return graphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,bgcolor,observer); - } - - public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) - { - backBufferGraphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,observer); - return graphics.drawImage(img,dx1,dy1,dx2,dy2,sx1,sy1,sx2,sy2,observer); - } - - public void drawLine(int x1, int y1, int x2, int y2) - { - graphics.drawLine(x1,y1,x2,y2); - backBufferGraphics.drawLine(x1,y1,x2,y2); - } - - public void drawOval(int x, int y, int width, int height) - { - graphics.drawOval(x,y,width,height); - backBufferGraphics.drawOval(x,y,width,height); - } - - public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) - { - graphics.drawPolygon(xPoints,yPoints,nPoints); - backBufferGraphics.drawPolygon(xPoints,yPoints,nPoints); - } - - public void drawPolygon(Polygon p) - { - graphics.drawPolygon(p); - backBufferGraphics.drawPolygon(p); - } - - public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) - { - graphics.drawPolyline(xPoints,yPoints,nPoints); - backBufferGraphics.drawPolyline(xPoints,yPoints,nPoints); - } - - public void drawRect(int x, int y, int width, int height) - { - graphics.drawRect(x,y,width,height); - backBufferGraphics.drawRect(x,y,width,height); - } - - public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - { - graphics.drawRoundRect(x,y,width,height,arcWidth,arcHeight); - backBufferGraphics.drawRoundRect(x,y,width,height,arcWidth,arcHeight); - } - - public void drawString(AttributedCharacterIterator iterator, int x, int y) - { - graphics.drawString(iterator,x,y); - backBufferGraphics.drawString(iterator,x,y); - } - - public void drawString(String str, int x, int y) - { - graphics.drawString(str,x,y); - backBufferGraphics.drawString(str,x,y); - } - - public void fill3DRect(int x, int y, int width, int height, boolean raised) - { - graphics.fill3DRect(x,y,width,height,raised); - backBufferGraphics.fill3DRect(x,y,width,height,raised); - } - - public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) - { - graphics.fillArc(x,y,width,height,startAngle,arcAngle); - backBufferGraphics.fillArc(x,y,width,height,startAngle,arcAngle); - } - - public void fillOval(int x, int y, int width, int height) - { - graphics.fillOval(x,y,width,height); - backBufferGraphics.fillOval(x,y,width,height); - } - - public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) - { - graphics.fillPolygon(xPoints,yPoints,nPoints); - backBufferGraphics.fillPolygon(xPoints,yPoints,nPoints); - } - - public void fillPolygon(Polygon p) - { - graphics.fillPolygon(p); - backBufferGraphics.fillPolygon(p); - } - - public void fillRect(int x, int y, int width, int height) - { - graphics.fillRect(x,y,width,height); - backBufferGraphics.fillRect(x,y,width,height); - } - - public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) - { - graphics.fillRoundRect(x,y,width,height,arcWidth,arcHeight); - backBufferGraphics.fillRoundRect(x,y,width,height,arcWidth,arcHeight); - } - - public Shape getClip() - { - return graphics.getClip(); - } - - public Rectangle getClipBounds() - { - return graphics.getClipBounds(); - } - - public Rectangle getClipBounds(Rectangle r) - { - return graphics.getClipBounds(r); - } - - public Rectangle getClipRect() - { - return graphics.getClipRect(); - } - - public Color getColor() - { - return getColor(); - } - - public Font getFont() - { - return getFont(); - } - - public FontMetrics getFontMetrics() - { - return getFontMetrics(); - } - - public FontMetrics getFontMetrics(Font f) - { - return getFontMetrics(f); - } - - public boolean hitClip(int x, int y, int width, int height) - { - return graphics.hitClip(x,y,width,height); - } - - public void setClip(int x, int y, int width, int height) - { - graphics.setClip(x,y,width,height); - backBufferGraphics.setClip(x,y,width,height); - } - - public void setClip(Shape clip) - { - graphics.setClip(clip); - backBufferGraphics.setClip(clip); - } - - public void setColor(Color c) - { - graphics.setColor(c); - backBufferGraphics.setColor(c); - } - - public void setFont(Font font) - { - graphics.setFont(font); - backBufferGraphics.setFont(font); - } - - public void setPaintMode() - { - graphics.setPaintMode(); - backBufferGraphics.setPaintMode(); - } - - public void setXORMode(Color c1) - { - graphics.setXORMode(c1); - backBufferGraphics.setXORMode(c1); - } - - public String toString() - { - return graphics.toString(); - } - - public void translate(int x, int y) - { - graphics.translate(x,y); - backBufferGraphics.translate(x,y); - } - - //---------------------------------------------------------------------------------- - - // - // Graphics2D - // ========== - // - public void addRenderingHints(Map hints) - { - graphics.addRenderingHints(hints); - backBufferGraphics.addRenderingHints(hints); - } - - public void clip(Shape s) - { - graphics.clip(s); - backBufferGraphics.clip(s); - } - - public void draw(Shape s) - { - graphics.draw(s); - backBufferGraphics.draw(s); - } - - public void drawGlyphVector(GlyphVector g, float x, float y) - { - graphics.drawGlyphVector(g,x,y); - backBufferGraphics.drawGlyphVector(g,x,y); - } - - public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) - { - graphics.drawImage(img,op,x,y); - backBufferGraphics.drawImage(img,op,x,y); - } - - public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) - { - backBufferGraphics.drawImage(img,xform,obs); - return graphics.drawImage(img,xform,obs); - } - - public void drawRenderableImage(RenderableImage img, AffineTransform xform) - { - graphics.drawRenderableImage(img,xform); - backBufferGraphics.drawRenderableImage(img,xform); - } - - public void drawRenderedImage(RenderedImage img, AffineTransform xform) - { - graphics.drawRenderedImage(img,xform); - backBufferGraphics.drawRenderedImage(img,xform); - } - - public void drawString(AttributedCharacterIterator iterator, float x, float y) - { - graphics.drawString(iterator,x,y); - backBufferGraphics.drawString(iterator,x,y); - } - - public void drawString(String s, float x, float y) - { - graphics.drawString(s,x,y); - backBufferGraphics.drawString(s,x,y); - } - - public void fill(Shape s) - { - graphics.fill(s); - backBufferGraphics.fill(s); - } - - public Color getBackground() - { - return graphics.getBackground(); - } - - public Composite getComposite() - { - return graphics.getComposite(); - } - - public GraphicsConfiguration getDeviceConfiguration() - { - return graphics.getDeviceConfiguration(); - } - - public FontRenderContext getFontRenderContext() - { - return graphics.getFontRenderContext(); - } - - public Paint getPaint() - { - return graphics.getPaint(); - } - - public Object getRenderingHint(RenderingHints.Key hintKey) - { - return graphics.getRenderingHint(hintKey); - } - - public RenderingHints getRenderingHints() - { - return graphics.getRenderingHints(); - } - - public Stroke getStroke() - { - return graphics.getStroke(); - } - - public AffineTransform getTransform() - { - return graphics.getTransform(); - } - - public boolean hit(Rectangle rect, Shape s, boolean onStroke) - { - return graphics.hit(rect,s,onStroke); - } - - public void rotate(double theta) - { - graphics.rotate(theta); - backBufferGraphics.rotate(theta); - } - - public void rotate(double theta, double x, double y) - { - graphics.rotate(theta,x,y); - backBufferGraphics.rotate(theta,x,y); - } - - public void scale(double sx, double sy) - { - graphics.scale(sx,sy); - backBufferGraphics.scale(sx,sy); - } - - public void setBackground(Color color) - { - graphics.setBackground(color); - backBufferGraphics.setBackground(color); - } - - public void setComposite(Composite comp) - { - graphics.setComposite(comp); - backBufferGraphics.setComposite(comp); - } - - public void setPaint(Paint paint) - { - graphics.setPaint(paint); - backBufferGraphics.setPaint(paint); - } - - public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) - { - graphics.setRenderingHint(hintKey,hintValue); - backBufferGraphics.setRenderingHint(hintKey,hintValue); - } - - public void setRenderingHints(Map hints) - { - graphics.setRenderingHints(hints); - backBufferGraphics.setRenderingHints(hints); - } - - public void setStroke(Stroke s) - { - graphics.setStroke(s); - backBufferGraphics.setStroke(s); - } - - public void setTransform(AffineTransform Tx) - { - graphics.setTransform(Tx); - backBufferGraphics.setTransform(Tx); - } - - public void shear(double shx, double shy) - { - graphics.shear(shx,shy); - backBufferGraphics.shear(shx,shy); - } - - public void transform(AffineTransform Tx) - { - graphics.transform(Tx); - backBufferGraphics.transform(Tx); - } - - public void translate(double tx, double ty) - { - graphics.translate(tx,ty); - backBufferGraphics.translate(tx,ty); - } -} diff --git a/canvas/source/java/CanvasBase.java b/canvas/source/java/CanvasBase.java deleted file mode 100644 index 5f086e268069..000000000000 --- a/canvas/source/java/CanvasBase.java +++ /dev/null @@ -1,344 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasBase.java,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; -import java.awt.geom.*; - -public abstract class CanvasBase - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.rendering.XCanvas -{ - // to be overridden - public abstract Graphics2D getGraphics(); - - //---------------------------------------------------------------------------------- - - // - // XCanvas interface - // ================= - // - public synchronized void clear() - { - Graphics2D graphics = getGraphics(); - // TODO(F3): retrieve true dimensions of the Graphics - graphics.clearRect(0,0,1000,1000); - } - - public synchronized void drawPoint( RealPoint2D aPoint, - ViewState viewState, - RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - - // calculate the domain value for a single device pixel. we're - // using delta mapping here, to avoid later subtraction of two - // mapped values (as we really only need a transformed size, - // not a transformed point). - AffineTransform transform = graphics.getTransform(); - AffineTransform inverse; - try - { - inverse = transform.createInverse(); - } - catch( NoninvertibleTransformException e ) - { - // transformation not invertible. Nothing to render then. - return; - } - - java.awt.geom.Point2D.Double pointSize = new java.awt.geom.Point2D.Double(1.0,1.0); - java.awt.geom.Point2D.Double domainPointSize = new java.awt.geom.Point2D.Double(); - inverse.deltaTransform( pointSize, domainPointSize ); - - // render a circle one device pixel wide - Ellipse2D.Double ellipse = new Ellipse2D.Double(aPoint.X, aPoint.Y, domainPointSize.x, domainPointSize.y); - - // render, at last - graphics.fill( ellipse ); - - CanvasUtils.printLog( "XCanvas: drawPoint called" ); - } - - public synchronized void drawLine( RealPoint2D aStartPoint, - RealPoint2D aEndPoint, - ViewState viewState, - RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - graphics.setStroke( new BasicStroke() ); - - // setup line object - Line2D.Double line = new Line2D.Double(aStartPoint.X, aStartPoint.Y, aEndPoint.X, aEndPoint.Y); - - // render, at last - graphics.draw( line ); - - CanvasUtils.printLog( "XCanvas: drawLine called" ); - } - - public synchronized void drawBezier( RealBezierSegment2D aBezierSegment, - RealPoint2D aEndPoint, - ViewState viewState, - RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - graphics.setStroke( new BasicStroke() ); - - // setup bezier object - CubicCurve2D.Double curve = new CubicCurve2D.Double(aBezierSegment.Px, aBezierSegment.Py, - aBezierSegment.C1x, aBezierSegment.C1y, - aBezierSegment.C2x, aBezierSegment.C2y, - aEndPoint.X, aEndPoint.Y); - - // render, at last - graphics.draw( curve ); - - CanvasUtils.printLog( "XCanvas: drawbezier called" ); - } - - public synchronized XCachedPrimitive drawPolyPolygon( XPolyPolygon2D xPolyPolygon, - ViewState viewState, - RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.drawPolyPolygon() called" ); - - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - graphics.setStroke( new BasicStroke() ); - - // render the polygon - // TODO: maybe use Graphics.drawPolyline here! - graphics.draw( CanvasUtils.makeGeneralPath(xPolyPolygon) ); - - CanvasUtils.printLog( "XCanvas: drawPolyPolygon called" ); - - return null; - } - - public synchronized XCachedPrimitive strokePolyPolygon( XPolyPolygon2D xPolyPolygon, - ViewState viewState, - RenderState renderState, - StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException - { - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - CanvasUtils.applyStrokeAttributes( graphics, strokeAttributes ); - - // stroke the polygon - graphics.draw( CanvasUtils.makeGeneralPath(xPolyPolygon) ); - - CanvasUtils.printLog( "XCanvas: strokePolyPolygon called" ); - - return null; - } - - public synchronized XCachedPrimitive strokeTexturedPolyPolygon( XPolyPolygon2D xPolyPolygon, - ViewState viewState, - RenderState renderState, - Texture[] textures, - StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException - { - return null; - } - - public synchronized XCachedPrimitive strokeTextureMappedPolyPolygon( XPolyPolygon2D xPolyPolygon, - ViewState viewState, - RenderState renderState, - Texture[] textures, - com.sun.star.geometry.XMapping2D xMapping, - StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException - { - return null; - } - - public synchronized XPolyPolygon2D queryStrokeShapes( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon, - com.sun.star.rendering.ViewState viewState, - com.sun.star.rendering.RenderState renderState, - com.sun.star.rendering.StrokeAttributes strokeAttributes ) throws com.sun.star.lang.IllegalArgumentException - { - return null; - } - - public synchronized XCachedPrimitive fillPolyPolygon( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon, - com.sun.star.rendering.ViewState viewState, - com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.fillPolyPolygon() called" ); - - // cache - Graphics2D graphics = getGraphics(); - - // initialize the Graphics2D - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - - // fill the polygon - graphics.fill( CanvasUtils.makeGeneralPath(xPolyPolygon) ); - - CanvasUtils.printLog( "XCanvas: fillPolyPolygon called" ); - - return null; - } - - public synchronized XCachedPrimitive fillTexturedPolyPolygon( com.sun.star.rendering.XPolyPolygon2D xPolyPolygon, - com.sun.star.rendering.ViewState viewState, - com.sun.star.rendering.RenderState renderState, - com.sun.star.rendering.Texture [] textures ) throws com.sun.star.lang.IllegalArgumentException - { - return null; - } - - public synchronized XCachedPrimitive fillTextureMappedPolyPolygon( XPolyPolygon2D xPolyPolygon, - ViewState viewState, - RenderState renderState, - Texture[] textures, - com.sun.star.geometry.XMapping2D xMapping ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException - { - return null; - } - - public synchronized XCanvasFont createFont( FontRequest fontRequest, com.sun.star.beans.PropertyValue[] extraFontProperties, com.sun.star.geometry.Matrix2D fontMatrix ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO: support extra arguments - return new CanvasFont( fontRequest, this ); - } - - public FontInfo[] queryAvailableFonts( FontInfo aFilter, com.sun.star.beans.PropertyValue[] aFontProperties ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - return null; - } - - public XCachedPrimitive drawText( StringContext text, XCanvasFont xFont, ViewState viewState, RenderState renderState, byte textDirection ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.drawText() called" ); - - // cache - Graphics2D graphics = getGraphics(); - - CanvasUtils.printLog( "XCanvas: drawText called" ); - - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - CanvasUtils.setupGraphicsFont( graphics, viewState, renderState, xFont ); - - CanvasUtils.printLog( "XCanvas: drawText rendering \""+ text.Text.substring(text.StartPosition, text.StartPosition+text.Length) + "\"" ); - - graphics.drawString( text.Text.substring(text.StartPosition, text.StartPosition+text.Length), (float)0.0, (float)0.0 ); - return null; - } - - public XCachedPrimitive drawTextLayout( XTextLayout layoutetText, ViewState viewState, RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.drawOffsettedText() called" ); - - // cache - Graphics2D graphics = getGraphics(); - - CanvasUtils.printLog( "XCanvas: drawOffsettedText called" ); - - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - CanvasUtils.setupGraphicsFont( graphics, viewState, renderState, layoutetText.getFont() ); - - CanvasUtils.printLog( "XCanvas: drawOffsettedText canvas setup done" ); - - if( layoutetText instanceof TextLayout ) - { - ((TextLayout)layoutetText).draw( graphics ); - } - else - { - CanvasUtils.printLog( "drawTextLayout: mismatching TextLayout object." ); - throw new com.sun.star.lang.IllegalArgumentException(); - } - - return null; - } - - public synchronized XCachedPrimitive drawBitmap( com.sun.star.rendering.XBitmap xBitmap, - com.sun.star.rendering.ViewState viewState, - com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.drawBitmap() called" ); - - // cache - Graphics2D graphics = getGraphics(); - - CanvasUtils.setupGraphicsState( graphics, viewState, renderState, CanvasUtils.alsoSetupPaint ); - - java.awt.image.BufferedImage bitmap = CanvasUtils.getBufferedImage( xBitmap ); - - if( !graphics.drawImage(bitmap, 0, 0, null) ) - CanvasUtils.printLog( "CanvasBase.drawBitmap: image paint incomplete" ); - - CanvasUtils.postRenderImageTreatment( bitmap ); - - return null; - } - - public synchronized XCachedPrimitive drawBitmapModulated( com.sun.star.rendering.XBitmap xBitmap, - com.sun.star.rendering.ViewState viewState, - com.sun.star.rendering.RenderState renderState ) throws com.sun.star.lang.IllegalArgumentException - { - CanvasUtils.printLog( "CanvasBase.drawBitmapModulated() called" ); - - // TODO(F3): Implement channel modulation - return drawBitmap(xBitmap, - viewState, - renderState); - } - - public synchronized XGraphicDevice getDevice() - { - CanvasUtils.printLog( "CanvasBase.getDevice() called" ); - return new CanvasGraphicDevice( getGraphics() ); - } -} diff --git a/canvas/source/java/CanvasBitmap.java b/canvas/source/java/CanvasBitmap.java deleted file mode 100644 index e55d96b76472..000000000000 --- a/canvas/source/java/CanvasBitmap.java +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasBitmap.java,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -public class CanvasBitmap - extends CanvasBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.rendering.XBitmapCanvas, - com.sun.star.rendering.XIntegerBitmap -{ - private java.awt.image.BufferedImage bitmap; - private java.awt.Graphics2D graphics; - - public CanvasBitmap( java.awt.image.BufferedImage _bitmap ) - { - bitmap = _bitmap; - graphics = bitmap.createGraphics(); - } - - public CanvasBitmap( IntegerSize2D mySize ) - { - bitmap = new java.awt.image.BufferedImage(mySize.Width, mySize.Height, - java.awt.image.BufferedImage.TYPE_4BYTE_ABGR); - graphics = bitmap.createGraphics(); - } - - public CanvasBitmap( RealSize2D newSize, boolean beFast, CanvasBitmap source ) - { -// java.awt.geom.AffineTransform transform = new java.awt.geom.AffineTransform(); -// transform.scale( newSize.width/size.Width, newSize.height/size.Height ); - -// // TODO: Maybe keep the image returned via -// // bitmap.getScaledInstance, and do scaling lazy. -// bitmap = new java.awt.image.BufferedImage((int)(newSize.width+.5), -// (int)(newSize.height+.5), -// java.awt.image.BufferedImage.TYPE_4BYTE_ABGR); - -// java.awt.image.AffineTransformOp transformer = -// new java.awt.image.AffineTransformOp( transform, -// java.awt.image.AffineTransformOp.TYPE_BILINEAR); - -// transformer.filter(source.getBufferedImage(), bitmap); - } - - public synchronized java.awt.image.BufferedImage getBufferedImage() - { - return bitmap; - } - - public java.awt.Graphics2D getGraphics() - { - return graphics; - } - - // - // XBitmap implementation - // ====================== - // - - public synchronized IntegerSize2D getSize() - { - return new IntegerSize2D( bitmap.getWidth(), - bitmap.getHeight() ); - } - - //---------------------------------------------------------------------------------- - - public synchronized XBitmapCanvas queryBitmapCanvas() - { - return this; - } - - //---------------------------------------------------------------------------------- - - public synchronized com.sun.star.rendering.XBitmap getScaledBitmap( RealSize2D newSize, boolean beFast ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException - { - return new CanvasBitmap( newSize, beFast, this ); - } - - //---------------------------------------------------------------------------------- - - public synchronized boolean hasAlpha() - { - // TODO - return false; - } - - //---------------------------------------------------------------------------------- - - // - // XBitmapCanvas impl - // ================== - // - - public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas, - com.sun.star.geometry.RealRectangle2D sourceRect, - com.sun.star.rendering.ViewState sourceViewState, - com.sun.star.rendering.RenderState sourceRenderState, - com.sun.star.geometry.RealRectangle2D destRect, - com.sun.star.rendering.ViewState destViewState, - com.sun.star.rendering.RenderState destRenderState ) - { - CanvasUtils.printLog( "JavaCanvas.copyRect() called" ); - - // TODO: create temp image when transform is non-trivial - - if( sourceCanvas == this ) - { - // copy rectangle within the canvas - getGraphics().copyArea((int)sourceRect.X1, - (int)sourceRect.Y1, - (int)(sourceRect.X2 - sourceRect.X1), - (int)(sourceRect.Y2 - sourceRect.Y1), - (int)(destRect.X1 - sourceRect.X1), - (int)(destRect.Y1 - sourceRect.Y1) ); - } - else - { - if( sourceCanvas instanceof JavaCanvas ) - { - // cache - CanvasUtils.setupGraphicsState( getGraphics(), destViewState, destRenderState, CanvasUtils.alsoSetupPaint ); - - java.awt.Image backBuffer = ((JavaCanvas)sourceCanvas).backBuffer.getBackBuffer(); - - // TODO: really extract correct source rect here - getGraphics().drawImage( backBuffer, 0, 0, null); - CanvasUtils.postRenderImageTreatment( backBuffer ); - } - // TODO: foreign canvas - } - } - - //---------------------------------------------------------------------------------- - - // - // XIntegerBitmap implementation - // ============================= - // - - public synchronized byte[] getData( IntegerBitmapLayout[] bitmapLayout, - IntegerRectangle2D rect ) - { - int [] pixelData = bitmap.getRGB( rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y1 - rect.Y2, null, 0, 0 ); - - return CanvasUtils.int2byte( pixelData ); - } - - //---------------------------------------------------------------------------------- - - public synchronized void setData( byte[] data, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerRectangle2D rect ) - { - int [] pixelData = CanvasUtils.byte2int( data ); - bitmap.setRGB( rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y2 - rect.Y1, pixelData, 0, bitmap.getWidth() ); - } - - //---------------------------------------------------------------------------------- - - public synchronized void setPixel( byte[] color, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerPoint2D pos ) - { - if( color.length != 4 ) - CanvasUtils.printLog( "CanvasBitmap.setPixel: Wrong color format" ); - - int pixel = color[0] + (color[1] + (color[2] + color[3]*256)*256)*256; - bitmap.setRGB( pos.X, pos.Y, pixel ); - } - - //---------------------------------------------------------------------------------- - - public synchronized byte[] getPixel( IntegerBitmapLayout[] bitmapLayout, - IntegerPoint2D pos ) - { - int pixel = bitmap.getRGB( pos.X, pos.Y ); - - byte[] res = new byte[4]; - res[0] = (byte)(pixel & 255); - res[1] = (byte)((pixel/256) & 255); - res[2] = (byte)((pixel/256/256) & 255); - res[3] = (byte)((pixel/256/256/256) & 255); - - return res; - } - - //---------------------------------------------------------------------------------- - - public synchronized XBitmapPalette getPalette() - { - return null; - } - - //---------------------------------------------------------------------------------- - - public synchronized IntegerBitmapLayout getMemoryLayout() - { - // TODO: finish that one - IntegerBitmapLayout layout = new IntegerBitmapLayout(); - - return layout; - } - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - - private static final String s_implName = "XIntegerBitmap.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.IntegerBitmap"; - - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/CanvasClonedSprite.java b/canvas/source/java/CanvasClonedSprite.java deleted file mode 100644 index 0976f0adbbaa..000000000000 --- a/canvas/source/java/CanvasClonedSprite.java +++ /dev/null @@ -1,188 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasClonedSprite.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.geom.*; - -public class CanvasClonedSprite - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.rendering.XSprite, - com.sun.star.lang.XServiceInfo, - SpriteBase -{ - private JavaCanvas canvas; - private double alpha; - private java.awt.geom.Point2D.Double outputPosition; - private SpriteRep spriteRep; - private SpriteBase original; - - //---------------------------------------------------------------------------------- - - public CanvasClonedSprite( JavaCanvas _canvas, - XSprite _original ) - { - CanvasUtils.printLog( "CanvasClonesSprite constructor called!" ); - - canvas = _canvas; - - if( _original instanceof SpriteBase ) - { - original = (SpriteBase)_original; - } - - alpha = 0.0; - outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0); - - // TODO: throw on error here! - } - - //---------------------------------------------------------------------------------- - - // - // SpriteBase - // ========== - // - public SpriteRep getSpriteRep() - { - if( spriteRep == null ) - { - spriteRep = new SpriteRep( original.getSpriteRep() ); - - spriteRep.moveSprite( outputPosition ); - spriteRep.setSpriteAlpha( alpha ); - - // TODO: Check for spriteRep.buffer != null here, throw otherwise - } - return spriteRep; - } - - //---------------------------------------------------------------------------------- - - // - // XComponent - // ========== - // - public void dispose() - { - canvas = null; - spriteRep = null; - original = null; - - super.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XSprite impl - // ================== - // - - public synchronized void setPriority( double nPriority ) - { - // TODO - } - - public synchronized void setAlpha( double _alpha ) - { - alpha = _alpha; - - if( spriteRep != null ) - { - spriteRep.setSpriteAlpha( alpha ); - } - } - - public synchronized void move( RealPoint2D _aNewPos, - ViewState _viewState, - RenderState _renderState ) - { - // transform given point with concatenated transformation - AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState ); - transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X, - _aNewPos.Y), - outputPosition ); - - if( spriteRep != null ) - { - spriteRep.moveSprite( outputPosition ); - } - } - - public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - } - - public synchronized void clip( XPolyPolygon2D aClip ) - { - // TODO - } - - public synchronized void show() - { - canvas.showSprite( this ); - canvas.updateScreen( false ); - } - - public synchronized void hide() - { - canvas.hideSprite( this ); - } - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XSprite.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.Sprite"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/CanvasCustomSprite.java b/canvas/source/java/CanvasCustomSprite.java deleted file mode 100644 index 3440f2f60dcd..000000000000 --- a/canvas/source/java/CanvasCustomSprite.java +++ /dev/null @@ -1,207 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasCustomSprite.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; -import java.awt.geom.*; - -public class CanvasCustomSprite - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.rendering.XCustomSprite, - com.sun.star.lang.XServiceInfo, - SpriteBase -{ - private JavaCanvas canvas; - private RealSize2D spriteSize; - private Graphics2D referenceGraphics; - private double alpha; - private java.awt.geom.Point2D.Double outputPosition; - private SpriteRep spriteRep; - - //---------------------------------------------------------------------------------- - - public CanvasCustomSprite( RealSize2D _spriteSize, - JavaCanvas _canvas, - Graphics2D _referenceGraphics ) - { - CanvasUtils.printLog( "CanvasCustomSprite constructor called, size is (" + _spriteSize.Width + ", " + _spriteSize.Height + ")" ); - - canvas = _canvas; - spriteSize = _spriteSize; - referenceGraphics = _referenceGraphics; - alpha = 0.0; - outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0); - } - - //---------------------------------------------------------------------------------- - - // - // SpriteBase - // ========== - // - public synchronized SpriteRep getSpriteRep() - { - if( spriteRep == null ) - { - spriteRep = new SpriteRep(); - - spriteRep.setupBuffer(referenceGraphics, (int)(spriteSize.Width+.5), (int)(spriteSize.Height+.5) ); - - spriteRep.moveSprite( outputPosition ); - spriteRep.setSpriteAlpha( alpha ); - } - return spriteRep; - } - - //---------------------------------------------------------------------------------- - - // - // XComponent - // ========== - // - public void dispose() - { - if( spriteRep != null ) - spriteRep.dispose(); - - canvas = null; - referenceGraphics = null; - spriteRep = null; - - super.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XCustomSprite impl - // ================== - // - - public synchronized void setPriority( double nPriority ) - { - // TODO - } - - public synchronized void setAlpha( double _alpha ) - { - CanvasUtils.printLog( "CanvasCustomSprite.setAlpha() called" ); - - alpha = _alpha; - - if( spriteRep != null ) - { - spriteRep.setSpriteAlpha( alpha ); - } - } - - public synchronized void move( RealPoint2D _aNewPos, - ViewState _viewState, - RenderState _renderState ) - { - CanvasUtils.printLog( "CanvasCustomSprite.move() called" ); - - // transform given point with concatenated transformation - AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState ); - transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X, - _aNewPos.Y), - outputPosition ); - - if( spriteRep != null ) - { - spriteRep.moveSprite( outputPosition ); - } - } - - public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - } - - public synchronized void clip( XPolyPolygon2D aClip ) - { - // TODO - } - - public synchronized void show() - { - CanvasUtils.printLog( "CanvasCustomSprite.show() called" ); - - canvas.showSprite( this ); - canvas.updateScreen( false ); - } - - public synchronized void hide() - { - CanvasUtils.printLog( "CanvasCustomSprite.hide() called" ); - - canvas.hideSprite( this ); - - // do _not_ dispose clear SpriteRep, since we cannot actively - // repaint ourselves - } - - public synchronized com.sun.star.rendering.XCanvas getContentCanvas() - { - CanvasUtils.printLog( "CanvasCustomSprite.getContentCanvas() called" ); - - return getSpriteRep().getContentCanvas(); - } - - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XCustomSprite.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.CustomSprite"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/CanvasFont.java b/canvas/source/java/CanvasFont.java deleted file mode 100644 index c8f0d76395ba..000000000000 --- a/canvas/source/java/CanvasFont.java +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasFont.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; - -public class CanvasFont - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.rendering.XCanvasFont -{ - private CanvasBase associatedCanvas; - private com.sun.star.rendering.FontRequest fontRequest; - private java.awt.Font font; - - //---------------------------------------------------------------------------------- - - public CanvasFont( com.sun.star.rendering.FontRequest _fontRequest, - CanvasBase _canvas ) - { - associatedCanvas = _canvas; - fontRequest = _fontRequest; - - // TODO: Use proper attributes here, first of all, use fractional point font size - font = new java.awt.Font( fontRequest.FontDescription.FamilyName, java.awt.Font.PLAIN, (int)(fontRequest.CellSize + .5) ); - } - - public java.awt.Font getFont() - { - return font; - } - - //---------------------------------------------------------------------------------- - - // - // XCanvasFont implementation - // =========================== - // - - public XTextLayout createTextLayout( StringContext aText, byte nDirection, long nRandomSeed ) - { - return new TextLayout( aText, nDirection, nRandomSeed, this, associatedCanvas ); - } - - public FontRequest getFontRequest( ) - { - return fontRequest; - } - - public FontMetrics getFontMetrics( ) - { - // TODO - return null; - } - - public double[] getAvailableSizes( ) - { - // TODO - return null; - } - - public com.sun.star.beans.PropertyValue[] getExtraFontProperties( ) - { - // TODO - return null; - } - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - - private static final String s_implName = "CanvasFont.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.XCanvasFont"; - - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/CanvasGraphicDevice.java b/canvas/source/java/CanvasGraphicDevice.java deleted file mode 100644 index 1c9c99b7a408..000000000000 --- a/canvas/source/java/CanvasGraphicDevice.java +++ /dev/null @@ -1,225 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasGraphicDevice.java,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; - -public class CanvasGraphicDevice - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.beans.XPropertySet, - com.sun.star.rendering.XGraphicDevice -{ - private java.awt.Graphics2D graphics; - private java.awt.GraphicsConfiguration graphicsConfig; - - //---------------------------------------------------------------------------------- - - public CanvasGraphicDevice( java.awt.Graphics2D _graphics ) - { - graphics = _graphics; - graphicsConfig = graphics.getDeviceConfiguration(); - } - - //---------------------------------------------------------------------------------- - - // - // GraphicsDevice implementation - // ============================= - // - public synchronized XBufferController getBufferController() - { - // Use java.awt.image.BufferStrategy to implement XBufferController - CanvasUtils.printLog( "CanvasGraphicDevice.getBufferController!" ); - return null; - } - - public synchronized XColorSpace getDeviceColorSpace() - { - CanvasUtils.printLog( "CanvasGraphicDevice.getDeviceColorSpace!" ); - return null; - } - - public synchronized com.sun.star.geometry.RealSize2D getPhysicalResolution() - { - CanvasUtils.printLog( "CanvasGraphicDevice.getPhysicalResolution!" ); - // TODO: getDefaultTransform + getNormalizingTransform - return new com.sun.star.geometry.RealSize2D(100,100); - } - - public synchronized com.sun.star.geometry.RealSize2D getPhysicalSize() - { - CanvasUtils.printLog( "CanvasGraphicDevice.getSize!" ); - java.awt.Rectangle bounds = graphicsConfig.getBounds(); - - return new com.sun.star.geometry.RealSize2D(bounds.width, bounds.height); - } - - public synchronized XLinePolyPolygon2D createCompatibleLinePolyPolygon( RealPoint2D[][] points ) - { - CanvasUtils.printLog( "createCompatibleLinePolyPolygon" ); - return new LinePolyPolygon( points ); - } - - public synchronized XBezierPolyPolygon2D createCompatibleBezierPolyPolygon( RealBezierSegment2D[][] points ) - { - CanvasUtils.printLog( "createCompatibleBezierPolyPolygon" ); - return new BezierPolyPolygon( points ); - } - - public synchronized com.sun.star.rendering.XBitmap createCompatibleBitmap( IntegerSize2D size ) - { - CanvasUtils.printLog( "createCompatibleBitmap called with size (" + size.Width + ", " + size.Height + ")" ); - return new CanvasBitmap( graphicsConfig.createCompatibleImage( size.Width, - size.Height, - Transparency.OPAQUE ) ); - } - - public synchronized com.sun.star.rendering.XVolatileBitmap createVolatileBitmap( IntegerSize2D size ) - { - CanvasUtils.printLog( "createVolatileBitmap called with size (" + size.Width + ", " + size.Height + ")" ); - //return new CanvasBitmap( graphicsConfig.createCompatibleVolatileImage( size.Width, size.Height ) ); - return null; - } - - public synchronized com.sun.star.rendering.XBitmap createCompatibleAlphaBitmap( IntegerSize2D size ) - { - CanvasUtils.printLog( "createCompatibleBitmap called with size (" + size.Width + ", " + size.Height + ")" ); - return new CanvasBitmap( graphicsConfig.createCompatibleImage( size.Width, - size.Height, - Transparency.TRANSLUCENT ) ); - } - - public synchronized com.sun.star.rendering.XVolatileBitmap createVolatileAlphaBitmap( IntegerSize2D size ) - { - CanvasUtils.printLog( "createVolatileBitmap called with size (" + size.Width + ", " + size.Height + ")" ); - //return new CanvasBitmap( graphicsConfig.createCompatibleVolatileImage( size.Width, size.Height ) ); - return null; - } - - public synchronized com.sun.star.rendering.XParametricPolyPolygon2DFactory getParametricPolyPolygonFactory() - { - // TODO - return null; - } - - public synchronized com.sun.star.beans.XPropertySetInfo getPropertySetInfo() - { - // This is a stealth property set - return null; - } - - public synchronized void setPropertyValue( String aPropertyName, java.lang.Object aValue ) throws com.sun.star.beans.PropertyVetoException - { - // all our properties are read-only - throw new com.sun.star.beans.PropertyVetoException(); - } - - public synchronized java.lang.Object getPropertyValue( String PropertyName ) throws com.sun.star.beans.UnknownPropertyException - { - if( PropertyName == "DeviceHandle" ) - return graphics; - - throw new com.sun.star.beans.UnknownPropertyException(); - } - - public synchronized void addPropertyChangeListener( String aPropertyName, com.sun.star.beans.XPropertyChangeListener xListener ) throws com.sun.star.beans.UnknownPropertyException - { - if( aPropertyName == "DeviceHandle" ) - return; - - throw new com.sun.star.beans.UnknownPropertyException(); - } - - public synchronized void removePropertyChangeListener( String aPropertyName, com.sun.star.beans.XPropertyChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException - { - if( aPropertyName == "DeviceHandle" ) - return; - - throw new com.sun.star.beans.UnknownPropertyException(); - } - - public synchronized void addVetoableChangeListener( String PropertyName, com.sun.star.beans.XVetoableChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException - { - if( PropertyName == "DeviceHandle" ) - return; - - throw new com.sun.star.beans.UnknownPropertyException(); - } - - public synchronized void removeVetoableChangeListener( String PropertyName, com.sun.star.beans.XVetoableChangeListener aListener ) throws com.sun.star.beans.UnknownPropertyException - { - if( PropertyName == "DeviceHandle" ) - return; - - throw new com.sun.star.beans.UnknownPropertyException(); - } - - - public synchronized boolean hasFullScreenMode() - { - return graphicsConfig.getDevice().isFullScreenSupported(); - } - - public synchronized boolean enterFullScreenMode( boolean bEnter ) - { - return false; - } - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - - private static final String s_implName = "XGraphicsDevice.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.GraphicsDevice"; - - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } - -} diff --git a/canvas/source/java/CanvasSprite.java b/canvas/source/java/CanvasSprite.java deleted file mode 100644 index 630b9ed386aa..000000000000 --- a/canvas/source/java/CanvasSprite.java +++ /dev/null @@ -1,311 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasSprite.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; -import java.awt.geom.*; - -public class CanvasSprite - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.rendering.XAnimatedSprite, - com.sun.star.lang.XServiceInfo, - SpriteBase -{ - private XAnimation spriteAnimation; - private JavaCanvas canvas; - private Graphics2D referenceGraphics; - private SpriteRunner runner; - private ViewState viewState; - private double alpha; - private java.awt.geom.Point2D.Double outputPosition; - private SpriteRep spriteRep; - - //---------------------------------------------------------------------------------- - - public CanvasSprite( XAnimation _animation, JavaCanvas _canvas, Graphics2D _referenceGraphics ) - { - CanvasUtils.printLog( "CanvasSprite constructor called!" ); - - spriteAnimation = _animation; - canvas = _canvas; - referenceGraphics = _referenceGraphics; - alpha = 0.0; - outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0); - - runner = new SpriteRunner( this, spriteAnimation, canvas ); - } - - public synchronized ViewState getViewState() - { - return viewState; - } - - //---------------------------------------------------------------------------------- - - // - // SpriteBase - // ========== - // - public synchronized SpriteRep getSpriteRep() - { - if( spriteRep == null ) - { - spriteRep = new SpriteRep(); - - setupSpriteBuffering( CanvasUtils.makeTransform( getViewState().AffineTransform ) ); - - spriteRep.moveSprite( outputPosition ); - spriteRep.setSpriteAlpha( alpha ); - - // render initial sprite content - updateAnimation(); - } - return spriteRep; - } - - //---------------------------------------------------------------------------------- - - // - // XComponent - // ========== - // - public void dispose() - { - // end the animation thread - if( runner != null ) - { - runner.quit(); - try - { - runner.join(0); // and wait until it's really over - } - catch( java.lang.InterruptedException e ) {} - } - - if( spriteRep != null ) - spriteRep.dispose(); - - canvas = null; - spriteAnimation = null; - runner = null; - referenceGraphics = null; - spriteRep = null; - - super.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XSprite impl - // ============ - // - - public synchronized void startAnimation( double speed ) - { - runner.startAnimation( speed ); - } - - public synchronized void stopAnimation() - { - runner.stopAnimation(); - } - - public synchronized void resetAnimation() - { - runner.resetAnimation(); - } - - public synchronized void updateAnimation() - { - // only call render explicitely, if animation not - // running. Otherwise, next animation render will update - // anyway. - if( spriteRep != null && - !runner.isAnimationActive() ) - { - spriteRep.renderAnimation( spriteAnimation, getViewState(), runner.getCurrentT() ); - } - } - - public synchronized void setPriority( double nPriority ) - { - // TODO - } - - public synchronized void setAlpha( double _alpha ) - { - alpha = _alpha; - - if( spriteRep != null ) - { - spriteRep.setSpriteAlpha( alpha ); - } - } - - public synchronized void move( com.sun.star.geometry.RealPoint2D _aNewPos, - com.sun.star.rendering.ViewState _viewState, - com.sun.star.rendering.RenderState _renderState ) - { - // transform given point with concatenated transformation - AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState ); - transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X, - _aNewPos.Y), - outputPosition ); - - if( spriteRep != null ) - { - spriteRep.moveSprite( outputPosition ); - } - } - - public synchronized void transform( AffineMatrix2D aTransformation ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - } - - public synchronized void clip( XPolyPolygon2D aClip ) - { - // TODO - } - - public synchronized void show() - { - canvas.showSprite( this ); - canvas.updateScreen( false ); - } - - public synchronized void hide() - { - canvas.hideSprite( this ); - - // dispose and clear SpriteRep, animation content can be - // regenerated at any time - if( spriteRep != null ) - spriteRep.dispose(); - - spriteRep = null; - } - - public synchronized void setViewState( ViewState _viewState ) - { - viewState = CanvasUtils.createAnimationViewState(_viewState, - getAnimationAttributes()); - - CanvasUtils.printTransform( CanvasUtils.makeTransform( viewState.AffineTransform ), - "CanvasSprite.setViewState" ); - - if( spriteRep != null ) - { - // calculate bounds of view-transformed animation output rectangle - setupSpriteBuffering( CanvasUtils.makeTransform(getViewState().AffineTransform) ); - updateAnimation(); - } - } - - public synchronized AnimationAttributes getAnimationAttributes() - { - return spriteAnimation.getAnimationAttributes(); - } - - public synchronized void setAll( RealPoint2D _aNewPos, - ViewState _viewState, - RenderState _renderState, - double _alpha, - boolean bUpdateAnimation ) - { - alpha = _alpha; - - // transform given point with concatenated transformation - AffineTransform transform = CanvasUtils.ViewConcatRenderTransform( _viewState, _renderState ); - transform.transform( new java.awt.geom.Point2D.Double(_aNewPos.X, - _aNewPos.Y), - outputPosition ); - - if( spriteRep != null ) - { - spriteRep.setSpriteAlpha( alpha ); - spriteRep.moveSprite( outputPosition ); - - if( bUpdateAnimation ) - updateAnimation(); - } - } - - //---------------------------------------------------------------------------------- - - private void setupSpriteBuffering( AffineTransform _viewTransform ) - { - // determine bounds of view-transformed animation output rectangle - com.sun.star.geometry.RealSize2D animSize = getAnimationAttributes().UntransformedSize; - - java.awt.geom.Rectangle2D.Double aTransformedBounds = - CanvasUtils.calcTransformedRectBounds( new java.awt.geom.Rectangle2D.Double(0.0,0.0, - animSize.Width, - animSize.Height), - _viewTransform ); - CanvasUtils.printTransform( _viewTransform, "setupSpriteBuffering" ); - CanvasUtils.printLog( "setupSpriteBuffering: bounds are (" + aTransformedBounds.width + ", " + aTransformedBounds.height + ")" ); - - // create a buffer of the appropriate size - spriteRep.setupBuffer(referenceGraphics, (int)(aTransformedBounds.width+.5), - (int)(aTransformedBounds.height+.5) ); - } - - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XSprite.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.Sprite"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/CanvasTest_perftest.java b/canvas/source/java/CanvasTest_perftest.java deleted file mode 100644 index 035fce6b38b3..000000000000 --- a/canvas/source/java/CanvasTest_perftest.java +++ /dev/null @@ -1,679 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasTest_perftest.java,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.IQueryInterface; -import com.sun.star.lang.XInitialization; -import com.sun.star.lib.uno.helper.WeakBase; - -// OOo AWT -import com.sun.star.awt.*; - -// Canvas -import com.sun.star.rendering.*; - -// Java AWT -import java.awt.*; -import java.awt.image.*; -import java.awt.geom.*; - -public class CanvasTest - extends CanvasBase - implements com.sun.star.awt.XWindow, - com.sun.star.rendering.XSpriteCanvas, - com.sun.star.lang.XServiceInfo, - com.sun.star.lang.XInitialization -{ - private WindowAdapter dummyFrame; - private BackBuffer backBuffer; - private java.awt.image.BufferStrategy bufferStrategy; - - private java.awt.Font fpsFont; - private long lastTime; - - - // TEST ONLY { - private static int testWidth = 1600; - private static int testHeight = 1200; - private BufferedImage backgroundBuffer; - private BufferedImage buffer; - private BufferedImage buffer2; - private Graphics2D backBufGraphics; - private Graphics2D bufferGraphics; - private Graphics2D buffer2Graphics; - private float currAlpha; - // TEST ONLY } - - - - public Graphics2D getGraphics() - { - return backBuffer.getGraphics(); - } - - //---------------------------------------------------------------------------------- - - // - // XInitialization - // =============== - // - public void initialize( java.lang.Object[] arguments ) - { - CanvasUtils.printLog( "CanvasTest.initialize called!" ); - - // Do that as the very first thing. The Java2D internal - // classes choose their render path at initialization time, - // thus this must happen before doing _any_ GUI. - - // TODO: Put those flags into javarc/java.ini, we're maybe - // coming late into a running JVM! - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - CanvasUtils.printLog( "System detected: " + os ); - - // tweak some speed knobs... - if( os.startsWith("Windows") ) - { - System.setProperty("sun.java2d.translaccel", "true"); - System.setProperty("sun.java2d.ddforcevram", "true"); - //System.setProperty("sun.java2d.accthreshold", "0"); - - CanvasUtils.printLog( "Optimizing for Windows" ); - } - else - { - System.setProperty("sun.java2d.opengl", "true"); - - CanvasUtils.printLog( "Optimizing for Unix" ); - } - - /* we're initialized with the following array of anys: - - arguments[0] = pointer to VCL window - arguments[1] = Integer (operating system window handle) - arguments[2] = com.sun.star.awt.Rectangle (position and size within that OS window) - arguments[3] = boolean (fullsize window or not) - - We then generate a dummy Java frame with that window as the - parent, to fake a root window for the Java implementation. - */ - try - { - com.sun.star.awt.Rectangle boundRect = (com.sun.star.awt.Rectangle) arguments[2]; - - //boolean isFullScreen = arguments[1]; - boolean isFullScreen = true; - //AnyConverter.toBoolean( arguments[3] ) ); - - // fake a root for Java in VCL window. Pass the flag - // whether we shall run fullscreen, too. - dummyFrame = new WindowAdapter( AnyConverter.toInt( arguments[1] ), isFullScreen ); - - if( isFullScreen ) - { - // blow window up to fullscreen. Otherwise, we cannot clear the whole screen, - // which results in ugly flickering - Dimension screenSize = dummyFrame.frame.getToolkit().getScreenSize(); - boundRect.X = 0; - boundRect.Y = 0; - boundRect.Width = screenSize.width-1; - boundRect.Height = screenSize.height-1; - } - - dummyFrame.setPosSize( boundRect.X, boundRect.Y, boundRect.Width, boundRect.Height, (short)0 ); - CanvasUtils.printLog( "Window size: " + boundRect.Width + ", " + boundRect.Height ); - - // TEST - if( true ) - { - backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(), - Math.max(1,boundRect.Width), - Math.max(1,boundRect.Height) ); - } - else - { - backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(), - 10, 10 ); - } - - // TODO: Maybe delay double buffer init until first sprite creation - dummyFrame.frame.createBufferStrategy(2); - bufferStrategy = dummyFrame.frame.getBufferStrategy(); - - if( bufferStrategy.getCapabilities().isPageFlipping() ) - CanvasUtils.printLog( "CanvasTest.initialize double buffering is using page flipping!" ); - else - CanvasUtils.printLog( "CanvasTest.initialize double buffering is using blitting!" ); - - lastTime = System.currentTimeMillis(); - fpsFont = new java.awt.Font( "Times", Font.PLAIN, 20 ); - - - if( false ) - { - // TEST ONLY { - Graphics2D frameGraphics= (Graphics2D) dummyFrame.frame.getGraphics(); - backgroundBuffer = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight); // TODO: size dynamic - buffer = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight, - Transparency.TRANSLUCENT); - buffer2 = frameGraphics.getDeviceConfiguration().createCompatibleImage(testWidth,testHeight, - Transparency.TRANSLUCENT); - bufferGraphics = (Graphics2D)buffer.getGraphics(); - buffer2Graphics = (Graphics2D)buffer2.getGraphics(); - backBufGraphics = (Graphics2D)backgroundBuffer.getGraphics(); - currAlpha = 0.1f; - - // init content - Font font = new Font( "Times", Font.PLAIN, 100 ); - - bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR)); - bufferGraphics.fillRect( 0,0,testWidth,testHeight ); - - bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); - bufferGraphics.setColor( Color.red ); - bufferGraphics.fillRect( 0,0,testWidth/2,testHeight/2 ); - bufferGraphics.setColor( Color.green ); - bufferGraphics.fillRect( testWidth/2,0,testWidth,testHeight/2 ); - bufferGraphics.setColor( Color.blue ); - bufferGraphics.fillRect( 0,testHeight/2,testWidth/2,testHeight ); - - buffer2Graphics.setColor( Color.red ); - buffer2Graphics.fillRect( 0,0,testWidth/2,testHeight/2 ); - buffer2Graphics.setColor( Color.green ); - buffer2Graphics.fillRect( testWidth/2,0,testWidth,testHeight/2 ); - buffer2Graphics.setColor( Color.blue ); - buffer2Graphics.fillRect( 0,testHeight/2,testWidth/2,testHeight ); - - backBufGraphics.setColor( Color.white ); - backBufGraphics.fillRect(0,0,testWidth,testHeight); - backBufGraphics.setColor( Color.red ); - backBufGraphics.setFont( font ); - int i, turns=15; - for(i=0; i 1.0 ) currAlpha = 0.1f; - // TEST ONLY } - } - - if( true ) - { - // repaint background - backBuffer.redraw( graph ); - - // repaint all active sprites - java.util.Set entries = activeSprites.entrySet(); - java.util.Iterator iter = entries.iterator(); - while( iter.hasNext() ) - { - java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); - if( entry.getValue() != null ) - ((SpriteRep)entry.getValue()).redraw(graph); - } - } - - long currTime = System.currentTimeMillis(); - graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) ); - graph.setFont( fpsFont ); - graph.setColor( java.awt.Color.black ); - - try - { - String fps = new String( String.valueOf(1000.0/(currTime-lastTime)) ); - graph.drawString( fps.substring(0,5) + " fps", 0, 20); - CanvasUtils.printLog( fps.substring(0,5) + " fps" ); - } - catch( Exception e ) - { - graph.drawString( "0 fps", 0, 20); - } - - lastTime = currTime; - } - finally - { - if( graph != null ) - graph.dispose(); - } - - bufferStrategy.show(); - } - - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XCanvas.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.Canvas"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public synchronized String getImplementationName() - { - return s_implName; - } - - public synchronized String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public synchronized boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } - - public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory( - String implName, - com.sun.star.lang.XMultiServiceFactory multiFactory, - com.sun.star.registry.XRegistryKey regKey ) - { - if (implName.equals( s_implName )) - { - return com.sun.star.comp.loader.FactoryHelper.getServiceFactory( - CanvasTest.class, s_serviceName, multiFactory, regKey ); - } - return null; - } - - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey regKey ) - { - return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - s_implName, s_serviceName, regKey ); - } -} diff --git a/canvas/source/java/CanvasUtils.java b/canvas/source/java/CanvasUtils.java deleted file mode 100644 index 423bb6954e06..000000000000 --- a/canvas/source/java/CanvasUtils.java +++ /dev/null @@ -1,630 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: CanvasUtils.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.UnoRuntime; - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; -import java.awt.geom.*; - -public class CanvasUtils -{ - // - // Canvas utilities - // ================ - // - public static java.awt.geom.AffineTransform makeTransform( AffineMatrix2D ooTransform ) - { - return new AffineTransform( ooTransform.m00, - ooTransform.m10, - ooTransform.m01, - ooTransform.m11, - ooTransform.m02, - ooTransform.m12 ); - } - - public static AffineMatrix2D makeAffineMatrix2D( java.awt.geom.AffineTransform transform ) - { - double[] matrix = new double[6]; - transform.getMatrix( matrix ); - - return new AffineMatrix2D( matrix[0], matrix[2], matrix[4], - matrix[1], matrix[3], matrix[5] ); - } - - public static void initGraphics( Graphics2D graphics ) - { - if( graphics != null ) - { - java.awt.RenderingHints hints = new java.awt.RenderingHints(null); - boolean hq = true; - - if( hq ) - { - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_FRACTIONALMETRICS, - java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON ) ); -// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, -// java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, - java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) ); -// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION, -// java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION, - java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR) ); -// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING, -// java.awt.RenderingHints.VALUE_RENDER_QUALITY) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING, - java.awt.RenderingHints.VALUE_RENDER_SPEED) ); -// hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL, -// java.awt.RenderingHints.VALUE_STROKE_NORMALIZE) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL, - java.awt.RenderingHints.VALUE_STROKE_DEFAULT) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ANTIALIASING, - java.awt.RenderingHints.VALUE_ANTIALIAS_ON) ); - } - else - { - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ALPHA_INTERPOLATION, - java.awt.RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_INTERPOLATION, - java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_RENDERING, - java.awt.RenderingHints.VALUE_RENDER_SPEED) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_STROKE_CONTROL, - java.awt.RenderingHints.VALUE_STROKE_DEFAULT) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_ANTIALIASING, - java.awt.RenderingHints.VALUE_ANTIALIAS_OFF) ); - } - - // the least common denominator standard - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_FRACTIONALMETRICS, - java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_ON) ); - hints.add( new java.awt.RenderingHints( java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, - java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON) ); - - graphics.setRenderingHints( hints ); - } - } - - //---------------------------------------------------------------------------------- - - public static java.awt.geom.GeneralPath makeGenPathFromBezierPoints( RealBezierSegment2D [][] points ) - { - java.awt.geom.GeneralPath path = new java.awt.geom.GeneralPath(); - - // extract every polygon into GeneralPath object - for( int i=0; i 0 ) - path.moveTo((float) points[i][0].Px, (float) points[i][0].Py); - - for( int j=1; j 0 ) - path.moveTo((float) points[i][0].X, (float) points[i][0].Y); - - for( int j=1; j - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.AnyConverter; - -// OOo AWT -import com.sun.star.awt.*; - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -// Java AWT -import java.awt.*; - -public class JavaCanvas - extends CanvasBase - implements com.sun.star.awt.XWindow, - com.sun.star.rendering.XSpriteCanvas, - com.sun.star.rendering.XIntegerBitmap, - com.sun.star.lang.XServiceInfo, - com.sun.star.lang.XInitialization -{ - private WindowAdapter dummyFrame; - public BackBuffer backBuffer; - private java.awt.image.BufferStrategy bufferStrategy; - - private java.awt.Font fpsFont; - private long lastTime; - private com.sun.star.awt.Rectangle boundRect; - - public Graphics2D getGraphics() - { - return backBuffer.getGraphics(); - } - - //---------------------------------------------------------------------------------- - - // - // XInitialization - // =============== - // - public void initialize( java.lang.Object[] arguments ) - { - CanvasUtils.printLog( "JavaCanvas.initialize called!" ); - - // Do that as the very first thing. The Java2D internal - // classes choose their render path at initialization time, - // thus this must happen before doing _any_ GUI. - - // TODO: Put those flags into javarc/java.ini, we're maybe - // coming late into a running JVM! - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - CanvasUtils.printLog( "System detected: " + os ); - - // tweak some speed knobs... -// if( os.startsWith("Windows") ) -// { -// System.setProperty("sun.java2d.translaccel", "true"); -// System.setProperty("sun.java2d.ddforcevram", "true"); -// //System.setProperty("sun.java2d.accthreshold", "0"); - -// CanvasUtils.printLog( "Optimizing for Windows" ); -// } -// else -// { -// System.setProperty("sun.java2d.opengl", "true"); - -// CanvasUtils.printLog( "Optimizing for Unix" ); -// } - - /* we're initialized with the following array of anys: - - arguments[0] = pointer to VCL window - arguments[1] = Integer (operating system window handle) - arguments[2] = com.sun.star.awt.Rectangle (position and size within that OS window) - arguments[3] = boolean (fullsize window or not) - - We then generate a dummy Java frame with that window as the - parent, to fake a root window for the Java implementation. - */ - try - { - boundRect = (com.sun.star.awt.Rectangle) arguments[2]; - - //boolean isFullScreen = arguments[1]; - boolean isFullScreen = true; - //AnyConverter.toBoolean( arguments[3] ) ); - - // fake a root for Java in VCL window. Pass the flag - // whether we shall run fullscreen, too. - dummyFrame = new WindowAdapter( AnyConverter.toInt( arguments[1] ), isFullScreen ); - - if( isFullScreen ) - { - // blow window up to fullscreen. Otherwise, we cannot clear the whole screen, - // which results in ugly flickering - Dimension screenSize = dummyFrame.frame.getToolkit().getScreenSize(); - boundRect.X = 0; - boundRect.Y = 0; - boundRect.Width = screenSize.width-1; - boundRect.Height = screenSize.height-1; - } - - dummyFrame.setPosSize( boundRect.X, boundRect.Y, boundRect.Width, boundRect.Height, (short)0 ); - CanvasUtils.printLog( "Window size: " + boundRect.Width + ", " + boundRect.Height ); - - backBuffer = new BackBuffer( (Graphics2D) dummyFrame.frame.getGraphics(), - Math.max(1,boundRect.Width), - Math.max(1,boundRect.Height) ); - - // TODO: Maybe delay double buffer init until first sprite creation - dummyFrame.frame.createBufferStrategy(2); - bufferStrategy = dummyFrame.frame.getBufferStrategy(); - - if( bufferStrategy.getCapabilities().isPageFlipping() ) - CanvasUtils.printLog( "JavaCanvas.initialize double buffering is using page flipping!" ); - else - CanvasUtils.printLog( "JavaCanvas.initialize double buffering is using blitting!" ); - - lastTime = System.currentTimeMillis(); - fpsFont = new java.awt.Font( "Times", Font.PLAIN, 20 ); - - CanvasUtils.printLog( "JavaCanvas.initialize finished!" ); - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - CanvasUtils.printLog( "Cannot create EmbeddedFrame within VCL window hierarchy!" ); - } - } - - //---------------------------------------------------------------------------------- - - // - // XComponent - // ========== - // - public void dispose() - { - CanvasUtils.printLog( "JavaCanvas: disposed!" ); - - // destroy all active sprites - java.util.Set entries = activeSprites.entrySet(); - java.util.Iterator iter = entries.iterator(); - - while( iter.hasNext() ) - { - java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); - if( entry.getValue() != null ) - ((SpriteRep)entry.getValue()).dispose(); - } - - if( bufferStrategy != null ) - bufferStrategy.getDrawGraphics().dispose(); // really necessary? - - if( dummyFrame != null ) - dummyFrame.dispose(); - - if( backBuffer != null) - backBuffer.dispose(); - - bufferStrategy = null; - dummyFrame = null; - backBuffer = null; - - super.dispose(); - } - - //---------------------------------------------------------------------------------- - - public JavaCanvas( XComponentContext xContext ) - { - CanvasUtils.printLog( "JavaCanvas constructor called!" ); - activeSprites = new java.util.HashMap( 33 ); - } - - //---------------------------------------------------------------------------------- - - // - // XWindow interface - // ================= - // - // This is delegated to WindowAdapter! - // - public synchronized void setPosSize( int X, int Y, int Width, int Height, short Flags ) - { - if( dummyFrame != null ) - { - dummyFrame.setPosSize( X, Y, Width, Height, Flags ); - - Width = Math.max(1,Width); - Height= Math.max(1,Height); - - CanvasUtils.printLog( "JavaCanvas graphics set to " + Width + "," + Height ); - backBuffer.setSize(Width,Height); - } - } - - public synchronized com.sun.star.awt.Rectangle getPosSize( ) - { - if( dummyFrame != null ) - return dummyFrame.getPosSize(); - - return new com.sun.star.awt.Rectangle(); - } - - public synchronized void setVisible( boolean visible ) - { - if( dummyFrame != null ) - dummyFrame.setVisible( visible ); - } - - public synchronized void setEnable( boolean enable ) - { - if( dummyFrame != null ) - dummyFrame.setEnable( enable ); - } - - public synchronized void setFocus() - { - if( dummyFrame != null ) - dummyFrame.setFocus(); - } - - public synchronized void addWindowListener( XWindowListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addWindowListener( xListener ); - } - - public synchronized void removeWindowListener( XWindowListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removeWindowListener( xListener ); - } - - public synchronized void addFocusListener( XFocusListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addFocusListener( xListener ); - } - - public synchronized void removeFocusListener( XFocusListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removeFocusListener( xListener ); - } - - public synchronized void addKeyListener( XKeyListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addKeyListener( xListener ); - } - - public synchronized void removeKeyListener( XKeyListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removeKeyListener( xListener ); - } - - public synchronized void addMouseListener( XMouseListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addMouseListener( xListener ); - } - - public synchronized void removeMouseListener( XMouseListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removeMouseListener( xListener ); - } - - public synchronized void addMouseMotionListener( XMouseMotionListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addMouseMotionListener( xListener ); - } - - public synchronized void removeMouseMotionListener( XMouseMotionListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removeMouseMotionListener( xListener ); - } - - public synchronized void addPaintListener( XPaintListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.addPaintListener( xListener ); - } - - public synchronized void removePaintListener( XPaintListener xListener ) - { - if( dummyFrame != null ) - dummyFrame.removePaintListener( xListener ); - } - - //---------------------------------------------------------------------------------- - - // - // XBitmapCanvas impl - // ================== - // - - public synchronized void copyRect( com.sun.star.rendering.XBitmapCanvas sourceCanvas, - com.sun.star.geometry.RealRectangle2D sourceRect, - com.sun.star.rendering.ViewState sourceViewState, - com.sun.star.rendering.RenderState sourceRenderState, - com.sun.star.geometry.RealRectangle2D destRect, - com.sun.star.rendering.ViewState destViewState, - com.sun.star.rendering.RenderState destRenderState ) - { - CanvasUtils.printLog( "JavaCanvas.copyRect() called" ); - - // TODO: create temp image when transform is non-trivial - - if( sourceCanvas == this ) - { - // copy rectangle within the canvas - getGraphics().copyArea((int)sourceRect.X1, - (int)sourceRect.Y1, - (int)(sourceRect.X2 - sourceRect.X1), - (int)(sourceRect.Y2 - sourceRect.Y1), - (int)(destRect.X1 - sourceRect.X1), - (int)(destRect.Y1 - sourceRect.Y1) ); - } - else - { - if( sourceCanvas instanceof JavaCanvas ) - { - // cache - CanvasUtils.setupGraphicsState( getGraphics(), destViewState, destRenderState, CanvasUtils.alsoSetupPaint ); - - java.awt.Image backBuffer = ((JavaCanvas)sourceCanvas).backBuffer.getBackBuffer(); - - // TODO: really extract correct source rect here - getGraphics().drawImage( backBuffer, 0, 0, null); - CanvasUtils.postRenderImageTreatment( backBuffer ); - } - // TODO: foreign canvas - } - } - - //---------------------------------------------------------------------------------- - - // a map of SpriteReps, with Sprite object as keys. Contains all - // active (i.e. visible) sprites, the SpriteReps are used to - // repaint the sprite content at any time. - private java.util.HashMap activeSprites; - - // - // XSpriteCanvas impl - // ================== - // - - public synchronized com.sun.star.rendering.XAnimatedSprite createSpriteFromAnimation( XAnimation animation ) - { - CanvasUtils.printLog( "JavaCanvas.createSpriteFromAnimation called" ); - - return new CanvasSprite( animation, this, (Graphics2D)dummyFrame.frame.getGraphics() ); - } - - public synchronized XAnimatedSprite createSpriteFromBitmaps( com.sun.star.rendering.XBitmap[] animationBitmaps, - byte interpolationMode ) - { - return null; - } - - public synchronized XCustomSprite createCustomSprite( RealSize2D spriteSize ) - { - CanvasUtils.printLog( "JavaCanvas.createCustomSprite called" ); - - return new CanvasCustomSprite( spriteSize, this, (Graphics2D)dummyFrame.frame.getGraphics() ); - } - - public synchronized XSprite createClonedSprite( XSprite original ) - { - return new CanvasClonedSprite( this, original ); - } - - public synchronized boolean updateScreen( boolean bUpdateAll ) - { - redrawAllLayers(); - - return true; - } - - // - // XBitmap implementation - // ====================== - // - - public synchronized IntegerSize2D getSize() - { - return new IntegerSize2D( boundRect.Width, - boundRect.Height ); - } - - //---------------------------------------------------------------------------------- - - public synchronized XBitmapCanvas queryBitmapCanvas() - { - return this; - } - - //---------------------------------------------------------------------------------- - - public synchronized com.sun.star.rendering.XBitmap getScaledBitmap( RealSize2D newSize, boolean beFast ) throws com.sun.star.lang.IllegalArgumentException, VolatileContentDestroyedException - { - // TODO - return null; - } - - //---------------------------------------------------------------------------------- - - public synchronized boolean hasAlpha() - { - // TODO - return false; - } - - //---------------------------------------------------------------------------------- - - // - // XIntegerBitmap implementation - // ============================= - // - - public synchronized byte[] getData( IntegerBitmapLayout[] bitmapLayout, - IntegerRectangle2D rect ) - { - // TODO - return null; - } - - //---------------------------------------------------------------------------------- - - public synchronized void setData( byte[] data, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerRectangle2D rect ) - { - // TODO - } - - //---------------------------------------------------------------------------------- - - public synchronized void setPixel( byte[] color, IntegerBitmapLayout bitmapLayout, com.sun.star.geometry.IntegerPoint2D pos ) - { - // TODO - } - - //---------------------------------------------------------------------------------- - - public synchronized byte[] getPixel( IntegerBitmapLayout[] bitmapLayout, - IntegerPoint2D pos ) - { - // TODO - return null; - } - - //---------------------------------------------------------------------------------- - - public synchronized XBitmapPalette getPalette() - { - // TODO - return null; - } - - //---------------------------------------------------------------------------------- - - public synchronized IntegerBitmapLayout getMemoryLayout() - { - // TODO: finish that one - IntegerBitmapLayout layout = new IntegerBitmapLayout(); - - return layout; - } - - //---------------------------------------------------------------------------------- - - // - // XSpriteCanvas helper - // ==================== - // - public synchronized void renderAnimation( CanvasSprite sprite, XAnimation animation, double t ) - { - SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite ); - if( spriteRep != null ) - { - //Graphics2D graph = getWindowGraphics(); - - // TODO: ensure update of graphics object externally, e.g. when - // VCL moves the toplevel window. - //java.awt.Rectangle bounds = dummyFrame.frame.getBounds(); - //graphics.setGraphics(graph, bounds.width, bounds.height); - - spriteRep.renderAnimation( animation, sprite.getViewState(), t ); - } - else - { - CanvasUtils.printLog( "JavaCanvas.renderAnimation sprite not active!" ); - } - } - - public synchronized void showSprite( SpriteBase sprite ) - { - CanvasUtils.printLog( "JavaCanvas.showSprite() called" ); - - SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite ); - if( spriteRep != null ) - { - CanvasUtils.printLog( "JavaCanvas.showSprite sprite already active!" ); - } - else - { - spriteRep = sprite.getSpriteRep(); - - // a valid SpriteRep for a given Sprite in the - // activeSprites hash denotes 'sprite active' - activeSprites.put( sprite, spriteRep ); - - // TODO: TEMP! Just for testing! Set empty cursor for presentation -// dummyFrame.frame.setCursor( dummyFrame.frame.getToolkit().createCustomCursor(new java.awt.image.BufferedImage(0,0, -// java.awt.image.BufferedImage.TYPE_INT_RGB), -// new java.awt.Point(0,0), -// "") ); - } - } - - public synchronized void hideSprite( SpriteBase sprite ) - { - CanvasUtils.printLog( "JavaCanvas.hideSprite() called" ); - - SpriteRep spriteRep = (SpriteRep)activeSprites.get( sprite ); - if( spriteRep != null ) - { - activeSprites.put( sprite, null ); - redrawAllLayers(); - } - else - { - CanvasUtils.printLog( "JavaCanvas.hideSprite sprite not active!" ); - } - } - - private void redrawAllLayers() - { - // fetch the Graphics object to draw into (we're doing double - // buffering here, the content is later shown via - // bufferStrategy.show(). - Graphics2D graph = null; - - try - { - graph = (Graphics2D)bufferStrategy.getDrawGraphics(); - - GraphicsDevice device = graph.getDeviceConfiguration().getDevice(); - CanvasUtils.printLog( "Available vram: " + device.getAvailableAcceleratedMemory() ); - - // repaint background - backBuffer.redraw( graph ); - - // repaint all active sprites - java.util.Set entries = activeSprites.entrySet(); - java.util.Iterator iter = entries.iterator(); - while( iter.hasNext() ) - { - java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); - if( entry.getValue() != null ) - ((SpriteRep)entry.getValue()).redraw(graph); - } - - long currTime = System.currentTimeMillis(); - graph.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER) ); - graph.setFont( fpsFont ); - graph.setColor( java.awt.Color.black ); - - try - { - String fps = new String( String.valueOf(1000.0/(currTime-lastTime)) ); - graph.drawString( fps.substring(0,5) + " fps", 0, 20); - CanvasUtils.printLog( fps.substring(0,5) + " fps" ); - } - catch( Exception e ) - { - graph.drawString( "0 fps", 0, 20); - } - - lastTime = currTime; - } - catch( Exception e ) - { - CanvasUtils.printLog( "Exception thrown in redrawAllLayers" ); - } - finally - { - if( graph != null ) - graph.dispose(); - } - - bufferStrategy.show(); - } - - //---------------------------------------------------------------------------------- - - private static final String s_implName = "XCanvas.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.JavaCanvas"; - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - public synchronized String getImplementationName() - { - return s_implName; - } - - public synchronized String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public synchronized boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } - - public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory( - String implName, - com.sun.star.lang.XMultiServiceFactory multiFactory, - com.sun.star.registry.XRegistryKey regKey ) - { - if (implName.equals( s_implName )) - { - return com.sun.star.comp.loader.FactoryHelper.getServiceFactory( - JavaCanvas.class, s_serviceName, multiFactory, regKey ); - } - return null; - } - - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey regKey ) - { - return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - s_implName, s_serviceName, regKey ); - } -} diff --git a/canvas/source/java/LinePolyPolygon.java b/canvas/source/java/LinePolyPolygon.java deleted file mode 100644 index 4c67f387a8de..000000000000 --- a/canvas/source/java/LinePolyPolygon.java +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: LinePolyPolygon.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; -import com.sun.star.geometry.*; - -public class LinePolyPolygon - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.rendering.XLinePolyPolygon2D -{ - private java.awt.geom.GeneralPath path; - - //---------------------------------------------------------------------------------- - - public LinePolyPolygon( RealPoint2D[][] points ) - { - setPoints( points, 0 ); - } - - public java.awt.geom.GeneralPath getJavaPath() - { - return path; - } - - //---------------------------------------------------------------------------------- - - // - // XPolyPolygon implementation - // =========================== - // - public synchronized void addPolyPolygon( RealPoint2D position, XPolyPolygon2D polyPolygon ) - { - } - - public synchronized int getNumberOfPolygons( ) - { - return 0; - } - - public synchronized int getNumberOfPolygonPoints( int polygon ) - { - return 0; - } - - public synchronized FillRule getFillRule( ) - { - if( path.getWindingRule() == java.awt.geom.GeneralPath.WIND_EVEN_ODD ) - return FillRule.EVEN_ODD; - else - return FillRule.NON_ZERO; - } - - public synchronized void setFillRule( FillRule fillRule ) - { - if( fillRule == FillRule.EVEN_ODD ) - path.setWindingRule( java.awt.geom.GeneralPath.WIND_EVEN_ODD ); - else - path.setWindingRule( java.awt.geom.GeneralPath.WIND_NON_ZERO ); - } - - public synchronized boolean isClosed( int index ) - { - // TODO - return false; - } - - public synchronized void setClosed( int index, boolean closedState ) - { - // TODO - } - - //---------------------------------------------------------------------------------- - - // - // XLinePolyPolygon implementation - // =============================== - // - public synchronized RealPoint2D[][] getPoints( int nPolygonIndex, int nNumberOfPolygons, int nPointIndex, int nNumberOfPoints ) - { - // TODO: Implement subsetting - -// double [] points = new double[6]; - -// // BAH! Use util.Vector here! - -// // find number of subpaths -// PathIterator aIter = path.getPathIterator( new AffineTransform() ); -// int nNumSubPaths = 0; -// while( !aIter.isDone() ) -// { -// if( aIter.currentSegment(points) == SEG_MOVETO ) -// ++nNumSubPaths; - -// aIter.next(); -// } - -// Point2D [][] aRes = new Point2D[nNumSubPaths][]; -// aIter = path.getPathIterator( new AffineTransform() ); -// while( !aIter.isDone() ) -// { -// switch( aIter.currentSegment(points) ) -// { -// case SEG_MOVETO: -// break; - -// case SEG_LINETO: -// break; - -// case SEG_CLOSE: -// break; - -// default: -// CanvasUtils.printLog( "LinePolyPolygon.getPoints(): unexpected path type" ); -// break; -// } - -// aIter.next(); -// } -// double [] points = new double[6]; - - return null; - } - - public synchronized void setPoints( RealPoint2D[][] points, int nPolygonIndex ) - { - if( nPolygonIndex != 0 ) - CanvasUtils.printLog( "LinePolyPolygon.setPoints: subset not yet implemented!" ); - - path = CanvasUtils.makeGenPathFromLinePoints( points ); - } - - public synchronized RealPoint2D getPoint( int nPolygonIndex, int nPointIndex ) - { - return null; - } - - public synchronized void setPoint( RealPoint2D point, int nPolygonIndex, int nPointIndex ) - { - CanvasUtils.printLog( "LinePolyPolygon.setPoint: not yet implemented!" ); - } - - //---------------------------------------------------------------------------------- - - // - // XServiceInfo impl - // ================= - // - - private static final String s_implName = "XLinePolyPolygon2D.java.impl"; - private static final String s_serviceName = "com.sun.star.rendering.LinePolyPolygon2D"; - - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } -} diff --git a/canvas/source/java/SpriteBase.java b/canvas/source/java/SpriteBase.java deleted file mode 100644 index d275275454c4..000000000000 --- a/canvas/source/java/SpriteBase.java +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: SpriteBase.java,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas - -public interface SpriteBase -{ - // to be overridden - public SpriteRep getSpriteRep(); -} diff --git a/canvas/source/java/SpriteRep.java b/canvas/source/java/SpriteRep.java deleted file mode 100644 index 62755dd01ec0..000000000000 --- a/canvas/source/java/SpriteRep.java +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: SpriteRep.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; - -// Java AWT -import java.awt.*; -import java.awt.geom.*; - -public class SpriteRep -{ - private java.awt.image.BufferedImage buffer; - private CanvasBitmap canvasBitmap; - private double alpha; - private java.awt.geom.Point2D.Double outputPosition; - private boolean bufferOwned; - - //---------------------------------------------------------------------------------- - - // TODO: Everything in this class - // TODO: Implement lifetime control for buffer object, which is shared between SpriteReps - public SpriteRep() - { - CanvasUtils.printLog( "SpriteRep constructor called!" ); - - alpha = 0.0; - outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0); - bufferOwned = true; // the buffer member is our own, and has to be disposed - } - - public SpriteRep( SpriteRep original ) - { - CanvasUtils.printLog( "SpriteRep clone constructor called!" ); - - alpha = 0.0; - outputPosition = new java.awt.geom.Point2D.Double(0.0,0.0); - cloneBuffer( original ); - bufferOwned = false; // the buffer member is not our own, and must not be disposed - } - - //---------------------------------------------------------------------------------- - - public synchronized void renderAnimation( XAnimation animation, ViewState viewState, double t ) - { - if( canvasBitmap != null ) - { - // clear buffer with all transparent - Graphics2D bitmapGraphics = canvasBitmap.getGraphics(); - - // before that, setup _everything_ we might have changed in CanvasUtils.setupGraphicsState - bitmapGraphics.setColor( new Color( 0.0f, 0.0f, 0.0f, 1.0f ) ); - bitmapGraphics.setComposite( - java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.CLEAR)); - bitmapGraphics.setTransform( new AffineTransform() ); - bitmapGraphics.setClip( new java.awt.Rectangle(0,0,buffer.getWidth(),buffer.getHeight()) ); - bitmapGraphics.fillRect(0,0,buffer.getWidth(),buffer.getHeight()); - - try - { - // now push the animation at time instance t into the - // virginal graphics - animation.render(canvasBitmap, viewState, t); - } - catch( com.sun.star.lang.IllegalArgumentException e ) - { - CanvasUtils.printLog( "Cannot create EmbeddedFrame within VCL window hierarchy!" ); - } - } - } - - public synchronized void setSpriteAlpha( double _alpha ) - { - CanvasUtils.printLog("SpriteRep.setSpriteAlpha called with alpha=" + alpha); - alpha = _alpha; - } - - public synchronized void moveSprite( java.awt.geom.Point2D.Double aNewPos ) - { - outputPosition = aNewPos; - CanvasUtils.printLog( "SpriteRep.moveSprite: moving to (" + outputPosition.x + ", " + outputPosition.y + ")" ); - } - - public synchronized void redraw( Graphics2D output ) - { - if( buffer != null ) - { - CanvasUtils.printLog( "SpriteRep.redraw: compositing with alpha=" + alpha ); - output.setComposite( java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, (float)alpha) ); - - output.drawImage( buffer, - (int)(outputPosition.getX() + .5), - (int)(outputPosition.getY() + .5), - null ); - - //CanvasUtils.postRenderImageTreatment( buffer ); - - CanvasUtils.printLog( "SpriteRep.redraw called, output rect is (" + - outputPosition.getX() + ", " + - outputPosition.getY() + ", " + - buffer.getWidth() + ", " + - buffer.getHeight() + ")" ); - } - } - - public synchronized void setupBuffer( java.awt.Graphics2D graphics, int width, int height ) - { - if( canvasBitmap != null ) - canvasBitmap.dispose(); - - if( buffer != null ) - buffer.flush(); - - buffer = graphics.getDeviceConfiguration().createCompatibleImage(Math.max(1,width), - Math.max(1,height), - Transparency.TRANSLUCENT); - canvasBitmap = new CanvasBitmap( buffer ); - CanvasUtils.initGraphics( canvasBitmap.getGraphics() ); - - CanvasUtils.printLog( "SpriteRep.setupBuffer called, with dimensions (" + width + ", " + height + ")" ); - } - - public synchronized void cloneBuffer( SpriteRep original ) - { - buffer = original.buffer; - } - - public synchronized com.sun.star.rendering.XCanvas getContentCanvas() - { - CanvasUtils.printLog( "SpriteRep.getContentCanvas() called" ); - - Graphics2D graphics = canvasBitmap.getGraphics(); - graphics.setTransform( new AffineTransform() ); - graphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR)); - graphics.fillRect( 0,0,buffer.getWidth(),buffer.getHeight() ); - - return canvasBitmap; - } - - public void dispose() - { - if( canvasBitmap != null ) - canvasBitmap.dispose(); - - if( buffer != null && bufferOwned ) - buffer.flush(); - - canvasBitmap = null; - buffer = null; - } -} diff --git a/canvas/source/java/SpriteRunner.java b/canvas/source/java/SpriteRunner.java deleted file mode 100644 index 4a75125e377a..000000000000 --- a/canvas/source/java/SpriteRunner.java +++ /dev/null @@ -1,203 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: SpriteRunner.java,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; - -// -// HOWTO get a Graphics2D from a window -// - -// import javax.swing.*; -// import java.awt.*; -// import java.awt.geom.*; - -// public class Stroke1 extends JFrame { -// Stroke drawingStroke = new BasicStroke(5); -// Rectangle2D rect = -// new Rectangle2D.Double(20, 40, 100, 40); - -// public void paint(Graphics g) { -// Graphics2D g2d = (Graphics2D)g; -// g2d.setStroke(drawingStroke); -// g2d.draw(rect); -// } - -// public static void main(String args[]) { -// JFrame frame = new Stroke1(); -// frame.setDefaultCloseOperation(EXIT_ON_CLOSE); -// frame.setSize(200, 100); -// frame.show(); -// } -// } - - -public class SpriteRunner - extends Thread -{ - private CanvasSprite sprite; - private XAnimation spriteAnimation; - private JavaCanvas canvas; - private double startTime; - private double currentSpeed; - private double currentT; - private boolean animationActive; - private boolean stayAlive; - - //---------------------------------------------------------------------------------- - - public SpriteRunner( CanvasSprite _sprite, XAnimation _animation, JavaCanvas _canvas ) - { - CanvasUtils.printLog( "SpriteRunner constructor called!" ); - - sprite = _sprite; - spriteAnimation = _animation; - canvas = _canvas; - startTime = 0.0; - currentSpeed = 0.0; - currentT = 0.0; - animationActive = false; - stayAlive = true; - - // Set priority to lower-than-normal, as this thread runs the - // animation in a busy loop. - setPriority( MIN_PRIORITY ); - } - - //---------------------------------------------------------------------------------- - - // - // Thread - // ====== - // - // Overriding - // - public void run() - { - // perform the animation rendering (as fast as possible, for now) - - while( stayAlive ) - { - while( animationActive ) - { - // to determine the current animation step to render, calc the - // elapsed time since this animation was started - double elapsedTime = getCurrentTime() - startTime; - - // the frame to render is determined by mapping the cycle - // duration (currentSpeed) to the [0,1] range of the animation. - currentT = (elapsedTime % currentSpeed) / currentSpeed; - - // delegate animation rendering to SpriteCanvas, as - // only this instance can enforce consistency (on-time - // saving of background etc.) - canvas.renderAnimation( sprite, spriteAnimation, currentT ); - - // TODO: Consolidate _all_ sprites per canvas into one - // thread, call updateScreen() only after all sprites - // have been processed. - - //Make changes visible - canvas.updateScreen( false ); - - // TODO: Evaluate vs. setPriority and other means -// try -// { -// // give other tasks some time to breathe (10ms - this is only meant symbolically) -// sleep(10); -// } catch( InterruptedException e ) { } - } - - // wait until animation is activated again - try - { - wait(); - } - catch( InterruptedException e ) { } - catch( IllegalMonitorStateException e ) { } - } - } - - public synchronized void startAnimation( double speed ) - { - resetAnimation(); - currentSpeed = speed; - - // start us, if not done already - if( !isAlive() ) - start(); - - // enable animation thread - animationActive = true; - - try - { - notify(); - } catch( IllegalMonitorStateException e ) { } - } - - public synchronized void stopAnimation() - { - // stop animation after the current frame has been completely - // rendered - animationActive = false; - } - - public synchronized void resetAnimation() - { - startTime = getCurrentTime(); - } - - public synchronized boolean isAnimationActive() - { - return animationActive; - } - - public synchronized void quit() - { - stayAlive = false; - stopAnimation(); - } - - public synchronized double getCurrentT() - { - return currentT; - } - - //---------------------------------------------------------------------------------- - - // helper - static double getCurrentTime() - { - // determine current time in seconds - java.util.Calendar cal = new java.util.GregorianCalendar(); - return cal.getTimeInMillis() / 1000.0; - } -} diff --git a/canvas/source/java/TextLayout.java b/canvas/source/java/TextLayout.java deleted file mode 100644 index 5495fa7e90be..000000000000 --- a/canvas/source/java/TextLayout.java +++ /dev/null @@ -1,208 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: TextLayout.java,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// Canvas -import com.sun.star.rendering.*; - -public class TextLayout - extends com.sun.star.lib.uno.helper.ComponentBase - implements com.sun.star.lang.XServiceInfo, - com.sun.star.rendering.XTextLayout -{ - private double[] advancements; - private StringContext text; - private byte direction; - private CanvasBase associatedCanvas; - private CanvasFont font; - - //---------------------------------------------------------------------------------- - - public TextLayout( StringContext aText, - byte nDirection, - long nRandomSeed, - CanvasFont _font, - CanvasBase _canvas ) - { - text = aText; - direction = nDirection; - associatedCanvas = _canvas; - font = _font; - } - - // - // XTextLayout implementation - // ========================== - // - - public XPolyPolygon2D[] queryTextShapes( ) - { - // TODO - return null; - } - - public com.sun.star.geometry.RealRectangle2D[] queryInkMeasures( ) - { - // TODO - return null; - } - - public com.sun.star.geometry.RealRectangle2D[] queryMeasures( ) - { - // TODO - return null; - } - - public double[] queryLogicalAdvancements( ) - { - // TODO - return null; - } - - public void applyLogicalAdvancements( double[] aAdvancements ) throws com.sun.star.lang.IllegalArgumentException - { - if( aAdvancements.length != text.Length ) - throw new com.sun.star.lang.IllegalArgumentException(); - - advancements = aAdvancements; - } - - public com.sun.star.geometry.RealRectangle2D queryTextBounds( ) - { - // TODO - return null; - } - - public double justify( double nSize ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - return 0; - } - - public double combinedJustify( XTextLayout[] aNextLayouts, double nSize ) throws com.sun.star.lang.IllegalArgumentException - { - // TODO - return 0; - } - - public TextHit getTextHit( /*IN*/com.sun.star.geometry.RealPoint2D aHitPoint ) - { - // TODO - return null; - } - - public Caret getCaret( int nInsertionIndex, boolean bExcludeLigatures ) throws com.sun.star.lang.IndexOutOfBoundsException - { - // TODO - return null; - } - - public int getNextInsertionIndex( int nStartIndex, int nCaretAdvancement, boolean bExcludeLigatures ) throws com.sun.star.lang.IndexOutOfBoundsException - { - // TODO - return 0; - } - - public XPolyPolygon2D queryVisualHighlighting( int nStartIndex, int nEndIndex ) throws com.sun.star.lang.IndexOutOfBoundsException - { - // TODO - return null; - } - - public XPolyPolygon2D queryLogicalHighlighting( int nStartIndex, int nEndIndex ) throws com.sun.star.lang.IndexOutOfBoundsException - { - // TODO - return null; - } - - public double getBaselineOffset( ) - { - // TODO - return 0.0; - } - - public byte getMainTextDirection( ) - { - return direction; - } - - public XCanvasFont getFont( ) - { - return font; - } - - public StringContext getText( ) - { - return text; - } - - public boolean draw( java.awt.Graphics2D graphics ) - { - // TODO: use proper advancement. Text direction need not be horizontal! - // TODO: given text string need not have a one-to-one relationship between code point and glyph (offset)! - graphics.drawString( text.Text.substring(text.StartPosition, text.StartPosition + 1), (float)0.0, (float)0.0 ); - for( int i=1; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.AnyConverter; -import com.sun.star.lang.XInitialization; -import com.sun.star.lib.uno.helper.WeakBase; - -// OOo AWT -import com.sun.star.awt.*; - -// system-dependent stuff -import sun.awt.*; - -//Apple specifics -import apple.awt.*; - - -public class WindowAdapter -// defacto implementing the interface, but not deriving from it, since -// we're no real XInterface here -// implements com.sun.star.awt.XWindow -{ - public java.awt.Frame frame; - private boolean fullscreen; - - public WindowAdapter( int windowHandle, - boolean _fullscreen ) - { - fullscreen = false; - - if( _fullscreen ) - { - // create a normal Java frame, and set it into fullscreen mode - frame = new javax.swing.JFrame( "Presentation" ); - frame.setUndecorated( true ); - frame.setVisible( true ); - - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(Aqua): entering fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); - fullscreen = true; - } - else - { - CanvasUtils.printLog( "WindowAdapter(Aqua): fullscreen not supported" ); - } - - graphics.dispose(); - } - else - { - // we're initialized with the operating system window handle - // as the parameter. We then generate a dummy Java frame with - // that window as the parent, to fake a root window for the - // Java implementation. - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - // create the embedded frame - if( os.startsWith("Mac OS X") ) - frame = new apple.awt.CEmbeddedFrame( windowHandle ); - else - throw new com.sun.star.uno.RuntimeException(); - - -// frame = new javax.swing.JFrame( "Test window" ); - -// // resize it according to the given bounds -// frame.setBounds( boundRect ); -// frame.setVisible( true ); - } - } - - //---------------------------------------------------------------------------------- - - public void dispose() - { - if( fullscreen ) - { - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(Aqua): leaving fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); - } - graphics.dispose(); - } - - if( frame != null ) - frame.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XWindow interface - // ================= - // - public void setPosSize( int X, int Y, int Width, int Height, short Flags ) - { - frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) ); - } - - public com.sun.star.awt.Rectangle getPosSize( ) - { - java.awt.Rectangle bounds = frame.getBounds(); - - return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ); - } - - public void setVisible( boolean visible ) - { - frame.setVisible( visible ); - } - - public void setEnable( boolean enable ) - { - frame.setEnabled( enable ); - } - - public void setFocus() - { - } - - public void addWindowListener( XWindowListener xListener ) - { - } - - public void removeWindowListener( XWindowListener xListener ) - { - } - - public void addFocusListener( XFocusListener xListener ) - { - } - - public void removeFocusListener( XFocusListener xListener ) - { - } - - public void addKeyListener( XKeyListener xListener ) - { - } - - public void removeKeyListener( XKeyListener xListener ) - { - } - - public void addMouseListener( XMouseListener xListener ) - { - } - - public void removeMouseListener( XMouseListener xListener ) - { - } - - public void addMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void removeMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void addPaintListener( XPaintListener xListener ) - { - } - - public void removePaintListener( XPaintListener xListener ) - { - } -} diff --git a/canvas/source/java/java_Service.java b/canvas/source/java/java_Service.java deleted file mode 100644 index 6fcaa1581ca8..000000000000 --- a/canvas/source/java/java_Service.java +++ /dev/null @@ -1,118 +0,0 @@ - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.awt.*; - -public class java_Service - extends com.sun.star.lib.uno.helper.WeakBase - implements com.sun.star.lang.XServiceInfo, foo.XBar -{ - private XToolkit m_xToolkit; - private XVclWindowPeer m_xPeer; - private javax.swing.JFrame m_frame; - - public java_Service( XComponentContext xContext ) - { - try - { - m_xToolkit = - (XToolkit) UnoRuntime.queryInterface( - XToolkit.class, - xContext.getServiceManager().createInstanceWithContext( - "com.sun.star.awt.Toolkit", xContext ) ); - } - catch (com.sun.star.uno.Exception exc) - { - throw new com.sun.star.uno.RuntimeException( - "exception occured gettin toolkit: " + exc, this ); - } - } - - // XBar impl - public void raiseAndCloseWindows( foo.XBar [] seq ) - throws com.sun.star.uno.Exception - { - for ( int nPos = 0; nPos < seq.length; ++nPos ) - seq[ nPos ].raiseWindows( "called by Java code" ); - - // modal dialog before closing - javax.swing.JOptionPane.showMessageDialog( - null, "[Java] all windows created." ); - - for ( int nPos = 0; nPos < seq.length; ++nPos ) - seq[ nPos ].closeWindows(); - } - - public void raiseWindows( String msg ) - throws com.sun.star.uno.Exception - { - // create java frame - m_frame = new javax.swing.JFrame( - "[java frame created by Java code] " + msg ); - m_frame.setSize( 500, 50 ); - m_frame.setLocation( 200, 500 ); - m_frame.setVisible( true ); - - // create office workwindow - m_xPeer = (XVclWindowPeer) UnoRuntime.queryInterface( - XVclWindowPeer.class, - m_xToolkit.createWindow( - new WindowDescriptor( - WindowClass.TOP, "workwindow", null, (short) -1, - new Rectangle( 800, 500, 500, 50 ), - WindowAttribute.SHOW | - WindowAttribute.BORDER | - WindowAttribute.SIZEABLE | - WindowAttribute.MOVEABLE | - WindowAttribute.CLOSEABLE ) ) ); - m_xPeer.setProperty( - "Title", "[office window created by Java code] " + msg ); - } - - public void closeWindows() - throws com.sun.star.uno.Exception - { - m_frame.dispose(); - m_xPeer.dispose(); - } - - - private static final String s_implName = "foo.java.impl"; - private static final String s_serviceName = "foo.java"; - - // XServiceInfo impl - public String getImplementationName() - { - return s_implName; - } - - public String [] getSupportedServiceNames() - { - return new String [] { s_serviceName }; - } - - public boolean supportsService( String serviceName ) - { - return serviceName.equals( s_serviceName ); - } - - public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory( - String implName, - com.sun.star.lang.XMultiServiceFactory multiFactory, - com.sun.star.registry.XRegistryKey regKey ) - { - if (implName.equals( s_implName )) - { - return com.sun.star.comp.loader.FactoryHelper.getServiceFactory( - java_Service.class, s_serviceName, multiFactory, regKey ); - } - return null; - } - - public static boolean __writeRegistryServiceInfo( - com.sun.star.registry.XRegistryKey regKey ) - { - return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo( - s_implName, s_serviceName, regKey ); - } -} diff --git a/canvas/source/java/makefile.mk b/canvas/source/java/makefile.mk deleted file mode 100644 index 9a06b3939c64..000000000000 --- a/canvas/source/java/makefile.mk +++ /dev/null @@ -1,97 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.11 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied 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. -# -#************************************************************************* - -# Builds the Java Canvas implementation. - -PRJNAME = canvas -PRJ = ..$/.. -TARGET = javacanvas -PACKAGE = canvas - -USE_JAVAVER:=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE: settings.mk - -.IF "$(SOLAR_JAVA)"=="TRUE" -# Since Canvas needs newer features like -# e.g. java.awt.image.BufferStrategy, -# disabled for now for everything <1.4 -.IF "$(JAVANUMVER:s/.//)" >= "000100040000" - -JAVAFILES = \ - SpriteBase.java \ - JavaCanvas.java \ - CanvasGraphicDevice.java \ - CanvasUtils.java \ - CanvasFont.java \ - CanvasBitmap.java \ - CanvasSprite.java \ - CanvasCustomSprite.java \ - CanvasClonedSprite.java \ - TextLayout.java \ - BackBuffer.java \ - LinePolyPolygon.java \ - BezierPolyPolygon.java \ - SpriteRunner.java - -.IF "$(GUIBASE)"=="unx" - -JAVAFILES += x11/WindowAdapter.java - -.ELIF "$(GUIBASE)"=="aqua" - -JAVAFILES += aqua/WindowAdapter.java - -.ELSE - -JAVAFILES += win/WindowAdapter.java - -.ENDIF # "$(GUIBASE)"=="unx" - -JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar -#JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).uno.jar -JARCOMPRESS = TRUE -#JARCLASSDIRS = $(PACKAGE) -CUSTOMMANIFESTFILE = manifest - -.ENDIF # "$(JAVANUMVER:s/.//)" >= "000100040000" -.ENDIF # "$(SOLAR_JAVA)"=="TRUE" - -# --- Targets ------------------------------------------------------ - -.INCLUDE: target.mk - -#dist: $(JAVA_FILES:b:+".class") -# +jar -cvfm $(CLASSDIR)/JavaCanvas.jar $(JARMANIFEST) $(JAVACLASSFILES) diff --git a/canvas/source/java/manifest b/canvas/source/java/manifest deleted file mode 100644 index 6ddc3ab0ae51..000000000000 --- a/canvas/source/java/manifest +++ /dev/null @@ -1 +0,0 @@ -RegistrationClassName: JavaCanvas diff --git a/canvas/source/java/perftest/PerfTest.java b/canvas/source/java/perftest/PerfTest.java deleted file mode 100644 index 0534ce3dad0b..000000000000 --- a/canvas/source/java/perftest/PerfTest.java +++ /dev/null @@ -1,317 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: PerfTest.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -import java.awt.*; -import java.awt.image.*; -import java.awt.geom.*; - - -public class PerfTest -{ - // the frame object we're generating. TODO: Remove public access. - private Frame frame; - private boolean fullscreen; - - public PerfTest() - { - fullscreen = false; - - // create a normal Java frame, and set it into fullscreen mode - frame = new javax.swing.JFrame( "PerformanceTest" ); - frame.setBounds( new Rectangle(0,0,1600,1200) ); - frame.setUndecorated( true ); - frame.setVisible( true ); - - Graphics2D graphics = (Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - System.err.println( "entering fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); - fullscreen = true; - } - else - { - System.err.println( "fullscreen not supported" ); - } - - graphics.dispose(); - } - - //---------------------------------------------------------------------------------- - - public void dispose() - { - if( fullscreen ) - { - Graphics2D graphics = (Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - System.err.println( "leaving fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); - } - graphics.dispose(); - } - - if( frame != null ) - frame.dispose(); - } - - //---------------------------------------------------------------------------------- - - public static void initGraphics( Graphics2D graphics ) - { - if( graphics != null ) - { - RenderingHints hints = new RenderingHints(null); - boolean hq = true; - - if( hq ) - { - hints.add( new RenderingHints( RenderingHints.KEY_FRACTIONALMETRICS, - RenderingHints.VALUE_FRACTIONALMETRICS_ON ) ); -// hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION, -// RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY) ); - hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION, - RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) ); -// hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION, -// RenderingHints.VALUE_INTERPOLATION_BICUBIC) ); - hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION, - RenderingHints.VALUE_INTERPOLATION_BILINEAR) ); -// hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, -// RenderingHints.VALUE_RENDER_QUALITY) ); - hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, - RenderingHints.VALUE_RENDER_SPEED) ); -// hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL, -// RenderingHints.VALUE_STROKE_NORMALIZE) ); - hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL, - RenderingHints.VALUE_STROKE_DEFAULT) ); - hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON) ); - } - else - { - hints.add( new RenderingHints( RenderingHints.KEY_ALPHA_INTERPOLATION, - RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED) ); - hints.add( new RenderingHints( RenderingHints.KEY_INTERPOLATION, - RenderingHints.VALUE_INTERPOLATION_BILINEAR) ); - hints.add( new RenderingHints( RenderingHints.KEY_RENDERING, - RenderingHints.VALUE_RENDER_SPEED) ); - hints.add( new RenderingHints( RenderingHints.KEY_STROKE_CONTROL, - RenderingHints.VALUE_STROKE_DEFAULT) ); - hints.add( new RenderingHints( RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_OFF) ); - } - - // the least common denominator standard - hints.add( new RenderingHints( RenderingHints.KEY_FRACTIONALMETRICS, - RenderingHints.VALUE_FRACTIONALMETRICS_ON) ); - hints.add( new RenderingHints( RenderingHints.KEY_TEXT_ANTIALIASING, - RenderingHints.VALUE_TEXT_ANTIALIAS_ON) ); - - graphics.setRenderingHints( hints ); - } - } - - public void run() - { - frame.createBufferStrategy(2); - BufferStrategy bufferStrategy = frame.getBufferStrategy(); - - if( bufferStrategy.getCapabilities().isPageFlipping() ) - System.err.println( "double buffering is using page flipping" ); - else - System.err.println( "double buffering is using blitting" ); - - int width = 1600; - int height = 1200; - Graphics2D graphics = (Graphics2D)frame.getGraphics(); - VolatileImage backBuffer = graphics.getDeviceConfiguration().createCompatibleVolatileImage(width,height); // TODO: size dynamic - BufferedImage buffer = graphics.getDeviceConfiguration().createCompatibleImage(width,height, - Transparency.TRANSLUCENT); - BufferedImage buffer2 = graphics.getDeviceConfiguration().createCompatibleImage(width,height, - Transparency.TRANSLUCENT); - BufferedImage buffer3 = graphics.getDeviceConfiguration().createCompatibleImage(width,height, - Transparency.TRANSLUCENT); - - GraphicsDevice device = graphics.getDeviceConfiguration().getDevice(); - System.err.println( "Images generated. Available vram: " + device.getAvailableAcceleratedMemory() ); - - Graphics2D bufferGraphics = (Graphics2D)buffer.getGraphics(); - Graphics2D buffer2Graphics = (Graphics2D)buffer2.getGraphics(); - Graphics2D buffer3Graphics = (Graphics2D)buffer3.getGraphics(); - Graphics2D backBufGraphics = (Graphics2D)backBuffer.getGraphics(); - - System.err.println( "Image graphics generated. Available vram: " + device.getAvailableAcceleratedMemory() ); - - // init Graphics - initGraphics( graphics ); - initGraphics( bufferGraphics ); - initGraphics( buffer2Graphics ); - initGraphics( backBufGraphics ); - - // init content - Font font = new Font( "Times", Font.PLAIN, 100 ); - Font fpsFont = new Font( "Times", Font.PLAIN, 20 ); - - bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.CLEAR)); - bufferGraphics.fillRect( 0,0,width,height ); - - bufferGraphics.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); - bufferGraphics.setColor( Color.red ); - bufferGraphics.fillRect( 0,0,width/2,height/2 ); - bufferGraphics.setColor( Color.green ); - bufferGraphics.fillRect( width/2,0,width,height/2 ); - bufferGraphics.setColor( Color.blue ); - bufferGraphics.fillRect( 0,height/2,width/2,height ); - - buffer2Graphics.setColor( Color.red ); - buffer2Graphics.fillRect( 0,0,width/2,height/2 ); - buffer2Graphics.setColor( Color.green ); - buffer2Graphics.fillRect( width/2,0,width,height/2 ); - buffer2Graphics.setColor( Color.blue ); - buffer2Graphics.fillRect( 0,height/2,width/2,height ); - - buffer3Graphics.setColor( Color.blue ); - buffer3Graphics.fillRect( 0,0,width/2,height/2 ); - buffer3Graphics.setColor( Color.white ); - buffer3Graphics.fillRect( width/2,0,width,height/2 ); - buffer3Graphics.setColor( Color.gray ); - buffer3Graphics.fillRect( 0,height/2,width/2,height ); - - backBufGraphics.setColor( Color.white ); - backBufGraphics.fillRect(0,0,width,height); - backBufGraphics.setColor( Color.red ); - backBufGraphics.setFont( font ); - int i, turns=15; - for(i=0; i - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -import sun.awt.*; -import com.sun.star.awt.*; - - -public class WindowAdapter -// defacto implementing the interface, but not deriving from it, since -// we're no real XInterface here -// implements com.sun.star.awt.XWindow -{ - // the frame object we're generating. TODO: Remove public access. - public java.awt.Frame frame; - private boolean fullscreen; - - public WindowAdapter( int windowHandle, - boolean _fullscreen ) - { - CanvasUtils.printLog( "WindowAdapter(X11): constructor called" ); - fullscreen = false; - - if( _fullscreen ) - { - // create a normal Java frame, and set it into fullscreen mode - frame = new javax.swing.JFrame( "Presentation" ); - frame.setUndecorated( true ); - frame.setVisible( true ); - - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(X11): entering fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); - fullscreen = true; - } - else - { - CanvasUtils.printLog( "WindowAdapter(X11): fullscreen not supported" ); - } - - graphics.dispose(); - } - else - { - // we're initialized with the operating system window handle - // as the parameter. We then generate a dummy Java frame with - // that window as the parent, to fake a root window for the - // Java implementation. - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - System.err.println("WindowAdapter created"); - - // create the embedded frame - if( os.startsWith("Linux") ) - { - // create a java frame from that - // TODO: Maybe that's the reason why we crash on Linux 1.5beta - // immediately: Try XAWT here, or naked X: sun.awt.X11.XEmbeddedFrame - - //frame = new sun.awt.motif.MEmbeddedFrame( windowHandle ); - //frame = new sun.awt.X11.XEmbeddedFrame( windowHandle ); // cannot currently compile - CanvasUtils.printLog( "WindowAdapter(X11): no frame created for now" ); - frame = null; - } - else - { - throw new com.sun.star.uno.RuntimeException(); - } - } - } - - //---------------------------------------------------------------------------------- - - public void dispose() - { - if( fullscreen ) - { - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(X11): leaving fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); - } - graphics.dispose(); - } - - if( frame != null ) - frame.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XWindow interface - // ================= - // - public void setPosSize( int X, int Y, int Width, int Height, short Flags ) - { - frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) ); - } - - public com.sun.star.awt.Rectangle getPosSize( ) - { - java.awt.Rectangle bounds = frame.getBounds(); - - return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ); - } - - public void setVisible( boolean visible ) - { - frame.setVisible( visible ); - } - - public void setEnable( boolean enable ) - { - frame.setEnabled( enable ); - } - - public void setFocus() - { - } - - public void addWindowListener( XWindowListener xListener ) - { - } - - public void removeWindowListener( XWindowListener xListener ) - { - } - - public void addFocusListener( XFocusListener xListener ) - { - } - - public void removeFocusListener( XFocusListener xListener ) - { - } - - public void addKeyListener( XKeyListener xListener ) - { - } - - public void removeKeyListener( XKeyListener xListener ) - { - } - - public void addMouseListener( XMouseListener xListener ) - { - } - - public void removeMouseListener( XMouseListener xListener ) - { - } - - public void addMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void removeMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void addPaintListener( XPaintListener xListener ) - { - } - - public void removePaintListener( XPaintListener xListener ) - { - } -} diff --git a/canvas/source/java/perftest/makefile.mk b/canvas/source/java/perftest/makefile.mk deleted file mode 100644 index 3049887d5a06..000000000000 --- a/canvas/source/java/perftest/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied 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. -# -#************************************************************************* - -# Builds the Java Canvas implementation. - -PRJNAME = canvas -PRJ = ../../.. -TARGET = PerfTest -PACKAGE = test - -# --- Settings ----------------------------------------------------- - -.INCLUDE: settings.mk - -JAVAFILES = \ - PerfTest.java - -JARFILES = jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -#JARCLASSDIRS = $(PACKAGE) -CUSTOMMANIFESTFILE = manifest - -# --- Targets ------------------------------------------------------ - -.INCLUDE: target.mk - -#dist: $(JAVA_FILES:b:+".class") -# +jar -cvfm $(CLASSDIR)/PerfTest.jar $(JARMANIFEST) $(JAVACLASSFILES) diff --git a/canvas/source/java/perftest/manifest b/canvas/source/java/perftest/manifest deleted file mode 100644 index 805a87d47b57..000000000000 --- a/canvas/source/java/perftest/manifest +++ /dev/null @@ -1 +0,0 @@ -RegistrationClassName: PerfTest diff --git a/canvas/source/java/win/WindowAdapter.java b/canvas/source/java/win/WindowAdapter.java deleted file mode 100644 index fe3a83b17e67..000000000000 --- a/canvas/source/java/win/WindowAdapter.java +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: WindowAdapter.java,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -// UNO -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.AnyConverter; -import com.sun.star.lang.XInitialization; -import com.sun.star.lib.uno.helper.WeakBase; - -// OOo AWT -import com.sun.star.awt.*; - -// system-dependent stuff -import sun.awt.*; - - -public class WindowAdapter -// defacto implementing the interface, but not deriving from it, since -// we're no real XInterface here -// implements com.sun.star.awt.XWindow -{ - public java.awt.Frame frame; - private boolean fullscreen; - - public WindowAdapter( int windowHandle, - boolean _fullscreen ) - { - fullscreen = false; - - if( _fullscreen ) - { - // create a normal Java frame, and set it into fullscreen mode - frame = new javax.swing.JFrame( "Presentation" ); - frame.setUndecorated( true ); - frame.setVisible( true ); - - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(Win32): entering fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); - fullscreen = true; - } - else - { - CanvasUtils.printLog( "WindowAdapter(Win32): fullscreen not supported" ); - } - - graphics.dispose(); - } - else - { - // we're initialized with the operating system window handle - // as the parameter. We then generate a dummy Java frame with - // that window as the parent, to fake a root window for the - // Java implementation. - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - // create the embedded frame - if( os.startsWith("Windows") ) - frame = new sun.awt.windows.WEmbeddedFrame( windowHandle ); - else - throw new com.sun.star.uno.RuntimeException(); - - -// frame = new javax.swing.JFrame( "Test window" ); - -// // resize it according to the given bounds -// frame.setBounds( boundRect ); -// frame.setVisible( true ); - } - } - - //---------------------------------------------------------------------------------- - - public void dispose() - { - if( fullscreen ) - { - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(Win32): leaving fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); - } - graphics.dispose(); - } - - if( frame != null ) - frame.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XWindow interface - // ================= - // - public void setPosSize( int X, int Y, int Width, int Height, short Flags ) - { - frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) ); - } - - public com.sun.star.awt.Rectangle getPosSize( ) - { - java.awt.Rectangle bounds = frame.getBounds(); - - return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ); - } - - public void setVisible( boolean visible ) - { - frame.setVisible( visible ); - } - - public void setEnable( boolean enable ) - { - frame.setEnabled( enable ); - } - - public void setFocus() - { - } - - public void addWindowListener( XWindowListener xListener ) - { - } - - public void removeWindowListener( XWindowListener xListener ) - { - } - - public void addFocusListener( XFocusListener xListener ) - { - } - - public void removeFocusListener( XFocusListener xListener ) - { - } - - public void addKeyListener( XKeyListener xListener ) - { - } - - public void removeKeyListener( XKeyListener xListener ) - { - } - - public void addMouseListener( XMouseListener xListener ) - { - } - - public void removeMouseListener( XMouseListener xListener ) - { - } - - public void addMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void removeMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void addPaintListener( XPaintListener xListener ) - { - } - - public void removePaintListener( XPaintListener xListener ) - { - } -} diff --git a/canvas/source/java/x11/WindowAdapter.java b/canvas/source/java/x11/WindowAdapter.java deleted file mode 100644 index e45999eb50c0..000000000000 --- a/canvas/source/java/x11/WindowAdapter.java +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: WindowAdapter.java,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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. - * - ************************************************************************/ - -import com.sun.star.awt.*; - - -public class WindowAdapter -// defacto implementing the interface, but not deriving from it, since -// we're no real XInterface here -// implements com.sun.star.awt.XWindow -{ - // the frame object we're generating. TODO: Remove public access. - public java.awt.Frame frame; - private boolean fullscreen; - - public WindowAdapter( int windowHandle, - boolean _fullscreen ) - { - CanvasUtils.printLog( "WindowAdapter(X11): constructor called" ); - fullscreen = false; - - if( _fullscreen ) - { - // create a normal Java frame, and set it into fullscreen mode - frame = new javax.swing.JFrame( "Presentation" ); - frame.setUndecorated( true ); - frame.setVisible( true ); - - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(X11): entering fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( frame ); - fullscreen = true; - } - else - { - CanvasUtils.printLog( "WindowAdapter(X11): fullscreen not supported" ); - } - - graphics.dispose(); - } - else - { - // we're initialized with the operating system window handle - // as the parameter. We then generate a dummy Java frame with - // that window as the parent, to fake a root window for the - // Java implementation. - - // now, we're getting slightly system dependent here. - String os = (String) System.getProperty("os.name"); - - System.err.println("WindowAdapter created"); - - // create the embedded frame - if( os.startsWith("Linux") ) - { - // create a java frame from that - // TODO: Maybe that's the reason why we crash on Linux 1.5beta - // immediately: Try XAWT here, or naked X: sun.awt.X11.XEmbeddedFrame - - // TODO - //frame = new sun.awt.motif.MEmbeddedFrame( windowHandle ); // Crashes 1.5, because class is unknown - //frame = new sun.awt.X11.XEmbeddedFrame( windowHandle ); // cannot currently compile, because class is not in 1.4. - CanvasUtils.printLog( "WindowAdapter(X11): no frame created for now" ); - frame = null; // disabled for now - } - else - { - throw new com.sun.star.uno.RuntimeException(); - } - } - } - - //---------------------------------------------------------------------------------- - - public void dispose() - { - if( fullscreen ) - { - java.awt.Graphics2D graphics = (java.awt.Graphics2D)frame.getGraphics(); - if( graphics.getDeviceConfiguration().getDevice().isFullScreenSupported() ) - { - CanvasUtils.printLog( "WindowAdapter(X11): leaving fullscreen mode" ); - graphics.getDeviceConfiguration().getDevice().setFullScreenWindow( null ); - } - graphics.dispose(); - } - - if( frame != null ) - frame.dispose(); - } - - //---------------------------------------------------------------------------------- - - // - // XWindow interface - // ================= - // - public void setPosSize( int X, int Y, int Width, int Height, short Flags ) - { - frame.setBounds( new java.awt.Rectangle( X, Y, Width, Height ) ); - } - - public com.sun.star.awt.Rectangle getPosSize( ) - { - java.awt.Rectangle bounds = frame.getBounds(); - - return new com.sun.star.awt.Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ); - } - - public void setVisible( boolean visible ) - { - frame.setVisible( visible ); - } - - public void setEnable( boolean enable ) - { - frame.setEnabled( enable ); - } - - public void setFocus() - { - } - - public void addWindowListener( XWindowListener xListener ) - { - } - - public void removeWindowListener( XWindowListener xListener ) - { - } - - public void addFocusListener( XFocusListener xListener ) - { - } - - public void removeFocusListener( XFocusListener xListener ) - { - } - - public void addKeyListener( XKeyListener xListener ) - { - } - - public void removeKeyListener( XKeyListener xListener ) - { - } - - public void addMouseListener( XMouseListener xListener ) - { - } - - public void removeMouseListener( XMouseListener xListener ) - { - } - - public void addMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void removeMouseMotionListener( XMouseMotionListener xListener ) - { - } - - public void addPaintListener( XPaintListener xListener ) - { - } - - public void removePaintListener( XPaintListener xListener ) - { - } -} -- cgit From c10b53fa4c2346f5e12b5d5917d9e1c81226f5f1 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 26 Jan 2010 16:53:19 +0100 Subject: sb118: #i108681# hack by pl to not process events for removed frames --- vcl/unx/headless/svpinst.cxx | 26 +++++++++++++++++++++----- vcl/unx/headless/svpinst.hxx | 3 +++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx index 7b93e59b6acd..da70a4d2da52 100644 --- a/vcl/unx/headless/svpinst.cxx +++ b/vcl/unx/headless/svpinst.cxx @@ -58,6 +58,19 @@ extern "C" } } +bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const +{ + for( std::list< SalFrame* >::const_iterator it = m_aFrames.begin(); + it != m_aFrames.end(); ++it ) + { + if( *it == pFrame ) + { + return true; + } + } + return false; +} + SvpSalInstance* SvpSalInstance::s_pDefaultInstance = NULL; SvpSalInstance::SvpSalInstance() @@ -349,12 +362,15 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) { for( std::list::const_iterator it = aEvents.begin(); it != aEvents.end(); ++it ) { - it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData ); - if( it->m_nEvent == SALEVENT_RESIZE ) + if ( isFrameAlive( it->m_pFrame ) ) { - // this would be a good time to post a paint - const SvpSalFrame* pSvpFrame = static_cast(it->m_pFrame); - pSvpFrame->PostPaint(); + it->m_pFrame->CallCallback( it->m_nEvent, it->m_pData ); + if( it->m_nEvent == SALEVENT_RESIZE ) + { + // this would be a good time to post a paint + const SvpSalFrame* pSvpFrame = static_cast(it->m_pFrame); + pSvpFrame->PostPaint(); + } } } } diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx index e77debb53f1d..83d5a591ea22 100644 --- a/vcl/unx/headless/svpinst.hxx +++ b/vcl/unx/headless/svpinst.hxx @@ -111,6 +111,9 @@ class SvpSalInstance : public SalInstance std::list< SalUserEvent > m_aUserEvents; std::list< SalFrame* > m_aFrames; + + bool isFrameAlive( const SalFrame* pFrame ) const; + public: static SvpSalInstance* s_pDefaultInstance; -- cgit From ebdbb7cb93519ec367d75d333f4af23062dffd41 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 26 Jan 2010 17:43:48 +0100 Subject: ppp02: #i106560# use IsForPagePreviews accessibility setting --- vcl/inc/vcl/prndlg.hxx | 2 ++ vcl/source/window/printdlg.cxx | 78 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index 4aed8ddbeb64..f9ead1570b35 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -61,6 +61,8 @@ namespace vcl VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; + + bool useHCColorReplacement() const; public: PrintPreviewWindow( Window* pParent, const ResId& ); virtual ~PrintPreviewWindow(); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 0404bed4218e..132f918d7099 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -45,16 +45,22 @@ #include "vcl/help.hxx" #include "vcl/decoview.hxx" #include "vcl/svapp.hxx" +#include "vcl/unohelp.hxx" #include "unotools/localedatawrapper.hxx" #include "rtl/ustrbuf.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/awt/Size.hpp" using namespace vcl; using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::container; using namespace com::sun::star::beans; #define HELPID_PREFIX ".HelpId:vcl:PrintDialog" @@ -69,7 +75,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re { SetPaintTransparent( TRUE ); SetBackground(); - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + if( useHCColorReplacement() ) maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); @@ -79,12 +85,76 @@ PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() { } +bool PrintDialog::PrintPreviewWindow::useHCColorReplacement() const +{ + bool bRet = false; + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + { + try + { + // get service provider + Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + // create configuration hierachical access name + if( xSMgr.is() ) + { + try + { + Reference< XMultiServiceFactory > 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" ) ); + aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Accessibility" ) ); + aArgs.getArray()[0] <<= aVal; + Reference< XNameAccess > xConfigAccess( + Reference< XNameAccess >( + xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ) + ); + if( xConfigAccess.is() ) + { + try + { + sal_Bool bValue = sal_False; + Any aAny = xConfigAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsForPagePreviews" ) ) ); + if( aAny >>= bValue ) + bRet = bool(bValue); + } + catch( NoSuchElementException& ) + { + } + catch( WrappedTargetException& ) + { + } + } + } + } + catch( Exception& ) + { + } + } + } + catch( WrappedTargetException& ) + { + } + } + return bRet; +} + void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt ) { // react on settings changed if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS ) { - if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + if( useHCColorReplacement() ) maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); else maPageVDev.SetBackground( Color( COL_WHITE ) ); @@ -214,9 +284,7 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi #endif SetQuickHelpText( aBuf.makeStringAndClear() ); maMtf = i_rNewPreview; - if( GetSettings().GetStyleSettings().GetHighContrastMode() && - GetSettings().GetStyleSettings().GetWindowColor().IsDark() - ) + if( useHCColorReplacement() ) { maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 ); } -- cgit From 56844a3bf61a58e84eb37796fa4fee4b9052cd3a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 27 Jan 2010 11:48:56 +0100 Subject: ppp02: #i107481# change replacement visualization --- vcl/source/window/printdlg.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 132f918d7099..4b1f0b850b57 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -202,9 +202,14 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) // replacement is active Push(); Rectangle aTextRect( Point( 0, 0 ), aSize ); - Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); - aFont.SetSize( Size( 0, aSize.Height()/12 ) ); - SetFont( aFont ); + DecorationView aVw( this ); + aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP ); + aTextRect.Left() += 2; + aTextRect.Top() += 2; + aTextRect.Right() -= 2; + aTextRect.Bottom() -= 2; + Font aFont( GetSettings().GetStyleSettings().GetLabelFont() ); + SetZoomedPointFont( aFont ); DrawText( aTextRect, maReplacementString, TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); -- cgit From c5bed97b38a8e4d527f0ad9091a409ab7babd03d Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 27 Jan 2010 16:23:59 +0100 Subject: sb118: changed tools/debug to never fall back from writing to shell to writing to file, and read DBGSV_INIT from rtl::Bootstrap; the latter causes problems if tools/debug is called from static code executing before SAL_MAIN has called osl_setCommandArgs -> removed statics from code and added assertions to osl/process; various improvements to smoketests.cxx (incl. passing an appropriate dbgsv.ini for non-pro builds) --- tools/bootstrp/command.cxx | 8 ++-- tools/bootstrp/rscdep.cxx | 8 +--- tools/inc/bootstrp/command.hxx | 4 +- tools/inc/tools/debug.hxx | 31 ++++++------- tools/source/debug/debug.cxx | 68 +++++++++++----------------- vcl/inc/vcl/ppdparser.hxx | 30 ++++++------- vcl/source/app/dbggui.cxx | 25 ----------- vcl/unx/source/printer/ppdparser.cxx | 87 ++++++++++++++++++------------------ 8 files changed, 104 insertions(+), 157 deletions(-) diff --git a/tools/bootstrp/command.cxx b/tools/bootstrp/command.cxx index 05e981b64a0e..bc30dee4f148 100644 --- a/tools/bootstrp/command.cxx +++ b/tools/bootstrp/command.cxx @@ -358,7 +358,7 @@ CCommand::CCommand( ByteString &rString ) { rString.SearchAndReplace( '\t', ' ' ); aCommand = rString.GetToken( 0, ' ' ); - aCommandLine = Search(); + aCommandLine = Search( "PATH" ); #ifndef UNX aCommandLine += " /c "; #else @@ -368,7 +368,7 @@ CCommand::CCommand( ByteString &rString ) ByteString sCmd( rString.GetToken( 0, ' ' )); ByteString sParam( rString.Copy( sCmd.Len())); - aCommandLine += Search( thePath, sCmd ); + aCommandLine += Search( "PATH", sCmd ); aCommandLine += sParam; ImplInit(); @@ -382,7 +382,7 @@ CCommand::CCommand( const char *pChar ) aString.SearchAndReplace( '\t', ' ' ); aCommand = aString.GetToken( 0, ' ' ); - aCommandLine = Search(); + aCommandLine = Search( "PATH" ); #ifndef UNX aCommandLine += " /c "; #else @@ -393,7 +393,7 @@ CCommand::CCommand( const char *pChar ) ByteString sCmd( rString.GetToken( 0, ' ' )); ByteString sParam( rString.Copy( sCmd.Len())); - aCommandLine += Search( thePath, sCmd ); + aCommandLine += Search( "PATH", sCmd ); aCommandLine += sParam; ImplInit(); diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index d4411058a6fb..a95b94fe057c 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -39,6 +39,7 @@ #include #include "bootstrp/prj.hxx" +#include "sal/main.h" #include #include @@ -81,12 +82,7 @@ static int optopt = 0; static int opterr = 0; #endif - -int -#ifdef WNT -_cdecl -#endif -main( int argc, char **argv ) +SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) { int c; char aBuf[255]; diff --git a/tools/inc/bootstrp/command.hxx b/tools/inc/bootstrp/command.hxx index 3b481371908b..30b60ae2c069 100644 --- a/tools/inc/bootstrp/command.hxx +++ b/tools/inc/bootstrp/command.hxx @@ -95,8 +95,6 @@ public: void Print(); }; -static ByteString thePath( "PATH" ); - /** Declares and spawns a child process. The spawned programm could be a native executable or a schell script. */ @@ -130,7 +128,7 @@ public: @param sItem specifies the system shell @return the Location (when programm was found) */ - static ByteString Search( ByteString sEnv = thePath, + static ByteString Search( ByteString sEnv, ByteString sItem = COMMAND_SHELL ); /** Spawns the Process diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx index 843f620649a2..5ecb71b9d9a9 100644 --- a/tools/inc/tools/debug.hxx +++ b/tools/inc/tools/debug.hxx @@ -128,19 +128,18 @@ struct DbgDataType #define DBG_FUNC_SAVEDATA 5 #define DBG_FUNC_SETPRINTMSGBOX 6 #define DBG_FUNC_SETPRINTWINDOW 7 -#define DBG_FUNC_SETPRINTSHELL 8 -#define DBG_FUNC_SETPRINTTESTTOOL 9 -#define DBG_FUNC_MEMTEST 10 -#define DBG_FUNC_XTORINFO 11 -#define DBG_FUNC_MEMINFO 12 -#define DBG_FUNC_COREDUMP 13 -#define DBG_FUNC_ALLERROROUT 14 -#define DBG_FUNC_SETTESTSOLARMUTEX 15 -#define DBG_FUNC_TESTSOLARMUTEX 16 -#define DBG_FUNC_PRINTFILE 17 -#define DBG_FUNC_GETPRINTMSGBOX 18 -#define DBG_FUNC_FILTERMESSAGE 19 // new for #i38967 -#define DBG_FUNC_UPDATEOSLHOOK 20 +#define DBG_FUNC_SETPRINTTESTTOOL 8 +#define DBG_FUNC_MEMTEST 9 +#define DBG_FUNC_XTORINFO 10 +#define DBG_FUNC_MEMINFO 11 +#define DBG_FUNC_COREDUMP 12 +#define DBG_FUNC_ALLERROROUT 13 +#define DBG_FUNC_SETTESTSOLARMUTEX 14 +#define DBG_FUNC_TESTSOLARMUTEX 15 +#define DBG_FUNC_PRINTFILE 16 +#define DBG_FUNC_GETPRINTMSGBOX 17 +#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967 +#define DBG_FUNC_UPDATEOSLHOOK 19 TOOLS_DLLPUBLIC void* DbgFunc( USHORT nAction, void* pData = NULL ); @@ -179,11 +178,6 @@ inline void DbgSetPrintWindow( DbgPrintLine pProc ) DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc ); } -inline void DbgSetPrintShell( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTSHELL, (void*)(long)pProc ); -} - inline void DbgSetPrintTestTool( DbgPrintLine pProc ) { DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc ); @@ -347,6 +341,7 @@ void DbgPrintStackTree( void* p ); TOOLS_DLLPUBLIC void DbgOut( const sal_Char* pMsg, USHORT nOutType = DBG_OUT_TRACE, const sal_Char* pFile = NULL, USHORT nLine = 0 ); +TOOLS_DLLPUBLIC void DbgPrintShell(char const * message); TOOLS_DLLPUBLIC void DbgOutTypef( USHORT nOutType, const sal_Char* pFStr, ... ); TOOLS_DLLPUBLIC void DbgOutf( const sal_Char* pFStr, ... ); TOOLS_DLLPUBLIC void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... ); diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 119defa91ad0..3bf25b43a82d 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -64,6 +64,8 @@ #endif #include +#include +#include #include #include @@ -154,7 +156,6 @@ struct DebugData USHORT bInit; DbgPrintLine pDbgPrintMsgBox; DbgPrintLine pDbgPrintWindow; - DbgPrintLine pDbgPrintShell; DbgPrintLine pDbgPrintTestTool; ::std::vector< DbgPrintLine > aDbgPrintUserChannels; @@ -169,7 +170,6 @@ struct DebugData :bInit( FALSE ) ,pDbgPrintMsgBox( FALSE ) ,pDbgPrintWindow( NULL ) - ,pDbgPrintShell( NULL ) ,pDbgPrintTestTool( NULL ) ,pProfList( NULL ) ,pXtorList( NULL ) @@ -666,26 +666,13 @@ BOOL PointerList::IsIn( const void* p ) const // ======================================================================= -static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) +static rtl::OString DbgGetDbgFileName() { -#if defined( UNX ) - const sal_Char* pName = getenv("DBGSV_INIT"); - if ( !pName ) - pName = ".dbgsv.init"; - strncpy( pStr, pName, nMaxLen ); -#elif defined( WNT ) - const sal_Char* pName = getenv("DBGSV_INIT"); - if ( pName ) - strncpy( pStr, pName, nMaxLen ); - else - GetProfileStringA( "sv", "dbgsv", "dbgsv.ini", pStr, nMaxLen ); -#elif defined( OS2 ) - PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSV", - "dbgsv.ini", (PSZ)pStr, nMaxLen ); -#else - strncpy( pStr, "dbgsv.ini", nMaxLen ); -#endif - pStr[ nMaxLen - 1 ] = 0; + rtl::OUString s; + rtl::Bootstrap::get( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBGSV_INIT")), s, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbgsv.ini"))); + return rtl::OUStringToOString(s, osl_getThreadTextEncoding()); } // ----------------------------------------------------------------------- @@ -734,14 +721,13 @@ static DebugData* GetDebugData() DbgGetLogFileName( aDebugData.aDbgData.aDebugName ); // DEBUG.INI-File - sal_Char aBuf[ 4096 ]; - DbgGetDbgFileName( aBuf, sizeof( aBuf ) ); - FILETYPE pIniFile = FileOpen( aBuf, "r" ); + FILETYPE pIniFile = FileOpen( DbgGetDbgFileName().getStr(), "r" ); if ( pIniFile != NULL ) { ConfigSection eCurrentSection = eUnknown; // no sophisticated algorithm here, assume that the whole file fits into aBuf ... + sal_Char aBuf[ 4096 ]; ULONG nReallyRead = FileRead( aBuf, 1, sizeof( aBuf ) / sizeof( sal_Char ) - 1, pIniFile ); aBuf[ nReallyRead ] = 0; const sal_Char* pLine = aBuf; @@ -1040,9 +1026,7 @@ static void DebugDeInit() pData->aDbgData.nTestFlags &= (DBG_TEST_MEM | DBG_TEST_PROFILING); pData->aDbgPrintUserChannels.clear(); pData->pDbgPrintTestTool = NULL; - pData->pDbgPrintShell = NULL; pData->pDbgPrintWindow = NULL; - pData->pDbgPrintShell = NULL; pData->pOldDebugMessageFunc = NULL; ImplDbgDeInitLock(); } @@ -1202,10 +1186,6 @@ void* DbgFunc( USHORT nAction, void* pParam ) pDebugData->pDbgPrintWindow = (DbgPrintLine)(long)pParam; break; - case DBG_FUNC_SETPRINTSHELL: - pDebugData->pDbgPrintShell = (DbgPrintLine)(long)pParam; - break; - case DBG_FUNC_SETPRINTTESTTOOL: pDebugData->pDbgPrintTestTool = (DbgPrintLine)(long)pParam; break; @@ -1214,9 +1194,7 @@ void* DbgFunc( USHORT nAction, void* pParam ) { const DbgData* pData = static_cast< const DbgData* >( pParam ); - sal_Char aBuf[ 4096 ]; - DbgGetDbgFileName( aBuf, sizeof( aBuf ) ); - FILETYPE pIniFile = FileOpen( aBuf, "w" ); + FILETYPE pIniFile = FileOpen( DbgGetDbgFileName().getStr(), "w" ); if ( pIniFile == NULL ) break; @@ -1741,14 +1719,6 @@ void DbgOut( const sal_Char* pMsg, USHORT nDbgOut, const sal_Char* pFile, USHORT { if ( pData->pDbgPrintMsgBox ) pData->pDbgPrintMsgBox( aBufOut ); - else - nOut = DBG_OUT_SHELL; - } - - if ( nOut == DBG_OUT_SHELL ) - { - if ( pData->pDbgPrintShell ) - pData->pDbgPrintShell( aBufOut ); else nOut = DBG_OUT_WINDOW; } @@ -1761,14 +1731,28 @@ void DbgOut( const sal_Char* pMsg, USHORT nDbgOut, const sal_Char* pFile, USHORT nOut = DBG_OUT_FILE; } - if ( nOut == DBG_OUT_FILE ) + switch ( nOut ) + { + case DBG_OUT_SHELL: + DbgPrintShell( aBufOut ); + break; + case DBG_OUT_FILE: ImplDbgPrintFile( aBufOut ); + break; + } ImplDbgUnlock(); bIn = FALSE; } +void DbgPrintShell(char const * message) { + fprintf(stderr, "%s\n", message); +#if defined WNT + OutputDebugStringA(message); +#endif +} + // ----------------------------------------------------------------------- void DbgOutTypef( USHORT nDbgOut, const sal_Char* pFStr, ... ) diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx index ed9f91b97d99..bec74ec688b3 100644 --- a/vcl/inc/vcl/ppdparser.hxx +++ b/vcl/inc/vcl/ppdparser.hxx @@ -222,7 +222,7 @@ public: bool isType42Capable() const { return m_bType42Capable; } ULONG getLanguageLevel() const { return m_nLanguageLevel; } - const String& getDefaultPaperDimension() const; + String getDefaultPaperDimension() const; void getDefaultPaperDimension( int& rWidth, int& rHeight ) const { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); } bool getPaperDimension( const String& rPaperName, @@ -231,12 +231,12 @@ public: // returns false if paper not found int getPaperDimensions() const { return m_pPaperDimensions ? m_pPaperDimensions->countValues() : 0; } - const String& getPaperDimension( int ) const; - const String& getPaperDimensionCommand( int ) const; - const String& getPaperDimensionCommand( const String & ) const; + String getPaperDimension( int ) const; + String getPaperDimensionCommand( int ) const; + String getPaperDimensionCommand( const String & ) const; // match the best paper for width and height - const String& matchPaper( int nWidth, int nHeight ) const; + String matchPaper( int nWidth, int nHeight ) const; bool getMargins( const String& rPaperName, int &rLeft, int& rRight, @@ -246,27 +246,27 @@ public: // values int pt - const String& getDefaultInputSlot() const; + String getDefaultInputSlot() const; int getInputSlots() const { return m_pInputSlots ? m_pInputSlots->countValues() : 0; } - const String& getSlot( int ) const; - const String& getSlotCommand( int ) const; - const String& getSlotCommand( const String& ) const; + String getSlot( int ) const; + String getSlotCommand( int ) const; + String getSlotCommand( const String& ) const; void getDefaultResolution( int& rXRes, int& rYRes ) const; int getResolutions() const; void getResolution( int, int& rXRes, int& rYRes ) const; - const String& getResolutionCommand( int nXRes, int nYRes ) const; + String getResolutionCommand( int nXRes, int nYRes ) const; // values in dpi void getResolutionFromString( const String&, int&, int& ) const; // helper function - const String& getDefaultDuplexType() const; + String getDefaultDuplexType() const; int getDuplexTypes() const { return m_pDuplexTypes ? m_pDuplexTypes->countValues() : 0; } - const String& getDuplex( int ) const; - const String& getDuplexCommand( int ) const; - const String& getDuplexCommand( const String& ) const; + String getDuplex( int ) const; + String getDuplexCommand( int ) const; + String getDuplexCommand( const String& ) const; int getFonts() const { return m_pFontList ? m_pFontList->countValues() : 0; } @@ -276,7 +276,7 @@ public: void getFontAttributes( const String&, String& rEncoding, String& rCharset ) const; - const String& getFont( int ) const; + String getFont( int ) const; }; // ---------------------------------------------------------------------- diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index 36d0991c7640..a2f98d1f8796 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -1786,8 +1786,6 @@ void DbgDialogTest( Window* pWindow ) } // ======================================================================= -void DbgPrintShell( const char* pLine ); - #ifndef WNT #define USE_VCL_MSGBOX #define COPY_BUTTON_ID 25 @@ -1966,27 +1964,6 @@ void DbgPrintWindow( const char* pLine ) bIn = FALSE; } -// ----------------------------------------------------------------------- - -void DbgPrintShell( const char* pLine ) -{ -#if defined( WNT ) - // TODO: Shouldn't this be a IsDebuggerPresent()? - if ( GetSystemMetrics( SM_DEBUG ) ) - { - strcpy( aDbgOutBuf, pLine ); - strcat( aDbgOutBuf, "\r\n" ); - OutputDebugString( aDbgOutBuf ); - return; - } - - DbgPrintWindow( pLine ); -#endif -#ifdef UNX - fprintf( stderr, "%s\n", pLine ); -#endif -} - // ======================================================================= #ifdef WNT @@ -1999,7 +1976,6 @@ void DbgGUIInit() { DbgSetPrintMsgBox( DbgPrintMsgBox ); DbgSetPrintWindow( DbgPrintWindow ); - DbgSetPrintShell( DbgPrintShell ); #ifdef WNT DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); #endif @@ -2011,7 +1987,6 @@ void DbgGUIDeInit() { DbgSetPrintMsgBox( NULL ); DbgSetPrintWindow( NULL ); - DbgSetPrintShell( NULL ); #ifdef WNT DbgSetTestSolarMutex( NULL ); #endif diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx index 95bc7bca41ca..b815ce001d7e 100644 --- a/vcl/unx/source/printer/ppdparser.cxx +++ b/vcl/unx/source/printer/ppdparser.cxx @@ -64,7 +64,6 @@ using namespace rtl; std::list< PPDParser* > PPDParser::aAllParsers; std::hash_map< OUString, OUString, OUStringHash >* PPDParser::pAllPPDFiles = NULL; -static String aEmptyString; class PPDDecompressStream { @@ -1031,12 +1030,12 @@ void PPDParser::parseConstraint( const ByteString& rLine ) m_aConstraints.push_back( aConstraint ); } -const String& PPDParser::getDefaultPaperDimension() const +String PPDParser::getDefaultPaperDimension() const { if( m_pDefaultPaperDimension ) return m_pDefaultPaperDimension->m_aOption; - return aEmptyString; + return String(); } bool PPDParser::getMargins( @@ -1103,10 +1102,10 @@ bool PPDParser::getPaperDimension( return true; } -const String& PPDParser::matchPaper( int nWidth, int nHeight ) const +String PPDParser::matchPaper( int nWidth, int nHeight ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); int nPDim = -1; double PDWidth, PDHeight; @@ -1140,51 +1139,51 @@ const String& PPDParser::matchPaper( int nWidth, int nHeight ) const { // swap portrait/landscape and try again bDontSwap = true; - const String& rRet = matchPaper( nHeight, nWidth ); + String rRet = matchPaper( nHeight, nWidth ); bDontSwap = false; return rRet; } - return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : aEmptyString; + return nPDim != -1 ? m_pPaperDimensions->getValue( nPDim )->m_aOption : String(); } -const String& PPDParser::getDefaultInputSlot() const +String PPDParser::getDefaultInputSlot() const { if( m_pDefaultInputSlot ) return m_pDefaultInputSlot->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getSlot( int nSlot ) const +String PPDParser::getSlot( int nSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aOption; else if( m_pInputSlots->countValues() > 0 ) return m_pInputSlots->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getSlotCommand( int nSlot ) const +String PPDParser::getSlotCommand( int nSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); if( nSlot > 0 && nSlot < m_pInputSlots->countValues() ) return m_pInputSlots->getValue( nSlot )->m_aValue; else if( m_pInputSlots->countValues() > 0 ) return m_pInputSlots->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getSlotCommand( const String& rSlot ) const +String PPDParser::getSlotCommand( const String& rSlot ) const { if( ! m_pInputSlots ) - return aEmptyString; + return String(); for( int i=0; i < m_pInputSlots->countValues(); i++ ) { @@ -1192,39 +1191,39 @@ const String& PPDParser::getSlotCommand( const String& rSlot ) const if( pValue->m_aOption == rSlot ) return pValue->m_aValue; } - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimension( int nPaperDimension ) const +String PPDParser::getPaperDimension( int nPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aOption; else if( m_pPaperDimensions->countValues() > 0 ) return m_pPaperDimensions->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimensionCommand( int nPaperDimension ) const +String PPDParser::getPaperDimensionCommand( int nPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); if( nPaperDimension > 0 && nPaperDimension < m_pPaperDimensions->countValues() ) return m_pPaperDimensions->getValue( nPaperDimension )->m_aValue; else if( m_pPaperDimensions->countValues() > 0 ) return m_pPaperDimensions->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const +String PPDParser::getPaperDimensionCommand( const String& rPaperDimension ) const { if( ! m_pPaperDimensions ) - return aEmptyString; + return String(); for( int i=0; i < m_pPaperDimensions->countValues(); i++ ) { @@ -1232,7 +1231,7 @@ const String& PPDParser::getPaperDimensionCommand( const String& rPaperDimension if( pValue->m_aOption == rPaperDimension ) return pValue->m_aValue; } - return aEmptyString; + return String(); } void PPDParser::getResolutionFromString( @@ -1290,13 +1289,13 @@ void PPDParser::getResolution( int nNr, int& rXRes, int& rYRes ) const rXRes, rYRes ); } -const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const +String PPDParser::getResolutionCommand( int nXRes, int nYRes ) const { if( ( ! m_pResolutions || m_pResolutions->countValues() == 0 ) && m_pDefaultResolution ) return m_pDefaultResolution->m_aValue; if( ! m_pResolutions ) - return aEmptyString; + return String(); int nX, nY; for( int i = 0; i < m_pResolutions->countValues(); i++ ) @@ -1306,46 +1305,46 @@ const String& PPDParser::getResolutionCommand( int nXRes, int nYRes ) const if( nX == nXRes && nY == nYRes ) return m_pResolutions->getValue( i )->m_aValue; } - return aEmptyString; + return String(); } -const String& PPDParser::getDefaultDuplexType() const +String PPDParser::getDefaultDuplexType() const { if( m_pDefaultDuplexType ) return m_pDefaultDuplexType->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplex( int nDuplex ) const +String PPDParser::getDuplex( int nDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aOption; else if( m_pDuplexTypes->countValues() > 0 ) return m_pDuplexTypes->getValue( (ULONG)0 )->m_aOption; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplexCommand( int nDuplex ) const +String PPDParser::getDuplexCommand( int nDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); if( nDuplex > 0 && nDuplex < m_pDuplexTypes->countValues() ) return m_pDuplexTypes->getValue( nDuplex )->m_aValue; else if( m_pDuplexTypes->countValues() > 0 ) return m_pDuplexTypes->getValue( (ULONG)0 )->m_aValue; - return aEmptyString; + return String(); } -const String& PPDParser::getDuplexCommand( const String& rDuplex ) const +String PPDParser::getDuplexCommand( const String& rDuplex ) const { if( ! m_pDuplexTypes ) - return aEmptyString; + return String(); for( int i=0; i < m_pDuplexTypes->countValues(); i++ ) { @@ -1353,7 +1352,7 @@ const String& PPDParser::getDuplexCommand( const String& rDuplex ) const if( pValue->m_aOption == rDuplex ) return pValue->m_aValue; } - return aEmptyString; + return String(); } void PPDParser::getFontAttributes( @@ -1383,14 +1382,14 @@ void PPDParser::getFontAttributes( } } -const String& PPDParser::getFont( int nFont ) const +String PPDParser::getFont( int nFont ) const { if( ! m_pFontList ) - return aEmptyString; + return String(); if( nFont >=0 && nFont < m_pFontList->countValues() ) return m_pFontList->getValue( nFont )->m_aOption; - return aEmptyString; + return String(); } /* -- cgit From 3bd26e732a7618b2591fb187046fd7c7cd96eb0e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 28 Jan 2010 10:00:01 +0100 Subject: ppp02: #i108686# make last used printer persistent for UI print jobs --- vcl/source/gdi/print3.cxx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index f7cdfa216fb6..b0d61a9a1ff2 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -39,6 +39,7 @@ #include "vcl/svids.hrc" #include "vcl/metaact.hxx" #include "vcl/msgbox.hxx" +#include "vcl/configsettings.hxx" #include "tools/urlobj.hxx" @@ -330,9 +331,25 @@ void Printer::ImplPrintJob( const boost::shared_ptr& i_pContr // setup printer // if no specific printer is already set, create one + + // #i108686# + // in case of a UI (platform independent or system dialog) print job, make the printer persistent over jobs + // however if no printer was already set by the print job's originator, + // and this is an API job, then use the system default location (because + // this is the only sensible default available if the user has no means of changing + // the destination if( ! pController->getPrinter() ) { - boost::shared_ptr pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) ); + rtl::OUString aPrinterName( i_rInitSetup.GetPrinterName() ); + if( ! aPrinterName.getLength() && pController->isShowDialogs() ) + { + // get printer name from configuration + SettingsConfigItem* pItem = SettingsConfigItem::get(); + aPrinterName = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ) ); + } + + boost::shared_ptr pPrinter( new Printer( aPrinterName ) ); pController->setPrinter( pPrinter ); } @@ -653,6 +670,16 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrsetJobState( view::PrintableState_JOB_SPOOLED ); } + // make last used printer persistent for UI jobs + if( i_pController->isShowDialogs() ) + { + SettingsConfigItem* pItem = SettingsConfigItem::get(); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinterUsed" ) ), + GetName() + ); + } + return true; } -- cgit From 90ba98f3931737e0fa832632421bf0664100dc65 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 28 Jan 2010 10:06:05 +0100 Subject: ppp02: #i108686# do not forget direct print --- vcl/source/gdi/print3.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index b0d61a9a1ff2..5ac7d509ceb0 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -341,7 +341,7 @@ void Printer::ImplPrintJob( const boost::shared_ptr& i_pContr if( ! pController->getPrinter() ) { rtl::OUString aPrinterName( i_rInitSetup.GetPrinterName() ); - if( ! aPrinterName.getLength() && pController->isShowDialogs() ) + if( ! aPrinterName.getLength() && pController->isShowDialogs() && ! pController->isDirectPrint() ) { // get printer name from configuration SettingsConfigItem* pItem = SettingsConfigItem::get(); @@ -671,7 +671,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptrisShowDialogs() ) + if( i_pController->isShowDialogs() && ! i_pController->isDirectPrint() ) { SettingsConfigItem* pItem = SettingsConfigItem::get(); pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), -- cgit From a0b4cdb08bec2ad107634bfdcbe6bb0b0f050881 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 29 Jan 2010 15:39:36 +0100 Subject: sb118: additional main -> SAL_MAIN adaption (to ensure osl_setCommandArgs is called) --- rsc/source/prj/start.cxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index df4ce12200c5..9756bce9351c 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -57,6 +57,7 @@ #endif // UNX #include #include +#include #include /*************** C O D E ************************************************/ @@ -325,14 +326,8 @@ static BOOL CallRsc2( ByteString aRsc2Name, |* Letzte Aenderung MM 05.09.91 |* *************************************************************************/ -#if defined UNX || (defined OS2 && (defined CSET || defined GCC )) || defined WTC || defined MTW || defined ICC || defined(__MINGW32__) -int main ( int argc, char ** argv) +SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { -#else -int cdecl main ( int argc, char ** argv) -{ -#endif - BOOL bPrePro = TRUE; BOOL bResFile = TRUE; BOOL bHelp = FALSE; -- cgit From eeca9dafb71c0ff288cd9a0683fd1dcb0626baca Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 29 Jan 2010 17:01:54 +0100 Subject: sb118: #i108776# changed addsym.awk to also export STLport num_put symbols, and simplified it by requiring that first section is labeled UDK_3_0_0; adapted map files accordingly, replacing many individual ones with solenv/src templates --- basebmp/test/export.map | 2 +- basegfx/test/export.map | 2 +- canvas/source/cairo/exports.map | 8 -------- canvas/source/cairo/makefile.mk | 2 +- canvas/source/factory/canvasfactory.map | 8 -------- canvas/source/factory/makefile.mk | 2 +- canvas/source/null/exports.map | 8 -------- canvas/source/null/makefile.mk | 2 +- canvas/source/simplecanvas/exports.map | 8 -------- canvas/source/simplecanvas/makefile.mk | 2 +- canvas/source/vcl/exports.map | 8 -------- canvas/source/vcl/makefile.mk | 2 +- dtrans/source/generic/exports.map | 9 --------- dtrans/source/generic/makefile.mk | 2 +- dtrans/util/exports.map | 10 ---------- dtrans/util/makefile.mk | 2 +- goodies/source/filter.vcl/egif/exports.map | 2 +- goodies/source/filter.vcl/eos2met/exports.map | 2 +- goodies/source/filter.vcl/epbm/exports.map | 2 +- goodies/source/filter.vcl/epgm/exports.map | 2 +- goodies/source/filter.vcl/epict/exports.map | 2 +- goodies/source/filter.vcl/eppm/exports.map | 2 +- goodies/source/filter.vcl/eps/exports.map | 2 +- goodies/source/filter.vcl/eras/exports.map | 2 +- goodies/source/filter.vcl/etiff/exports.map | 2 +- goodies/source/filter.vcl/expm/exports.map | 2 +- goodies/source/filter.vcl/icgm/exports.map | 2 +- goodies/source/filter.vcl/idxf/exports.map | 2 +- goodies/source/filter.vcl/ieps/exports.map | 2 +- goodies/source/filter.vcl/ios2met/exports.map | 2 +- goodies/source/filter.vcl/ipbm/exports.map | 2 +- goodies/source/filter.vcl/ipcd/exports.map | 2 +- goodies/source/filter.vcl/ipcx/exports.map | 2 +- goodies/source/filter.vcl/ipict/exports.map | 2 +- goodies/source/filter.vcl/ipsd/exports.map | 2 +- goodies/source/filter.vcl/iras/exports.map | 2 +- goodies/source/filter.vcl/itga/exports.map | 2 +- goodies/source/filter.vcl/itiff/exports.map | 2 +- i18npool/source/breakiterator/data/dict.map | 2 +- i18npool/source/collator/data/collator_data.map | 2 +- i18npool/source/indexentry/data/index_data.map | 2 +- i18npool/source/localedata/data/localedata_en.map | 2 +- i18npool/source/localedata/data/localedata_es.map | 2 +- i18npool/source/localedata/data/localedata_euro.map | 2 +- i18npool/source/localedata/data/localedata_others.map | 2 +- i18npool/source/search/i18nsearch.map | 10 ---------- i18npool/source/search/makefile.mk | 2 +- i18npool/source/textconversion/data/textconv_dict.map | 2 +- i18npool/util/i18npool.map | 10 ---------- i18npool/util/makefile.mk | 2 +- o3tl/qa/export.map | 2 +- svl/qa/complex/ConfigItems/helper/exports.map | 10 ---------- svl/qa/complex/ConfigItems/helper/makefile.mk | 2 +- svl/source/fsstor/exports.map | 8 -------- svl/source/fsstor/makefile.mk | 2 +- svl/source/passwordcontainer/exports.map | 8 -------- svl/source/passwordcontainer/makefile.mk | 2 +- svtools/source/hatchwindow/exports.map | 8 -------- svtools/source/hatchwindow/makefile.mk | 2 +- svtools/source/productregistration/exports.map | 8 -------- svtools/source/productregistration/makefile.mk | 2 +- svtools/workben/unodialog/makefile.mk | 2 +- svtools/workben/unodialog/udlg.map | 8 -------- tools/test/export.map | 2 +- ucbhelper/workben/myucp/exports.map | 8 -------- ucbhelper/workben/myucp/makefile.mk | 2 +- 66 files changed, 50 insertions(+), 187 deletions(-) delete mode 100644 canvas/source/cairo/exports.map delete mode 100644 canvas/source/factory/canvasfactory.map delete mode 100644 canvas/source/null/exports.map delete mode 100644 canvas/source/simplecanvas/exports.map delete mode 100644 canvas/source/vcl/exports.map delete mode 100644 dtrans/source/generic/exports.map delete mode 100644 dtrans/util/exports.map delete mode 100644 i18npool/source/search/i18nsearch.map delete mode 100644 i18npool/util/i18npool.map delete mode 100644 svl/qa/complex/ConfigItems/helper/exports.map delete mode 100644 svl/source/fsstor/exports.map delete mode 100644 svl/source/passwordcontainer/exports.map delete mode 100644 svtools/source/hatchwindow/exports.map delete mode 100644 svtools/source/productregistration/exports.map delete mode 100644 svtools/workben/unodialog/udlg.map delete mode 100644 ucbhelper/workben/myucp/exports.map diff --git a/basebmp/test/export.map b/basebmp/test/export.map index ac406a4096dd..9122b9e99025 100644 --- a/basebmp/test/export.map +++ b/basebmp/test/export.map @@ -29,7 +29,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: cppunitTestPlugIn; diff --git a/basegfx/test/export.map b/basegfx/test/export.map index eef13a7090fb..e5e669b3c436 100644 --- a/basegfx/test/export.map +++ b/basegfx/test/export.map @@ -29,7 +29,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: cppunitTestPlugIn; diff --git a/canvas/source/cairo/exports.map b/canvas/source/cairo/exports.map deleted file mode 100644 index 4101b0d761a9..000000000000 --- a/canvas/source/cairo/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -CAN_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/canvas/source/cairo/makefile.mk b/canvas/source/cairo/makefile.mk index 27a1aeb6dcd7..1c88f6e501d3 100644 --- a/canvas/source/cairo/makefile.mk +++ b/canvas/source/cairo/makefile.mk @@ -125,7 +125,7 @@ SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp diff --git a/canvas/source/factory/canvasfactory.map b/canvas/source/factory/canvasfactory.map deleted file mode 100644 index 44fb01f37126..000000000000 --- a/canvas/source/factory/canvasfactory.map +++ /dev/null @@ -1,8 +0,0 @@ -CAN_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/canvas/source/factory/makefile.mk b/canvas/source/factory/makefile.mk index 1051b953ae81..af43916b0b8b 100644 --- a/canvas/source/factory/makefile.mk +++ b/canvas/source/factory/makefile.mk @@ -47,7 +47,7 @@ SHL1STDLIBS = \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) -SHL1VERSIONMAP = canvasfactory.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1DEPN = SHL1IMPLIB = i$(TARGET) diff --git a/canvas/source/null/exports.map b/canvas/source/null/exports.map deleted file mode 100644 index 4101b0d761a9..000000000000 --- a/canvas/source/null/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -CAN_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/canvas/source/null/makefile.mk b/canvas/source/null/makefile.mk index 99a6bbab93a4..834b75e5a23b 100644 --- a/canvas/source/null/makefile.mk +++ b/canvas/source/null/makefile.mk @@ -64,7 +64,7 @@ SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp diff --git a/canvas/source/simplecanvas/exports.map b/canvas/source/simplecanvas/exports.map deleted file mode 100644 index 4101b0d761a9..000000000000 --- a/canvas/source/simplecanvas/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -CAN_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/canvas/source/simplecanvas/makefile.mk b/canvas/source/simplecanvas/makefile.mk index c0a60250ab85..3f045775efc7 100644 --- a/canvas/source/simplecanvas/makefile.mk +++ b/canvas/source/simplecanvas/makefile.mk @@ -56,7 +56,7 @@ SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp diff --git a/canvas/source/vcl/exports.map b/canvas/source/vcl/exports.map deleted file mode 100644 index 4101b0d761a9..000000000000 --- a/canvas/source/vcl/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -CAN_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/canvas/source/vcl/makefile.mk b/canvas/source/vcl/makefile.mk index fdfdd62d16b8..96a2688e134f 100644 --- a/canvas/source/vcl/makefile.mk +++ b/canvas/source/vcl/makefile.mk @@ -79,7 +79,7 @@ SHL1IMPLIB=i$(TARGET) SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map DEF1NAME=$(SHL1TARGET) DEF1EXPORTFILE=exports.dxp diff --git a/dtrans/source/generic/exports.map b/dtrans/source/generic/exports.map deleted file mode 100644 index 28449cc0f4a8..000000000000 --- a/dtrans/source/generic/exports.map +++ /dev/null @@ -1,9 +0,0 @@ -DTRANS_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; - diff --git a/dtrans/source/generic/makefile.mk b/dtrans/source/generic/makefile.mk index aa856865a3a8..32386db10734 100644 --- a/dtrans/source/generic/makefile.mk +++ b/dtrans/source/generic/makefile.mk @@ -50,7 +50,7 @@ SLOFILES= \ SHL1TARGET= dtrans -SHL1VERSIONMAP= exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1STDLIBS= \ $(SALLIB) \ diff --git a/dtrans/util/exports.map b/dtrans/util/exports.map deleted file mode 100644 index 7c56baa9bd73..000000000000 --- a/dtrans/util/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/dtrans/util/makefile.mk b/dtrans/util/makefile.mk index 2e9666137619..255f772113c8 100644 --- a/dtrans/util/makefile.mk +++ b/dtrans/util/makefile.mk @@ -68,7 +68,7 @@ SHL1IMPLIB=i$(SHL1TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) DEF1EXPORTFILE= exports.dxp -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map .IF "$(GUI)"=="WNT" diff --git a/goodies/source/filter.vcl/egif/exports.map b/goodies/source/filter.vcl/egif/exports.map index 10820132c0ce..61e4682c6551 100644 --- a/goodies/source/filter.vcl/egif/exports.map +++ b/goodies/source/filter.vcl/egif/exports.map @@ -1,4 +1,4 @@ -GIFEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/eos2met/exports.map b/goodies/source/filter.vcl/eos2met/exports.map index ce76d3850094..61e4682c6551 100644 --- a/goodies/source/filter.vcl/eos2met/exports.map +++ b/goodies/source/filter.vcl/eos2met/exports.map @@ -1,4 +1,4 @@ -METEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/epbm/exports.map b/goodies/source/filter.vcl/epbm/exports.map index 2d09b0bdb752..61e4682c6551 100644 --- a/goodies/source/filter.vcl/epbm/exports.map +++ b/goodies/source/filter.vcl/epbm/exports.map @@ -1,4 +1,4 @@ -PBMEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/epgm/exports.map b/goodies/source/filter.vcl/epgm/exports.map index 3967c4684f05..61e4682c6551 100644 --- a/goodies/source/filter.vcl/epgm/exports.map +++ b/goodies/source/filter.vcl/epgm/exports.map @@ -1,4 +1,4 @@ -PGMEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/epict/exports.map b/goodies/source/filter.vcl/epict/exports.map index 2f21c5c04b53..61e4682c6551 100644 --- a/goodies/source/filter.vcl/epict/exports.map +++ b/goodies/source/filter.vcl/epict/exports.map @@ -1,4 +1,4 @@ -PICTEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/eppm/exports.map b/goodies/source/filter.vcl/eppm/exports.map index 0462b75b7b43..61e4682c6551 100644 --- a/goodies/source/filter.vcl/eppm/exports.map +++ b/goodies/source/filter.vcl/eppm/exports.map @@ -1,4 +1,4 @@ -PPMEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/eps/exports.map b/goodies/source/filter.vcl/eps/exports.map index 1b61354c2869..61e4682c6551 100644 --- a/goodies/source/filter.vcl/eps/exports.map +++ b/goodies/source/filter.vcl/eps/exports.map @@ -1,4 +1,4 @@ -EPSEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; DoExportDialog; diff --git a/goodies/source/filter.vcl/eras/exports.map b/goodies/source/filter.vcl/eras/exports.map index 4a78a96ee951..d4e28c44700c 100644 --- a/goodies/source/filter.vcl/eras/exports.map +++ b/goodies/source/filter.vcl/eras/exports.map @@ -1,4 +1,4 @@ -RASEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; diff --git a/goodies/source/filter.vcl/etiff/exports.map b/goodies/source/filter.vcl/etiff/exports.map index 094e72c0f5fb..d4e28c44700c 100644 --- a/goodies/source/filter.vcl/etiff/exports.map +++ b/goodies/source/filter.vcl/etiff/exports.map @@ -1,4 +1,4 @@ -TIFEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; diff --git a/goodies/source/filter.vcl/expm/exports.map b/goodies/source/filter.vcl/expm/exports.map index f1f42312c802..d4e28c44700c 100644 --- a/goodies/source/filter.vcl/expm/exports.map +++ b/goodies/source/filter.vcl/expm/exports.map @@ -1,4 +1,4 @@ -XPMEXPORTER_1_0 { +UDK_3_0_0 { global: GraphicExport; diff --git a/goodies/source/filter.vcl/icgm/exports.map b/goodies/source/filter.vcl/icgm/exports.map index eaa1db885d5e..cc7f07dd1112 100644 --- a/goodies/source/filter.vcl/icgm/exports.map +++ b/goodies/source/filter.vcl/icgm/exports.map @@ -1,4 +1,4 @@ -CGMIMPORTER_1_0 { +UDK_3_0_0 { global: ImportCGM; diff --git a/goodies/source/filter.vcl/idxf/exports.map b/goodies/source/filter.vcl/idxf/exports.map index d107435568e5..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/idxf/exports.map +++ b/goodies/source/filter.vcl/idxf/exports.map @@ -1,4 +1,4 @@ -DXFIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ieps/exports.map b/goodies/source/filter.vcl/ieps/exports.map index 59406d7255ef..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ieps/exports.map +++ b/goodies/source/filter.vcl/ieps/exports.map @@ -1,4 +1,4 @@ -EPSIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ios2met/exports.map b/goodies/source/filter.vcl/ios2met/exports.map index 440afa9245d8..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ios2met/exports.map +++ b/goodies/source/filter.vcl/ios2met/exports.map @@ -1,4 +1,4 @@ -METIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ipbm/exports.map b/goodies/source/filter.vcl/ipbm/exports.map index 0e2a1bcdec9d..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ipbm/exports.map +++ b/goodies/source/filter.vcl/ipbm/exports.map @@ -1,4 +1,4 @@ -PBMIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ipcd/exports.map b/goodies/source/filter.vcl/ipcd/exports.map index a0719af28be2..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ipcd/exports.map +++ b/goodies/source/filter.vcl/ipcd/exports.map @@ -1,4 +1,4 @@ -PCDIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ipcx/exports.map b/goodies/source/filter.vcl/ipcx/exports.map index d44f79111a96..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ipcx/exports.map +++ b/goodies/source/filter.vcl/ipcx/exports.map @@ -1,4 +1,4 @@ -PCXIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ipict/exports.map b/goodies/source/filter.vcl/ipict/exports.map index 2576cecdca91..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ipict/exports.map +++ b/goodies/source/filter.vcl/ipict/exports.map @@ -1,4 +1,4 @@ -PICTIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/ipsd/exports.map b/goodies/source/filter.vcl/ipsd/exports.map index b2cda91bec78..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/ipsd/exports.map +++ b/goodies/source/filter.vcl/ipsd/exports.map @@ -1,4 +1,4 @@ -PSDIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/iras/exports.map b/goodies/source/filter.vcl/iras/exports.map index ebd8464837fa..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/iras/exports.map +++ b/goodies/source/filter.vcl/iras/exports.map @@ -1,4 +1,4 @@ -RASIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/itga/exports.map b/goodies/source/filter.vcl/itga/exports.map index cb127f330e5d..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/itga/exports.map +++ b/goodies/source/filter.vcl/itga/exports.map @@ -1,4 +1,4 @@ -TGAIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/goodies/source/filter.vcl/itiff/exports.map b/goodies/source/filter.vcl/itiff/exports.map index 983df223406e..941e4ab9bde8 100644 --- a/goodies/source/filter.vcl/itiff/exports.map +++ b/goodies/source/filter.vcl/itiff/exports.map @@ -1,4 +1,4 @@ -TIFIMPORTER_1_0 { +UDK_3_0_0 { global: GraphicImport; diff --git a/i18npool/source/breakiterator/data/dict.map b/i18npool/source/breakiterator/data/dict.map index 271ba8b2b83c..ebd4f9185d1f 100644 --- a/i18npool/source/breakiterator/data/dict.map +++ b/i18npool/source/breakiterator/data/dict.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; getDataArea; diff --git a/i18npool/source/collator/data/collator_data.map b/i18npool/source/collator/data/collator_data.map index 09f298912ee9..412635f19eed 100644 --- a/i18npool/source/collator/data/collator_data.map +++ b/i18npool/source/collator/data/collator_data.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; get_zh_charset; diff --git a/i18npool/source/indexentry/data/index_data.map b/i18npool/source/indexentry/data/index_data.map index b9add8b3a6f8..30d03853d6ad 100644 --- a/i18npool/source/indexentry/data/index_data.map +++ b/i18npool/source/indexentry/data/index_data.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; get_indexdata_ko_dict; diff --git a/i18npool/source/localedata/data/localedata_en.map b/i18npool/source/localedata/data/localedata_en.map index 10e5a998c932..ab13f033745c 100644 --- a/i18npool/source/localedata/data/localedata_en.map +++ b/i18npool/source/localedata/data/localedata_en.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; getAllCalendars_en_AU; diff --git a/i18npool/source/localedata/data/localedata_es.map b/i18npool/source/localedata/data/localedata_es.map index edcdd4e153e3..7743539232a6 100644 --- a/i18npool/source/localedata/data/localedata_es.map +++ b/i18npool/source/localedata/data/localedata_es.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; getAllCalendars_es_AR; diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 1a28eb537bd5..e64bf08261b8 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; getAllCalendars_ast_ES; diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index a8212624e8e8..7a4fa6cd072c 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: getAllCalendars_af_NA; getAllCalendars_af_ZA; diff --git a/i18npool/source/search/i18nsearch.map b/i18npool/source/search/i18nsearch.map deleted file mode 100644 index 02fe32ac5839..000000000000 --- a/i18npool/source/search/i18nsearch.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { -global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - -local: - *; -}; diff --git a/i18npool/source/search/makefile.mk b/i18npool/source/search/makefile.mk index 2e81ec3f1d53..ad10347bffcc 100644 --- a/i18npool/source/search/makefile.mk +++ b/i18npool/source/search/makefile.mk @@ -72,7 +72,7 @@ SHL1STDLIBS= \ $(I18NREGEXPLIB) SHL1DEPN= makefile.mk -SHL1VERSIONMAP= i18nsearch.map +SHL1VERSIONMAP= $(SOLARENV)/src/component.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) diff --git a/i18npool/source/textconversion/data/textconv_dict.map b/i18npool/source/textconversion/data/textconv_dict.map index 03f9073c5d86..afd873b6f38e 100644 --- a/i18npool/source/textconversion/data/textconv_dict.map +++ b/i18npool/source/textconversion/data/textconv_dict.map @@ -1,4 +1,4 @@ -OOO_1.1 { +UDK_3_0_0 { global: GetVersionInfo; getHangul2HanjaData; diff --git a/i18npool/util/i18npool.map b/i18npool/util/i18npool.map deleted file mode 100644 index 02fe32ac5839..000000000000 --- a/i18npool/util/i18npool.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { -global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - -local: - *; -}; diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index 582089a309e8..6ea6ab1fd2ef 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -64,7 +64,7 @@ SHL1IMPLIB= i$(SHL1TARGET) SHL1DEPN= makefile.mk \ $(SLB)/i18nisolang$(ISOLANG_MAJOR)$(COMID).lib -SHL1VERSIONMAP=$(PRJNAME).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/o3tl/qa/export.map b/o3tl/qa/export.map index ac406a4096dd..9122b9e99025 100644 --- a/o3tl/qa/export.map +++ b/o3tl/qa/export.map @@ -29,7 +29,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: cppunitTestPlugIn; diff --git a/svl/qa/complex/ConfigItems/helper/exports.map b/svl/qa/complex/ConfigItems/helper/exports.map deleted file mode 100644 index 85610ad80888..000000000000 --- a/svl/qa/complex/ConfigItems/helper/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/svl/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk index d41fe6c129c6..c0557afac25d 100644 --- a/svl/qa/complex/ConfigItems/helper/makefile.mk +++ b/svl/qa/complex/ConfigItems/helper/makefile.mk @@ -73,7 +73,7 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) -SHL1VERSIONMAP= exports.map +SHL1VERSIONMAP= $(SOLARENV)/src/component.map # --- Targets ------------------------------------------------------ diff --git a/svl/source/fsstor/exports.map b/svl/source/fsstor/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svl/source/fsstor/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svl/source/fsstor/makefile.mk b/svl/source/fsstor/makefile.mk index 7f46009750fd..a4b5e5d7fc50 100644 --- a/svl/source/fsstor/makefile.mk +++ b/svl/source/fsstor/makefile.mk @@ -60,7 +60,7 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(SALLIB) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) diff --git a/svl/source/passwordcontainer/exports.map b/svl/source/passwordcontainer/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svl/source/passwordcontainer/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svl/source/passwordcontainer/makefile.mk b/svl/source/passwordcontainer/makefile.mk index 3c74246ee3ed..e9dd4b68e2aa 100644 --- a/svl/source/passwordcontainer/makefile.mk +++ b/svl/source/passwordcontainer/makefile.mk @@ -56,7 +56,7 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(SALLIB) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) diff --git a/svtools/source/hatchwindow/exports.map b/svtools/source/hatchwindow/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/source/hatchwindow/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/source/hatchwindow/makefile.mk b/svtools/source/hatchwindow/makefile.mk index 8366763a81f9..6b99aa8484a6 100644 --- a/svtools/source/hatchwindow/makefile.mk +++ b/svtools/source/hatchwindow/makefile.mk @@ -59,7 +59,7 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(SALLIB) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) diff --git a/svtools/source/productregistration/exports.map b/svtools/source/productregistration/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/source/productregistration/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk index 1892f1600dd8..86bfd4308e08 100644 --- a/svtools/source/productregistration/makefile.mk +++ b/svtools/source/productregistration/makefile.mk @@ -63,7 +63,7 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(SALLIB) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) diff --git a/svtools/workben/unodialog/makefile.mk b/svtools/workben/unodialog/makefile.mk index c6cd6e5d8491..9ad708884b2d 100644 --- a/svtools/workben/unodialog/makefile.mk +++ b/svtools/workben/unodialog/makefile.mk @@ -60,7 +60,7 @@ SLOFILES= $(SLO)$/unodialogsample.obj \ # --- library ----------------------------------- SHL1TARGET=$(TARGET)$(DLLPOSTFIX) -SHL1VERSIONMAP=$(TARGET).map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1STDLIBS= \ $(CPPULIB) \ diff --git a/svtools/workben/unodialog/udlg.map b/svtools/workben/unodialog/udlg.map deleted file mode 100644 index 276f9673d067..000000000000 --- a/svtools/workben/unodialog/udlg.map +++ /dev/null @@ -1,8 +0,0 @@ -UDLG_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/tools/test/export.map b/tools/test/export.map index 1953f105dc08..df94ae98ee5c 100644 --- a/tools/test/export.map +++ b/tools/test/export.map @@ -29,7 +29,7 @@ # #************************************************************************* -UDK_3.1 { +UDK_3_0_0 { global: registerAllTestFunction; diff --git a/ucbhelper/workben/myucp/exports.map b/ucbhelper/workben/myucp/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/ucbhelper/workben/myucp/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk index ca6b3f941b0e..256bd6946dd2 100644 --- a/ucbhelper/workben/myucp/makefile.mk +++ b/ucbhelper/workben/myucp/makefile.mk @@ -72,7 +72,7 @@ LIB1OBJFILES=$(SLOFILES) SHL1TARGET=$(TARGET) SHL1IMPLIB=i$(TARGET) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map # @@@ Add additional libs here. SHL1STDLIBS=\ -- cgit From 6a6313957dc8b98a66cbe1a74a6952e4efb324dd Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 3 Feb 2010 13:43:59 +0100 Subject: sb118: additional main -> SAL_MAIN adaptions (to ensure osl_setCommandArgs is called) --- rsc/source/prj/gui.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx index 6bf466348d1b..9b0bb2d3fa78 100644 --- a/rsc/source/prj/gui.cxx +++ b/rsc/source/prj/gui.cxx @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -71,15 +72,7 @@ RscVerbosity lcl_determineVerbosity( int argc, char ** argv ) return RscVerbosityNormal; } -#if defined( UNX ) || ( defined( OS2 ) && ( defined( CSET ) || defined ( GCC ))) || defined (WTC) || defined(ICC) || defined(__MINGW32__) -int main ( int argc, char ** argv) { -#else -#if defined( MTW ) -int main ( int argc, char const ** argv) { -#else -int cdecl main ( int argc, char ** argv) { -#endif -#endif +SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { #ifndef UNX #ifdef CSET atexit( ExitProgram ); -- cgit From 4e0a003d8289b16c012fc936cc9f1fa2130b2bd9 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 3 Feb 2010 13:49:27 +0100 Subject: sb118: reverted parts of HG -c 160b248247a0 again: the "static code executing before SAL_MAIN" problem was too severe; instead, globally set DBGSV_INIT build env var to new solenv/bin/dbgsv.ini --- tools/source/debug/debug.cxx | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 3bf25b43a82d..e298d6e9659f 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -64,8 +64,6 @@ #endif #include -#include -#include #include #include @@ -666,13 +664,26 @@ BOOL PointerList::IsIn( const void* p ) const // ======================================================================= -static rtl::OString DbgGetDbgFileName() +static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) { - rtl::OUString s; - rtl::Bootstrap::get( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBGSV_INIT")), s, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("dbgsv.ini"))); - return rtl::OUStringToOString(s, osl_getThreadTextEncoding()); +#if defined( UNX ) + const sal_Char* pName = getenv("DBGSV_INIT"); + if ( !pName ) + pName = ".dbgsv.init"; + strncpy( pStr, pName, nMaxLen ); +#elif defined( WNT ) + const sal_Char* pName = getenv("DBGSV_INIT"); + if ( pName ) + strncpy( pStr, pName, nMaxLen ); + else + GetProfileStringA( "sv", "dbgsv", "dbgsv.ini", pStr, nMaxLen ); +#elif defined( OS2 ) + PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSV", + "dbgsv.ini", (PSZ)pStr, nMaxLen ); +#else + strncpy( pStr, "dbgsv.ini", nMaxLen ); +#endif + pStr[ nMaxLen - 1 ] = 0; } // ----------------------------------------------------------------------- @@ -721,13 +732,14 @@ static DebugData* GetDebugData() DbgGetLogFileName( aDebugData.aDbgData.aDebugName ); // DEBUG.INI-File - FILETYPE pIniFile = FileOpen( DbgGetDbgFileName().getStr(), "r" ); + sal_Char aBuf[ 4096 ]; + DbgGetDbgFileName( aBuf, sizeof( aBuf ) ); + FILETYPE pIniFile = FileOpen( aBuf, "r" ); if ( pIniFile != NULL ) { ConfigSection eCurrentSection = eUnknown; // no sophisticated algorithm here, assume that the whole file fits into aBuf ... - sal_Char aBuf[ 4096 ]; ULONG nReallyRead = FileRead( aBuf, 1, sizeof( aBuf ) / sizeof( sal_Char ) - 1, pIniFile ); aBuf[ nReallyRead ] = 0; const sal_Char* pLine = aBuf; @@ -1194,7 +1206,9 @@ void* DbgFunc( USHORT nAction, void* pParam ) { const DbgData* pData = static_cast< const DbgData* >( pParam ); - FILETYPE pIniFile = FileOpen( DbgGetDbgFileName().getStr(), "w" ); + sal_Char aBuf[ 4096 ]; + DbgGetDbgFileName( aBuf, sizeof( aBuf ) ); + FILETYPE pIniFile = FileOpen( aBuf, "w" ); if ( pIniFile == NULL ) break; -- cgit From 2f7231406991297a3e03ad13bfb46eadc636a04d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 3 Feb 2010 17:38:46 +0100 Subject: ppp02: #i108740# distibguish between preferred and formatting paper size --- vcl/source/gdi/print3.cxx | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 5ac7d509ceb0..c2b1b637afd5 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -742,27 +742,43 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons { PrinterController::PageSize aPageSize; aPageSize.aSize = mpPrinter->GetPaperSize(); + awt::Size aSetSize, aIsSize; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { - if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) { - awt::Size aSize; - i_rProps[ nProperty].Value >>= aSize; - aPageSize.aSize.Width() = aSize.Width; - aPageSize.aSize.Height() = aSize.Height; - - Size aCurSize( mpPrinter->GetPaperSize() ); - Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); - if( aRealPaperSize != aCurSize ) - mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); + i_rProps[ nProperty ].Value >>= aSetSize; } - if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + { + i_rProps[ nProperty ].Value >>= aIsSize; + } + else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) { sal_Bool bVal = sal_False; - i_rProps[ nProperty].Value >>= bVal; + i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast(bVal); } } + + Size aCurSize( mpPrinter->GetPaperSize() ); + if( aSetSize.Width && aSetSize.Height ) + { + Size aSetPaperSize( aSetSize.Width, aSetSize.Height ); + Size aRealPaperSize( getRealPaperSize( aSetPaperSize ) ); + if( aRealPaperSize != aCurSize ) + aIsSize = aSetSize; + } + + if( aIsSize.Width && aIsSize.Height ) + { + aPageSize.aSize.Width() = aIsSize.Width; + aPageSize.aSize.Height() = aIsSize.Height; + + Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); + if( aRealPaperSize != aCurSize ) + mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); + } return aPageSize; } -- cgit From 624a9db6cff42903d72a58784f7b247be727062d Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 3 Feb 2010 21:44:04 -0500 Subject: koheiautodecimal: #i26826# Prefer scientific notation for values less than 1.0E-4. --- svl/source/numbers/zformat.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 8c49ed34c5a7..56cb6c80eb63 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -71,6 +71,7 @@ struct Gregorian }; const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary... +const double EXP_LOWER_BOUND = 1.0E-4; // prefer scientific notation below this value. } @@ -2012,6 +2013,12 @@ bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, Stri if (bSign) fTestNum = -fTestNum; + if (fTestNum < EXP_LOWER_BOUND) + { + lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString); + return true; + } + double fExp = log10(fTestNum); // Values < 1.0 always have one digit before the decimal point. sal_uInt16 nDigitPre = fExp >= 0.0 ? static_cast(ceil(fExp)) : 1; @@ -2072,7 +2079,27 @@ BOOL SvNumberformat::GetOutputString(double fNumber, { if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION) { + bool bSign = ::rtl::math::isSignBitSet(fNumber); + if (bSign) + fNumber = -fNumber; ImpGetOutputInputLine(fNumber, OutString); + if (fNumber < EXP_LOWER_BOUND) + { + xub_StrLen nLen = OutString.Len(); + if (!nLen) + return false; + + if (nLen > 11) + { + sal_uInt16 nStandardPrec = rScan.GetStandardPrec(); + nStandardPrec = ::std::min(nStandardPrec, static_cast(14)); // limits to 14 decimals + OutString = ::rtl::math::doubleToUString( fNumber, + rtl_math_StringFormat_E, nStandardPrec /*2*/, + GetFormatter().GetNumDecimalSep().GetChar(0), true); + } + } + if (bSign) + OutString.Insert('-', 0); return false; } ImpGetOutputStandard(fNumber, OutString); -- cgit From 4cec6d24d5b976ddfe022c3dca554fd7942a4cd6 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Thu, 4 Feb 2010 10:34:33 +0100 Subject: dr73: #i108935# prevent error from debug STL: don't calculate position behind end of vector --- vcl/source/gdi/sallayout.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index c8748c65e2d3..4d80f5a1aa19 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1803,8 +1803,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) int nRunStart, nRunEnd; while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl)) { - if (bRtl) std::fill(vRtl.begin() + nRunStart - rArgs.mnMinCharPos, - vRtl.begin() + nRunEnd - rArgs.mnMinCharPos, true); + if (bRtl) std::fill(vRtl.begin() + ( nRunStart - rArgs.mnMinCharPos ), + vRtl.begin() + ( nRunEnd - rArgs.mnMinCharPos ), true); } rArgs.ResetPos(); -- cgit From 46830b2a1b5b4dbcda6555122782ebf1d1ef0383 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 5 Feb 2010 12:58:44 +0100 Subject: writerfilter07: #i108047# do not throw through C code --- sax/source/fastparser/fastparser.cxx | 495 +++++++++++++++-------------------- sax/source/fastparser/fastparser.hxx | 17 +- 2 files changed, 219 insertions(+), 293 deletions(-) diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 2b2461c1173f..3bbbaa5dbb9f 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -44,8 +45,9 @@ #include -using ::rtl::OUString; using ::rtl::OString; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; using namespace ::std; using namespace ::osl; using namespace ::cppu; @@ -54,8 +56,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::xml::sax; //using namespace ::com::sun::star::util; using namespace ::com::sun::star::io; -namespace sax_fastparser -{ + +namespace sax_fastparser { // -------------------------------------------------------------------- @@ -114,30 +116,35 @@ private: // the implementation part //--------------------------------------------- -extern "C" +extern "C" { + +static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts) { - static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts) - { - FastSaxParser::callbackStartElement(userData,name,atts); - } - static void call_callbackEndElement(void *userData, const XML_Char *name) - { - FastSaxParser::callbackEndElement(userData,name); - } - static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen ) - { - FastSaxParser::callbackCharacters(userData,s,nLen); - } - static int call_callbackExternalEntityRef(XML_Parser parser, - const XML_Char *openEntityNames, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) - { - return FastSaxParser::callbackExternalEntityRef(parser,openEntityNames,base,systemId,publicId); - } + FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData ); + pFastParser->callbackStartElement( name, atts ); +} + +static void call_callbackEndElement(void *userData, const XML_Char *name) +{ + FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData ); + pFastParser->callbackEndElement( name ); +} + +static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen ) +{ + FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( userData ); + pFastParser->callbackCharacters( s, nLen ); } +static int call_callbackExternalEntityRef( XML_Parser parser, + const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId ) +{ + FastSaxParser* pFastParser = reinterpret_cast< FastSaxParser* >( XML_GetUserData( parser ) ); + return pFastParser->callbackExternalEntityRef( parser, openEntityNames, base, systemId, publicId ); +} + +} // extern "C" + // -------------------------------------------------------------------- // FastLocatorImpl implementation // -------------------------------------------------------------------- @@ -175,15 +182,13 @@ OUString SAL_CALL FastLocatorImpl::getSystemId(void) throw (RuntimeException) // FastSaxParser implementation // -------------------------------------------------------------------- -FastSaxParser::FastSaxParser( ) +FastSaxParser::FastSaxParser() { mxDocumentLocator.set( new FastLocatorImpl( this ) ); // performance-Improvment. Reference is needed when calling the startTag callback. // Handing out the same object with every call is allowed (see sax-specification) mxAttributes.set( new FastAttributeList( mxTokenHandler ) ); - - mbExceptionWasThrown = sal_False; } // -------------------------------------------------------------------- @@ -422,34 +427,27 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx struct Entity entity; entity.maStructSource = maStructSource; - if( ! entity.maStructSource.aInputStream.is() ) - { - throw SAXException( OUString::createFromAscii( "No input source" ), Reference< XInterface > () , Any() ); - } + if( !entity.maStructSource.aInputStream.is() ) + throw SAXException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source" ) ), Reference< XInterface >(), Any() ); entity.maConverter.setInputStream( entity.maStructSource.aInputStream ); if( entity.maStructSource.sEncoding.getLength() ) - { - entity.maConverter.setEncoding( OUStringToOString( entity.maStructSource.sEncoding , RTL_TEXTENCODING_ASCII_US ) ); - } + entity.maConverter.setEncoding( OUStringToOString( entity.maStructSource.sEncoding, RTL_TEXTENCODING_ASCII_US ) ); // create parser with proper encoding entity.mpParser = XML_ParserCreate( 0 ); - if( ! entity.mpParser ) - { - throw SAXException( OUString::createFromAscii( "Couldn't create parser" ), Reference< XInterface > (), Any() ); - } + if( !entity.mpParser ) + throw SAXException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Couldn't create parser" ) ), Reference< XInterface >(), Any() ); // set all necessary C-Callbacks - XML_SetUserData( entity.mpParser , this ); - XML_SetElementHandler( entity.mpParser , - call_callbackStartElement , - call_callbackEndElement ); - XML_SetCharacterDataHandler( entity.mpParser , call_callbackCharacters ); - XML_SetExternalEntityRefHandler( entity.mpParser, - call_callbackExternalEntityRef); + XML_SetUserData( entity.mpParser, this ); + XML_SetElementHandler( entity.mpParser, call_callbackStartElement, call_callbackEndElement ); + XML_SetCharacterDataHandler( entity.mpParser, call_callbackCharacters ); + XML_SetExternalEntityRefHandler( entity.mpParser, call_callbackExternalEntityRef ); + // maSavedException used to transport exceptions through C callbacks maSavedException.clear(); + pushEntity( entity ); try { @@ -572,112 +570,71 @@ Sequence< OUString > FastSaxParser::getSupportedServiceNames(void) throw (Runtim * Helper functions and classes * *-------------------------------------------*/ -OUString getErrorMessage( XML_Error xmlE, OUString sSystemId , sal_Int32 nLine ) -{ - OUString Message; - if( XML_ERROR_NONE == xmlE ) { - Message = OUString::createFromAscii( "No" ); - } - else if( XML_ERROR_NO_MEMORY == xmlE ) { - Message = OUString::createFromAscii( "no memory" ); - } - else if( XML_ERROR_SYNTAX == xmlE ) { - Message = OUString::createFromAscii( "syntax" ); - } - else if( XML_ERROR_NO_ELEMENTS == xmlE ) { - Message = OUString::createFromAscii( "no elements" ); - } - else if( XML_ERROR_INVALID_TOKEN == xmlE ) { - Message = OUString::createFromAscii( "invalid token" ); - } - else if( XML_ERROR_UNCLOSED_TOKEN == xmlE ) { - Message = OUString::createFromAscii( "unclosed token" ); - } - else if( XML_ERROR_PARTIAL_CHAR == xmlE ) { - Message = OUString::createFromAscii( "partial char" ); - } - else if( XML_ERROR_TAG_MISMATCH == xmlE ) { - Message = OUString::createFromAscii( "tag mismatch" ); - } - else if( XML_ERROR_DUPLICATE_ATTRIBUTE == xmlE ) { - Message = OUString::createFromAscii( "duplicate attribute" ); - } - else if( XML_ERROR_JUNK_AFTER_DOC_ELEMENT == xmlE ) { - Message = OUString::createFromAscii( "junk after doc element" ); - } - else if( XML_ERROR_PARAM_ENTITY_REF == xmlE ) { - Message = OUString::createFromAscii( "parameter entity reference" ); - } - else if( XML_ERROR_UNDEFINED_ENTITY == xmlE ) { - Message = OUString::createFromAscii( "undefined entity" ); - } - else if( XML_ERROR_RECURSIVE_ENTITY_REF == xmlE ) { - Message = OUString::createFromAscii( "recursive entity reference" ); - } - else if( XML_ERROR_ASYNC_ENTITY == xmlE ) { - Message = OUString::createFromAscii( "async entity" ); - } - else if( XML_ERROR_BAD_CHAR_REF == xmlE ) { - Message = OUString::createFromAscii( "bad char reference" ); - } - else if( XML_ERROR_BINARY_ENTITY_REF == xmlE ) { - Message = OUString::createFromAscii( "binary entity reference" ); - } - else if( XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF == xmlE ) { - Message = OUString::createFromAscii( "attribute external entity reference" ); - } - else if( XML_ERROR_MISPLACED_XML_PI == xmlE ) { - Message = OUString::createFromAscii( "misplaced xml processing instruction" ); - } - else if( XML_ERROR_UNKNOWN_ENCODING == xmlE ) { - Message = OUString::createFromAscii( "unknown encoding" ); - } - else if( XML_ERROR_INCORRECT_ENCODING == xmlE ) { - Message = OUString::createFromAscii( "incorrect encoding" ); - } - else if( XML_ERROR_UNCLOSED_CDATA_SECTION == xmlE ) { - Message = OUString::createFromAscii( "unclosed cdata section" ); - } - else if( XML_ERROR_EXTERNAL_ENTITY_HANDLING == xmlE ) { - Message = OUString::createFromAscii( "external entity reference" ); - } - else if( XML_ERROR_NOT_STANDALONE == xmlE ) { - Message = OUString::createFromAscii( "not standalone" ); - } - OUString str = OUString::createFromAscii( "[" ); - str += sSystemId; - str += OUString::createFromAscii( " line " ); - str += OUString::valueOf( nLine ); - str += OUString::createFromAscii( "]: " ); - str += Message; - str += OUString::createFromAscii( "error" ); +namespace { - return str; +OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine ) +{ + const sal_Char* pMessage = ""; + switch( xmlE ) + { + case XML_ERROR_NONE: pMessage = "No"; break; + case XML_ERROR_NO_MEMORY: pMessage = "no memory"; break; + case XML_ERROR_SYNTAX: pMessage = "syntax"; break; + case XML_ERROR_NO_ELEMENTS: pMessage = "no elements"; break; + case XML_ERROR_INVALID_TOKEN: pMessage = "invalid token"; break; + case XML_ERROR_UNCLOSED_TOKEN: pMessage = "unclosed token"; break; + case XML_ERROR_PARTIAL_CHAR: pMessage = "partial char"; break; + case XML_ERROR_TAG_MISMATCH: pMessage = "tag mismatch"; break; + case XML_ERROR_DUPLICATE_ATTRIBUTE: pMessage = "duplicate attribute"; break; + case XML_ERROR_JUNK_AFTER_DOC_ELEMENT: pMessage = "junk after doc element"; break; + case XML_ERROR_PARAM_ENTITY_REF: pMessage = "parameter entity reference"; break; + case XML_ERROR_UNDEFINED_ENTITY: pMessage = "undefined entity"; break; + case XML_ERROR_RECURSIVE_ENTITY_REF: pMessage = "recursive entity reference"; break; + case XML_ERROR_ASYNC_ENTITY: pMessage = "async entity"; break; + case XML_ERROR_BAD_CHAR_REF: pMessage = "bad char reference"; break; + case XML_ERROR_BINARY_ENTITY_REF: pMessage = "binary entity reference"; break; + case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: pMessage = "attribute external entity reference"; break; + case XML_ERROR_MISPLACED_XML_PI: pMessage = "misplaced xml processing instruction"; break; + case XML_ERROR_UNKNOWN_ENCODING: pMessage = "unknown encoding"; break; + case XML_ERROR_INCORRECT_ENCODING: pMessage = "incorrect encoding"; break; + case XML_ERROR_UNCLOSED_CDATA_SECTION: pMessage = "unclosed cdata section"; break; + case XML_ERROR_EXTERNAL_ENTITY_HANDLING: pMessage = "external entity reference"; break; + case XML_ERROR_NOT_STANDALONE: pMessage = "not standalone"; break; + default:; + } + + OUStringBuffer aBuffer( sal_Unicode( '[' ) ); + aBuffer.append( sSystemId ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " line " ) ); + aBuffer.append( nLine ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "]: " ) ); + aBuffer.appendAscii( pMessage ); + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " error" ) ); + return aBuffer.makeStringAndClear(); } +} // namespace // starts parsing with actual parser ! -void FastSaxParser::parse( ) +void FastSaxParser::parse() { - const int nBufSize = 16*1024; + const int BUFFER_SIZE = 16 * 1024; + Sequence< sal_Int8 > seqOut( BUFFER_SIZE ); - int nRead = nBufSize; - Sequence< sal_Int8 > seqOut(nBufSize); - - while( nRead ) + int nRead = 0; + do { - nRead = getEntity().maConverter.readAndConvert( seqOut, nBufSize ); - - if( ! nRead ) + nRead = getEntity().maConverter.readAndConvert( seqOut, BUFFER_SIZE ); + if( nRead <= 0 ) { - XML_Parse( getEntity().mpParser, ( const char * ) seqOut.getArray(), 0 , 1 ); + XML_Parse( getEntity().mpParser, (const char*) seqOut.getConstArray(), 0, 1 ); break; } - sal_Bool bContinue = ( XML_Parse( getEntity().mpParser, (const char *) seqOut.getArray(), nRead, 0 ) != 0 ); - - if( !bContinue || mbExceptionWasThrown ) + bool bContinue = XML_Parse( getEntity().mpParser, (const char*) seqOut.getConstArray(), nRead, 0 ) != 0; + // callbacks used inside XML_Parse may have caught an exception + if( !bContinue || maSavedException.hasValue() ) { // Error during parsing ! XML_Error xmlE = XML_GetErrorCode( getEntity().mpParser ); @@ -685,26 +642,25 @@ void FastSaxParser::parse( ) sal_Int32 nLine = mxDocumentLocator->getLineNumber(); SAXParseException aExcept( - getErrorMessage(xmlE , sSystemId, nLine) , + lclGetErrorMessage( xmlE, sSystemId, nLine ), Reference< XInterface >(), - Any( &maSavedException , getCppuType( &maSavedException) ), + Any( &maSavedException, getCppuType( &maSavedException ) ), mxDocumentLocator->getPublicId(), mxDocumentLocator->getSystemId(), mxDocumentLocator->getLineNumber(), mxDocumentLocator->getColumnNumber() - ); + ); + // error handler is set, it may throw the exception if( mxErrorHandler.is() ) - { - // error handler is set, so the handler may throw the maSavedException mxErrorHandler->fatalError( Any( aExcept ) ); - } - // Error handler has not thrown an maSavedException, but parsing cannot go on, - // so an maSavedException MUST be thrown. + // error handler has not thrown, but parsing cannot go on, the + // exception MUST be thrown throw aExcept; } } + while( nRead > 0 ); } //------------------------------------------ @@ -724,25 +680,23 @@ struct AttributeData } // namespace -void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName, const XML_Char **awAttributes ) +void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char** awAttributes ) { - FastSaxParser *pThis = (FastSaxParser*)pvThis; - Reference< XFastContextHandler > xParentContext; - if( !pThis->maContextStack.empty() ) + if( !maContextStack.empty() ) { - xParentContext = pThis->maContextStack.top()->mxContext; + xParentContext = maContextStack.top()->mxContext; if( !xParentContext.is() ) { // we ignore current elements, so no processing needed - pThis->pushContext(); + pushContext(); return; } } - pThis->pushContext(); + pushContext(); - pThis->mxAttributes->clear(); + mxAttributes->clear(); // create attribute map and process namespace instructions int i = 0; @@ -750,108 +704,100 @@ void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName, const XML_Char *pName; const XML_Char *pPrefix; - /* #158414# Each element may define new namespaces, also for attribues. - First, process all namespace attributes and cache other attributes in a - vector. Second, process the attributes after namespaces have been - initialized. */ - ::std::vector< AttributeData > aAttribs; - - // #158414# first: get namespaces - for( ; awAttributes[i]; i += 2 ) + try { - OSL_ASSERT( awAttributes[i+1] ); + /* #158414# Each element may define new namespaces, also for attribues. + First, process all namespace attributes and cache other attributes in a + vector. Second, process the attributes after namespaces have been + initialized. */ + ::std::vector< AttributeData > aAttribs; - pThis->splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen ); - if( nPrefixLen ) + // #158414# first: get namespaces + for( ; awAttributes[i]; i += 2 ) { - if( (nPrefixLen == 5) && (strncmp( pPrefix, "xmlns", 5 ) == 0) ) + OSL_ASSERT( awAttributes[i+1] ); + + splitName( awAttributes[i], pPrefix, nPrefixLen, pName, nNameLen ); + if( nPrefixLen ) { - pThis->DefineNamespace( OString( pName, nNameLen ), awAttributes[i+1] ); + if( (nPrefixLen == 5) && (strncmp( pPrefix, "xmlns", 5 ) == 0) ) + { + DefineNamespace( OString( pName, nNameLen ), awAttributes[i+1] ); + } + else + { + aAttribs.resize( aAttribs.size() + 1 ); + aAttribs.back().maPrefix = OString( pPrefix, nPrefixLen ); + aAttribs.back().maName = OString( pName, nNameLen ); + aAttribs.back().maValue = OString( awAttributes[i+1] ); + } } else { - aAttribs.resize( aAttribs.size() + 1 ); - aAttribs.back().maPrefix = OString( pPrefix, nPrefixLen ); - aAttribs.back().maName = OString( pName, nNameLen ); - aAttribs.back().maValue = OString( awAttributes[i+1] ); + if( (nNameLen == 5) && (strcmp( pName, "xmlns" ) == 0) ) + { + // namespace of the element found + maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 ); + } + else + { + aAttribs.resize( aAttribs.size() + 1 ); + aAttribs.back().maName = OString( pName, nNameLen ); + aAttribs.back().maValue = OString( awAttributes[i+1] ); + } } } - else + + // #158414# second: fill attribute list with other attributes + for( ::std::vector< AttributeData >::const_iterator aIt = aAttribs.begin(), aEnd = aAttribs.end(); aIt != aEnd; ++aIt ) { - if( (nNameLen == 5) && (strcmp( pName, "xmlns" ) == 0) ) + if( aIt->maPrefix.getLength() > 0 ) { - // namespace of the element found - pThis->maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 ); + sal_Int32 nAttributeToken = GetTokenWithPrefix( aIt->maPrefix, aIt->maName ); + if( nAttributeToken != FastToken::DONTKNOW ) + mxAttributes->add( nAttributeToken, aIt->maValue ); + else + mxAttributes->addUnknown( GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue ); } else { - aAttribs.resize( aAttribs.size() + 1 ); - aAttribs.back().maName = OString( pName, nNameLen ); - aAttribs.back().maValue = OString( awAttributes[i+1] ); + sal_Int32 nAttributeToken = GetToken( aIt->maName ); + if( nAttributeToken != FastToken::DONTKNOW ) + mxAttributes->add( nAttributeToken, aIt->maValue ); + else + mxAttributes->addUnknown( aIt->maName, aIt->maValue ); } } - } - // #158414# second: fill attribute list with other attributes - for( ::std::vector< AttributeData >::const_iterator aIt = aAttribs.begin(), aEnd = aAttribs.end(); aIt != aEnd; ++aIt ) - { - if( aIt->maPrefix.getLength() ) - { - const sal_Int32 nAttributeToken = pThis->GetTokenWithPrefix( aIt->maPrefix, aIt->maName ); - if( nAttributeToken != FastToken::DONTKNOW ) - pThis->mxAttributes->add( nAttributeToken, aIt->maValue ); - else - pThis->mxAttributes->addUnknown( pThis->GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue ); - } + sal_Int32 nElementToken; + splitName( pwName, pPrefix, nPrefixLen, pName, nNameLen ); + if( nPrefixLen > 0 ) + nElementToken = GetTokenWithPrefix( pPrefix, nPrefixLen, pName, nNameLen ); + else if( maContextStack.top()->maNamespace.getLength() > 0 ) + nElementToken = GetTokenWithNamespaceURL( maContextStack.top()->maNamespace, pName, nNameLen ); else - { - const sal_Int32 nAttributeToken = pThis->GetToken( aIt->maName ); - if( nAttributeToken != FastToken::DONTKNOW ) - pThis->mxAttributes->add( nAttributeToken, aIt->maValue ); - else - pThis->mxAttributes->addUnknown( aIt->maName, aIt->maValue ); - } - } + nElementToken = GetToken( pName ); + maContextStack.top()->mnElementToken = nElementToken; - sal_Int32 nElementToken; - pThis->splitName( pwName, pPrefix, nPrefixLen, pName, nNameLen ); - if( nPrefixLen ) - { - nElementToken = pThis->GetTokenWithPrefix( pPrefix, nPrefixLen, pName, nNameLen ); - } - else if( pThis->maContextStack.top()->maNamespace.getLength() ) - { - nElementToken = pThis->GetTokenWithNamespaceURL( pThis->maContextStack.top()->maNamespace, pName, nNameLen ); - } - else - { - nElementToken = pThis->GetToken( pName ); - } - pThis->maContextStack.top()->mnElementToken = nElementToken; - - try - { - Reference< XFastAttributeList > xAttr( pThis->mxAttributes.get() ); + Reference< XFastAttributeList > xAttr( mxAttributes.get() ); Reference< XFastContextHandler > xContext; if( nElementToken == FastToken::DONTKNOW ) { - if( nPrefixLen ) - { - pThis->maContextStack.top()->maNamespace = pThis->GetNamespaceURL( pPrefix, nPrefixLen ); - } + if( nPrefixLen > 0 ) + maContextStack.top()->maNamespace = GetNamespaceURL( pPrefix, nPrefixLen ); - const OUString aNamespace( pThis->maContextStack.top()->maNamespace ); + const OUString aNamespace( maContextStack.top()->maNamespace ); const OUString aElementName( pPrefix, nPrefixLen, RTL_TEXTENCODING_UTF8 ); - pThis->maContextStack.top()->maElementName = aElementName; + maContextStack.top()->maElementName = aElementName; if( xParentContext.is() ) xContext = xParentContext->createUnknownChildContext( aNamespace, aElementName, xAttr ); else - xContext = pThis->mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr ); + xContext = mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr ); if( xContext.is() ) { - pThis->maContextStack.top()->mxContext = xContext; + maContextStack.top()->mxContext = xContext; xContext->startUnknownElement( aNamespace, aElementName, xAttr ); } } @@ -860,142 +806,125 @@ void FastSaxParser::callbackStartElement( void *pvThis, const XML_Char *pwName, if( xParentContext.is() ) xContext = xParentContext->createFastChildContext( nElementToken, xAttr ); else - xContext = pThis->mxDocumentHandler->createFastChildContext( nElementToken, xAttr ); + xContext = mxDocumentHandler->createFastChildContext( nElementToken, xAttr ); if( xContext.is() ) { - pThis->maContextStack.top()->mxContext = xContext; + maContextStack.top()->mxContext = xContext; xContext->startFastElement( nElementToken, xAttr ); } } } catch( Exception& e ) { - pThis->maSavedException <<= e; + maSavedException <<= e; } } -void FastSaxParser::callbackEndElement( void *pvThis , const XML_Char * ) +void FastSaxParser::callbackEndElement( const XML_Char* ) { - FastSaxParser *pThis = (FastSaxParser*)pvThis; - - if( !pThis->maContextStack.empty() ) + OSL_ENSURE( !maContextStack.empty(), "FastSaxParser::callbackEndElement - no context" ); + if( !maContextStack.empty() ) { - SaxContextImplPtr pContext( pThis->maContextStack.top() ); + SaxContextImplPtr pContext( maContextStack.top() ); const Reference< XFastContextHandler >& xContext( pContext->mxContext ); if( xContext.is() ) try { sal_Int32 nElementToken = pContext->mnElementToken; if( nElementToken != FastToken::DONTKNOW ) - { xContext->endFastElement( nElementToken ); - } else - { xContext->endUnknownElement( pContext->maNamespace, pContext->maElementName ); - } } catch( Exception& e ) { - pThis->maSavedException <<= e; + maSavedException <<= e; } - pThis->popContext(); - } - else - { - OSL_ENSURE( false, "no context on sax::FastSaxParser::callbackEndElement() ??? "); + popContext(); } } -void FastSaxParser::callbackCharacters( void *pvThis , const XML_Char *s , int nLen ) +void FastSaxParser::callbackCharacters( const XML_Char* s, int nLen ) { - FastSaxParser *pThis = (FastSaxParser*)pvThis; - - const Reference< XFastContextHandler >& xContext( pThis->maContextStack.top()->mxContext ); + const Reference< XFastContextHandler >& xContext( maContextStack.top()->mxContext ); if( xContext.is() ) try { xContext->characters( OUString( s, nLen, RTL_TEXTENCODING_UTF8 ) ); } catch( Exception& e ) { - pThis->maSavedException <<= e; + maSavedException <<= e; } } int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, - const XML_Char *context, - const XML_Char * /*base*/, - const XML_Char *systemId, - const XML_Char *publicId) + const XML_Char *context, const XML_Char * /*base*/, const XML_Char *systemId, const XML_Char *publicId ) { bool bOK = true; InputSource source; - FastSaxParser *pImpl = ((FastSaxParser*)XML_GetUserData( parser )); struct Entity entity; - if( pImpl->mxEntityResolver.is() ) { - try - { - entity.maStructSource = pImpl->mxEntityResolver->resolveEntity( - OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) , - OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) ); - } - catch( SAXParseException & e ) - { - pImpl->maSavedException <<= e; - bOK = false; - } - catch( SAXException & e ) - { - pImpl->maSavedException <<= SAXParseException( - e.Message , e.Context , e.WrappedException , - pImpl->mxDocumentLocator->getPublicId(), - pImpl->mxDocumentLocator->getSystemId(), - pImpl->mxDocumentLocator->getLineNumber(), - pImpl->mxDocumentLocator->getColumnNumber() ); - bOK = false; - } + if( mxEntityResolver.is() ) try + { + entity.maStructSource = mxEntityResolver->resolveEntity( + OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) , + OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) ); + } + catch( SAXParseException & e ) + { + maSavedException <<= e; + bOK = false; + } + catch( SAXException & e ) + { + maSavedException <<= SAXParseException( + e.Message, e.Context, e.WrappedException, + mxDocumentLocator->getPublicId(), + mxDocumentLocator->getSystemId(), + mxDocumentLocator->getLineNumber(), + mxDocumentLocator->getColumnNumber() ); + bOK = false; } if( entity.maStructSource.aInputStream.is() ) { - entity.mpParser = XML_ExternalEntityParserCreate( parser , context, 0 ); + entity.mpParser = XML_ExternalEntityParserCreate( parser, context, 0 ); if( ! entity.mpParser ) { return false; } entity.maConverter.setInputStream( entity.maStructSource.aInputStream ); - pImpl->pushEntity( entity ); + pushEntity( entity ); try { - pImpl->parse(); + parse(); } catch( SAXParseException & e ) { - pImpl->maSavedException <<= e; + maSavedException <<= e; bOK = false; } catch( IOException &e ) { SAXException aEx; aEx.WrappedException <<= e; - pImpl->maSavedException <<= aEx; + maSavedException <<= aEx; bOK = false; } catch( RuntimeException &e ) { SAXException aEx; aEx.WrappedException <<= e; - pImpl->maSavedException <<= aEx; + maSavedException <<= aEx; bOK = false; } - pImpl->popEntity(); + popEntity(); XML_ParserFree( entity.mpParser ); } @@ -1003,4 +932,4 @@ int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, return bOK; } -} +} // namespace sax_fastparser diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 3e6220a0c782..967aa0e3234d 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -97,14 +97,12 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); -public: - // the C-Callbacks for the expat parser - void static callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts); - void static callbackEndElement(void *userData, const XML_Char *name); - void static callbackCharacters( void *userData , const XML_Char *s , int nLen ); - int static callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); + // called by the C callbacks of the expat parser + void callbackStartElement( const XML_Char* name, const XML_Char** atts ); + void callbackEndElement( const XML_Char* name ); + void callbackCharacters( const XML_Char* s, int nLen ); + int callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); -public: void pushEntity( const struct Entity &entity ) { vecEntity.push_back( entity ); } void popEntity() { vecEntity.pop_back( ); } struct Entity &getEntity() { return vecEntity.back(); } @@ -142,10 +140,9 @@ private: // External entity stack std::vector< struct Entity > vecEntity; - // Exception cannot be thrown through the C-XmlParser (possible resource leaks), - // therefor the maSavedException must be saved somewhere. + // Exceptions cannot be thrown through the C-XmlParser (possible resource leaks), + // therefore the exception must be saved somewhere. ::com::sun::star::uno::Any maSavedException; - sal_Bool mbExceptionWasThrown; ::com::sun::star::lang::Locale maLocale; -- cgit From 0e3b2c2af5e872665e2c57a0176f4956a1b8f3db Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 5 Feb 2010 13:45:10 +0100 Subject: #161586# allowing for thesaurus vendor images --- unotools/inc/unotools/lingucfg.hxx | 4 ++- unotools/source/config/lingucfg.cxx | 71 +++++++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 11 deletions(-) mode change 100644 => 100755 unotools/inc/unotools/lingucfg.hxx mode change 100644 => 100755 unotools/source/config/lingucfg.cxx diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx old mode 100644 new mode 100755 index 49500db964c2..68d0acb43ff7 --- a/unotools/inc/unotools/lingucfg.hxx +++ b/unotools/inc/unotools/lingucfg.hxx @@ -233,8 +233,10 @@ public: ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - bool HasAnyVendorImages() const; + bool HasVendorImages( const char *pImageName ) const; bool HasGrammarChecker() const; }; diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx old mode 100644 new mode 100755 index d4eff83efec6..917862fdd5bf --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1409,21 +1409,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( } -bool SvtLinguConfig::HasAnyVendorImages() const +::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const { - bool bRes = false; - try + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; + +::rtl::OUString SvtLinguConfig::GetSynonymsContextImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } - catch (uno::Exception &) + return aRes; +} + + +bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const +{ + bool bRes = false; + if (pImageName) { - DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + sal_Int32 nVendors = aElementNames.getLength(); + const rtl::OUString *pVendor = aElementNames.getConstArray(); + for (sal_Int32 i = 0; i < nVendors; ++i) + { + uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() ); + sal_Int32 nProps = aPropNames.getLength(); + const rtl::OUString *pPropNames = aPropNames.getConstArray(); + for (sal_Int32 k = 0; k < nProps; ++k) + { + // for a quicker check we ignore the HC image names here + const OUString &rName = pPropNames[k]; + if (rName.equalsAscii( pImageName )) + { + bRes = true; + break; + } + } + } + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. HasVendorImages failed" ); + } } return bRes; } -- cgit From 28f0ce26ad0ba4c5dda5536697e0628a3311dd4c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 10 Feb 2010 13:53:11 +0100 Subject: sw33a11y01: #i88070# - accessible Writer comments - part 3 --- vcl/unx/gtk/a11y/atkwrapper.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 8854083e1509..d88f5150b0c5 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -286,7 +286,9 @@ static AtkRole mapToAtkRole( sal_Int16 nRole ) ATK_ROLE_RULER, ATK_ROLE_UNKNOWN, // SECTION - registered below ATK_ROLE_UNKNOWN, // TREE_ITEM - registered below - ATK_ROLE_TREE_TABLE + ATK_ROLE_TREE_TABLE, + ATK_ROLE_SCROLL_PANE, // COMMENT - mapped to atk_role_scroll_pane + ATK_ROLE_UNKNOWN // COMMENT_END - mapped to atk_role_unknown }; static bool initialized = false; -- cgit From ab8f91dc7359fb53642632d2d9232f90579169ac Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 10 Feb 2010 18:55:30 +0100 Subject: ppp02: #i109022# create automnemonics before layouting --- vcl/source/window/printdlg.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 4b1f0b850b57..a8259078637a 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1654,6 +1654,12 @@ void PrintDialog::setupOptionalUI() maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() ); #endif + // create auto mnemomnics now so they can be calculated in layout + ImplWindowAutoMnemonic( &maJobPage ); + ImplWindowAutoMnemonic( &maNUpPage ); + ImplWindowAutoMnemonic( &maOptionsPage ); + ImplWindowAutoMnemonic( this ); + // calculate job page Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); // and layout page -- cgit From 57aa95f8ec0c9615619d55c5323c0c0ac0a04d18 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 11 Feb 2010 11:07:17 +0100 Subject: sb118: #i109112# re-purpose EXTRAJARFILES --- l10ntools/source/help/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk index 57164004af8b..32a03e6611cc 100644 --- a/l10ntools/source/help/makefile.mk +++ b/l10ntools/source/help/makefile.mk @@ -105,7 +105,7 @@ JAVACLASSFILES = \ $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class .IF "$(SYSTEM_LUCENE)" == "YES" -CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR) +EXTRAJARFILES += $(LUCENE_CORE_JAR) $(LUCENE_ANALYZERS_JAR) .ELSE JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar .ENDIF -- cgit From 7e2c826eabd76afb13bee5c3231221011b388099 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 16 Mar 2010 15:38:33 +0100 Subject: os141: fix order of calls --- svtools/source/uno/treecontrolpeer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index e5a273bbbf6d..70ffe67b7759 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -287,14 +287,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN pEntry->AddItem( pUnoItem ); + mpTreeImpl->insert( pEntry, pParent, nPos ); + if( msDefaultExpandedGraphicURL.getLength() ) mpTreeImpl->SetExpandedEntryBmp( pEntry, maDefaultExpandedImage ); if( msDefaultCollapsedGraphicURL.getLength() ) mpTreeImpl->SetCollapsedEntryBmp( pEntry, maDefaultCollapsedImage ); - mpTreeImpl->insert( pEntry, pParent, nPos ); - updateEntry( pEntry ); } return pEntry; -- cgit From 73fece8b3989b7dc56fbcf50c720ab70e6ba5995 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 18 Mar 2010 08:21:26 +0100 Subject: os141: when all rows are removed clear also the current selection --- svtools/inc/svtools/table/tablecontrol.hxx | 1 + svtools/source/table/tablecontrol.cxx | 5 +++++ svtools/source/table/tablecontrol_impl.cxx | 6 ++++++ svtools/source/table/tablecontrol_impl.hxx | 1 + svtools/source/uno/svtxgridcontrol.cxx | 1 + 5 files changed, 14 insertions(+) diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index f08a1723c143..6419446d03be 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -221,6 +221,7 @@ namespace svt { namespace table ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); + void clearSelection(); void selectionChanged(bool _bChanged); protected: diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 8c95fab6120b..2e7b28fd6aa4 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -175,6 +175,11 @@ namespace svt { namespace table return m_pImpl->goTo( _nColPos, _nRowPos ); } //-------------------------------------------------------------------- + void TableControl::clearSelection() + { + m_pImpl->clearSelection(); + } + //-------------------------------------------------------------------- void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved) { Rectangle _rRect; diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 1526dbdb778d..3288ab6a4284 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1647,6 +1647,12 @@ namespace svt { namespace table { return m_nRowSelected; } + //-------------------------------------------------------------------- + void TableControl_Impl::clearSelection() + { + m_nRowSelected.clear(); + } + //-------------------------------------------------------------------- //------------------------------------------------------------------------------- void TableControl_Impl::removeSelectedRow(RowPos _nRowPos) { diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 0a487c77c76c..12b518aa3578 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -204,6 +204,7 @@ namespace svt { namespace table /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(); + void clearSelection(); // IAbstractTableControl virtual void hideCursor(); virtual void showCursor(); diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index b411181c2aab..728ee17bbda2 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -478,6 +478,7 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri deselectAllRows(); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); + pTable->clearSelection(); m_pTableModel->getCellContent().clear(); if(pTable->isAccessibleAlive()) { -- cgit From f400db10eea4d9244506d671671598379437630d Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 22 Mar 2010 10:18:33 +0100 Subject: os141: allow tabstop also for treecontrols --- toolkit/source/controls/tree/treecontrol.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index 5655e4e10abc..f70a73c3b5eb 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -67,6 +67,7 @@ UnoTreeModel::UnoTreeModel() ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE ); ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE ); ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL ); -- cgit From 08e0e53c74d3d5019a7c510e39e8adf57145ca70 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 10:05:04 +0200 Subject: fs33a: #i111238# add support for images to AWT's ListBoxControl/Model --- toolkit/inc/toolkit/awt/vclxwindows.hxx | 31 +- toolkit/inc/toolkit/controls/roadmapcontrol.hxx | 6 - toolkit/inc/toolkit/controls/unocontrol.hxx | 2 +- toolkit/inc/toolkit/controls/unocontrolmodel.hxx | 1 - toolkit/inc/toolkit/controls/unocontrols.hxx | 123 +++-- toolkit/source/awt/vclxwindows.cxx | 136 +++++- toolkit/source/controls/unocontrolmodel.cxx | 21 +- toolkit/source/controls/unocontrols.cxx | 558 +++++++++++++++++++++-- vcl/inc/vcl/lstbox.hxx | 1 + vcl/source/control/lstbox.cxx | 9 + 10 files changed, 759 insertions(+), 129 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index c334e4d9af65..8efe01b526ba 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -83,7 +83,9 @@ #include #include #include +#include #include +#include #include #include "toolkit/awt/vclxwindow.hxx" @@ -677,9 +679,12 @@ public: // ---------------------------------------------------- // class VCLXListBox // ---------------------------------------------------- -class VCLXListBox : public ::com::sun::star::awt::XListBox, - public ::com::sun::star::awt::XTextLayoutConstrains, - public VCLXWindow +typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow + , ::com::sun::star::awt::XListBox + , ::com::sun::star::awt::XTextLayoutConstrains + , ::com::sun::star::awt::XItemListListener + > VCLXListBox_Base; +class VCLXListBox : public VCLXListBox_Base { private: ActionListenerMultiplexer maActionListeners; @@ -694,16 +699,6 @@ protected: public: VCLXListBox(); - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XComponent void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); @@ -744,6 +739,16 @@ public: void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + // XItemListListener + virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) throw (::com::sun::star::uno::RuntimeException); + static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } }; diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx index 7ac858a6a7b7..46f31947b276 100644 --- a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx +++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx @@ -132,15 +132,9 @@ namespace toolkit{ // ::com::sun::star::io::XPersistObject ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::beans::XMultiPropertySet -// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlModel, szServiceName2_UnoControlRoadmapModel ) -// void ImplPropertyChanged( sal_uInt16 nPropId ); - sal_Int32 SAL_CALL getCount() throw (RuntimeException); virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx index 578b5070e8e8..19d498ef2a85 100644 --- a/toolkit/inc/toolkit/controls/unocontrol.hxx +++ b/toolkit/inc/toolkit/controls/unocontrol.hxx @@ -119,7 +119,7 @@ protected: ::osl::Mutex& GetMutex() { return maMutex; } ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const; - void updateFromModel(); + virtual void updateFromModel(); void peerCreated(); bool ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer ); diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx index 2de5e36aa02c..a443cb4d2d6b 100644 --- a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx +++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx @@ -74,7 +74,6 @@ protected: void ImplRegisterProperties( const std::list< sal_uInt16 > &rIds ); void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault ); ::com::sun::star::uno::Sequence ImplGetPropertyIds() const; - virtual void ImplPropertyChanged( sal_uInt16 nPropId ); virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const; diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index a4015dfd3b44..5c612c887859 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -58,12 +59,17 @@ #include #include #include +#include #include #include #include #include #include +#include + +#include +#include #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" #define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:" @@ -751,19 +757,18 @@ public: // ---------------------------------------------------- // class UnoControlListBoxModel // ---------------------------------------------------- -class UnoControlListBoxModel : public UnoControlModel +struct UnoControlListBoxModel_Data; +typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel + , ::com::sun::star::awt::XItemList + > UnoControlListBoxModel_Base; +class UnoControlListBoxModel :public UnoControlListBoxModel_Base { -protected: - ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; - ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - public: UnoControlListBoxModel(); - UnoControlListBoxModel( const UnoControlListBoxModel& rModel ) : UnoControlModel( rModel ) {;} + UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ); UnoControlModel* Clone() const { return new UnoControlListBoxModel( *this ); } - void ImplPropertyChanged( sal_uInt16 nPropId ); virtual void ImplNormalizePropertySequence( const sal_Int32 _nCount, /// the number of entries in the arrays sal_Int32* _pHandles, /// the handles of the properties to set @@ -780,41 +785,85 @@ public: // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel ) + // ::com::sun::star::awt::XItemList + virtual ::sal_Int32 SAL_CALL getItemCount() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertItem( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItem( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeAllItems( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); + + // OPropertySetHelper + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); + +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +private: + void impl_notifyItemListEvent_nolck( + const sal_Int32 i_nItemPosition, + const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, + void ( SAL_CALL ::com::sun::star::awt::XItemListListener::*NotificationMethod )( const ::com::sun::star::awt::ItemListEvent& ) + ); + + void impl_handleInsert( + const sal_Int32 i_nItemPosition, + const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, + ::osl::ClearableMutexGuard& i_rClearBeforeNotify + ); + + void impl_handleRemove( + const sal_Int32 i_nItemPosition, + ::osl::ClearableMutexGuard& i_rClearBeforeNotify + ); + + void impl_handleModify( + const sal_Int32 i_nItemPosition, + const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, + ::osl::ClearableMutexGuard& i_rClearBeforeNotify + ); + + void impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const; + void impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems ); + +private: + ::boost::scoped_ptr< UnoControlListBoxModel_Data > m_pData; + ::cppu::OInterfaceContainerHelper m_aItemListListeners; }; // ---------------------------------------------------- // class UnoListBoxControl // ---------------------------------------------------- -class UnoListBoxControl : public UnoControlBase, - public ::com::sun::star::awt::XListBox, - public ::com::sun::star::awt::XItemListener, - public ::com::sun::star::awt::XLayoutConstrains, - public ::com::sun::star::awt::XTextLayoutConstrains +typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase + , ::com::sun::star::awt::XListBox + , ::com::sun::star::awt::XItemListener + , ::com::sun::star::awt::XLayoutConstrains + , ::com::sun::star::awt::XTextLayoutConstrains + , ::com::sun::star::awt::XItemListListener + > UnoListBoxControl_Base; +class UnoListBoxControl : public UnoListBoxControl_Base { -private: - ActionListenerMultiplexer maActionListeners; - ItemListenerMultiplexer maItemListeners; - public: - UnoListBoxControl(); ::rtl::OUString GetComponentServiceName(); - void ImplUpdateSelectedItemsProperty(); - void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); - - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); } - ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); } - void SAL_CALL release() throw() { OWeakAggObject::release(); } void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); } - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::awt::XListBox void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException); @@ -851,9 +900,27 @@ public: ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException); + // XUnoControl + sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException ); + + // XItemListListener + virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox ) +protected: + void ImplUpdateSelectedItemsProperty(); + virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); + virtual void updateFromModel(); + +private: + ActionListenerMultiplexer maActionListeners; + ItemListenerMultiplexer maItemListeners; }; // ---------------------------------------------------- diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index e2fc78421d5e..ff4dc6fb5ec4 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -29,7 +29,7 @@ #include "precompiled_toolkit.hxx" #include #include -#include +#include #include #include #include @@ -43,6 +43,9 @@ #include #include #include +#include +#include +#include #include #ifndef _SV_BUTTON_HXX @@ -58,12 +61,17 @@ #include #include #include -#include +#include using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::makeAny; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::lang::EventObject; +using ::com::sun::star::awt::ItemListEvent; +using ::com::sun::star::awt::XItemList; using ::com::sun::star::graphic::XGraphic; +using ::com::sun::star::graphic::XGraphicProvider; using namespace ::com::sun::star; using namespace ::com::sun::star::awt::VisualEffect; @@ -1550,22 +1558,6 @@ VCLXListBox::VCLXListBox() { } -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXListBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XListBox*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXListBox ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ), - VCLXWindow::getTypes() -IMPL_XTYPEPROVIDER_END - void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -2096,6 +2088,114 @@ void VCLXListBox::ImplCallItemListeners() } } +namespace +{ + Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL ) + { + if ( !i_rImageURL.getLength() ) + return Image(); + + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XGraphicProvider > xProvider; + if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) + { + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put( "URL", i_rImageURL ); + Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); + return Image( xGraphic ); + } + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return Image(); + } +} + +void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ), + "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" ); + pListBox->InsertEntry( + i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(), + i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(), + i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ), + "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" ); + + pListBox->RemoveEntry( i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); + + ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); + ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ), + "VCLXListBox::listItemModified: illegal (inconsistent) item position!" ); + + // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert + + const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : pListBox->GetEntry( i_rEvent.ItemPosition ); + const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) ); + + pListBox->RemoveEntry( i_rEvent.ItemPosition ); + pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition ); +} + +void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); + + pListBox->Clear(); + + (void)i_rEvent; +} + +void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() ); + ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" ); + + pListBox->Clear(); + + Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW ); + uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems(); + for ( sal_Int32 i=0; iInsertEntry( aItems[i].First, lcl_getImageFromURL( aItems[i].Second ) ); + } +} + +void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException) +{ + // just disambiguate + VCLXWindow::disposing( i_rEvent ); +} // ---------------------------------------------------- // class VCLXMessageBox diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 29b683a5ed40..d34f5d9d9006 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -216,10 +216,6 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const return mpData->Get( nPropId ) ? sal_True : sal_False; } -void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) -{ -} - ::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const { ::com::sun::star::uno::Any aDefault; @@ -1259,22 +1255,13 @@ sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any & void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) { - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - // Fehlt: Die gefakten Einzelproperties des FontDescriptors... ImplControlProperty* pProp = mpData->Get( nPropId ); - if ( pProp ) - { - DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" ); - ImplPropertyChanged( (sal_uInt16)nPropId ); - pProp->SetValue( rValue ); - } - else - { - // exception... - DBG_ERROR( "SetPropertyValues: Invalid Property!" ); - } + ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" ); + + DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" ); + pProp->SetValue( rValue ); } void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index ae9e59d045e7..a4b7037b3b73 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -73,8 +73,11 @@ #include #include +#include using namespace ::com::sun::star; +using ::com::sun::star::graphic::XGraphic; +using ::com::sun::star::uno::Reference; using namespace ::toolkit; @@ -1841,19 +1844,100 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException) return sal_True; } -// ---------------------------------------------------- -// class UnoControlListBoxModel -// ---------------------------------------------------- +// ===================================================================================================================== +// = UnoControlListBoxModel_Data +// ===================================================================================================================== +typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > ListItem; +struct UnoControlListBoxModel_Data +{ + UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_aListItems() + ,m_bSettingLegacyProperty( false ) + { + } + + sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); } + + const ListItem& getItem( const sal_Int32 i_nIndex ) const + { + if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl ); + return m_aListItems[ i_nIndex ]; + } + + ListItem& getItem( const sal_Int32 i_nIndex ) + { + return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) ); + } + + ListItem& insertItem( const sal_Int32 i_nIndex ) + { + if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl ); + return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() ); + } + + Sequence< ListItem > getAllItems() const + { + Sequence< ListItem > aItems( sal_Int32( m_aListItems.size() ) ); + ::std::copy( m_aListItems.begin(), m_aListItems.end(), aItems.getArray() ); + return aItems; + } + + void setAllItems( const ::std::vector< ListItem >& i_rItems ) + { + m_aListItems = i_rItems; + } + + void removeItem( const sal_Int32 i_nIndex ) + { + if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl ); + m_aListItems.erase( m_aListItems.begin() + i_nIndex ); + } + + void removeAllItems() + { + ::std::vector< ListItem > aEmpty; + m_aListItems.swap( aEmpty ); + } + +public: + bool m_bSettingLegacyProperty; + +private: + UnoControlListBoxModel& m_rAntiImpl; + ::std::vector< ListItem > m_aListItems; +}; + +// ===================================================================================================================== +// = UnoControlListBoxModel +// ===================================================================================================================== +// --------------------------------------------------------------------------------------------------------------------- UnoControlListBoxModel::UnoControlListBoxModel() + :UnoControlListBoxModel_Base() + ,m_pData( new UnoControlListBoxModel_Data( *this ) ) + ,m_aItemListListeners( GetMutex() ) { UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox ); } +// --------------------------------------------------------------------------------------------------------------------- +UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource ) + :UnoControlListBoxModel_Base( i_rSource ) + ,m_pData( new UnoControlListBoxModel_Data( *this ) ) + ,m_aItemListListeners( GetMutex() ) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- ::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ); } +// --------------------------------------------------------------------------------------------------------------------- uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const { if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) @@ -1865,6 +1949,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const return UnoControlModel::ImplGetDefaultValue( nPropId ); } +// --------------------------------------------------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper() { static UnoPropertyArrayHelper* pHelper = NULL; @@ -1876,6 +1961,7 @@ uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const return *pHelper; } +// --------------------------------------------------------------------------------------------------------------------- // beans::XMultiPropertySet uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException) { @@ -1883,19 +1969,61 @@ uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySet return xInfo; } -void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId ) +// --------------------------------------------------------------------------------------------------------------------- +namespace +{ + struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem > + { + ListItem operator()( const ::rtl::OUString& i_rItemText ) + { + return ListItem( i_rItemText, ::rtl::OUString() ); + } + }; +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception) { - if ( nPropId == BASEPROPERTY_STRINGITEMLIST ) + UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue ); + + if ( nHandle == BASEPROPERTY_STRINGITEMLIST ) { + // reset selection uno::Sequence aSeq; uno::Any aAny; aAny <<= aSeq; setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny ); - } - UnoControlModel::ImplPropertyChanged( nPropId ); + if ( !m_pData->m_bSettingLegacyProperty ) + { + // synchronize the legacy StringItemList property with our list items + Sequence< ::rtl::OUString > aStringItemList; + Any aPropValue; + getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST ); + OSL_VERIFY( aPropValue >>= aStringItemList ); + + ::std::vector< ListItem > aItems( aStringItemList.getLength() ); + ::std::transform( + aStringItemList.getConstArray(), + aStringItemList.getConstArray() + aStringItemList.getLength(), + aItems.begin(), + CreateListItem() + ); + m_pData->setAllItems( aItems ); + + // since an XItemListListener does not have a "all items modified" or some such method, + // we simulate this by notifying removal of all items, followed by insertion of all new + // items + lang::EventObject aEvent; + aEvent.Source = *this; + m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent ); + // TODO: OPropertySetHelper calls into this method with the mutex locked ... + // which is wrong for the above notifications ... + } + } } +// --------------------------------------------------------------------------------------------------------------------- void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles, uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(()) { @@ -1906,12 +2034,311 @@ void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCo UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles ); } +// --------------------------------------------------------------------------------------------------------------------- +::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + return m_pData->getItemCount(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->insertItem( i_nPosition ) ); + rItem.First = i_rItemText; + rItem.Second = i_rItemImageURL; + + impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->insertItem( i_nPosition ) ); + rItem.First = i_rItemText; + + impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->insertItem( i_nPosition ) ); + rItem.Second = i_rItemImageURL; + + impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + m_pData->removeItem( i_nPosition ); + + impl_handleRemove( i_nPosition, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::removeAllItems( ) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + m_pData->removeAllItems(); + + impl_handleRemove( -1, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + rItem.First = i_rItemText; + + impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + rItem.Second = i_rItemImageURL; + + impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + // SYNCHRONIZED -----> + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + rItem.First = i_rItemText; + rItem.Second = i_rItemImageURL; + + impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard ); + // <----- SYNCHRONIZED +} + +// --------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem.First; +} + +// --------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem.Second; +} + +// --------------------------------------------------------------------------------------------------------------------- +beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem; +} + +// --------------------------------------------------------------------------------------------------------------------- +Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + return m_pData->getAllItems(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException) +{ + if ( i_Listener.is() ) + m_aItemListListeners.addInterface( i_Listener ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException) +{ + if ( i_Listener.is() ) + m_aItemListListeners.removeInterface( i_Listener ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const +{ + Sequence< ::rtl::OUString > aStringItemList; + Any aPropValue; + getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST ); + OSL_VERIFY( aPropValue >>= aStringItemList ); + + o_rStringItems.resize( size_t( aStringItemList.getLength() ) ); + ::std::copy( + aStringItemList.getConstArray(), + aStringItemList.getConstArray() + aStringItemList.getLength(), + o_rStringItems.begin() + ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems ) +{ + Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() ); + ::std::copy( + i_rStringItems.begin(), + i_rStringItems.end(), + aStringItems.getArray() + ); + m_pData->m_bSettingLegacyProperty = true; + try + { + setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) ); + } + catch( const Exception& ) + { + m_pData->m_bSettingLegacyProperty = false; + throw; + } + m_pData->m_bSettingLegacyProperty = false; +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify ) +{ + // SYNCHRONIZED -----> + // sync with legacy StringItemList property + ::std::vector< ::rtl::OUString > aStringItems; + impl_getStringItemList( aStringItems ); + OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" ); + if ( size_t( i_nItemPosition ) <= aStringItems.size() ) + { + const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() ); + aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText ); + } + + i_rClearBeforeNotify.clear(); + // <----- SYNCHRONIZED + impl_setStringItemList_nolck( aStringItems ); + + // notify ItemListListeners + impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify ) +{ + // SYNCHRONIZED -----> + const bool bAllItems = ( i_nItemPosition < 0 ); + // sync with legacy StringItemList property + ::std::vector< ::rtl::OUString > aStringItems; + impl_getStringItemList( aStringItems ); + if ( !bAllItems ) + { + OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" ); + if ( size_t( i_nItemPosition ) < aStringItems.size() ) + { + aStringItems.erase( aStringItems.begin() + i_nItemPosition ); + } + } + else + { + aStringItems.resize(0); + } + + i_rClearBeforeNotify.clear(); + // <----- SYNCHRONIZED + impl_setStringItemList_nolck( aStringItems ); + + // notify ItemListListeners + if ( bAllItems ) + { + EventObject aEvent( *this ); + m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent ); + } + else + { + impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(), + &XItemListListener::listItemRemoved ); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify ) +{ + // SYNCHRONIZED -----> + if ( !!i_rItemText ) + { + // sync with legacy StringItemList property + ::std::vector< ::rtl::OUString > aStringItems; + impl_getStringItemList( aStringItems ); + OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" ); + if ( size_t( i_nItemPosition ) < aStringItems.size() ) + { + aStringItems[ i_nItemPosition] = *i_rItemText; + } + + i_rClearBeforeNotify.clear(); + // <----- SYNCHRONIZED + impl_setStringItemList_nolck( aStringItems ); + } + else + { + i_rClearBeforeNotify.clear(); + // <----- SYNCHRONIZED + } + + // notify ItemListListeners + impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified ); +} + +// --------------------------------------------------------------------------------------------------------------------- +void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText, + const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, + void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) ) +{ + ItemListEvent aEvent; + aEvent.Source = *this; + aEvent.ItemPosition = i_nItemPosition; + if ( !!i_rItemText ) + { + aEvent.ItemText.IsPresent = sal_True; + aEvent.ItemText.Value = *i_rItemText; + } + if ( !!i_rItemImageURL ) + { + aEvent.ItemImageURL.IsPresent = sal_True; + aEvent.ItemImageURL.Value = *i_rItemImageURL; + } + + m_aItemListListeners.notifyEach( NotificationMethod, aEvent ); +} + // ---------------------------------------------------- // class UnoListBoxControl // ---------------------------------------------------- UnoListBoxControl::UnoListBoxControl() - : maActionListeners( *this ), - maItemListeners( *this ) + :maActionListeners( *this ) + ,maItemListeners( *this ) { maComponentInfos.nWidth = 100; maComponentInfos.nHeight = 12; @@ -1922,27 +2349,6 @@ UnoListBoxControl::UnoListBoxControl() return ::rtl::OUString::createFromAscii( "listbox" ); } -// uno::XInterface -uno::Any UnoListBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException) -{ - uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( awt::XListBox*, this ), - SAL_STATIC_CAST( awt::XItemListener*, this ), - SAL_STATIC_CAST( lang::XEventListener*, SAL_STATIC_CAST( awt::XItemListener*, this ) ), - SAL_STATIC_CAST( awt::XLayoutConstrains*, this ), - SAL_STATIC_CAST( awt::XTextLayoutConstrains*, this ) ); - return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType )); -} - -// lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( UnoListBoxControl ) - getCppuType( ( uno::Reference< awt::XListBox>* ) NULL ), - getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ), - getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ), - getCppuType( ( uno::Reference< awt::XTextLayoutConstrains>* ) NULL ), - UnoControlBase::getTypes() -IMPL_XTYPEPROVIDER_END - void UnoListBoxControl::dispose() throw(uno::RuntimeException) { lang::EventObject aEvt; @@ -1966,24 +2372,26 @@ void UnoListBoxControl::ImplUpdateSelectedItemsProperty() } } -void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal ) +void UnoListBoxControl::updateFromModel() { - UnoControl::ImplSetPeerProperty( rPropName, rVal ); + UnoControlBase::updateFromModel(); + + Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY ); + ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" ); + + EventObject aEvent( getModel() ); + xItemListListener->itemListChanged( aEvent ); +} - // Wenn die SelectedItems vor der StringItemList gesetzt werden, - // hat das keine Auswirkung... +void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal ) +{ if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) ) - { - ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS ); - uno::Any aVal = ImplGetPropertyValue( aSelPropName ); - if ( !( aVal.getValueType().getTypeClass() == uno::TypeClass_VOID ) ) - { - uno::Reference< awt::XVclWindowPeer > xW( getPeer(), uno::UNO_QUERY ); - if (xW.is()) - // same comment as in UnoControl::ImplSetPeerProperty - see there - xW->setProperty( aSelPropName, aVal ); - } - } + // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item + // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes + // will be forwarded to the peer, which will update itself accordingly. + return; + + UnoControl::ImplSetPeerProperty( rPropName, rVal ); } void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) @@ -2281,6 +2689,66 @@ void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines Impl_getColumnsAndLines( nCols, nLines ); } +sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( GetMutex() ); + + const Reference< XItemList > xOldItems( getModel(), UNO_QUERY ); + OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" ); + const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY ); + OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" ); + + if ( !UnoListBoxControl_Base::setModel( i_rModel ) ) + return sal_False; + + if ( xOldItems.is() ) + xOldItems->removeItemListListener( this ); + if ( xNewItems.is() ) + xNewItems->addItemListListener( this ); + + return sal_True; +} + +void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemInserted( i_rEvent ); +} + +void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemRemoved( i_rEvent ); +} + +void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->listItemModified( i_rEvent ); +} + +void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->allItemsRemoved( i_rEvent ); +} + +void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException) +{ + const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY ); + OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" ); + if ( xPeerListener.is() ) + xPeerListener->itemListChanged( i_rEvent ); +} + // ---------------------------------------------------- // class UnoControlComboBoxModel // ---------------------------------------------------- diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx index 98cd05d999dd..3659e5aee485 100644 --- a/vcl/inc/vcl/lstbox.hxx +++ b/vcl/inc/vcl/lstbox.hxx @@ -130,6 +130,7 @@ public: virtual USHORT GetEntryPos( const XubString& rStr ) const; virtual USHORT GetEntryPos( const void* pData ) const; + Image GetEntryImage( USHORT nPos ) const; virtual XubString GetEntry( USHORT nPos ) const; virtual USHORT GetEntryCount() const; diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 70b67c0a3d57..dde34d52806c 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -1081,6 +1081,15 @@ void ListBox::RemoveEntry( USHORT nPos ) // ----------------------------------------------------------------------- +Image ListBox::GetEntryImage( USHORT nPos ) const +{ + if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) ) + return mpImplLB->GetEntryList()->GetEntryImage( nPos ); + return Image(); +} + +// ----------------------------------------------------------------------- + USHORT ListBox::GetEntryPos( const XubString& rStr ) const { USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr ); -- cgit From 7878b4f9db37a25be146c36438422ad1a2c9141f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 14:10:03 +0200 Subject: fs33a: #i111238# now with UserData support --- toolkit/inc/toolkit/controls/unocontrols.hxx | 2 + toolkit/source/controls/unocontrols.cxx | 84 +++++++++++++++++++++------- 2 files changed, 67 insertions(+), 19 deletions(-) diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 5c612c887859..71e0a915788d 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -795,9 +795,11 @@ public: virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setUserData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getUserData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index a4b7037b3b73..975040ca9070 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -1847,7 +1847,37 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException) // ===================================================================================================================== // = UnoControlListBoxModel_Data // ===================================================================================================================== -typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > ListItem; +struct ListItem +{ + ::rtl::OUString ItemText; + ::rtl::OUString ItemImageURL; + Any ItemUserData; + + ListItem() + :ItemText() + ,ItemImageURL() + ,ItemUserData() + { + } + + ListItem( const ::rtl::OUString& i_rItemText ) + :ItemText( i_rItemText ) + ,ItemImageURL() + ,ItemUserData() + { + } +}; + +typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem; + +struct StripItemData : public ::std::unary_function< ListItem, UnoListItem > +{ + UnoListItem operator()( const ListItem& i_rItem ) + { + return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL ); + } +}; + struct UnoControlListBoxModel_Data { UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl ) @@ -1878,10 +1908,10 @@ struct UnoControlListBoxModel_Data return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() ); } - Sequence< ListItem > getAllItems() const + Sequence< UnoListItem > getAllItems() const { - Sequence< ListItem > aItems( sal_Int32( m_aListItems.size() ) ); - ::std::copy( m_aListItems.begin(), m_aListItems.end(), aItems.getArray() ); + Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) ); + ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() ); return aItems; } @@ -1976,7 +2006,7 @@ namespace { ListItem operator()( const ::rtl::OUString& i_rItemText ) { - return ListItem( i_rItemText, ::rtl::OUString() ); + return ListItem( i_rItemText ); } }; } @@ -2047,8 +2077,8 @@ void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->insertItem( i_nPosition ) ); - rItem.First = i_rItemText; - rItem.Second = i_rItemImageURL; + rItem.ItemText = i_rItemText; + rItem.ItemImageURL = i_rItemImageURL; impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard ); // <----- SYNCHRONIZED @@ -2060,7 +2090,7 @@ void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, c ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->insertItem( i_nPosition ) ); - rItem.First = i_rItemText; + rItem.ItemText = i_rItemText; impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard ); // <----- SYNCHRONIZED @@ -2072,7 +2102,7 @@ void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->insertItem( i_nPosition ) ); - rItem.Second = i_rItemImageURL; + rItem.ItemImageURL = i_rItemImageURL; impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard ); // <----- SYNCHRONIZED @@ -2106,7 +2136,7 @@ void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, cons ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->getItem( i_nPosition ) ); - rItem.First = i_rItemText; + rItem.ItemText = i_rItemText; impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard ); // <----- SYNCHRONIZED @@ -2118,7 +2148,7 @@ void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, con ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->getItem( i_nPosition ) ); - rItem.Second = i_rItemImageURL; + rItem.ItemImageURL = i_rItemImageURL; impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard ); // <----- SYNCHRONIZED @@ -2130,35 +2160,51 @@ void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPositi ::osl::ClearableMutexGuard aGuard( GetMutex() ); // SYNCHRONIZED -----> ListItem& rItem( m_pData->getItem( i_nPosition ) ); - rItem.First = i_rItemText; - rItem.Second = i_rItemImageURL; + rItem.ItemText = i_rItemText; + rItem.ItemImageURL = i_rItemImageURL; impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard ); // <----- SYNCHRONIZED } +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UnoControlListBoxModel::setUserData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + ListItem& rItem( m_pData->getItem( i_nPosition ) ); + rItem.ItemUserData = i_rDataValue; +} + // --------------------------------------------------------------------------------------------------------------------- ::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::MutexGuard aGuard( GetMutex() ); - ListItem& rItem( m_pData->getItem( i_nPosition ) ); - return rItem.First; + const ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem.ItemText; } // --------------------------------------------------------------------------------------------------------------------- ::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::MutexGuard aGuard( GetMutex() ); - ListItem& rItem( m_pData->getItem( i_nPosition ) ); - return rItem.Second; + const ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem.ItemImageURL; } // --------------------------------------------------------------------------------------------------------------------- beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::MutexGuard aGuard( GetMutex() ); - ListItem& rItem( m_pData->getItem( i_nPosition ) ); - return rItem; + const ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL ); +} + +// --------------------------------------------------------------------------------------------------------------------- +Any SAL_CALL UnoControlListBoxModel::getUserData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::ClearableMutexGuard aGuard( GetMutex() ); + const ListItem& rItem( m_pData->getItem( i_nPosition ) ); + return rItem.ItemUserData; } // --------------------------------------------------------------------------------------------------------------------- -- cgit From 4de89c5b78184fb74e5c907df3d911379fa018be Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Feb 2010 10:45:01 +0100 Subject: autorecovery: +ENSURE_OR_RETURN_VOID --- tools/inc/tools/diagnose_ex.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 6833fd6632ce..b244d11dc305 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -130,6 +130,17 @@ #define ENSURE_OR_RETURN_FALSE(c, m) \ ENSURE_OR_RETURN(c, m, false) +/** This macro asserts the given condition (in debug mode), and + returns afterwards, without return value "void". + */ +#define ENSURE_OR_RETURN_VOID( c, m ) \ + if( !(c) ) \ + { \ + OSL_ENSURE( c, m ); \ + return; \ + } + + /** This macro asserts the given condition (in debug mode), and returns afterwards, without return value "void". -- cgit From 594ffd1d561d75217d1bfcb1cb9aeca5cf31c676 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 12 Feb 2010 12:45:29 +0100 Subject: cws tl74: switching from DBG_ASSERT to OSL_ENSURE (don't use 'tools') --- i18npool/source/transliteration/transliteration_body.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index d041a1d8f915..07ca4a781a25 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include "characterclassificationImpl.hxx" @@ -99,7 +99,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - DBG_ASSERT( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); nRes = MappingTypeUpperToLower; } } -- cgit From 64f1d786dd49626cec33d231292ce4ecb28b9c1f Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 12 Feb 2010 15:52:52 +0100 Subject: cws tl74: merge --- i18npool/source/transliteration/transliteration_body.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 i18npool/source/transliteration/transliteration_body.cxx diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx old mode 100644 new mode 100755 index d041a1d8f915..807a09b65e39 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include "characterclassificationImpl.hxx" @@ -99,7 +99,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - DBG_ASSERT( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); nRes = MappingTypeUpperToLower; } } -- cgit From f3f5684a87eec71e31151d0c17e73a16a593d71c Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 12 Feb 2010 17:05:02 +0100 Subject: recent changes for grid control --- toolkit/inc/toolkit/helper/property.hxx | 3 + .../controls/grid/defaultgridcolumnmodel.cxx | 35 ++++++++-- .../controls/grid/defaultgridcolumnmodel.hxx | 17 +++-- .../source/controls/grid/defaultgriddatamodel.cxx | 80 +++++++++++++++------- .../source/controls/grid/defaultgriddatamodel.hxx | 21 +++--- toolkit/source/controls/grid/gridcolumn.cxx | 67 ++++++++++++++++++ toolkit/source/controls/grid/gridcolumn.hxx | 17 ++++- toolkit/source/controls/grid/gridcontrol.cxx | 53 ++++++-------- toolkit/source/controls/grid/gridcontrol.hxx | 9 ++- toolkit/source/helper/property.cxx | 5 +- 10 files changed, 222 insertions(+), 85 deletions(-) diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index f82df1f5b53f..6fa223cc7b26 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -198,6 +198,9 @@ namespace rtl { #define BASEPROPERTY_GRID_SELECTIONMODE 144 #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool #define BASEPROPERTY_REFERENCE_DEVICE 146 +#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 147 +#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148 +#define BASEPROPERTY_GRID_LINE_COLOR 149 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index bdd7fb475afe..337076bdfaa9 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -41,7 +41,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; - +using namespace ::com::sun::star::style; #define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" )) namespace toolkit @@ -51,8 +51,10 @@ namespace toolkit // class DefaultGridColumnModel /////////////////////////////////////////////////////////////////////// -DefaultGridColumnModel::DefaultGridColumnModel() +DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory) : columns(std::vector< Reference< XGridColumn > >()) + ,m_nColumnHeaderHeight(10) + ,m_xFactory(xFactory) { } @@ -107,7 +109,7 @@ void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun { Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); - broadcast( column_changed, aEvent); + broadcast( column_removed, aEvent); } //--------------------------------------------------------------------- @@ -141,7 +143,6 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); columns.push_back(column); - sal_Int32 index = columns.size() - 1; broadcast_add(index, column ); return index; @@ -163,7 +164,7 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value else return Reference< XGridColumn >(); } - +//--------------------------------------------------------------------- void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) { BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); @@ -176,6 +177,26 @@ void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGr BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); } +//--------------------------------------------------------------------- +void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException) +{ + m_nColumnHeaderHeight = _value; +} +//--------------------------------------------------------------------- +sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnHeaderHeight() throw (::com::sun::star::uno::RuntimeException) +{ + return m_nColumnHeaderHeight; +} + +//--------------------------------------------------------------------- +void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + Reference xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY ); + for(sal_Int32 i=0;i SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& ) +Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory) { - return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel ); + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) ); } diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx index b230188f9107..d700a6b07b5d 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx @@ -41,6 +41,8 @@ #include #include #include +#include +#include using ::rtl::OUString; using namespace ::com::sun::star; @@ -58,7 +60,7 @@ class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, public MutexAndBroadcastHelper { public: - DefaultGridColumnModel(); + DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory); virtual ~DefaultGridColumnModel(); // XGridColumnModel @@ -71,17 +73,18 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); - + virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); private: void broadcast( broadcast_type eType, const GridColumnEvent& aEvent ); @@ -91,6 +94,8 @@ private: std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns; sal_Bool selectionAllowed; + sal_Int32 m_nColumnHeaderHeight; + Reference< XMultiServiceFactory > m_xFactory; }; } diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 865be80f55a7..c564618336af 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: treedatamodel.cxx,v $ + * $RCSfile: defaultgriddatamodel.cxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. @@ -30,17 +30,21 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#include "defaultgriddatamodel.hxx" +#include "DefaultGridDataModel.hxx" #include #include #include +#include +#include + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; +//using namespace ::com::sun::star::style; #define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" )) #define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" )) @@ -53,8 +57,9 @@ namespace toolkit /////////////////////////////////////////////////////////////////////// DefaultGridDataModel::DefaultGridDataModel() -: rowHeight(0), - rowHeaders(std::vector< ::rtl::OUString >()) +: rowHeight(10), + rowHeaders(std::vector< ::rtl::OUString >()), + m_nRowHeaderWidth(7) { } @@ -64,7 +69,7 @@ DefaultGridDataModel::~DefaultGridDataModel() { } -void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) +void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException) { ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() ); if( pIter ) @@ -85,25 +90,28 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& //--------------------------------------------------------------------- -void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) +void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException) { Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() ); + GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), + Sequence< Any >() ); broadcast( data_changed, aEvent); } //--------------------------------------------------------------------- -void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ) +void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, + ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException) { Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData ); + GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)rowData ); broadcast( row_added, aEvent); } //--------------------------------------------------------------------- -void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ) +void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, + ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException) { Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData ); @@ -168,19 +176,33 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S //--------------------------------------------------------------------- -void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & rRowdata) throw (::com::sun::star::uno::RuntimeException) { // store header name rowHeaders.push_back(headername); - // store row data - std::vector< rtl::OUString > newRow( - comphelper::sequenceToContainer< std::vector >(rRowdata)); + std::vector< Any > newRow; + for ( int i = 0; i < rRowdata.getLength();i++) + { + //OUString title(rRowdata[i]); + + // create and use interal a UnoControlFixedText for text content + //Reference< XFixedText > xFixedText( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedText" ) ), UNO_QUERY_THROW ); + //Reference< XControl > xFixedTextControl( xFixedText , UNO_QUERY ); + // + //Reference< XControlModel > xFixedTextModel( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedTextModel" ) ), UNO_QUERY ); + //Reference< ::com::sun::star::beans::XPropertySet > xFixedTextModelPropSet( xFixedTextModel, UNO_QUERY ); + //xFixedTextModelPropSet->setPropertyValue( OUString::createFromAscii( "Label"), makeAny( title ) ); + + //xFixedTextControl->setModel( xFixedTextModel ); + + newRow.push_back(rRowdata[i]); + } data.push_back( newRow ); - broadcast_add( data.size()-1, headername, rRowdata); + broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow)); } @@ -199,7 +221,7 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] ); rowHeaders.erase(rowHeaders.begin() + index); - Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] ); + Sequence< Any >& rowData ( (Sequence< Any >&)data[index] ); data.erase(data.begin() + index); broadcast_remove( index, headerName, rowData); } @@ -207,19 +229,19 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s return; } //--------------------------------------------------------------------- -::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException) +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException) { - std::vector< std::vector< ::rtl::OUString > >::iterator iterator; - std::vector< Sequence< ::rtl::OUString > > dummyContainer(0); + std::vector< std::vector< Any > >::iterator iterator; + std::vector< Sequence< Any > > dummyContainer(0); for(iterator = data.begin(); iterator != data.end(); iterator++) { - Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator)); + Sequence< Any > cols(comphelper::containerToSequence(*iterator)); dummyContainer.push_back( cols ); } - Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer)); + Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer)); return dataSequence; } @@ -237,14 +259,23 @@ void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDa { BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener ); } - +//--------------------------------------------------------------------- void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException) { rowHeaders.clear(); data.clear(); broadcast_remove( -1, ::rtl::OUString(), 0); } - +//--------------------------------------------------------------------- +void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException) +{ + m_nRowHeaderWidth = _value; +} +//--------------------------------------------------------------------- +sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException) +{ + return m_nRowHeaderWidth; +} //--------------------------------------------------------------------- // XComponent //--------------------------------------------------------------------- @@ -305,6 +336,5 @@ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& ) { - return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel ); + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() ); } - diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx index 18000c9f5a71..e2cd50389698 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: griddatamodel.hxx,v $ + * $RCSfile: defaultgriddatamodel.hxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -67,13 +68,14 @@ public: virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & data) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException); virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException); virtual void SAL_CALL removeAll() throw (RuntimeException); - + virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); @@ -86,14 +88,15 @@ public: private: - void broadcast( broadcast_type eType, const GridDataEvent& aEvent ); - void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ); - void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ); - void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ); + void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); + void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException); + void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException); + void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException); sal_Int32 rowHeight; - std::vector< std::vector < ::rtl::OUString > > data; + std::vector< std::vector < Any > > data; std::vector< ::rtl::OUString > rowHeaders; + sal_Int32 m_nRowHeaderWidth; }; } diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index 8b398b4aed58..e8dadc527fbd 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -41,6 +41,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::style; namespace toolkit { @@ -51,6 +52,9 @@ namespace toolkit GridColumn::GridColumn() : identifier(Any()) +,horizontalAlign(HorizontalAlignment(0)) +,columnWidth(4) +,bResizeable(true) { } @@ -91,6 +95,45 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s { columnWidth = value; } +//-------------------------------------------------------------------- + +::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException) +{ + return preferredWidth; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) +{ + preferredWidth = value; +} +//-------------------------------------------------------------------- + +::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException) +{ + return maxWidth; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) +{ + maxWidth = value; +} +//-------------------------------------------------------------------- + +::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException) +{ + return minWidth; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) +{ + minWidth = value; +} //-------------------------------------------------------------------- @@ -105,6 +148,30 @@ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com:: { title = value; } +//-------------------------------------------------------------------- + +sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException) +{ + return bResizeable; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException) +{ + bResizeable = value; +} +//--------------------------------------------------------------------- +HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() +{ + return horizontalAlign; +} +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) +{ + horizontalAlign = align; +} //--------------------------------------------------------------------- // XComponent diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx index a451054ce93f..a458a07ffda8 100644 --- a/toolkit/source/controls/grid/gridcolumn.hxx +++ b/toolkit/source/controls/grid/gridcolumn.hxx @@ -39,6 +39,7 @@ #include #include #include +#include using ::rtl::OUString; using namespace ::com::sun::star; @@ -62,9 +63,18 @@ public: virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException); - + virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); @@ -79,7 +89,12 @@ public: private: Any identifier; sal_Int32 columnWidth; + sal_Int32 preferredWidth; + sal_Int32 maxWidth; + sal_Int32 minWidth; + sal_Bool bResizeable; ::rtl::OUString title; + ::com::sun::star::style::HorizontalAlignment horizontalAlign; }; } diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx index c642d8a0dcce..fa0c3de3adb3 100644 --- a/toolkit/source/controls/grid/gridcontrol.cxx +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -71,11 +72,20 @@ UnoGridModel::UnoGridModel() ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable ImplRegisterProperty( BASEPROPERTY_HSCROLL ); ImplRegisterProperty( BASEPROPERTY_VSCROLL ); + ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER ); ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER ); ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL ); ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL ); ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE ); + ImplRegisterProperty( BASEPROPERTY_FONTRELIEF ); + ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); + ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); + ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND ); + ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND ); + ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR ); } @@ -152,50 +162,31 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW ); Reference xListener ( getPeer(), UNO_QUERY_THROW ); + //Reference xColListener ( getPeer(), UNO_QUERY_THROW ); Reference xPropSet ( getModel(), UNO_QUERY_THROW ); Reference xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW ); - xGridDataModel->addDataListener(xListener); + if(xGridDataModel != NULL) + xGridDataModel->addDataListener(xListener); + //Reference xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW ); + //if(xGridColumnModel != NULL) + // xGridColumnModel->addColumnListener(xColListener); } // ------------------------------------------------------------------- // XGridControl -// ------------------------------------------------------------------- - -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException) -{ - Reference xPropSet ( getModel(), UNO_QUERY_THROW ); - Reference xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW ); - - return xGridColumnModel; -} -void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException) -{ - Reference xPropSet ( getModel(), UNO_QUERY_THROW ); - xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model)); -} - -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException) -{ - Reference xPropSet ( getModel(), UNO_QUERY_THROW ); - Reference xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW ); - - return xGridDataModel; -} - -void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException) +::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) { - Reference xPropSet ( getModel(), UNO_QUERY_THROW ); - xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model)); + Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW ); + return xGrid->getItemIndexAtPoint( x, y ); } -::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException) { - return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y ); + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns ); } - /* void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException) { @@ -260,7 +251,7 @@ void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::un { Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener ); } -} +}//namespace toolkit Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& ) { diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index 5648c812fbff..8b219e70a0f2 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -33,10 +33,11 @@ #include #include -#include +#include #include #include #include +#include #include @@ -90,11 +91,9 @@ public: void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); // ::com::sun::star::awt::grid::XGridControl - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException); //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index a59af95a2e1f..9438cb93541b 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -283,7 +283,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ) + DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ), + DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ) }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); -- cgit From 32a402c2d5d9519e1bd5c0c33b4a9b2696b8220a Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 12 Feb 2010 17:08:15 +0100 Subject: recent changes for grid control --- svtools/inc/svtools/accessibletable.hxx | 3 +- svtools/inc/svtools/table/abstracttablecontrol.hxx | 12 +- svtools/inc/svtools/table/defaultinputhandler.hxx | 1 + svtools/inc/svtools/table/gridtablerenderer.hxx | 6 +- svtools/inc/svtools/table/tablecontrol.hxx | 8 +- svtools/inc/svtools/table/tabledatawindow.hxx | 3 + svtools/inc/svtools/table/tablemodel.hxx | 65 +- svtools/inc/svtools/table/tablerenderer.hxx | 34 +- svtools/source/table/defaultinputhandler.cxx | 33 +- svtools/source/table/gridtablerenderer.cxx | 306 ++++++++-- svtools/source/table/tablecontrol.cxx | 98 +-- svtools/source/table/tablecontrol_impl.cxx | 658 +++++++++++++++++---- svtools/source/table/tablecontrol_impl.hxx | 19 +- svtools/source/table/tabledatawindow.cxx | 32 +- svtools/source/table/tablegeometry.cxx | 8 +- svtools/source/uno/svtxgridcontrol.cxx | 383 +++++++++--- svtools/source/uno/svtxgridcontrol.hxx | 7 +- svtools/source/uno/unocontroltablemodel.cxx | 250 +++++++- svtools/source/uno/unocontroltablemodel.hxx | 34 +- 19 files changed, 1568 insertions(+), 392 deletions(-) diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index 0e3f08bfc568..e13a0afe9469 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -34,6 +34,7 @@ #include #include #include +#include // ============================================================================ @@ -125,7 +126,7 @@ public: virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0; virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0; virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; - virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; + virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; virtual std::vector& GetSelectedRows() = 0; }; diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 03bc0a999f7a..ba25152e34e2 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -29,6 +29,7 @@ #include #include #include +#include "tabletypes.hxx" //........................................................................ namespace svt { namespace table { @@ -111,14 +112,15 @@ namespace svt { namespace table @see TableControlAction */ virtual bool dispatchAction( TableControlAction _eAction ) = 0; - /** to be called on mouse button up/down - @return - if the click was in the visible area of the table control, - otherwise.*/ - virtual bool isClickInVisibleArea( const Point& _rPoint ) = 0; /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; + virtual void setCursorAtCurrentCell(const Point& rPoint) = 0; + virtual void setTooltip(const Point& rPoint ) = 0; + virtual RowPos getCurrentRow(const Point& rPoint ) = 0; + virtual void resizeColumn(const Point& rPoint ) = 0; + virtual bool startResizeColumn(const Point& rPoint) = 0; + virtual bool endResizeColumn(const Point& rPoint) = 0; virtual ~IAbstractTableControl() {}; }; diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx index eb1c14b43a85..0cd4ba5ea7df 100644 --- a/svtools/inc/svtools/table/defaultinputhandler.hxx +++ b/svtools/inc/svtools/table/defaultinputhandler.hxx @@ -43,6 +43,7 @@ namespace svt { namespace table friend class TableDataWindow; private: DefaultInputHandler_Impl* m_pImpl; + bool m_bResize; public: DefaultInputHandler(); diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx index a935f6b7386e..1facc75fecb7 100644 --- a/svtools/inc/svtools/table/gridtablerenderer.hxx +++ b/svtools/inc/svtools/table/gridtablerenderer.hxx @@ -89,7 +89,11 @@ namespace svt { namespace table bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ); - virtual void PaintCell( ColPos _nColumn, + virtual void PaintCellImage( ColPos _nColumn, + bool _bActive, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rArea, + const StyleSettings& _rStyle, Image* _pCellData ); + virtual void PaintCellString( ColPos _nColumn, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ); diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index e3edd0b681ae..59720cfd0602 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -32,6 +32,7 @@ #include #include #include "svtaccessiblefactory.hxx" +#include //........................................................................ namespace svt { namespace table @@ -70,6 +71,8 @@ namespace svt { namespace table DECL_LINK( ImplMouseButtonUpHdl, MouseEvent* ); TableControl_Impl* m_pImpl; + ::com::sun::star::uno::Sequence< sal_Int32 >& m_nCols; + ::com::sun::star::uno::Sequence< ::rtl::OUString >& m_aText; public: ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; @@ -201,12 +204,15 @@ namespace svt { namespace table virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const; virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const; virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; - virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; + virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; virtual sal_Bool HasRowHeader(); virtual sal_Bool HasColHeader(); virtual sal_Bool isAccessibleAlive( ) const; virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); + ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); + ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); + void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); protected: /// retrieves the XAccessible implementation associated with the GridControl instance diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index fddbfdcd4a3c..564680a39347 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -66,6 +66,9 @@ namespace svt { namespace table virtual void MouseMove( const MouseEvent& rMEvt); virtual void MouseButtonDown( const MouseEvent& rMEvt); virtual void MouseButtonUp( const MouseEvent& rMEvt); + virtual void SetPointer( const Pointer& rPointer ); + virtual void CaptureMouse(); + virtual void ReleaseMouse(); }; //........................................................................ diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 6e74d35b8586..18d4db16c123 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -29,10 +29,12 @@ #include #include #include - +#include #include - +#include #include +#include +#include //........................................................................ namespace svt { namespace table @@ -43,21 +45,16 @@ namespace svt { namespace table //==================================================================== //= cell data //==================================================================== - struct CellEntryType + struct TableContentType { - String m_aStr; - //Image m_aImage; - //Control m_aControl; - CellEntryType( const String& _rStr ) : - m_aStr( _rStr ) - {} + ::rtl::OUString sContent; + Image* pImage; + TableContentType() : + sContent(), + pImage( ) + { + } }; - - //typedef ::std::vector CellColumnContent; - //vector, which contains text data for each cell - typedef ::std::vector CellColumnContent; - //vector, which contains data for rows - typedef ::std::vector CellContent; //==================================================================== //= ScrollbarVisibility //==================================================================== @@ -284,7 +281,24 @@ namespace svt { namespace table */ virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0; + /** returns the preferred width of the column, or 0 if the column + does not have a preferred width. + + @see setMaxWidth + @see getMinWidth + @see getWidth + */ + virtual TableMetrics getPreferredWidth() const = 0; + /** sets the preferred width of the column, to be used when user resizes column + + @see getMaxWidth + @see setMinWidth + @see setWidth + */ + virtual void setPreferredWidth( TableMetrics _nPrefWidth ) = 0; + virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0; + virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0; /// deletes the column model instance virtual ~IColumnModel() { } }; @@ -429,19 +443,34 @@ namespace svt { namespace table */ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0; + virtual bool hasVerticalScrollbar() =0; + virtual bool hasHorizontalScrollbar() = 0; /** fills cells with content */ - virtual void setCellContent(std::vector > cellContent)=0; + virtual void setCellContent(std::vector< std::vector< ::com::sun::star::uno::Any > > cellContent)=0; /** gets the content of the cells */ - virtual std::vector >& getCellContent() = 0; + virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; /**sets title of header rows */ - virtual void setRowHeaderName(std::vector cellColumnContent)=0; + virtual void setRowHeaderName(std::vector cellColumnContent)=0; /** gets title of header rows */ virtual std::vector& getRowHeaderName() = 0; + virtual ::com::sun::star::util::Color getLineColor() = 0; + virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0; + virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; + virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + virtual ::com::sun::star::util::Color getTextColor() = 0; + virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0; + virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; + virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; + virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; + virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0; + /// destroys the table model instance virtual ~ITableModel() { } }; diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx index eb645ad574c4..6f9e9d0865c6 100644 --- a/svtools/inc/svtools/table/tablerenderer.hxx +++ b/svtools/inc/svtools/table/tablerenderer.hxx @@ -187,6 +187,38 @@ namespace svt { namespace table The row to be painted is denoted by the most recent call to ->PrepareRow. + @param _bSelected + if and only if the cell to be painted is + selected currently. This is the case if either + the row or the column of the cell is currently selected. +
+ Note that this flag is equal to the respective flag in the + previous ->PrepareRow call, it's passed here for convinience + only. + @param _bActive + if the cell is currently active. +
+ Note that this flag is equal to the respective flag in the + previous ->PrepareRow call, it's passed here for convinience + only. + @param _rDevice + denotes the device to paint onto + @param _rArea + the are into which the cell should be painted + @param _rStyle + the style to be used for drawing + @param _pCellData + the content of the cell + */ + virtual void PaintCellImage( ColPos _nColumn, + bool _bActive, bool _bSelected, + OutputDevice& _rDevice, const Rectangle& _rArea, + const StyleSettings& _rStyle, Image* _pCellData ) = 0; + /** paints a certain cell + + The row to be painted is denoted by the most recent call to + ->PrepareRow. + @param _bSelected if and only if the cell to be painted is selected currently. This is the case if either @@ -210,7 +242,7 @@ namespace svt { namespace table @param _rText the content of the cell */ - virtual void PaintCell( ColPos _nColumn, + virtual void PaintCellString( ColPos _nColumn, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0; diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index 17ee0222857f..d85ab643bdb0 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -49,6 +49,7 @@ namespace svt { namespace table //-------------------------------------------------------------------- DefaultInputHandler::DefaultInputHandler() :m_pImpl( new DefaultInputHandler_Impl ) + ,m_bResize(false) { } @@ -61,8 +62,12 @@ namespace svt { namespace table //-------------------------------------------------------------------- bool DefaultInputHandler::MouseMove( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt ) { - (void)_rControl; - (void)_rMEvt; + Point aPoint = _rMEvt.GetPosPixel(); + if(m_bResize) + { + _rControl.resizeColumn(aPoint); + return true; + } return false; } @@ -71,7 +76,12 @@ namespace svt { namespace table { bool bHandled = false; Point aPoint = _rMEvt.GetPosPixel(); - if(_rControl.isClickInVisibleArea(aPoint)) + if(_rControl.getCurrentRow(aPoint) == -1) + { + m_bResize = _rControl.startResizeColumn(aPoint); + bHandled = true; + } + else if(_rControl.getCurrentRow(aPoint) >= 0) { if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION) { @@ -92,9 +102,14 @@ namespace svt { namespace table { bool bHandled = false; Point aPoint = _rMEvt.GetPosPixel(); - if(_rControl.isClickInVisibleArea(aPoint)) + if(_rControl.getCurrentRow(aPoint) >= 0) { - if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION) + if(m_bResize) + { + m_bResize = _rControl.endResizeColumn(aPoint); + bHandled = true; + } + else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION) { GetFocus(_rControl); _rControl.setCursorAtCurrentCell(aPoint); @@ -103,6 +118,14 @@ namespace svt { namespace table else bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt); } + else + { + if(m_bResize) + { + m_bResize = _rControl.endResizeColumn(aPoint); + bHandled = true; + } + } return bHandled; } diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 2c4fda711009..7e721832c04c 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -30,6 +30,7 @@ #include #include +#include //........................................................................ namespace svt { namespace table @@ -78,14 +79,31 @@ namespace svt { namespace table "GridTableRenderer::PaintHeaderArea: invalid area flags!" ); // fill the rows with alternating background colors - _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR ); - - _rDevice.SetLineColor(); - _rDevice.SetFillColor( _rStyle.GetDialogColor() ); + _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + //Color background = _rStyle.GetBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + if( background != 0xFFFFFF && line == 0xFFFFFF) + { + _rDevice.SetLineColor(background); + _rDevice.SetFillColor(background); + } + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + _rDevice.SetFillColor(background); + } _rDevice.DrawRect( _rArea ); // delimiter lines at bottom/right - _rDevice.SetLineColor( _rStyle.GetDialogTextColor() ); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); @@ -98,10 +116,19 @@ namespace svt { namespace table void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) { - _rDevice.Push( PUSH_LINECOLOR ); - - _rDevice.SetLineColor( _rStyle.GetDialogTextColor() ); - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + _rDevice.Push( PUSH_LINECOLOR); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + if(line == 0xFFFFFF) + _rDevice.SetLineColor(_rStyle.GetShadowColor()); + else + // if Line color is set, then it was user defined and should be visible + // if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight()); String sHeaderText; @@ -109,20 +136,26 @@ namespace svt { namespace table DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); if ( !!pColumn ) sHeaderText = pColumn->getName(); - Color aRowBackground = _rStyle.GetFieldColor(); - if ( _bSelected ) - { - aRowBackground = COL_BLUE; - } - _rDevice.DrawText( _rArea, sHeaderText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP ); + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + _rDevice.DrawText( _rArea, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.Pop(); (void)_bActive; // no special painting for the active column at the moment - //(void)_bSelected; - // TODO: selection not yet implemented + (void)_bSelected; + //selection for column header not yet implemented } //-------------------------------------------------------------------- @@ -132,86 +165,243 @@ namespace svt { namespace table // remember the row for subsequent calls to the other ->ITableRenderer methods m_pImpl->nCurrentRow = _nRow; - // fill the rows with alternating background colors - _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR ); - - _rDevice.SetLineColor(); + _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - Color aRowBackground = _rStyle.GetFieldColor(); + Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + //if row is selected background color becomes blue, and lines should be also blue + //if they aren't user defined + if(_bSelected) + { + Color aSelected(_rStyle.GetHighlightColor()); + aRowBackground = aSelected; + if(line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + _rDevice.SetLineColor(line); + } + //if row not selected, check the cases whether user defined backgrounds are set + //and set line color to be the same + else + { + if(aRowBackground2 != 0xFFFFFF && _nRow%2) + { + aRowBackground = aRowBackground2; + if(line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + _rDevice.SetLineColor(line); + } + //fill the rows with alternating background colors if second background color is specified + else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } + } + Rectangle aRect(_rRowArea); + if(m_pImpl->rModel.hasColumnHeaders() || _nRow != 0) + --aRect.Top(); + if(m_pImpl->rModel.hasRowHeaders()) + --aRect.Left(); _rDevice.SetFillColor( aRowBackground ); + _rDevice.DrawRect( aRect ); - _rDevice.DrawRect( _rRowArea ); - - // TODO: active? selected? + // TODO: active? _rDevice.Pop(); - (void) _bSelected; (void)_bActive; - - // no special painting for the active row at the moment - - //(void)_bSelected; - // TODO: selection not yet implemented } //-------------------------------------------------------------------- void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) { - _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR ); - - _rDevice.SetLineColor( _rStyle.GetDialogTextColor() ); + _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); + //default background and line color is white + //background and lines should have same color, that's means lines aren't visible + //in case line color isn't set and background color is set, this should be changed + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + if(background != 0xFFFFFF && line == 0xFFFFFF) + { + _rDevice.SetLineColor(background); + } + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - _rDevice.DrawText( _rArea, _rText, TEXT_DRAW_LEFT); + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + _rDevice.DrawText( _rArea, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); // TODO: active? selected? (void)_bActive; (void)_bSelected; - + //at the moment no special paint for selected row header _rDevice.Pop(); } //-------------------------------------------------------------------- - void GridTableRenderer::PaintCell( ColPos _nColumn, bool _bSelected, bool _bActive, - OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) + void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive, + OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData ) { - _rDevice.Push( PUSH_LINECOLOR ); - - // draw the grid - _rDevice.SetLineColor( COL_LIGHTGRAY ); - // TODO: the LIGHTGRAY should probably be a property/setting + _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION); + _rDevice.IntersectClipRegion( _rArea ); + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + else + _rDevice.SetLineColor(line); + } + //else set line color to the color of row background + else + { + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } + } _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - { // TODO: remove those temporary place holders Rectangle aRect( _rArea ); ++aRect.Left(); --aRect.Right(); - ++aRect.Top(); --aRect.Bottom(); + aRect.Top(); aRect.Bottom(); + Point imagePos(Point(aRect.Left(), aRect.Top())); + Size imageSize = _pCellData->GetSizePixel(); - String sText; - if(_bSelected) + if(aRect.GetWidth() > imageSize.Width()) { - Color aRed(COL_BLUE); - _rDevice.SetFillColor( aRed ); - _rDevice.SetTextColor(COL_WHITE); + if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) + imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2; + else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) + imagePos.X() = aRect.Right() - imageSize.Width(); } - _rDevice.DrawRect( _rArea ); - (void)_nColumn; - _rDevice.DrawText( aRect, _rText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP); + else + imageSize.Width() = aRect.GetWidth(); + if(aRect.GetHeight() > imageSize.Height()) + { + if(m_pImpl->rModel.getVerticalAlign() == 1) + imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + imagePos.Y() = aRect.Bottom() - imageSize.Height(); + } + else + imageSize.Height() = aRect.GetHeight()-1; + Image& image (*_pCellData); + _rDevice.DrawImage(imagePos, imageSize, image, 0); } + + _rDevice.Pop(); + + (void)_bActive; +// // no special painting for the active cell at the moment + (void)_rStyle; +// // TODO: do we need this? + } + + //-------------------------------------------------------------------- + void GridTableRenderer::PaintCellString( ColPos _nColumn, bool _bSelected, bool _bActive, + OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) + { + _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue if(_bSelected) { - _rDevice.SetFillColor( _rStyle.GetFieldColor() ); - _rDevice.SetTextColor(COL_BLACK); + if(line == 0xFFFFFF) + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); + else + _rDevice.SetLineColor(line); + } + //else set line color to the color of row background + else + { + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + { + // TODO: remove those temporary place holders + Rectangle aRect( _rArea ); + ++aRect.Left(); --aRect.Right(); + aRect.Top(); aRect.Bottom(); + String sText; + if(_bSelected) + { + _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); + } + else + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + //_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); + //(void)_nColumn; + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + } _rDevice.Pop(); (void)_bActive; -// // no special painting for the active cell at the moment + // no special painting for the active cell at the moment (void)_rStyle; -// // TODO: do we need this? + // TODO: do we need this? } //-------------------------------------------------------------------- diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 1d7b046ae94b..427f65557e52 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -67,6 +67,8 @@ namespace svt { namespace table TableControl::TableControl( Window* _pParent, WinBits _nStyle ) :Control( _pParent, _nStyle ) ,m_pImpl( new TableControl_Impl( *this ) ) + ,m_nCols(*( new ::com::sun::star::uno::Sequence< sal_Int32 >(0) )) + ,m_aText(*( new ::com::sun::star::uno::Sequence< ::rtl::OUString >(0) )) { m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); @@ -239,6 +241,7 @@ namespace svt { namespace table ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const { ::rtl::OUString aRetText; + //Window* pWin; switch( eObjType ) { case TCTYPE_GRIDCONTROL: @@ -254,7 +257,8 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); break; case TCTYPE_TABLECELL: - aRetText = GetCellContent(_nRow, _nCol); + //Window* pWin = GetCellContent(_nRow, _nCol); + aRetText = GetRowName(_nRow); break; case TCTYPE_ROWHEADERCELL: aRetText = GetRowName(_nRow); @@ -327,13 +331,13 @@ namespace svt { namespace table // ----------------------------------------------------------------------------- -::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const +::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const { - ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii(""); - std::vector >& aTableContent = GetModel()->getCellContent(); + ::com::sun::star::uno::Any cellContent = ::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")); + std::vector >& aTableContent = GetModel()->getCellContent(); if(&aTableContent) { - std::vector& aRowContent = aTableContent[_nRowPos]; + std::vector< ::com::sun::star::uno::Any >& aRowContent = aTableContent[_nRowPos]; if(&aRowContent) cellContent = aRowContent[_nColPos]; } @@ -491,48 +495,64 @@ sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnP { (void)_nRow; (void)_nColumnPos; - return GetIndexForPoint(_rPoint); + return GetIndexForPoint(_rPoint); ; } - // ----------------------------------------------------------------------------- -sal_Bool TableControl::isAccessibleAlive( ) const -{ - return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive(); -} + // ----------------------------------------------------------------------------- +sal_Bool TableControl::isAccessibleAlive( ) const +{ + return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive(); +} // ----------------------------------------------------------------------------- ::svt::IAccessibleFactory& TableControl::getAccessibleFactory() { return m_pAccessTable->m_aFactoryAccess.getFactory(); } -// ----------------------------------------------------------------------------- -void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) -{ - if ( isAccessibleAlive() ) - m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); -} -// ----------------------------------------------------------------------------- -Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) -{ - (void)_bOnScreen; - Rectangle aRectTable, aRectTableWithHeaders; - m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); - m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); - Size aSizeTable(aRectTable.GetSize()); - Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); - if(_bIsColumnBar) - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); - else - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); -} -// ----------------------------------------------------------------------------- -Rectangle TableControl::calcTableRect(BOOL _bOnScreen) -{ - (void)_bOnScreen; - Rectangle aRect; - m_pImpl->impl_getAllVisibleDataCellArea(aRect); - return aRect; -} +// ----------------------------------------------------------------------------- +void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) +{ + if ( isAccessibleAlive() ) + m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) +{ + (void)_bOnScreen; + Rectangle aRectTable, aRectTableWithHeaders; + m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); + m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); + Size aSizeTable(aRectTable.GetSize()); + Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); + if(_bIsColumnBar) + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); + else + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcTableRect(BOOL _bOnScreen) +{ + (void)_bOnScreen; + Rectangle aRect; + m_pImpl->impl_getAllVisibleDataCellArea(aRect); + return aRect; +} +//-------------------------------------------------------------------- +::com::sun::star::uno::Sequence< sal_Int32 >& TableControl::getColumnsForTooltip() +{ + return m_nCols; +} +//-------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::rtl::OUString >& TableControl::getTextForTooltip() +{ + return m_aText; +} +//-------------------------------------------------------------------- +void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols ) +{ + m_aText = aText; + m_nCols = nCols; +} //........................................................................ }} // namespace svt::table diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 89c0eed4229a..9bc8644276f1 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -32,9 +32,14 @@ #include "tablecontrol_impl.hxx" #include "tablegeometry.hxx" #include "svtools/table/tabledatawindow.hxx" - +#include #include #include +#include +#include +#include +#include +#include #include #include @@ -177,13 +182,71 @@ namespace svt { namespace table (void)actWidth; return ScrollbarShowNever; } - virtual void setCellContent(std::vector > pCellEntryType) + virtual bool hasVerticalScrollbar() + { + return false; + } + virtual bool hasHorizontalScrollbar() + { + return false; + } + virtual void setCellContent(std::vector > pCellEntryType) { (void)pCellEntryType; } - virtual std::vector >& getCellContent() + virtual ::com::sun::star::util::Color getLineColor() + { + return 0; + } + virtual void setLineColor(::com::sun::star::util::Color _rColor) + { + (void)_rColor; + } + virtual ::com::sun::star::util::Color getHeaderBackgroundColor() + { + return -1; + } + + virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) + { + (void)_rColor; + } + virtual ::com::sun::star::util::Color getTextColor() + { + return 0; + } + virtual void setTextColor(::com::sun::star::util::Color _rColor) + { + (void)_rColor; + } + virtual ::com::sun::star::util::Color getOddRowBackgroundColor() + { + return -1; + } + virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) + { + (void)_rColor; + } + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() + { + return com::sun::star::style::VerticalAlignment(0); + } + virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment _Align) + { + (void)_Align; + } + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() + { + return -1; + } + virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) + { + (void)_rColor; + } + + virtual std::vector >& getCellContent() { - return *( new std::vector >); + return *( new std::vector >); } virtual void setRowHeaderName(std::vector pCellEntryType) { @@ -302,7 +365,8 @@ namespace svt { namespace table // m_nColHeaderHeightPixel consistent with the model's value? { TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0; - nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height(); + // nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height(); + nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height(); if ( nHeaderHeight != m_nColHeaderHeightPixel ) return "column header heights are inconsistent!"; } @@ -311,7 +375,8 @@ namespace svt { namespace table if ( !isDummyModel ) { TableMetrics nRowHeight = m_pModel->getRowHeight(); - nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height(); + // nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height(); + nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height(); if ( nRowHeight != m_nRowHeightPixel ) return "row heights are inconsistent!"; } @@ -319,7 +384,8 @@ namespace svt { namespace table // m_nRowHeaderWidthPixel consistent with the model's value? { TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0; - nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width(); + //nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width(); + nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width(); if ( nHeaderWidth != m_nRowHeaderWidthPixel ) return "row header widths are inconsistent!"; } @@ -385,6 +451,8 @@ namespace svt { namespace table ,m_nRowSelected ( ) ,m_pTableFunctionSet ( new TableFunctionSet(this ) ) ,m_nAnchor (-1 ) + ,m_bResizing ( false ) + ,m_nResizingColumn ( 0 ) #if DBG_UTIL ,m_nRequiredInvariants ( INV_SCROLL_POSITION ) #endif @@ -429,7 +497,7 @@ namespace svt { namespace table // TODO: revoke as table listener from the model m_pModel = _pModel; - if ( !m_pModel ) + if ( !m_pModel) m_pModel.reset( new EmptyTableModel ); // TODO: register as table listener @@ -503,11 +571,13 @@ namespace svt { namespace table m_pInputHandler.reset(); m_nColumnCount = m_nRowCount = 0; - m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height(); + //m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height(); + m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height(); if ( m_pModel->hasColumnHeaders() ) - m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height(); + //m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height(); + m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height(); if ( m_pModel->hasRowHeaders() ) - m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_100TH_MM ).Width(); + m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width(); impl_ni_updateColumnWidths(); @@ -528,34 +598,100 @@ namespace svt { namespace table return; TableSize colCount = m_pModel->getColumnCount(); + m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); long accumulatedPixelWidth = 0; + double gridWidth = m_rAntiImpl.GetSizePixel().Width()-1; + if(m_pModel->hasRowHeaders()) + { + TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); + gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); + } + if(m_pModel->hasVerticalScrollbar()) + { + sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + gridWidth-=scrollbarWidth; + //m_rAntiImpl.LogicToPixel( Size( scrollbarWidth, 0 ), MAP_APPFONT ).Width(); + } + double colWidthsSum = 0.0; + double colWithoutFixedWidthsSum = 0.0; for ( ColPos col = 0; col < colCount; ++col ) { PColumnModel pColumn = m_pModel->getColumnModel( col ); DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); if ( !pColumn ) continue; - - TableMetrics colWidth = pColumn->getWidth(); - DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ), - "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" ); - - long pixelWidth = 0; - if ( colWidth == COLWIDTH_FIT_TO_VIEW ) + TableMetrics colWidth = 0; + TableMetrics colPrefWidth = pColumn->getPreferredWidth(); + if( colPrefWidth != 0) { - // TODO - DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" ); + colWidth = colPrefWidth; + pColumn->setWidth(colPrefWidth); } else + colWidth = pColumn->getWidth(); + long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + if(pColumn->isResizable() && colPrefWidth == 0) + colWithoutFixedWidthsSum+=pixelWidth; + colWidthsSum+=pixelWidth; + } + if(colWidthsSum < gridWidth) + { + gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double scalingFactor = 1.0; + if(colWithoutFixedWidthsSum>0) + scalingFactor = gridWidth/colWithoutFixedWidthsSum; + long pixelWidth = 0; + for ( ColPos col = 0; col < colCount; ++col ) { - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width(); + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = pColumn->getWidth(); + //if(pColumn->getPreferredWidth() != 0) + // colWidth = pColumn->getPreferredWidth(); + if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + { + colWidth*=scalingFactor; + pColumn->setWidth(colWidth); + } + pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + m_aColumnWidthsPixel.push_back( pixelWidth ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); } + //m_rAntiImpl.SetModel(m_pModel); + + } + else + { + for ( ColPos col = 0; col < colCount; ++col ) + { + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; - m_aColumnWidthsPixel.push_back( pixelWidth ); + TableMetrics colWidth = pColumn->getWidth(); + DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ), + "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + long pixelWidth = 0; + if ( colWidth == COLWIDTH_FIT_TO_VIEW ) + { + // TODO + DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" ); + } + else + { + //pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width(); + pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + } + m_aColumnWidthsPixel.push_back( pixelWidth ); + + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + } } } @@ -677,6 +813,13 @@ namespace svt { namespace table Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() ); aDataCellPlayground.Left() = m_nRowHeaderWidthPixel; aDataCellPlayground.Top() = m_nColHeaderHeightPixel; + m_nRowCount = m_pModel->getRowCount(); + m_nColumnCount = m_pModel->getColumnCount(); + + if(m_aAccColumnWidthsPixel.empty()) + { + impl_ni_updateColumnWidths(); + } // do we need a vertical scrollbar? bool bFirstRoundVScrollNeed = false; @@ -708,15 +851,6 @@ namespace svt { namespace table aDataCellPlayground.Right() -= nScrollbarMetrics; } } - else - { - Size regionWithoutHeader = m_rAntiImpl.PixelToLogic(Size(aDataCellPlayground.Right() - aDataCellPlayground.Left(),0),MAP_100TH_MM); - TableMetrics nColWidth = regionWithoutHeader.Width()/m_nColumnCount; - for ( ColPos col = 0; col < m_nColumnCount; ++col ) - m_pModel->getColumnModel(col)->setWidth(nColWidth); - m_rAntiImpl.SetModel(m_pModel); - } - // create or destroy the vertical scrollbar, as needed lcl_updateScrollbar( m_rAntiImpl, @@ -791,20 +925,20 @@ namespace svt { namespace table void TableControl_Impl::onResize() { DBG_CHECK_ME(); - impl_ni_updateScrollbars(); + if(m_nColumnCount != 0) + impl_ni_updateScrollbars(); //Rectangle aAllCells; // impl_getAllVisibleCellsArea( aAllCells ); //m_pSelEngine->SetVisibleArea(aAllCells); } //-------------------------------------------------------------------- - void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect ) + void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect ) { DBG_CHECK_ME(); if ( !getModel() ) return; - PTableRenderer pRenderer = getModel()->getRenderer(); DBG_ASSERT( !!pRenderer, "TableDataWindow::Paint: invalid renderer!" ); if ( !pRenderer ) @@ -819,6 +953,14 @@ namespace svt { namespace table impl_getAllVisibleCellsArea( aAllCellsWithHeaders ); m_nRowCount = m_pModel->getRowCount(); + TableSize nVisibleRows = impl_getVisibleRows(true); + TableSize nVisibleColumns = impl_getVisibleColumns(true); + TableSize nActualRows = m_nRowCount; + TableSize nActualCols = m_nColumnCount; + if(m_nRowCount>nVisibleRows) + nActualRows = nVisibleRows; + if(m_nColumnCount>nVisibleColumns) + nActualCols = nVisibleColumns; // ............................ // draw the header column area if ( getModel()->hasColumnHeaders() ) @@ -853,7 +995,10 @@ namespace svt { namespace table { aRowHeaderArea = aAllCellsWithHeaders; aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1; - aRowHeaderArea.Bottom() = m_nRowHeightPixel * m_nRowCount + m_nColHeaderHeightPixel - 1; + if(m_nTopRow+nActualRows>m_nRowCount) + aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1; + else + aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1; pRenderer->PaintHeaderArea( *m_pDataWindow, aRowHeaderArea, false, true, rStyle ); @@ -881,25 +1026,24 @@ namespace svt { namespace table impl_getAllVisibleDataCellArea( aAllDataCellsArea ); //get the vector, which contains row vectors, each containing the data for the cells in this row - std::vector >& aCellContent = m_pModel->getCellContent(); + std::vector >& aCellContent = m_pModel->getCellContent(); //if the vector is empty, fill it with empty data, so the table can be painted if(aCellContent.empty()) { - std::vector emptyCells; + std::vector< ::com::sun::star::uno::Any > emptyCells; while(m_nRowCount!=0) { - aCellContent.push_back(emptyCells); + aCellContent.push_back( emptyCells); --m_nRowCount; } } - std::vector >::iterator it = aCellContent.begin()+m_nTopRow; + std::vector >::iterator it = aCellContent.begin()+m_nTopRow; //get the vector, which contains the row header titles std::vector& aRowHeaderContent = m_pModel->getRowHeaderName(); ::std::vector::iterator itRowName = aRowHeaderContent.begin(); if(m_pModel->hasRowHeaders()) { - aRowHeaderContent = m_pModel->getRowHeaderName(); //if the vector is empty, fill it with empty strings, so the table can be painted if(aRowHeaderContent.empty()) { @@ -933,28 +1077,29 @@ namespace svt { namespace table isSelectedRow = true; } } - std::vector aCellData; - if(it != aCellContent.end()) + std::vector< ::com::sun::star::uno::Any > aCellData; + if(it != aCellContent.begin()+m_nTopRow+nActualRows) { aCellData = *it; ++it; } - ::std::vector::iterator iter = aCellData.begin()+m_nLeftColumn; + ::std::vector< ::com::sun::star::uno::Any >::iterator iter = aCellData.begin()+m_nLeftColumn; // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, - *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle ); + *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle ); // paint the row header if ( m_pModel->hasRowHeaders() ) { rtl::OUString rowHeaderName; - if(itRowName != aRowHeaderContent.end()) + if(itRowName != aRowHeaderContent.begin()+m_nTopRow+nActualRows) { rowHeaderName = *itRowName; ++itRowName; } Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); + //rStyle.SetBackgroundColor(m_rAntiImpl.getHeaderBackgroundColor()); pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, rStyle, rowHeaderName ); } @@ -967,25 +1112,34 @@ namespace svt { namespace table aCell.moveRight() ) { - // if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() ) - // continue; - //bool isActiveCell = isActiveRow && ( aCell.getColumn() == getCurColumn() ); bool isSelectedColumn = false; - rtl::OUString cellData; - if(aCellData.empty()) - cellData=rtl::OUString::createFromAscii(""); - else if(iter != aCellData.end()) + ::com::sun::star::uno::Any rCellData; + if(!aCellData.empty() && iter != aCellData.begin()+m_nLeftColumn+nActualCols) { - cellData = *iter; + TableSize nPartlyVisibleCols = impl_getVisibleColumns(false); + TableSize nPartlyVisibleRows = impl_getVisibleRows(false); + rCellData = *iter; ++iter; + Size siz = m_rAntiImpl.GetSizePixel(); + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(rCellData>>=xGraphic) + { + Image* pImage = new Image(xGraphic); + if(pImage!=NULL) + pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + *m_pDataWindow, aCell.getRect(), rStyle, pImage ); + } + else + { + ::rtl::OUString sContent = impl_convertToString(rCellData); + pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + *m_pDataWindow, aCell.getRect(), rStyle, sContent ); + } } - pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, - *m_pDataWindow, aCell.getRect(), rStyle, cellData ); } } } - //-------------------------------------------------------------------- void TableControl_Impl::hideCursor() { @@ -1042,7 +1196,11 @@ namespace svt { namespace table else { if ( m_nCurRow < m_nRowCount - 1 ) + { bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 ); + if(m_pSelEngine->GetSelectionMode() == MULTIPLE_SELECTION) + m_nAnchor = m_nCurRow; + } } break; @@ -1076,7 +1234,11 @@ namespace svt { namespace table else { if ( m_nCurRow > 0 ) + { bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 ); + if(m_pSelEngine->GetSelectionMode() == MULTIPLE_SELECTION) + m_nAnchor = m_nCurRow; + } } break; case cursorLeft: @@ -1183,24 +1345,24 @@ namespace svt { namespace table int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1); if(prevRow>-1) - { - //if m_nCurRow isn't the upper one, can move up, otherwise not + { + //if m_nCurRow isn't the upper one, can move up, otherwise not if(m_nCurRow>0) - m_nCurRow--; - else - return bSuccess = true; - //if nextRow already selected, deselect it, otherwise select it - if(m_nRowSelected[nextRow] == m_nCurRow) - { - m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); - invalidateSelectedRow(m_nCurRow+1, rCells); - } - else + m_nCurRow--; + else + return bSuccess = true; + //if nextRow already selected, deselect it, otherwise select it + if(m_nRowSelected[nextRow] == m_nCurRow) + { + m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); + invalidateSelectedRow(m_nCurRow+1, rCells); + } + else { - m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); - } - } + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRow(m_nCurRow, rCells); + } + } } } else @@ -1260,23 +1422,23 @@ namespace svt { namespace table int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow); int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1); if(prevRow>-1) - { - //if m_nCurRow isn't the last one, can move down, otherwise not - if(m_nCurRow= 0 ) && ( _nColumn < m_pModel->getColumnCount() ), - "TableControl_Impl::impl_getCellRect: invalid column index!" ); - DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ), - "TableControl_Impl::impl_getCellRect: invalid row index!" ); + //DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_pModel->getColumnCount() ), + // "TableControl_Impl::impl_getCellRect: invalid column index!" ); + //DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ), + // "TableControl_Impl::impl_getCellRect: invalid row index!" ); Rectangle aAllCells; impl_getAllVisibleCellsArea( aAllCells ); @@ -1412,7 +1574,7 @@ namespace svt { namespace table RowPos newRowPos = -2;//-1 is HeaderRow ColPos newColPos = 0; //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!! - for(int i=0;iInvalidate(_rCellRect); } @@ -1584,28 +1746,15 @@ namespace svt { namespace table //impl_getCellRect(m_nCurColumn,_nRowEnd,rCells2); //_rCellRect.Bottom()=rCells2.Bottom(); impl_ni_updateScrollbars(); + TableSize nVisibleRows = impl_getVisibleRows(true); + if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) + m_nTopRow--; + else + m_nTopRow = 0; //m_pDataWindow->Invalidate(_rCellRect); m_pDataWindow->Invalidate(); } - - //------------------------------------------------------------------------------- - bool TableControl_Impl::isClickInVisibleArea(const Point& rPoint) - { - DBG_CHECK_ME(); - long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); - //clickable area is in the visible table control area without the scrollbars - Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() ); - aDataCellPlayground.Top() = m_nColHeaderHeightPixel; - aDataCellPlayground.Right() -= nScrollbarMetrics; - aDataCellPlayground.Bottom() -= nScrollbarMetrics; - if((rPoint.X() >= aDataCellPlayground.Left() && rPoint.X() <= aDataCellPlayground.Right()) && rPoint.Y() >= aDataCellPlayground.Top() && rPoint.Y() <= aDataCellPlayground.Bottom()) - { - return true; - } - else - return false; - } //-------------------------------------------------------------------- TableSize TableControl_Impl::impl_getVisibleRows( bool _bAcceptPartialRow ) const { @@ -1734,7 +1883,7 @@ namespace svt { namespace table && abs( nPixelDelta ) < aDataArea.GetHeight() ) { - m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE ); + m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE | SCROLL_CHILDREN); } else m_pDataWindow->Invalidate( INVALIDATE_UPDATE ); @@ -1822,12 +1971,284 @@ namespace svt { namespace table } return pos; } + void TableControl_Impl::setTooltip(const Point& rPoint ) + { + ::rtl::OUString aTooltipText; + RowPos current = getCurrentRow(rPoint); + com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip(); + com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip(); + if(text.getLength() == 0) + { + for(int i=0; igetCellContent()[current][cols[i]]; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(content>>=xGraphic) + aTooltipText=::rtl::OUString::createFromAscii("IMAGE"); + else + aTooltipText = impl_convertToString(content); + } + else + { + aTooltipText+= ::rtl::OUString::createFromAscii("\n"); + ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(content>>=xGraphic) + aTooltipText += ::rtl::OUString::createFromAscii("IMAGE"); + else + aTooltipText += impl_convertToString(content); + } + } + } + else if(cols.getLength() == 0) + { + for(int i=0; igetCellContent()[current][cols[i]]; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(content>>=xGraphic) + aTooltipText = ::rtl::OUString::createFromAscii("IMAGE"); + else + aTooltipText = text[i] + impl_convertToString(content); + } + else + { + aTooltipText+= ::rtl::OUString::createFromAscii("\n"); + aTooltipText+= text[i]; + if(nCols > i) + { + ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + if(content>>=xGraphic) + aTooltipText +=::rtl::OUString::createFromAscii("IMAGE"); + else + aTooltipText += impl_convertToString(content); + } + } + } + } + Help::ShowBalloon(m_pDataWindow, rPoint, aTooltipText); + } + //-------------------------------------------------------------------- + void TableControl_Impl::resizeColumn(const Point& rPoint) + { + Pointer aNewPointer(POINTER_ARROW); + int headerRowWidth = 0; + if(m_pModel->hasRowHeaders()) + headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); + int resizingColumn=m_nCurColumn-m_nLeftColumn; + PColumnModel pColumn = m_pModel->getColumnModel(m_nCurColumn); + sal_Int32 colWidth = pColumn->getWidth(); + impl_ni_getAccVisibleColWidths(); + int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell + if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && pColumn->isResizable()) + { + aNewPointer = Pointer( POINTER_HSPLIT ); + } + //MouseButton was pressed but not yet released, mouse is moving + if(m_bResizing) + { + if(rPoint.X() > m_pDataWindow->GetSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth) + aNewPointer = Pointer( POINTER_NOTALLOWED); + else + aNewPointer = Pointer( POINTER_HSPLIT ); + m_pDataWindow->HideTracking(); + int lineHeight = 0; + if(m_pModel->hasColumnHeaders()) + lineHeight+= m_nColHeaderHeightPixel; + lineHeight+=m_nRowHeightPixel*m_nRowCount; + int gridHeight = m_pDataWindow->GetSizePixel().Height(); + if(lineHeight >= gridHeight) + lineHeight = gridHeight; + m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )), + SHOWTRACK_SPLIT | SHOWTRACK_WINDOW); + } + m_pDataWindow->SetPointer(aNewPointer); + } - void TableControl_Impl::setCellContent(CellEntryType* pCellEntryType) + //-------------------------------------------------------------------- + bool TableControl_Impl::startResizeColumn(const Point& rPoint) { - (void)pCellEntryType; + m_nResizingColumn = m_nCurColumn; + PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); + sal_Int32 colWidth = pColumn->getWidth(); + //impl_ni_getAccVisibleColWidths(); + int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable()) + { + m_pDataWindow->CaptureMouse(); + m_bResizing = true; + } + return m_bResizing; + } + //-------------------------------------------------------------------- + bool TableControl_Impl::endResizeColumn(const Point& rPoint) + { + if(m_bResizing) + { + m_pDataWindow->HideTracking(); + PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); + int maxWidth = pColumn->getMaxWidth(); + int minWidth = pColumn->getMinWidth(); + int colWidth = pColumn->getWidth(); + int resizeCol = m_nResizingColumn-m_nLeftColumn; + //new position of mouse + int actX = rPoint.X(); + //old position of right border + int oldX = m_aVisibleColumnWidthsPixel[resizeCol]; + //position of left border if cursor in the first cell + int leftX = 0; + if(m_nResizingColumn-1 > 0 && m_nResizingColumn > m_nLeftColumn) + leftX = m_aVisibleColumnWidthsPixel[resizeCol-1]; + else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders()) + leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); + int actWidth = actX - leftX; + int newActWidth = 0; + //minimize the column width + if(oldX > actX && actX >= leftX) + { + if(minWidth == 0 && pColumn->isResizable()) + { + minWidth = 1; + //TO DO: set it back to model + } + if(minWidth < actWidth) + { + newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); + pColumn->setPreferredWidth(newActWidth); + } + else + pColumn->setPreferredWidth(minWidth); + if(m_nLeftColumn != 0) + impl_updateLeftColumn(); + } + else if(oldX < actX) + { + if(maxWidth == 0 && pColumn->isResizable()) + { + maxWidth = m_pDataWindow->GetSizePixel().Width()-1; + //TO DO: set it back to model + } + if(actWidth < maxWidth) + { + newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); + pColumn->setPreferredWidth(newActWidth); + } + else + pColumn->setPreferredWidth(maxWidth); + } + m_nCurColumn = m_nResizingColumn; + impl_ni_updateColumnWidths(); + impl_ni_updateScrollbars(); + m_pDataWindow->Invalidate(INVALIDATE_UPDATE); + m_pDataWindow->SetPointer(Pointer()); + m_bResizing = false; + } + m_pDataWindow->ReleaseMouse(); + return m_bResizing; } + void TableControl_Impl::impl_ni_getAccVisibleColWidths() + { + TableSize nVisCols = impl_getVisibleColumns(true); + int widthsPixel = 0; + int pixelWidth = 0; + m_aVisibleColumnWidthsPixel.resize(0); + m_aVisibleColumnWidthsPixel.reserve(nVisCols); + int headerRowWidth = 0; + if(m_pModel->hasRowHeaders()) + { + headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); + widthsPixel+=headerRowWidth; + } + int col = m_nLeftColumn; + while(nVisCols) + { + PColumnModel pColumn = m_pModel->getColumnModel(col); + pixelWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getWidth(), 0 ), MAP_APPFONT ).Width(); + m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=pixelWidth); + col++; + nVisCols--; + } + } + void TableControl_Impl::impl_updateLeftColumn() + { + int nVisCols = m_aVisibleColumnWidthsPixel.size(); + int headerRowWidth = 0; + //sum of currently visible columns + int widthsPixel = 0; + //header pixel should be added, because header doesn't vanish when scrolling + if(m_pModel->hasRowHeaders()) + { + headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); + widthsPixel+=headerRowWidth; + } + int col = m_nLeftColumn; + //add column width of the neighbour of the left column + widthsPixel+=m_aColumnWidthsPixel[col-1]; + //compute the sum of the new column widths + while(nVisCols) + { + PColumnModel pColumn = m_pModel->getColumnModel(col); + int colWidth = pColumn->getWidth(); + int colPrefWidth = pColumn->getPreferredWidth(); + if(colPrefWidth!=0) + colWidth = colPrefWidth; + widthsPixel += m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + col++; + nVisCols--; + } + //when the sum of all visible columns and the next to the left column is smaller than + //window width, then update m_nLeftColumn + if(widthsPixelGetSizePixel().Width()) + m_nLeftColumn--; + } + //-------------------------------------------------------------------- + rtl::OUString TableControl_Impl::impl_convertToString(::com::sun::star::uno::Any value) + { + sal_Int32 nInt; + sal_Bool bBool; + double fDouble; + ::rtl::OUString sNewString; + ::rtl::OUString sConvertString; + if(value >>= sConvertString) + sNewString = sConvertString; + else if(value >>= nInt) + sNewString = sConvertString.valueOf(nInt); + else if(value >>= bBool) + sNewString = sConvertString.valueOf(bBool); + else if(value >>= fDouble) + sNewString = sConvertString.valueOf(fDouble); + return sNewString; + } //-------------------------------------------------------------------- IMPL_LINK( TableControl_Impl, OnScroll, ScrollBar*, _pScrollbar ) { @@ -1841,7 +2262,6 @@ namespace svt { namespace table return 0L; } - //--------------------------------------------------------------------------------------- TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl): m_pTableControl( _pTableControl) diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 0a25e82e4502..a26079a37827 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -38,6 +38,7 @@ #include #include + class ScrollBar; class ScrollBarBox; @@ -75,6 +76,8 @@ namespace svt { namespace table counting the space for a possible row header column */ ArrayOfLong m_aAccColumnWidthsPixel; + + ArrayOfLong m_aVisibleColumnWidthsPixel; /// the height of a single row in the table, measured in pixels long m_nRowHeightPixel; /// the height of the column header row in the table, measured in pixels @@ -113,8 +116,8 @@ namespace svt { namespace table TableFunctionSet* m_pTableFunctionSet; //part of selection engine RowPos m_nAnchor; - - + bool m_bResizing; + ColPos m_nResizingColumn; #if DBG_UTIL #define INV_SCROLL_POSITION 1 @@ -145,7 +148,6 @@ namespace svt { namespace table inline const TableControl& getAntiImpl() const { return m_rAntiImpl; } inline TableControl& getAntiImpl() { return m_rAntiImpl; } - void setCellContent(CellEntryType* pCellEntryType); public: TableControl_Impl( TableControl& _rAntiImpl ); @@ -181,7 +183,7 @@ namespace svt { namespace table */ void ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility ); /** returns the row, which contains the input point*/ - RowPos getCurrentRow (const Point& rPoint); + virtual RowPos getCurrentRow (const Point& rPoint); void setCursorAtCurrentCell(const Point& rPoint); /** proves whether the vector with the selected rows contains the current row*/ @@ -206,8 +208,11 @@ namespace svt { namespace table virtual void hideCursor(); virtual void showCursor(); virtual bool dispatchAction( TableControlAction _eAction ); - virtual bool isClickInVisibleArea(const Point& rPoint); virtual SelectionEngine* getSelEngine(); + virtual void setTooltip(const Point& rPoint ); + virtual void resizeColumn(const Point& rPoint); + virtual bool startResizeColumn(const Point& rPoint); + virtual bool endResizeColumn(const Point& rPoint); TableDataWindow* getDataWindow(); /** retrieves the area occupied by the totality of (at least partially) visible cells @@ -312,6 +317,10 @@ namespace svt { namespace table */ TableSize impl_ni_ScrollColumns( TableSize _nRowDelta ); + void impl_ni_getAccVisibleColWidths(); + void impl_updateLeftColumn(); + ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); + DECL_LINK( OnScroll, ScrollBar* ); }; //see seleng.hxx, seleng.cxx, FunctionSet overwritables, part of selection engine diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 71a313bb2e00..8631ed76a6c0 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -44,9 +44,6 @@ namespace svt { namespace table :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) { - Color backgroundColor = m_rTableControl.getAntiImpl().GetSettings().GetStyleSettings().GetFieldColor(); - SetBackground( backgroundColor ); - SetControlBackground( backgroundColor ); } //-------------------------------------------------------------------- @@ -56,8 +53,22 @@ namespace svt { namespace table } void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { + Point aPoint = rMEvt.GetPosPixel(); if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) ) - Window::MouseMove( rMEvt ); + { + if(m_rTableControl.getCurrentRow(aPoint)>=0 && + (!m_rTableControl.getAntiImpl().getColumnsForTooltip().getLength()==0 || !m_rTableControl.getAntiImpl().getTextForTooltip().getLength()==0)) + { + m_rTableControl.setTooltip(aPoint); + SetPointer(POINTER_ARROW); + } + else if(m_rTableControl.getCurrentRow(aPoint) == -1) + { + m_rTableControl.resizeColumn(aPoint); + } + else + Window::MouseMove( rMEvt ); + } } void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt ) { @@ -75,7 +86,18 @@ namespace svt { namespace table m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } - + void TableDataWindow::SetPointer( const Pointer& rPointer ) + { + Window::SetPointer(rPointer); + } + void TableDataWindow::CaptureMouse() + { + Window::CaptureMouse(); + } + void TableDataWindow::ReleaseMouse( ) + { + Window::ReleaseMouse(); + } //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx index 569e14c61726..4ec032260b82 100644 --- a/svtools/source/table/tablegeometry.cxx +++ b/svtools/source/table/tablegeometry.cxx @@ -48,8 +48,8 @@ namespace svt { namespace table { if ( m_nRowPos == ROW_COL_HEADERS ) { - DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(), - "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" ); + //DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(), + // "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" ); m_aRect.Top() = 0; m_aRect.Bottom() = m_rControl.m_nColHeaderHeightPixel - 1; } @@ -86,8 +86,8 @@ namespace svt { namespace table { if ( m_nColPos == COL_ROW_HEADERS ) { - DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(), - "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" ); +/* DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(), + "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" )*/; m_aRect.Left() = 0; m_aRect.Right() = m_rControl.m_nRowHeaderWidthPixel - 1; } diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 2f2c896ee6a8..ce04078687b1 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -40,12 +40,16 @@ #include #include #include +#include #include #include -#include -#include -#include - +#include +#include +#include +#include +#include +#include +#include using ::rtl::OUString; using namespace ::svt::table; @@ -54,9 +58,9 @@ using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::view; using namespace ::toolkit; using namespace ::com::sun::star::accessibility; -using namespace ::com::sun::star::accessibility::AccessibleEventId; -using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType; -using ::com::sun::star::accessibility::AccessibleTableModelChange; +using namespace ::com::sun::star::accessibility::AccessibleEventId; +using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType; +using ::com::sun::star::accessibility::AccessibleTableModelChange; SVTXGridControl::SVTXGridControl() @@ -93,28 +97,20 @@ IMPL_XTYPEPROVIDER_START( SVTXGridControl ) VCLXWindow::getTypes() IMPL_XTYPEPROVIDER_END -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); return pTable->GetCurrentRow( Point(x,y) ); } +void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + /*std::vector< sal_Int32 > newCols( + comphelper::sequenceToContainer< std::vector< sal_Int32 > >(columns));*/ + pTable->setTooltip(text, columns); +} + void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) { (void)listener; @@ -158,6 +154,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An if( aValue >>= bHScroll ) { m_bHScroll = bHScroll; + m_pTableModel->setHorizontalScrollbarVisibility(bHScroll); } break; } @@ -167,9 +164,11 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An if( aValue >>= bVScroll ) { m_bVScroll = bVScroll; + m_pTableModel->setVerticalScrollbarVisibility(bVScroll); } break; } + case BASEPROPERTY_GRID_SHOWROWHEADER: { sal_Bool rowHeader = true; @@ -179,6 +178,66 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } break; } + case BASEPROPERTY_GRID_HEADER_BACKGROUND: + { + sal_Int32 colorHeader = 0x000000; + if( aValue >>= colorHeader ) + { + m_pTableModel->setHeaderBackgroundColor(colorHeader); + } + break; + } + case BASEPROPERTY_GRID_LINE_COLOR: + { + sal_Int32 colorLine = 0x000000; + if( aValue >>= colorLine ) + { + m_pTableModel->setLineColor(colorLine); + } + break; + } + case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND: + { + sal_Int32 colorEvenRow = 0x000000; + if( aValue >>= colorEvenRow ) + { + m_pTableModel->setEvenRowBackgroundColor(colorEvenRow); + } + break; + } + case BASEPROPERTY_BACKGROUNDCOLOR: + { + sal_Int32 colorBackground = 0x000000; + if( aValue >>= colorBackground ) + { + m_pTableModel->setOddRowBackgroundColor(colorBackground); + } + break; + } + case BASEPROPERTY_TEXTCOLOR: + { + com::sun::star::util::Color colorText; + if( aValue >>= colorText ) + { + m_pTableModel->setTextColor(colorText); + } + break; + } + case BASEPROPERTY_VERTICALALIGN: + { + com::sun::star::style::VerticalAlignment vAlign; + if( aValue >>= vAlign ) + { + switch( vAlign ) + { + case com::sun::star::style::VerticalAlignment_TOP: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break; + case com::sun::star::style::VerticalAlignment_MIDDLE: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(1)); break; + case com::sun::star::style::VerticalAlignment_BOTTOM: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(2)); break; + default: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break; + } + } + break; + } case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: { @@ -191,40 +250,97 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_DATAMODEL: { - m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); - Sequence > cellData = m_xDataModel->getData(); - Sequence rowData(0); - std::vector< std::vector< rtl::OUString > > aCellContent(0); - for(int i = 0; i< m_xDataModel->getRowCount();++i) + //m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); + //Sequence > cellData = m_xDataModel->getData(); + //Sequence rowData(0); + //std::vector< std::vector< Window* > > aCellContent(0); + //for(int i = 0; i< m_xDataModel->getRowCount();++i) + //{ + // rowData = cellData[i]; + // std::vector newRow( + // comphelper::sequenceToContainer< std::vector >(rowData)); + // if(newRow.size() < (unsigned)m_pTableModel->getColumnCount()) + // newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); + // aCellContent.push_back(newRow); + //} + //m_pTableModel->setCellContent(aCellContent); + //Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); + //std::vector< rtl::OUString > newRow( + // comphelper::sequenceToContainer< std::vector >(rowHeaders)); + //m_pTableModel->setRowCount(m_xDataModel->getRowCount()); + //m_pTableModel->setRowHeaderName(newRow); + //break; { - rowData = cellData[i]; - std::vector newRow( - comphelper::sequenceToContainer< std::vector >(rowData)); - if(newRow.size() < (unsigned)m_pTableModel->getColumnCount()) - newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); - aCellContent.push_back(newRow); + m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); + if(m_xDataModel != NULL) + { + Sequence > cellData = m_xDataModel->getData(); + if(cellData.getLength()!= 0) + { + for (int i = 0; i < cellData.getLength(); i++) + { + std::vector< Any > newRow; + Sequence< Any > rawRowData = cellData[i]; + //check whether the data row vector length matches with the column count, + //all cells must have some content even if it is empty string + //preventing errors + if(m_xColumnModel->getColumnCount() == 0) + { + for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col ) + { + UnoControlTableColumn* tableColumn = new UnoControlTableColumn(); + m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + } + m_xColumnModel->setDefaultColumns(rawRowData.getLength()); + } + if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount()) + throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel); + + for ( int k = 0; k < rawRowData.getLength(); k++) + { + newRow.push_back(rawRowData[k]); + } + m_pTableModel->getCellContent().push_back(newRow); + } + + Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); + std::vector< rtl::OUString > newRow( + comphelper::sequenceToContainer< std::vector >(rowHeaders)); + m_pTableModel->setRowCount(m_xDataModel->getRowCount()); + m_pTableModel->setRowHeaderName(newRow); + m_pTableModel->setRowHeight(m_xDataModel->getRowHeight()); + m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth()); + } + } + else + throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel); } - m_pTableModel->setCellContent(aCellContent); - Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); - std::vector< rtl::OUString > newRow( - comphelper::sequenceToContainer< std::vector >(rowHeaders)); - m_pTableModel->setRowCount(m_xDataModel->getRowCount()); - m_pTableModel->setRowHeaderName(newRow); break; } case BASEPROPERTY_GRID_COLUMNMODEL: { m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); - Sequence > columns = m_xColumnModel->getColumns(); - std::vector > aNewColumns( - comphelper::sequenceToContainer > >(columns)); - /* if(m_pTable->GetColumnCount().size()>0) - m_pTable->GetColumnName.clear();*/ - for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) + if(m_xColumnModel != NULL) { - UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); - m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + if(m_xColumnModel->getColumnCount() != 0) + { + Sequence > columns = m_xColumnModel->getColumns(); + std::vector > aNewColumns( + comphelper::sequenceToContainer > >(columns)); + m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight()); + for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) + { + UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); + m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + m_pTableModel->getColumnModel()[col]->setHorizontalAlign(m_xColumnModel->getColumn(col)->getHorizontalAlign()); + m_pTableModel->getColumnModel()[col]->setWidth(m_xColumnModel->getColumn(col)->getColumnWidth()); + m_pTableModel->getColumnModel()[col]->setResizable(m_xColumnModel->getColumn(col)->getResizeable()); + } + } } + else + throw GridInvalidModelException(rtl::OUString::createFromAscii("The column model isn't set!"), m_xColumnModel); + break; } default: @@ -268,6 +384,7 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru return Any ( m_xDataModel ); case BASEPROPERTY_GRID_COLUMNMODEL: return Any ( m_xColumnModel); + case BASEPROPERTY_TABSTOP: case BASEPROPERTY_HSCROLL: return Any ( m_bHScroll); case BASEPROPERTY_VSCROLL: @@ -285,6 +402,9 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_GRID_DATAMODEL, BASEPROPERTY_GRID_COLUMNMODEL, BASEPROPERTY_GRID_SELECTIONMODE, + BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND, + BASEPROPERTY_GRID_HEADER_BACKGROUND, + BASEPROPERTY_GRID_LINE_COLOR, 0); VCLXWindow::ImplGetPropertyIds( rIds, true ); } @@ -294,8 +414,18 @@ void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun: if ( pTable ) { pTable->SetModel(PTableModel(m_pTableModel)); - //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) ); pTable->Show( bVisible ); + if(m_xColumnModel != NULL) + { + for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) + { + //set the new widths, which are computed to fill the width of grid, back to uno awt gridcolumn + //so funktioniert es nicht!!! Die Toolkit Klassen müssen notifiziert werden, sonst kommt es nicht an + //herausfinden wie es gehen soll! + m_xColumnModel->getColumn(col)->setColumnWidth(m_pTableModel->getColumnModel()[col]->getWidth()); + } + } + //TO DO: notify uno awt GridModel about hor. /vert. scrollbars } } void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException) @@ -306,87 +436,154 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx } void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { - std::vector aNewRow( - comphelper::sequenceToContainer< std::vector >(Event.rowData)); - if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount()) - aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); - m_pTableModel->getCellContent().push_back(aNewRow); + std::vector< Any > newRow; + Sequence< Any > rawRowData = Event.rowData; + if(m_xColumnModel->getColumnCount() == 0) + { + for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col ) + { + UnoControlTableColumn* tableColumn = new UnoControlTableColumn(); + m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + } + m_xColumnModel->setDefaultColumns(rawRowData.getLength()); + } + else if((unsigned int)rawRowData.getLength()!=(unsigned)m_xColumnModel->getColumnCount()) + throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel); + for ( int k = 0; k < rawRowData.getLength(); k++) + { + ::rtl::OUString xCellType; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic> xGraphic; + /*if(xCellType.CellControl!= NULL) + { + xCellType.CellControl->createPeer( getToolkit(), this); + Window* pVclPeer = VCLUnoHelper::GetWindow( xCellType.CellControl->getPeer() ); + xTableCellType->pWindow = pVclPeer; + xTableCellType->pWindow->Hide(); + newRow.push_back(xTableCellType); + } + else + {*/ + newRow.push_back(rawRowData[k]); + //} + } + m_pTableModel->getCellContent().push_back(newRow); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().push_back(Event.headerName); - m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size()); + m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); + //if(m_pTableModel->hasVerticalScrollbar()) + m_bVScroll = m_pTableModel->hasVerticalScrollbar(); + com::sun::star::uno::Any aAny; + aAny <<= m_bVScroll; + setProperty(rtl::OUString::createFromAscii("VScroll"),aAny); + //Reference < XGridControl >( getPeer(), UNO_QUERY_THROW )->ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VSCROLL ), aAny, sal_True ); + + + m_bHScroll = m_pTableModel->hasHorizontalScrollbar(); TableControl* pTable = (TableControl*)GetWindow(); - pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false); - //pTable->GrabFocus(); + pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, false); if(pTable->isAccessibleAlive()) { - pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, - makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())), - Any()); - pTable->commitGridControlEvent(CHILD, - makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), - Any()); + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())), + Any()); + pTable->commitGridControlEvent(CHILD, + makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), + Any()); for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) { pTable->commitGridControlEvent( CHILD, makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), Any()); - } + } } } void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + //TableControl* pTable = (TableControl*)GetWindow(); + ////unsigned int rows =m_pImpl->aCellContent.size()-1; + //if(Event.index == -1) + //{ + // if(m_pTableModel->hasRowHeaders()) + // m_pTableModel->getRowHeaderName().clear(); + // m_pTableModel->getCellContent().clear(); + // if(pTable->isAccessibleAlive()) + // { + // pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + // makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())), + // Any()); + // } + //} + //else + //{ + // pTable->removeSelectedRow(Event.index); + // if(m_pTableModel->getCellContent().size()>1) + // { + // if(m_pTableModel->hasRowHeaders()) + // m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); + // m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index); + // + // } + // else + // { + // if(m_pTableModel->hasRowHeaders()) + // m_pTableModel->getRowHeaderName().clear(); + // m_pTableModel->getCellContent().clear(); + // //m_pImpl->nRowCount=0; + // } + //} + ////pTable->InvalidateDataWindow(Event.index, true); + //m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); + //pTable->InvalidateDataWindow(Event.index, true); TableControl* pTable = (TableControl*)GetWindow(); - //unsigned int rows =m_pImpl->aCellContent.size()-1; if(Event.index == -1) { if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); + //::std::vector >::iterator iter = m_pTableModel->getCellContent().begin(); + //for(;iter!=m_pTableModel->getCellContent().end();++iter) + //{ + // std::vector vectIn = *iter; + // std::vector::iterator iterIn = vectIn.begin(); + // for(;iterIn!=vectIn.end();++iterIn) + // DELETEZ(*iterIn); + //} m_pTableModel->getCellContent().clear(); - if(pTable->isAccessibleAlive()) - { - pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, - makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())), - Any()); - } } - else + else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount()) { pTable->removeSelectedRow(Event.index); - if(m_pTableModel->getCellContent().size()>1) - { - if(m_pTableModel->hasRowHeaders()) - m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); - m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index); - } - else - { - if(m_pTableModel->hasRowHeaders()) - m_pTableModel->getRowHeaderName().clear(); - m_pTableModel->getCellContent().clear(); - //m_pImpl->nRowCount=0; - } + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); + std::vector >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index; + //for ( std::vector::iterator iterIn = rowPos->begin(); + // iterIn != rowPos->end(); + // ++iterIn + // ) + //{ + // DELETEZ(*iterIn); + //} + m_pTableModel->getCellContent().erase( rowPos ); } - //pTable->InvalidateDataWindow(Event.index, true); m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); pTable->InvalidateDataWindow(Event.index, true); if(pTable->isAccessibleAlive()) { - pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, - makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())), - Any()); - //pTable->commitGridControlEvent(CHILD, - // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), - // Any()); + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, + makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())), + Any()); + //pTable->commitGridControlEvent(CHILD, + // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), + // Any()); //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) //{ // pTable->commitGridControlEvent( // CHILD, // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), // Any()); - //} + //} } //pTable->Invalidate(); } diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index 9ca6901681c9..c8b8af574a61 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -78,11 +78,6 @@ public: ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); //::com::sun::star::awt::grid::XGridControl - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); @@ -96,11 +91,13 @@ public: virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException); void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); }; #endif // _SVT_GRIDCONTROL_HXX_ diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index b4ddc2cc472d..d1eaee98e7bb 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -45,22 +45,34 @@ using ::rtl::OUString; using namespace ::svt::table; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt::grid; //-------------------------------------------------------------------- UnoControlTableColumn::UnoControlTableColumn(Reference m_xGridColumn) :m_nID( 0 ) ,m_sName() - ,m_bIsResizable( false ) - ,m_nWidth( 10 * 100 ) // 1 cm + ,m_bIsResizable( true ) + ,m_nWidth( 4 ) ,m_nMinWidth( 0 ) // no min width ,m_nMaxWidth( 0 ) // no max width + ,m_nPrefWidth ( 0 ) + ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { //m_nID = m_xGridColumn->getIdentifier(); //m_nWidth = m_xGridColumn->getColumnWidth(); m_sName = m_xGridColumn->getTitle(); } + //-------------------------------------------------------------------- + UnoControlTableColumn::UnoControlTableColumn() + :m_nID( 0 ) + ,m_sName() + ,m_bIsResizable( true ) + ,m_nWidth( 4 ) + ,m_nMinWidth( 0 ) // no min width + ,m_nMaxWidth( 0 ) // no max width + ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) + { + } //-------------------------------------------------------------------- ColumnID UnoControlTableColumn::getID() const @@ -91,7 +103,6 @@ using namespace ::com::sun::star::awt::grid; m_sName = _rName; // TODO: notifications? } - //-------------------------------------------------------------------- bool UnoControlTableColumn::isResizable() const { @@ -143,6 +154,29 @@ using namespace ::com::sun::star::awt::grid; m_nMaxWidth = _nMaxWidth; // TODO: notifications? } + //-------------------------------------------------------------------- + TableMetrics UnoControlTableColumn::getPreferredWidth() const + { + return m_nPrefWidth; + } + + //-------------------------------------------------------------------- + void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth ) + { + m_nPrefWidth = _nPrefWidth; + // TODO: notifications? + } + //-------------------------------------------------------------------- + ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign() + { + return m_xHorizontalAlign; + } + + //-------------------------------------------------------------------- + void UnoControlTableColumn::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align ) + { + m_xHorizontalAlign = _align; + } //==================================================================== //= DefaultTableModel_Impl @@ -153,26 +187,44 @@ using namespace ::com::sun::star::awt::grid; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; + bool bVScroll; + bool bHScroll; PTableRenderer pRenderer; PTableInputHandler pInputHandler; TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; std::vector& aRowHeadersTitle; - std::vector >& aCellContent; + //std::vector >& aCellContent; + std::vector >& aCellContent; + ::com::sun::star::util::Color m_xLineColor; + ::com::sun::star::util::Color m_xHeaderColor; + ::com::sun::star::util::Color m_xTextColor; + ::com::sun::star::util::Color m_xRowColor1; + ::com::sun::star::util::Color m_xRowColor2; + ::com::sun::star::style::VerticalAlignment m_xVerticalAlign; UnoControlTableModel_Impl() :aColumns ( *(new std::vector< PColumnModel> (0))) ,nRowCount ( 0 ) ,bHasColumnHeaders ( false ) ,bHasRowHeaders ( false ) + ,bVScroll ( false ) + ,bHScroll ( false ) ,pRenderer ( ) ,pInputHandler ( ) - ,nRowHeight ( 4 * 100 ) // 40 mm - ,nColumnHeaderHeight( 5 * 100 ) // 50 mm - ,nRowHeaderWidth ( 10 * 100 ) // 50 mm + ,nRowHeight ( 15 ) // 40 mm + ,nColumnHeaderHeight( 10 ) // 50 mm + ,nRowHeaderWidth ( 10 ) // 50 mm ,aRowHeadersTitle ( *(new std::vector(0))) - ,aCellContent ( *(new std::vector >(0))) + //,aCellContent ( *(new std::vector >(0))) + ,aCellContent ( *(new std::vector >(0)) ) + ,m_xLineColor( 0xFFFFFF ) + ,m_xHeaderColor( 0xFFFFFF ) + ,m_xTextColor( 0 ) //black as default + ,m_xRowColor1( 0xFFFFFF ) + ,m_xRowColor2( 0xFFFFFF ) + ,m_xVerticalAlign(com::sun::star::style::VerticalAlignment(0)) { } }; @@ -193,6 +245,17 @@ using namespace ::com::sun::star::awt::grid; //-------------------------------------------------------------------- UnoControlTableModel::~UnoControlTableModel() { + //if(!m_pImpl->aCellContent.empty()) + //{ + // ::std::vector >::iterator iter = m_pImpl->aCellContent.begin(); + // for(;iter!=m_pImpl->aCellContent.end();++iter) + // { + // std::vector vectIn = *iter; + // std::vector::iterator iterIn = vectIn.begin(); + // for(;iterIn!=vectIn.end();++iterIn) + // DELETEZ(*iterIn); + // } + //} DELETEZ( m_pImpl ); } @@ -324,6 +387,17 @@ using namespace ::com::sun::star::awt::grid; DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" ); return m_pImpl->nRowHeaderWidth; } + //-------------------------------------------------------------------- + void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight) + { + m_pImpl->nColumnHeaderHeight = _nHeight; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth) + { + m_pImpl->nRowHeaderWidth = _nWidth; + } //-------------------------------------------------------------------- void UnoControlTableModel::SetTitleHeight( TableMetrics _nHeight ) @@ -344,7 +418,7 @@ using namespace ::com::sun::star::awt::grid; //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const { - if(overAllHeight>=actHeight)// && !m_bVScroll) + if(overAllHeight>=actHeight && !m_pImpl->bVScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -353,38 +427,88 @@ using namespace ::com::sun::star::awt::grid; //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const { - if(overAllWidth>=actWidth)// && !m_bHScroll) + if(overAllWidth>=actWidth && !m_pImpl->bHScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; } //-------------------------------------------------------------------- - void UnoControlTableModel::setCellContent(std::vector > cellContent) + void UnoControlTableModel::setVerticalScrollbarVisibility(bool _bVScroll) const { - //if(cellContent.empty()) - //{ - // unsigned int i = m_pImpl->aColumns.size(); - // std::vector& emptyCells; - // while(i!=0) - // { - // cellContent.push_back(emptyCells); - // --i; - // } - //} - //std::vector cCC; - //for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - //{ - // cCC = *iter; - // m_pImpl->aCellContent.push_back(cCC); - //} + m_pImpl->bVScroll = _bVScroll; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setHorizontalScrollbarVisibility(bool _bHScroll) const + { + m_pImpl->bHScroll = _bHScroll; + } + //-------------------------------------------------------------------- + bool UnoControlTableModel::hasVerticalScrollbar() + { + return m_pImpl->bVScroll; + } + //-------------------------------------------------------------------- + bool UnoControlTableModel::hasHorizontalScrollbar() + { + return m_pImpl->bHScroll; + } + //-------------------------------------------------------------------- + // void UnoControlTableModel::setCellContent(std::vector > cellContent) + // { + // //if(cellContent.empty()) + // //{ + // // unsigned int i = m_pImpl->aColumns.size(); + // // std::vector& emptyCells; + // // while(i!=0) + // // { + // // cellContent.push_back(emptyCells); + // // --i; + // // } + // //} + // //std::vector cCC; + // //for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) + // //{ + // // cCC = *iter; + // // m_pImpl->aCellContent.push_back(cCC); + // //} + // m_pImpl->aCellContent.swap( cellContent ); + // } + + //std::vector >& UnoControlTableModel::getCellContent() + // { + // return m_pImpl->aCellContent; + // } + //-------------------------------------------------------------------- + void UnoControlTableModel::setCellContent(std::vector > cellContent) + { + //::vos::OGuard aGuard( GetMutex() ); + /* + if(cellContent.empty()) + { + unsigned int i = m_pImpl->aColumns.size(); + std::vector emptyCells; + while(i!=0) + { + cellContent.push_back(emptyCells); + --i; + } + } + */ + m_pImpl->aCellContent.swap( cellContent ); + + /*for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) + { + m_pImpl->aCellContent.push_back(*iter); + }*/ } - std::vector >& UnoControlTableModel::getCellContent() + std::vector >& UnoControlTableModel::getCellContent() { + //::vos::OGuard aGuard( GetMutex() ); return m_pImpl->aCellContent; } - //-------------------------------------------------------------------- void UnoControlTableModel::setRowHeaderName(std::vector cellColumnContent) { @@ -408,4 +532,70 @@ using namespace ::com::sun::star::awt::grid; { return m_pImpl->aRowHeadersTitle; } + //-------------------------------------------------------------------- + ::com::sun::star::util::Color UnoControlTableModel::getLineColor() + { + return m_pImpl->m_xLineColor; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor ) + { + m_pImpl->m_xLineColor = _rColor; + } + //-------------------------------------------------------------------- + ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor() + { + return m_pImpl->m_xHeaderColor; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor ) + { + m_pImpl->m_xHeaderColor = _rColor; + } + //-------------------------------------------------------------------- + ::com::sun::star::util::Color UnoControlTableModel::getTextColor() + { + return m_pImpl->m_xTextColor; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor ) + { + m_pImpl->m_xTextColor = _rColor; + } + //-------------------------------------------------------------------- + ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor() + { + return m_pImpl->m_xRowColor1; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor ) + { + m_pImpl->m_xRowColor1 = _rColor; + } + //-------------------------------------------------------------------- + ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor() + { + return m_pImpl->m_xRowColor2; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor ) + { + m_pImpl->m_xRowColor2 = _rColor; + } + //-------------------------------------------------------------------- + com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign() + { + return m_pImpl->m_xVerticalAlign; + } + + //-------------------------------------------------------------------- + void UnoControlTableModel::setVerticalAlign( com::sun::star::style::VerticalAlignment _xAlign ) + { + m_pImpl->m_xVerticalAlign = _xAlign; + } diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index fe3d1f28e9ed..cff18f4d9be2 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include +#include //#include @@ -60,9 +63,12 @@ class UnoControlTableColumn : public IColumnModel TableMetrics m_nWidth; TableMetrics m_nMinWidth; TableMetrics m_nMaxWidth; + TableMetrics m_nPrefWidth; + ::com::sun::star::style::HorizontalAlignment m_xHorizontalAlign; public: UnoControlTableColumn(Reference); + UnoControlTableColumn(); // IColumnModel overridables virtual ColumnID getID() const; @@ -77,6 +83,10 @@ class UnoControlTableColumn : public IColumnModel virtual void setMinWidth( TableMetrics _nMinWidth ); virtual TableMetrics getMaxWidth() const; virtual void setMaxWidth( TableMetrics _nMaxWidth ); + virtual TableMetrics getPreferredWidth() const; + virtual void setPreferredWidth( TableMetrics _nPrefWidth ); + virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign(); + virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign); }; struct UnoControlTableModel_Impl; @@ -94,6 +104,10 @@ class UnoControlTableColumn : public IColumnModel inline TableMetrics GetRowHeight() const { return getRowHeight(); } /// sets a new row height. void setRowHeight( TableMetrics _nHeight ); + /// sets a new row header width. + void setRowHeaderWidth( TableMetrics _nWidth ); + /// sets a new column header height. + void setColumnHeaderHeight( TableMetrics _nHeight ); /// returns the height of the title row (containing the column headers) inline TableMetrics GetTitleHeight() const { return getColumnHeaderHeight(); } @@ -135,10 +149,26 @@ class UnoControlTableColumn : public IColumnModel virtual TableMetrics getRowHeaderWidth() const; virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const; virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const; - virtual void setCellContent(std::vector > cellContent); - virtual std::vector >& getCellContent(); + virtual void setVerticalScrollbarVisibility(bool _bVScroll) const; + virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const; + virtual void setCellContent(std::vector > cellContent); + virtual std::vector >& getCellContent(); virtual void setRowHeaderName(std::vector cellColumnContent); virtual std::vector& getRowHeaderName(); + virtual ::com::sun::star::util::Color getLineColor(); + virtual void setLineColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getHeaderBackgroundColor(); + virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getTextColor(); + virtual void setTextColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getOddRowBackgroundColor(); + virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::util::Color getEvenRowBackgroundColor(); + virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor); + virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign(); + virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign); + virtual bool hasVerticalScrollbar(); + virtual bool hasHorizontalScrollbar(); }; inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) -- cgit From 9945f4ca9649f961bbc6d9f5be238771e3e2b96c Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 15 Feb 2010 14:45:34 +0100 Subject: recent changes for grid control --- toolkit/source/controls/grid/defaultgriddatamodel.cxx | 2 +- toolkit/source/controls/grid/gridcolumn.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index c564618336af..2d695a9bad0a 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#include "DefaultGridDataModel.hxx" +#include "defaultgriddatamodel.hxx" #include #include #include diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index e8dadc527fbd..40c2018c4cc5 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -162,13 +162,13 @@ void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star: bResizeable = value; } //--------------------------------------------------------------------- -HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() +HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException) { return horizontalAlign; } //--------------------------------------------------------------------- -void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) +void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException) { horizontalAlign = align; } -- cgit From 34cee89411da550fe89908e5a0aaa52a7f32ea2b Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 16 Feb 2010 11:53:58 +0100 Subject: sb118: adapted remaining */qa/unoapi tests to new framework --- svtools/prj/build.lst | 1 + svtools/qa/unoapi/Test.java | 51 +++++++++++++++++++++++++++++++++++++++++++ svtools/qa/unoapi/makefile.mk | 36 ++++++++++++++++-------------- toolkit/prj/build.lst | 1 + toolkit/qa/unoapi/Test.java | 51 +++++++++++++++++++++++++++++++++++++++++++ toolkit/qa/unoapi/makefile.mk | 39 +++++++++++++++++---------------- 6 files changed, 144 insertions(+), 35 deletions(-) create mode 100644 svtools/qa/unoapi/Test.java create mode 100644 toolkit/qa/unoapi/Test.java diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 5a67b9414181..de86d1824821 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -26,3 +26,4 @@ st svtools\util nmake - all st_util st__brw st__ctr st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL +st svtools\qa\unoapi nmake - all st_qa_unoapi NULL diff --git a/svtools/qa/unoapi/Test.java b/svtools/qa/unoapi/Test.java new file mode 100644 index 000000000000..8ae4af55ed61 --- /dev/null +++ b/svtools/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +package org.openoffice.svtools.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "svtools.sce", "-xcl", "knownissues.xcl", "-cs", + connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/svtools/qa/unoapi/makefile.mk b/svtools/qa/unoapi/makefile.mk index de69c4acec1e..e3afb77e637a 100644 --- a/svtools/qa/unoapi/makefile.mk +++ b/svtools/qa/unoapi/makefile.mk @@ -1,14 +1,9 @@ #************************************************************************* -# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# Copyright 2000, 2010 Oracle and/or its affiliates. # -# $Revision: 1.6 $ +# OpenOffice.org - a multi-platform office productivity suite # # This file is part of OpenOffice.org. # @@ -26,19 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=svtools -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = svtools +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/svtools/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce svtools.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst index 304d0e7c978f..126eea24c66c 100644 --- a/toolkit/prj/build.lst +++ b/toolkit/prj/build.lst @@ -11,3 +11,4 @@ ti toolkit\source\controls\grid nmake - all ti_grid NULL ti toolkit\source\layout\core nmake - all ti_layout_core NULL ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_grid ti_layout_vcl NULL +ti toolkit\qa\unoapi nmake - all ti_qa_unoapi NULL diff --git a/toolkit/qa/unoapi/Test.java b/toolkit/qa/unoapi/Test.java new file mode 100644 index 000000000000..f27d882314d2 --- /dev/null +++ b/toolkit/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +package org.openoffice.toolkit.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "toolkit.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk index 2002e0d02978..9517601c3917 100644 --- a/toolkit/qa/unoapi/makefile.mk +++ b/toolkit/qa/unoapi/makefile.mk @@ -1,14 +1,9 @@ #************************************************************************* -# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ +# Copyright 2000, 2010 Oracle and/or its affiliates. # -# $Revision: 1.6 $ +# OpenOffice.org - a multi-platform office productivity suite # # This file is part of OpenOffice.org. # @@ -26,22 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=toolkit -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = toolkit +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/toolkit/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce toolkit.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments - @echo ======================================================================= - @echo In case you noticed a failures of toolkit.AccessibleToolBoxItem make sure that the object bar is configured as text and not as icons - @echo ======================================================================= +.END -- cgit From 7b10d5c5f5ed23b9a641ec6113ac940909fd3ca8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 18 Feb 2010 17:08:32 +0100 Subject: ppp02: #i108327# set requested paper bin --- vcl/source/gdi/print3.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index c2b1b637afd5..cccf19d06ae8 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -743,6 +743,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons PrinterController::PageSize aPageSize; aPageSize.aSize = mpPrinter->GetPaperSize(); awt::Size aSetSize, aIsSize; + sal_Int32 nPaperBin = -1; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) @@ -759,6 +760,10 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons i_rProps[ nProperty ].Value >>= bVal; aPageSize.bFullPaper = static_cast(bVal); } + else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) + { + i_rProps[ nProperty ].Value >>= nPaperBin; + } } Size aCurSize( mpPrinter->GetPaperSize() ); @@ -779,6 +784,10 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons if( aRealPaperSize != aCurSize ) mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); } + + if( nPaperBin != -1 && nPaperBin != mpPrinter->GetPaperBin() ) + mpPrinter->SetPaperBin( nPaperBin ); + return aPageSize; } -- cgit From b76532e1fbc6ac8d421308cac5a1d4fb239047db Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 19 Feb 2010 01:13:34 +0100 Subject: Fix dxcanvas gradient glitches * moved common gradient step size code out to canvastools to share * reverted back to manual polygon rendering for anisotrophic rect and ellipse gradients * fixed tilemode==none case for bitmap fills --- canvas/inc/canvas/canvastools.hxx | 13 ++ .../source/directx/dx_canvashelper_texturefill.cxx | 194 +++++++++++---------- canvas/source/directx/dx_impltools.cxx | 2 +- canvas/source/tools/canvastools.cxx | 48 +++++ canvas/source/vcl/canvashelper_texturefill.cxx | 75 +++----- 5 files changed, 183 insertions(+), 149 deletions(-) mode change 100644 => 100755 canvas/inc/canvas/canvastools.hxx mode change 100644 => 100755 canvas/source/tools/canvastools.cxx mode change 100644 => 100755 canvas/source/vcl/canvashelper_texturefill.cxx diff --git a/canvas/inc/canvas/canvastools.hxx b/canvas/inc/canvas/canvastools.hxx old mode 100644 new mode 100755 index 345bcd9187ae..cada66cb9957 --- a/canvas/inc/canvas/canvastools.hxx +++ b/canvas/inc/canvas/canvastools.hxx @@ -69,6 +69,7 @@ namespace com { namespace sun { namespace star { namespace rendering struct ViewState; struct IntegerBitmapLayout; class XCanvas; + struct Texture; class XIntegerBitmapColorSpace; class XPolyPolygon2D; @@ -499,6 +500,18 @@ namespace canvas */ ::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange ); + /** Calculate number of gradient "strips" to generate (takes + into account device resolution) + + @param nColorSteps + Maximal integer difference between all color stops, needed + for smooth gradient color differences + */ + int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, + const ::com::sun::star::rendering::Texture& texture, + int nColorSteps ); /** A very simplistic map for ASCII strings and arbitrary value types. diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 453569298004..ab0f399b2901 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,7 @@ namespace dxcanvas typedef ::boost::shared_ptr< Gdiplus::PathGradientBrush > PathGradientBrushSharedPtr; bool fillLinearGradient( GraphicsSharedPtr& rGraphics, - const ::canvas::ParametricPolyPolygon::Values& rValues, + const ::canvas::ParametricPolyPolygon::Values& /*rValues*/, const std::vector< Gdiplus::Color >& rColors, const std::vector< Gdiplus::REAL >& rStops, const GraphicsPathSharedPtr& rFillPath, @@ -214,23 +215,14 @@ namespace dxcanvas const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, const rendering::Texture& texture ) { - Gdiplus::Matrix aMatrix; - tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix, - texture.AffineTransform ); - // copy original fill path object, might have to change it // below GraphicsPathSharedPtr pFillPath( rPath ); - - // clone original gradient path object, we need to change it - // below - GraphicsPathSharedPtr pGradientPath( - tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); - - ENSURE_OR_RETURN( pGradientPath.get(), - "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); + const ::basegfx::B2DPolygon& rGradientPoly( rValues.maGradientPoly ); PathGradientBrushSharedPtr pGradientBrush; @@ -264,8 +256,6 @@ namespace dxcanvas return false; } - rGraphics->MultiplyTransform( &aMatrix ); - // disable anti-aliasing, if any const Gdiplus::SmoothingMode eOldAAMode( rGraphics->GetSmoothingMode() ); rGraphics->SetSmoothingMode( Gdiplus::SmoothingModeHighSpeed ); @@ -278,50 +268,80 @@ namespace dxcanvas int nColorSteps = 0; for( size_t i=0; i 1.0), the inner + // polygon, representing the gradient focus, must have + // non-zero width. Specifically, a bound rect twice as wide as + // tall has a focus polygon of half it's width. + const double nAspectRatio( rValues.mnAspectRatio ); + if( nAspectRatio > 1.0 ) + { + // width > height case + aInnerPolygonTransformMatrix.scale( 1.0 - 1.0/nAspectRatio, + 0.0 ); + } + else if( nAspectRatio < 1.0 ) + { + // width < height case + aInnerPolygonTransformMatrix.scale( 0.0, + 1.0 - nAspectRatio ); + } + else + { + // isotrophic case + aInnerPolygonTransformMatrix.scale( 0.0, 0.0 ); + } + + // and finally, add texture transform to it. + aInnerPolygonTransformMatrix *= aTextureTransform; - Gdiplus::Matrix aWorldTransformMatrix; - rGraphics->GetTransform( &aWorldTransformMatrix ); - - Gdiplus::RectF aBounds; - pGradientPath->GetBounds( &aBounds, &aWorldTransformMatrix, NULL ); - - // longest line in gradient bound rect - const int nGradientSize( - static_cast( hypot( aBounds.Width, aBounds.Height ) + 1.0 ) ); - - // typical number for pixel of the same color (strip size) - const int nStripSize( nGradientSize < 50 ? 2 : 4 ); - - // use at least three steps, and at utmost the number of color - // steps - const int nStepCount( - ::std::max( - 3, - ::std::min( - nGradientSize / nStripSize, - nColorSteps ) ) ); - - Gdiplus::SolidBrush aFillBrush( rColors[0] ); - Gdiplus::Matrix aGDIScaleMatrix; - ::basegfx::B2DHomMatrix aScaleMatrix; - - // calc relative size for anisotrophic polygon scaling: - // when the aspect ratio is e.g. 2.0, that denotes a - // gradient which is twice as wide as high. Then, to - // generate a symmetric gradient, the x direction is only - // scaled to 0.5 times the gradient width. Similarly, when - // the aspect ratio is 4.0, the focus has 3/4 the width of - // the overall gradient. - const double nRelativeFocusSize( rValues.mnAspectRatio > 1.0 ? - 1.0 - 1.0/rValues.mnAspectRatio : - 1.0 - rValues.mnAspectRatio ); + // apply final matrix to polygon + aInnerPoly.transform( aInnerPolygonTransformMatrix ); + Gdiplus::GraphicsPath aCurrPath; + Gdiplus::SolidBrush aFillBrush( rColors[0] ); + const sal_uInt32 nNumPoints( aOuterPoly.count() ); basegfx::tools::KeyStopLerp aLerper(rValues.maStops); for( int i=1; i( basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha) ), @@ -329,45 +349,23 @@ namespace dxcanvas static_cast( basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha) ) ); aFillBrush.SetColor( aFillColor ); - - const double nCurrScale( (nStepCount-i)/(double)nStepCount ); - aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); - - // handle anisotrophic polygon scaling - if( rValues.mnAspectRatio < 1.0 ) - { - // height > width case - aScaleMatrix.scale( nCurrScale, - // lerp with nCurrScale - // between 1.0 and - // relative focus height - nCurrScale + (1.0-nCurrScale)*nRelativeFocusSize ); - } - else if( rValues.mnAspectRatio > 1.0 ) - { - // width > height case - aScaleMatrix.scale( nCurrScale + (1.0-nCurrScale)*nRelativeFocusSize, - // lerp with nCurrScale - // between 1.0 and - // relative focus width - nCurrScale ); - } - else + aCurrPath.Reset(); aCurrPath.StartFigure(); + for( unsigned int p=1; pTransform( &aGDIScaleMatrix ); - - rGraphics->FillPath( &aFillBrush, pScaledGradientPath.get() ); + rGraphics->FillPath( &aFillBrush, &aCurrPath ); } // reset to old anti-alias mode @@ -388,6 +386,11 @@ namespace dxcanvas // one sets both, only the translational components of the // texture is respected. + Gdiplus::Matrix aMatrix; + tools::gdiPlusMatrixFromAffineMatrix2D( aMatrix, + texture.AffineTransform ); + GraphicsPathSharedPtr pGradientPath( + tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly )); pGradientPath->Transform( &aMatrix ); pGradientBrush.reset( @@ -400,7 +403,7 @@ namespace dxcanvas // gradients are by default the _centroid_ of the path // (i.e. the weighted sum of edge points), it will not // necessarily coincide with our notion of center. - Gdiplus::PointF aCenterPoint(0.5, 0.5); + Gdiplus::PointF aCenterPoint(0, 0); aMatrix.TransformPoints( &aCenterPoint ); pGradientBrush->SetCenterPoint( aCenterPoint ); @@ -440,6 +443,8 @@ namespace dxcanvas const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, const rendering::Texture& texture ) { switch( rValues.meType ) @@ -461,6 +466,8 @@ namespace dxcanvas rStops, rGraphics, rPath, + viewState, + renderState, texture ); break; @@ -486,8 +493,8 @@ namespace dxcanvas const geometry::IntegerSize2D aBmpSize( xBitmap->getSize() ); ENSURE_ARG_OR_THROW( aBmpSize.Width != 0 && - aBmpSize.Height != 0, - "CanvasHelper::fillBitmap(): zero-sized texture bitmap" ); + aBmpSize.Height != 0, + "CanvasHelper::fillBitmap(): zero-sized texture bitmap" ); // TODO(P3): Detect case that path is rectangle and // bitmap is just scaled into that. Then, we can @@ -499,7 +506,6 @@ namespace dxcanvas tools::bitmapFromXBitmap( xBitmap ) ); TextureBrushSharedPtr pBrush; - if( ::rtl::math::approxEqual( rTexture.Alpha, 1.0 ) ) { @@ -537,9 +543,9 @@ namespace dxcanvas // scale down bitmap to [0,1]x[0,1] rect, as required // from the XCanvas interface. + pBrush->MultiplyTransform( &aTextureTransform ); pBrush->ScaleTransform( static_cast< Gdiplus::REAL >(1.0/aBmpSize.Width), static_cast< Gdiplus::REAL >(1.0/aBmpSize.Height) ); - pBrush->MultiplyTransform( &aTextureTransform ); // TODO(F1): FillRule ENSURE_OR_THROW( @@ -602,6 +608,8 @@ namespace dxcanvas aStops, pGraphics, tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ), + viewState, + renderState, textures[0] ); } } diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index 4f5b92d6bcb5..0067ea8e9b71 100755 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -199,7 +199,7 @@ namespace dxcanvas { const sal_uInt32 nPoints( rPoly.count() ); - if( !nPoints ) + if( nPoints < 2 ) return; rOutput->StartFigure(); diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx old mode 100644 new mode 100755 index 278789637c72..eabc8b847374 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -994,6 +994,54 @@ namespace canvas return aPolyPoly; } + int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, + const rendering::Texture& texture, + int nColorSteps ) + { + // calculate overall texture transformation (directly from + // texture to device space). + ::basegfx::B2DHomMatrix aMatrix; + + rTotalTransform.identity(); + ::basegfx::unotools::homMatrixFromAffineMatrix( rTotalTransform, + texture.AffineTransform ); + ::canvas::tools::mergeViewAndRenderTransform(aMatrix, + viewState, + renderState); + rTotalTransform *= aMatrix; // prepend total view/render transformation + + // determine size of gradient in device coordinate system + // (to e.g. determine sensible number of gradient steps) + ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 ); + ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 ); + ::basegfx::B2DPoint aRightTop( 1.0, 0.0 ); + ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 ); + + aLeftTop *= rTotalTransform; + aLeftBottom *= rTotalTransform; + aRightTop *= rTotalTransform; + aRightBottom*= rTotalTransform; + + // longest line in gradient bound rect + const int nGradientSize( + static_cast( + ::std::max( + ::basegfx::B2DVector(aRightBottom-aLeftTop).getLength(), + ::basegfx::B2DVector(aRightTop-aLeftBottom).getLength() ) + 1.0 ) ); + + // typical number for pixel of the same color (strip size) + const int nStripSize( nGradientSize < 50 ? 2 : 4 ); + + // use at least three steps, and at utmost the number of color + // steps + return ::std::max( 3, + ::std::min( + nGradientSize / nStripSize, + nColorSteps ) ); + } + } // namespace tools } // namespace canvas diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx old mode 100644 new mode 100755 index 9f8118e8a8f8..841d78375f82 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -562,62 +562,27 @@ namespace vclcanvas // deadlocks, canvashelper calls this method with locked own // mutex. - // calculate overall texture transformation (directly from - // texture to device space). - ::basegfx::B2DHomMatrix aMatrix; - ::basegfx::B2DHomMatrix aTextureTransform; - - ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform, - texture.AffineTransform ); - ::canvas::tools::mergeViewAndRenderTransform(aMatrix, - viewState, - renderState); - aTextureTransform *= aMatrix; // prepend total view/render transformation - - // determine maximal bound rect of gradient-filled polygon - const ::Rectangle aPolygonDeviceRectOrig( - rPoly.GetBoundRect() ); - - // determine size of gradient in device coordinate system - // (to e.g. determine sensible number of gradient steps) - ::basegfx::B2DPoint aLeftTop( 0.0, 0.0 ); - ::basegfx::B2DPoint aLeftBottom( 0.0, 1.0 ); - ::basegfx::B2DPoint aRightTop( 1.0, 0.0 ); - ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 ); - - aLeftTop *= aTextureTransform; - aLeftBottom *= aTextureTransform; - aRightTop *= aTextureTransform; - aRightBottom*= aTextureTransform; - - // calc step size // -------------- int nColorSteps = 0; for( size_t i=0; i( - ::std::max( - ::basegfx::B2DVector(aRightBottom-aLeftTop).getLength(), - ::basegfx::B2DVector(aRightTop-aLeftBottom).getLength() ) + 1.0 ) ); - - // typical number for pixel of the same color (strip size) - const int nStripSize( nGradientSize < 50 ? 2 : 4 ); - - // use at least three steps, and at utmost the number of color - // steps - const int nStepCount( - ::std::max( - 3, - ::std::min( - nGradientSize / nStripSize, - nColorSteps ) ) ); + ::basegfx::B2DHomMatrix aTotalTransform; + const int nStepCount= + ::canvas::tools::calcGradientStepCount(aTotalTransform, + viewState, + renderState, + texture, + nColorSteps); rOutDev.SetLineColor(); + // determine maximal bound rect of texture-filled + // polygon + const ::Rectangle aPolygonDeviceRectOrig( + rPoly.GetBoundRect() ); + if( tools::isRectangle( rPoly ) ) { // use optimized output path @@ -635,7 +600,7 @@ namespace vclcanvas doGradientFill( rOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, false ); @@ -648,7 +613,7 @@ namespace vclcanvas doGradientFill( *p2ndOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, false ); @@ -666,7 +631,7 @@ namespace vclcanvas doGradientFill( rOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, false ); @@ -679,7 +644,7 @@ namespace vclcanvas doGradientFill( *p2ndOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, false ); @@ -694,7 +659,7 @@ namespace vclcanvas doGradientFill( rOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, true ); @@ -705,7 +670,7 @@ namespace vclcanvas doGradientFill( rOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, true ); @@ -718,7 +683,7 @@ namespace vclcanvas doGradientFill( *p2ndOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, true ); @@ -729,7 +694,7 @@ namespace vclcanvas doGradientFill( *p2ndOutDev, rValues, rColors, - aTextureTransform, + aTotalTransform, aPolygonDeviceRectOrig, nStepCount, true ); -- cgit From 7ffd813fd3f0c4ec1e6b6f168acf94a6c3246a58 Mon Sep 17 00:00:00 2001 From: thb Date: Fri, 19 Feb 2010 11:14:19 +0100 Subject: Fix rgb2hsl miscalculation + add according test case * the fourth quadrant hue calculation had a typo for the rgb2hsl function. fixed now. * added testcase that break before, and works now --- basegfx/source/color/bcolortools.cxx | 2 +- basegfx/test/basegfx2d.cxx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx index 1c7d2b222fff..960ccfad4d67 100644 --- a/basegfx/source/color/bcolortools.cxx +++ b/basegfx/source/color/bcolortools.cxx @@ -65,7 +65,7 @@ namespace basegfx { namespace tools else if( g == maxVal ) h = 2.0 + (b - r)/d; else - h = 4.0 + (r - h)/d; + h = 4.0 + (r - g)/d; h *= 60.0; diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 0dfb3a8ea999..d8b574769554 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -1345,6 +1345,8 @@ public: tools::rgb2hsl(maMagenta) == BColor(300,1,0.5)); CPPUNIT_ASSERT_MESSAGE("cyan", tools::rgb2hsl(maCyan) == BColor(180,1,0.5)); + CPPUNIT_ASSERT_MESSAGE("third hue case", + tools::rgb2hsl(BColor(0,0.5,1)) == BColor(210,1,0.5)); CPPUNIT_ASSERT_MESSAGE("roundtrip white", tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite); -- cgit From 8796ec9bc22bb3d5ae9ba75f6689bad7352f418a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 19 Feb 2010 11:58:34 +0100 Subject: ppp02: #i108327# set papertray if necessary --- vcl/source/gdi/print3.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index cccf19d06ae8..b3e92a412e2f 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -175,13 +175,15 @@ public: // set by user through printer config dialog // if set, pages are centered and trimmed onto the fixed page Size maFixedPageSize; + sal_Int32 mnDefaultPaperBin; ImplPrinterControllerData() : mbFirstPage( sal_True ), mbLastPage( sal_False ), mbReversePageOrder( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), - mpProgress( NULL ) + mpProgress( NULL ), + mnDefaultPaperBin( -1 ) {} ~ImplPrinterControllerData() { delete mpProgress; } @@ -708,6 +710,7 @@ void PrinterController::setPrinter( const boost::shared_ptr& i_rPrinter mpImplData->mpPrinter = i_rPrinter; setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), makeAny( rtl::OUString( i_rPrinter->GetName() ) ) ); + mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin(); } bool PrinterController::setupPrinter( Window* i_pParent ) @@ -743,7 +746,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons PrinterController::PageSize aPageSize; aPageSize.aSize = mpPrinter->GetPaperSize(); awt::Size aSetSize, aIsSize; - sal_Int32 nPaperBin = -1; + sal_Int32 nPaperBin = mnDefaultPaperBin; for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) ) @@ -762,7 +765,10 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons } else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) ) { - i_rProps[ nProperty ].Value >>= nPaperBin; + sal_Int32 nBin = -1; + i_rProps[ nProperty ].Value >>= nBin; + if( nBin >= 0 && nBin < mpPrinter->GetPaperBinCount() ) + nPaperBin = nBin; } } -- cgit From ce0b093f1908ccce9446c29ee479142c61943090 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 19 Feb 2010 19:35:40 +0100 Subject: l10ntooling17: #i100845# support for java properties --- transex3/java/jpropex/build.xml | 169 ++++++++++ transex3/java/jpropex/java/JPropEx.java | 393 +++++++++++++++++++++++ transex3/java/jpropex/java/Main.java | 38 +++ transex3/java/jpropex/java/NoLocalizeFilter.java | 55 ++++ transex3/java/jpropex/java/OrderedHashMap.java | 96 ++++++ transex3/java/jpropex/java/SdfData.java | 108 +++++++ transex3/java/jpropex/java/SdfEntity.java | 254 +++++++++++++++ transex3/java/jpropex/jpropex | 10 + transex3/java/jpropex/jpropex.MF | 1 + transex3/java/jpropex/makefile.mk | 36 +++ transex3/prj/build.lst | 1 + transex3/prj/d.lst | 2 + transex3/source/localize.cxx | 1 + 13 files changed, 1164 insertions(+) create mode 100755 transex3/java/jpropex/build.xml create mode 100644 transex3/java/jpropex/java/JPropEx.java create mode 100644 transex3/java/jpropex/java/Main.java create mode 100644 transex3/java/jpropex/java/NoLocalizeFilter.java create mode 100644 transex3/java/jpropex/java/OrderedHashMap.java create mode 100644 transex3/java/jpropex/java/SdfData.java create mode 100644 transex3/java/jpropex/java/SdfEntity.java create mode 100755 transex3/java/jpropex/jpropex create mode 100755 transex3/java/jpropex/jpropex.MF create mode 100755 transex3/java/jpropex/makefile.mk diff --git a/transex3/java/jpropex/build.xml b/transex3/java/jpropex/build.xml new file mode 100755 index 000000000000..d74fb3975d0f --- /dev/null +++ b/transex3/java/jpropex/build.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/transex3/java/jpropex/java/JPropEx.java b/transex3/java/jpropex/java/JPropEx.java new file mode 100644 index 000000000000..2ba1e913f5d4 --- /dev/null +++ b/transex3/java/jpropex/java/JPropEx.java @@ -0,0 +1,393 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +import java.util.*; +import java.io.*; + +public class JPropEx +{ + private String inputFileArg; + private String outputFileArg; + private String pathPrefixArg; + private String pathPostfixArg; + private String projectArg; + private String rootArg; + private Vector forcedLangsArg; + private Vector langsArg; + private String inputSdfFileArg; + private boolean isQuiet = false; + private final String resourceType = "javaproperties"; + private final String sourceLanguage = "en-US"; + //private SdfData data; + + public JPropEx() + { + //data = new SdfData(); + } + + public JPropEx( String args[] ) + { + super(); + parseArguments( args ); + testArguments(); + if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 ) + merge(); + else + extract(); + } + + private String getSimpleArg( String[] args , int x ) + { + if( x < args.length ) x++; + else + { + System.err.println("ERROR: Missing arg for "+args[ x ]+"\n"); + help(); + } + return args[ x ]; + } + private Vector getComplexArg( String[] args , int x ) + { + if( x < args.length ) x++; + else + { + System.err.println("ERROR: Missing arg for "+args[ x ]+"\n"); + help(); + } + String value = args[ x ]; + Vector values = new Vector( Arrays.asList( value.split(",") ) ); + return values; + } + + private void help() + { + System.out.println("jpropex extract / merge java properties files"); + System.exit( -1 ); + } + + private void extract() + { + SdfData data = new SdfData(); + java.util.Properties prop = loadProp( inputFileArg ); + + // Get a prototype that already contains the most common settings + SdfEntity dolly = prepareSdfObj(); + String key; + SdfEntity currentStr; + String value; + for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; ) + { + key = (String) e.nextElement(); + currentStr = (SdfEntity) dolly.clone(); + // Set the new LID and the string text + currentStr.setLid( key ); + value = prop.getProperty( key , "" ); + //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!"); + currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!! + data.add( currentStr ); + } + data.write( outputFileArg ); + } + + private SdfEntity prepareSdfObj() + { + String path = makeAbs( inputFileArg ); + path = path.replace( rootArg + "/" , "" ); + path = path.replace("/","\\"); + return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ , + sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" ); + } + + private void merge() + { + SdfData data = getSdfData(); + if( inputFileArg.startsWith("@") ) + { + // Read files + Vector fileList = readFileList( inputFileArg ); + for( Enumeration e = fileList.elements(); e.hasMoreElements(); ) + mergeFile( (String) e.nextElement() , data ); + } + else + { + // Single file + mergeFile( inputFileArg , data ); + } + } + + private Vector readFileList( String filename ) + { + Vector lines = new Vector(); + try + { + BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) ); + while( in.ready() ) + lines.add( in.readLine() ); + } + catch( IOException e ) + { + System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'"); + System.exit( -1 ); + } + return lines; + } + + private void mergeFile( String filename , SdfData data ) + { + java.util.Properties sourceProp = loadProp( filename ); + Vector langs = getLanguages( data ); + HashMap props = new HashMap(); + // Create a properties object for every language + for( Enumeration e = langs.elements(); e.hasMoreElements();) + { + + props.put( (String)e.nextElement() , new java.util.Properties() ); + } + // Get a prototype that already contains the most common settings + + SdfEntity dolly = prepareSdfObj(); + String key; + String sourceString; + SdfEntity curStr; + SdfEntity curEntity; + SdfEntity mergedEntity; + String curLang; + for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys + { + key = (String) e.nextElement(); + sourceString = sourceProp.getProperty( key ); + curStr = (SdfEntity) dolly.clone(); + curStr.setLid( key ); + for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language + { + curEntity = (SdfEntity) curStr.clone(); + curLang = (String) lang.nextElement(); + curEntity.setLangid( curLang ); + mergedEntity = data.get( curEntity ); + if( mergedEntity == null ) + { + // if case there is not translation the fallback to the en-US source string + ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString ); + } + else + { + // Set the merged text from the sdf file + ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ??? + } + } + + } + // Now write them out + String lang; + for( Iterator i = props.keySet().iterator() ; i.hasNext() ; ) + { + lang = (String) i.next(); + writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang ); + } + } + private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang ) + { + // Prepare path to file + int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ; + String path = new String(); + String name = new String(); + if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 ) + { + path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString(); + name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); + } + else if( outputFileArg != null && outputFileArg.length()>0 ) + name = outputFileArg; + else + { + System.err.println("ERROR: No outputfile specified .. either -o or -x -y !"); + System.exit( -1 ); + } + + File dir = new File( path ); + try + { + if( !dir.exists() && path.length()>0 ) + { + if( !dir.mkdirs() ) + { + System.out.println("ERROR: Can't create directory '"+path+"' !!!"); + System.exit( -1 ); + } + } + } + catch( SecurityException e ) + { + System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?"); + System.exit( -1 ); + } + path += name; + // Write the properties file + try{ + BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) ); + if( prop == null ) + System.out.println("DBG: prop == null!!!"); + prop.store( out , "" ); // Legal headers? + } + catch( IOException e ) + { + System.out.println("ERROR: Can't write file '"+path+"' !!!!"); + System.exit( -1 ); + } + } + + private SdfData getSdfData() + { + SdfData data = new SdfData( inputSdfFileArg ); + data.read(); + return data; + } + private Vector getLanguages( SdfData data ) + { + Vector langs = new Vector(); + + if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file + langs.addAll( data.getLanguages() ); + else + langs.addAll( langsArg ); // use the langs giving by -l + + if( forcedLangsArg != null ) + langs.addAll( forcedLangsArg ); + + return removeDupes( langs ); + } + private Vector removeDupes( Vector vec ) + { + Collection coll = new LinkedHashSet( vec ); + return new Vector( coll ); + } + private java.util.Properties loadProp( String filename ) + { + java.util.Properties prop = new java.util.Properties(); + try + { + prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) ); + } + catch( IOException e ) + { + System.err.println("ERROR: Can't read file '"+filename+"'!!!"); + } + return prop; + } + private void parseArguments( String[] args ) + { + + if( args.length == 0 ) + { + System.out.println("ERROR: No args???"); + help(); + System.exit( -1 ); + } + for( int x = 0; x < args.length ; x++ ) + { + if( args[ x ].equalsIgnoreCase("-i") ) + { + // Input resource file + inputFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-o") ) + { + // Output sdf file + outputFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-x") ) + { + // path prefix + pathPrefixArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-y") ) + { + // path postfix + pathPostfixArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-p") ) + { + // project + projectArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-r") ) + { + // root + rootArg = getSimpleArg( args , x ); + rootArg = makeAbs( rootArg ); + } + else if( args[ x ].equalsIgnoreCase("-lf") ) + { + // forced langs + forcedLangsArg = getComplexArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-l") ) + { + // langs + langsArg = getComplexArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-m") ) + { + // input sdf file + inputSdfFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-qq") ) + { + isQuiet = true; + } + } + } + private String makeAbs( String path ) + { + File file; + try + { + file = new File( path ); + return file.getCanonicalPath(); + }catch( IOException e ) + { + e.printStackTrace(); + System.exit( -1 ); + } + return null; + } + private boolean testArguments() + { + // nice merge + if( inputSdfFileArg != null && inputSdfFileArg.length()>0 ) + // nice merge + return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null && + projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ; + else + // nice extract + return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null && + projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0; + } + +} diff --git a/transex3/java/jpropex/java/Main.java b/transex3/java/jpropex/java/Main.java new file mode 100644 index 000000000000..23dc477ddec3 --- /dev/null +++ b/transex3/java/jpropex/java/Main.java @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +class Main +{ + + public static void main( String args[] ) + { + JPropEx jpropex = new JPropEx( args ); + //jpropex.init(); + } +} + diff --git a/transex3/java/jpropex/java/NoLocalizeFilter.java b/transex3/java/jpropex/java/NoLocalizeFilter.java new file mode 100644 index 000000000000..c1e62fc951a8 --- /dev/null +++ b/transex3/java/jpropex/java/NoLocalizeFilter.java @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +import java.io.*; +import java.util.regex.*; + +// exit if the sequence x-no-localize is found in stream! +public class NoLocalizeFilter extends FilterInputStream +{ + InputStream in; +// Pattern p = Pattern.compile("[\\s]*#[\\s]*x-no-translate"); + + public NoLocalizeFilter( InputStream in ) { + super(in); + this.in = in; + } + public int read(byte[] b, int off, int len) throws IOException + { + String search = new String( b ); +// Matcher m = p.matcher( search ); + if( search.contains("x-no-translate" ) ) // TODO: fixme! + { +// System.out.println("found x-no-translate"); + in.close(); + close(); + System.exit( 0 ); + } + return in.read( b , off , len ); + } +} diff --git a/transex3/java/jpropex/java/OrderedHashMap.java b/transex3/java/jpropex/java/OrderedHashMap.java new file mode 100644 index 000000000000..a462d598b307 --- /dev/null +++ b/transex3/java/jpropex/java/OrderedHashMap.java @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +import java.util.*; + +// LinkedHashMap implrementation +public class OrderedHashMap +{ + private HashMap hm = new HashMap(); + private LinkedList list = new LinkedList(); + + public Iterator iterator() { return list.iterator(); } + + public boolean isEmpty() { return hm.isEmpty(); } + public Object get( Object key ) { return hm.get( key ); } + public Object get( int index ) { return hm.get( list.get( index ) ); } + public Iterator keys() { return list.iterator(); } + public Object add( Object key , Object value ) + { + list.add( key ); + return hm.put( key, value ); + } + public Object add( int index , Object key , Object value ) + { + list.add( index , key ); + return hm.put( key, value ); + } + public Object remove( Object key ) + { + list.remove( list.indexOf( key ) ); + return hm.remove( key ); + } + public void move( int idxFrom , int idxTo ) + { + Object key = list.get( idxFrom ); + list.remove( idxFrom ); + list.add( idxTo , key ); + } + public void move( Object key , int idxTo ) + { + move( list.indexOf( key ) , idxTo ); + } + public int size() + { + return hm.size(); + } + public Enumeration elements() + { + return new OHMenum( this ); + } +} + +final class OHMenum implements Enumeration +{ + OrderedHashMap ohm; + int index = 0; + + private OHMenum(){}; + public OHMenum( OrderedHashMap ohm ){ + this.ohm = ohm ; + } + + public boolean hasMoreElements() + { + return index < ohm.size(); + } + public Object nextElement() + { + return ohm.get( index++ ); + } +} diff --git a/transex3/java/jpropex/java/SdfData.java b/transex3/java/jpropex/java/SdfData.java new file mode 100644 index 000000000000..60f218c0ae15 --- /dev/null +++ b/transex3/java/jpropex/java/SdfData.java @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +import java.util.*; +import java.io.*; + +public class SdfData +{ + private String filename; + private OrderedHashMap ohm; + private LinkedHashSet languagesFound; + + public SdfData() + { + languagesFound = new LinkedHashSet(); + ohm = new OrderedHashMap(); + languagesFound = new LinkedHashSet(); + } + public SdfData( String filename ){ + this(); + this.filename = filename; + } + + public LinkedHashSet getLanguages() + { + return languagesFound; + } + public SdfEntity get( SdfEntity obj ) + { + return (SdfEntity) ohm.get( (String)obj.getId() ); + } + public SdfEntity get( String key ){ + return (SdfEntity) ohm.get( key ); + } + public void add( SdfEntity obj ) + { + ohm.add( obj.getId() , obj ); + } + + public void read() + { + BufferedReader in; + try + { + in = new BufferedReader( new FileReader( filename ) ); + SdfEntity entity; + while( in.ready() ) + { + String line = in.readLine(); + if( line.length() > 0 ) + { + entity = new SdfEntity( line ); + ohm.add( entity.getId() , entity ); // test if is valid + languagesFound.add( entity.getLangid() ); + } + } + in.close(); + } + catch( IOException e ) + { + System.out.println("Error: reading file " + filename); + System.exit( -1 ); + } + } + public void write( String filename ) + { + FileWriter out; + try + { + out = new FileWriter( filename , true ); // Always append + for( Enumeration e = ohm.elements(); e.hasMoreElements(); ) + { + out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" ); + } + out.close(); + } + catch( IOException e ) + { + System.out.println("Error: Can't write to file " + filename); + System.exit( -1 ); + } + } +} diff --git a/transex3/java/jpropex/java/SdfEntity.java b/transex3/java/jpropex/java/SdfEntity.java new file mode 100644 index 000000000000..e2c1606ee7c2 --- /dev/null +++ b/transex3/java/jpropex/java/SdfEntity.java @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +public class SdfEntity implements Cloneable{ + private String project = new String(""); + private String source_file = new String(""); + private String dummy1 = new String(""); + private String resource_type= new String(""); + private String gid = new String(""); + private String lid = new String(""); + private String helpid = new String(""); + private String platform = new String(""); + private String dummy2 = new String(""); + private String langid = new String(""); + private String text = new String(""); + private String helptext = new String(""); + private String quickhelptext= new String(""); + private String title = new String(""); + private String date = new String(""); + + public static int PROJECT_POS = 0; + public static int SOURCE_FILE_POS = 1; + public static int DUMMY1_POS = 2; + public static int RESOURCE_TYPE_POS = 3; + public static int GID_POS = 4; + public static int LID_POS = 5; + public static int HELPID_POS = 6; + public static int PLATFORM_POS = 7; + public static int DUMMY2_POS = 8; + public static int LANGID_POS = 9; + public static int TEXT_POS = 10; + public static int HELPTEXT_POS = 11; + public static int QUICKHELPTEXT_POS = 12; + public static int TITLE_POS = 13; + public static int DATE_POS = 14; + + public Object clone() + { + try + { + return super.clone(); + } + catch( CloneNotSupportedException e ) + { + System.out.println("ERROR: Can not clone, soemthing is broken here ...."); + System.exit( -1 ); + } + return null; // dummy + } + + public SdfEntity( String line ){ + // isValid? + setProperties( line ) ; + } + public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) { + super(); + this.project = project; + this.source_file = source_file; + this.dummy1 = dummy1; + this.resource_type = resource_type; + this.gid = gid; + this.lid = lid; + this.helpid = helpid; + this.platform = platform; + this.dummy2 = dummy2; + this.langid = langid; + this.text = text; + this.helptext = helptext; + this.quickhelptext = quickhelptext; + this.title = title; + this.date = date; + } + + public void setProperties( String line ){ + + String[] splitted = line.split("\t"); + + setProject( splitted[ SdfEntity.PROJECT_POS ] ); + setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] ); + setDummy1( splitted[ SdfEntity.DUMMY1_POS ] ); + setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] ); + setGid( splitted[ SdfEntity.GID_POS ] ); + setLid( splitted[ SdfEntity.LID_POS ] ); + setHelpid( splitted[ SdfEntity.HELPID_POS ] ); + setPlatform( splitted[ SdfEntity.PLATFORM_POS ] ); + setDummy2( splitted[ SdfEntity.DUMMY2_POS ] ); + setLangid( splitted[ SdfEntity.LANGID_POS ] ); + setText( splitted[ SdfEntity.TEXT_POS ] ); + setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] ); + setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] ); + setTitle( splitted[ SdfEntity.TITLE_POS ] ); + setDate( splitted[ SdfEntity.DATE_POS ] ); + } + + public String getFileId(){ + return project+"\\"+source_file; + } + public String getResourcePath(){ + return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 ); + } + public String toString(){ + return project+"\t"+source_file+"\t"+dummy1+"\t"+resource_type+"\t"+gid+"\t" + +lid+"\t"+helpid+"\t"+platform+"\t"+dummy2+"\t"+langid+"\t" + +text+"\t"+helptext+"\t"+quickhelptext+"\t"+title+"\t"+date; + } + public String getId(){ + return project+gid+lid+source_file+resource_type+platform+helpid; + } + + public String getDummy1() { + return dummy1; + } + + public void setDummy1(String dummy1) { + this.dummy1 = dummy1; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getDummy2() { + return dummy2; + } + + public void setDummy2(String dummy2) { + this.dummy2 = dummy2; + } + + public String getGid() { + return gid; + } + + public void setGid(String gid) { + this.gid = gid; + } + + public String getHelpid() { + return helpid; + } + + public void setHelpid(String helpid) { + this.helpid = helpid; + } + + public String getHelptext() { + return helptext; + } + + public void setHelptext(String helptext) { + this.helptext = helptext; + } + + public String getLangid() { + return langid; + } + + public void setLangid(String langid) { + this.langid = langid; + } + + public String getLid() { + return lid; + } + + public void setLid(String lid) { + this.lid = lid; + } + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + public String getQuickhelptext() { + return quickhelptext; + } + + public void setQuickhelptext(String quickhelptext) { + this.quickhelptext = quickhelptext; + } + + public String getResource_type() { + return resource_type; + } + + public void setResource_type(String resource_type) { + this.resource_type = resource_type; + } + + public String getSource_file() { + return source_file; + } + + public void setSource_file(String source_file) { + this.source_file = source_file; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + + +} diff --git a/transex3/java/jpropex/jpropex b/transex3/java/jpropex/jpropex new file mode 100755 index 000000000000..2d62d13b093e --- /dev/null +++ b/transex3/java/jpropex/jpropex @@ -0,0 +1,10 @@ +#!/bin/sh +if [ x${SOLARENV}x = xx ]; then + echo No environment found, please use 'configure' or 'setsolar' + exit 1 +fi +if [ x${JAVA_HOME}x = xx ]; then + echo No Java found! + exit 1 +fi +exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@" diff --git a/transex3/java/jpropex/jpropex.MF b/transex3/java/jpropex/jpropex.MF new file mode 100755 index 000000000000..3e22e7e9bfbf --- /dev/null +++ b/transex3/java/jpropex/jpropex.MF @@ -0,0 +1 @@ +Main-Class: Main diff --git a/transex3/java/jpropex/makefile.mk b/transex3/java/jpropex/makefile.mk new file mode 100755 index 000000000000..f86d2c830025 --- /dev/null +++ b/transex3/java/jpropex/makefile.mk @@ -0,0 +1,36 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + + +PRJ=../.. +PRJNAME=transex3 +TARGET=jpropex + +.INCLUDE : ant.mk + +ALLTAR : ANTBUILD + diff --git a/transex3/prj/build.lst b/transex3/prj/build.lst index 0017471af134..d6e2496cb6c3 100644 --- a/transex3/prj/build.lst +++ b/transex3/prj/build.lst @@ -5,6 +5,7 @@ tr transex3\source nmake - all tr_src tr_inc NULL tr transex3\layout nmake - all rt_layout tr_src tr_inc NULL tr transex3\java\l10nconv nmake - all tr_conv NULL tr transex3\java\receditor nmake - all tr_rece NULL +tr transex3\java\jpropex nmake - all tr_blah NULL tr transex3\source\help nmake - all tr_bla_help NULL tr transex3\source\filter\utils nmake - all tr_bla_utils NULL tr transex3\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst index a469837275ed..c5ed81af7109 100644 --- a/transex3/prj/d.lst +++ b/transex3/prj/d.lst @@ -29,6 +29,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\%__SRC%\bin\ulfconv %_DEST%\bin%_EXT%\ulfconv ..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin%_EXT%\FCFGMerge.jar ..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin%_EXT%\HelpIndexerTool.jar +..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin%_EXT%\jpropex.jar ..\%__SRC%\bin\HelpLinker %_DEST%\bin%_EXT%\HelpLinker ..\%__SRC%\bin\HelpCompiler %_DEST%\bin%_EXT%\HelpCompiler ..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin%_EXT%\HelpCompiler.exe @@ -40,6 +41,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar +..\java\jpropex\jpropex %_DEST%\bin%_EXT%\jpropex ..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl ..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl ..\scripts\localize %_DEST%\bin%_EXT%\localize diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index c82d152cac7e..6e680c579663 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -69,6 +69,7 @@ const char *ExeTable[][5] = { { "xcs", "cfgex", "-UTF8 -e -f", "negative", "iso" }, { "xrm", "xrmex", "-UTF8 -e", "negative", "iso" }, { "xhp", "helpex", " -e", "negative", "noiso" }, + { "properties", "jpropex", " -e", "negative", "noiso" }, { "NULL", "NULL", "NULL", "NULL", "NULL" } }; -- cgit From cd9a78ca085b739beb539070e65dfb2c788e141e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 22 Feb 2010 15:37:49 +0100 Subject: changes to help for print dialog --- vcl/source/window/printdlg.cxx | 7 +++++++ vcl/source/window/window.cxx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a8259078637a..3bb78e8e42fa 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1133,8 +1133,15 @@ static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId 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 ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5689972e69d6..93319bdb8967 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -8150,7 +8150,7 @@ const XubString& Window::GetHelpText() const { rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() ); aTxt.append( mpWindowImpl->maHelpText ); - aTxt.appendAscii( "\n+++++++++++++++\n" ); + aTxt.appendAscii( "\n------------------\n" ); if( bStrHelpId ) aTxt.append( rtl::OUString( aStrHelpId ) ); else -- cgit From d4bfdbf4901acf6ad798019780f62c4c93a6c145 Mon Sep 17 00:00:00 2001 From: hdu Date: Mon, 22 Feb 2010 17:16:11 +0100 Subject: #i101552# implement dynamic glyph fallback for WIN (thanks yanminjia!) --- vcl/inc/vcl/outfont.hxx | 6 ++ vcl/source/gdi/outdev3.cxx | 12 +++ vcl/win/source/gdi/salgdi3.cxx | 214 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 231 insertions(+), 1 deletion(-) diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index b72e78994a75..8feb9bfed8b8 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -39,6 +39,8 @@ #include +#include + class ImplDevFontListData; class ImplGetDevFontList; class ImplGetDevSizeList; @@ -190,6 +192,7 @@ public: // TODO: change to private class VCL_DLLPUBLIC ImplDevFontList { private: + friend class WinGlyphFallbackSubstititution; mutable bool mbMatchData; // true if matching attributes are initialized bool mbMapNames; // true if MapNames are available @@ -226,6 +229,9 @@ public: ImplGetDevFontList* GetDevFontList() const; ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const; + //used by 2-level font fallback + ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const; + protected: void InitMatchData() const; bool AreMapNamesAvailable() const { return mbMapNames; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 28fa4f8f5461..3aa98004c500 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1661,6 +1661,18 @@ void ImplDevFontList::InitMatchData() const } } +//---------------------------------------------------------------------------- +ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const +{ + // get the default font for a specified locale + const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + String aDefault = rDefaults.getUserInterfaceFont( lc ); + ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault ); + if( pFontData ) + return pFontData; + return 0; +} + // ----------------------------------------------------------------------- ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType, diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 12fdad65dfb1..babc968ca859 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -47,11 +47,15 @@ #include "vcl/fontsubset.hxx" #include "vcl/sallayout.hxx" +#include "vcl/outdev.h" // for ImplGlyphFallbackFontSubstitution +#include "unotools/fontcfg.hxx" // for IMPL_FONT_ATTR_SYMBOL + #include "rtl/logfile.hxx" #include "rtl/tencinfo.h" #include "rtl/textcvt.h" #include "rtl/bootstrap.hxx" +#include "i18npool/mslangid.hxx" #include "osl/module.h" #include "osl/file.hxx" @@ -82,7 +86,6 @@ #include #include - using namespace vcl; static const int MAXFONTHEIGHT = 2048; @@ -314,6 +317,208 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag ) } } +// =========================================================================== +// platform specific font substitution hooks for glyph fallback enhancement +// TODO: move into i18n module (maybe merge with svx/ucsubset.*) +struct Unicode2LangType +{ + sal_UCS4 mnMinCode; + sal_UCS4 mnMaxCode; + LanguageType mnLangID; +}; + +// map unicode ranges to languages supported by OOo +// NOTE: due to the binary search used this list must be sorted by mnMinCode +static const Unicode2LangType aLangFromCodeChart[]= { + {0x0000, 0x007f, LANGUAGE_ENGLISH}, // Basic Latin + {0x0080, 0x024f, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B + {0x0250, 0x02af, LANGUAGE_SYSTEM}, // IPA Extensions + {0x0370, 0x03ff, LANGUAGE_GREEK}, // Greek + {0x0590, 0x05ff, LANGUAGE_HEBREW}, // Hebrew + {0x0600, 0x06ff, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic + {0x0900, 0x097f, LANGUAGE_HINDI}, // Devanagari + {0x0980, 0x09ff, LANGUAGE_BENGALI}, // Bengali + {0x0a80, 0x0aff, LANGUAGE_GUJARATI}, // Gujarati + {0x0b00, 0x0b7f, LANGUAGE_ORIYA}, // Oriya + {0x0b80, 0x0bff, LANGUAGE_TAMIL}, // Tamil + {0x0e00, 0x0e7f, LANGUAGE_THAI}, // Thai + {0x0e80, 0x0eff, LANGUAGE_LAO}, // Lao + {0x1000, 0x109f, LANGUAGE_BURMESE}, // Burmese + {0x1100, 0x11ff, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific + {0x1780, 0x17ff, LANGUAGE_KHMER}, // Khmer + {0x1e00, 0x1eff, LANGUAGE_ENGLISH}, // Latin Extended Additional + {0x2c60, 0x2c7f, LANGUAGE_ENGLISH}, // Latin Extended-C + {0x2e80, 0x2fff, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters + {0x3000, 0x303F, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Symbols and punctuation + {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana + {0x3100, 0x312f, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo + {0x3130, 0x318f, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific + {0x3190, 0x319f, LANGUAGE_JAPANESE}, // Kanbun + {0x31a0, 0x31bf, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended + {0x31c0, 0x31ef, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Strokes + {0x31f0, 0x31ff, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions + {0x3400, 0x4dbf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Unified Ideographs Extension A + {0x4e00, 0x9fcf, LANGUAGE_CHINESE_SIMPLIFIED}, // Unified CJK Ideographs + {0xa720, 0xa7ff, LANGUAGE_ENGLISH}, // Latin Extended-D + {0xac00, 0xd7af, LANGUAGE_KOREAN}, // Hangul Syllables, Kocrean-specific + {0xF900, 0xFAFF, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Compatibility Ideographs + {0xfb00, 0xfb4f, LANGUAGE_HEBREW}, // Hibrew present forms + {0xfb50, 0xfdff, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A + {0xfe70, 0xfefe, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B + {0xff65, 0xff9f, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant + {0xffa0, 0xffDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant + {0x10140, 0x1018f, LANGUAGE_GREEK}, // Ancient Greak numbers + {0x1d200, 0x1d24f, LANGUAGE_GREEK}, // Ancient Greek Musical + {0x20000, 0x2a6df, LANGUAGE_CHINESE}, // CJK Unified Ideographs Extension B + {0x2f800, 0x2fa1f, LANGUAGE_CHINESE} // CJK Compatibility Ideographs Supplement +}; + +// get language type in accordance of a missing char +const LanguageType MapCharToLanguage( sal_UCS4 uChar ) +{ + // binary search + int nLow = 0; + int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1; + while( nLow <= nHigh ) + { + int nMiddle = (nHigh + nLow) / 2; + if( uChar < aLangFromCodeChart[ nMiddle].mnMinCode ) + nHigh = nMiddle - 1; + else if( uChar > aLangFromCodeChart[ nMiddle].mnMaxCode ) + nLow = nMiddle + 1; + else + return aLangFromCodeChart[ nMiddle].mnLangID; + } + + return LANGUAGE_DONTKNOW; +} + +//class ImplWinFontData; +void ImplGetLogFontFromFontSelect( HDC hDC, + const ImplFontSelectData* pFont, + LOGFONTW& rLogFont, + bool /*bTestVerticalAvail*/ ); + +class WinGlyphFallbackSubstititution +: public ImplGlyphFallbackFontSubstitution +{ +public: + WinGlyphFallbackSubstititution( HDC hDC, ImplDevFontList* pDFL ); + +// void SetHDC( HDC hDC ) { mhDC = hDC; } +// void SetFontList( ImplDevFontList* pFontLiest ) { mpFontList = pFontList; } + bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const; +private: + HDC mhDC; + ImplDevFontList* mpFontList; + bool HasMissingChars( const ImplFontData*, const rtl::OUString& rMissingChars ) const; +}; + +inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC, ImplDevFontList* pDFL ) +: mhDC( hDC ) +, mpFontList( pDFL ) +{} + +// does a font face hold the given missing characters? +bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const +{ + const ImplWinFontData* pWinFont = static_cast(pFace); + if( !pWinFont->GetImplFontCharMap() ) + { + // construct a Size structure as the parameter of constructor of class ImplFontSelectData + const Size aSize( pFace->GetWidth(), pFace->GetHeight() ); + // create a ImplFontSelectData object for getting s LOGFONT + const ImplFontSelectData aFSD( *pFace, aSize, (float)aSize.Height(), 0, false ); + // construct log font + LOGFONTW aLogFont; + ImplGetLogFontFromFontSelect( mhDC, &aFSD, aLogFont, true ); + + // create HFONT from log font + HFONT hNewFont = ::CreateFontIndirectW( &aLogFont ); + // select the new font into device + HFONT hOldFont = ::SelectFont( mhDC, hNewFont ); + + // read CMAP table + pWinFont->UpdateFromHDC( mhDC );; + + ::SelectFont( mhDC, hOldFont ); + ::DeleteFont( hNewFont ); + } + + sal_Int32 nStrIndex = 0; // TODO: check more missing characters? + const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIndex ); + const bool bHasChar = pWinFont->HasChar( uChar ); + return bHasChar; +} + +//get fallback font for missing characters +bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const +{ + //g et locale by the language type of missing string + com::sun::star::lang::Locale aLocale; + + // what are langauge and mapping locale of the missing characters? + sal_Int32 nStrIdx = 0; + const sal_Int32 nStrLen = rMissingChars.getLength(); + while( nStrIdx < nStrLen ) + { + const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx ); + const LanguageType eLang = MapCharToLanguage( uChar ); + if( eLang == LANGUAGE_DONTKNOW ) + continue; + MsLangId::convertLanguageToLocale( eLang, aLocale ); + break; + } + + // fall back to default UI locale + if( nStrIdx >= nStrLen ) + aLocale = Application::GetSettings().GetUILocale(); + + // first level fallback, get font type face by locale + /*const*/ ImplDevFontListData* pDevFont = mpFontList->ImplFindByLocale( aLocale ); + if( pDevFont ) + { +// const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); +// if( HasMissingChas( pFace, MissingChars) ) { + rFontSelData.maSearchName = pDevFont->GetSearchName(); + return true; +// } + } + + // are the missing characters symbols? + pDevFont = mpFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, + rFontSelData.meWeight, rFontSelData.meWidthType, + rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName ); + if( pDevFont ) + { + const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); + if( HasMissingChars( pFace, rMissingChars ) ) + { + rFontSelData.maSearchName = pDevFont->GetSearchName(); + return true; + } + } + + // last level fallback, check each font type face one by one + const ImplGetDevFontList* pTestFontList = mpFontList->GetDevFontList(); + // limit the count of fonts to be checked to prevent hangs + static const int MAX_GFBFONT_COUNT = 600; + int nTestFontCount = pTestFontList->Count(); + if( nTestFontCount > MAX_GFBFONT_COUNT ) + nTestFontCount = MAX_GFBFONT_COUNT; + + for( int i = 0; i < nTestFontCount; ++i ) + { + const ImplFontData* pFace = pTestFontList->Get( i ); + if( !HasMissingChars( pFace, rMissingChars ) ) + continue; + rFontSelData.maSearchName = pFace->maName; + return true; + } + + return false; +} + // ======================================================================= struct ImplEnumInfo @@ -910,6 +1115,8 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const { + if(!mpUnicodeMap) + return 0; mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -2248,6 +2455,11 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) bImplSalCourierScalable = aInfo.mbImplSalCourierScalable; bImplSalCourierNew = aInfo.mbImplSalCourierNew; } + + //set font fallback hook + static WinGlyphFallbackSubstititution aSubstFallback(mhDC, pFontList); + //aSubstFallback.SetHDC(mhDC); + pFontList->SetFallbackHook( &aSubstFallback ); } // ---------------------------------------------------------------------------- -- cgit From 0b10a16e5bb9b1b6b3dcd1afa112f07dd71c6918 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 22 Feb 2010 17:46:05 -0500 Subject: calctabcolor: COL_AUTO should be of type ColorData, not of UINT32. --- tools/inc/tools/color.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/inc/tools/color.hxx b/tools/inc/tools/color.hxx index 4af82e4f1003..51798a73d5b2 100644 --- a/tools/inc/tools/color.hxx +++ b/tools/inc/tools/color.hxx @@ -81,7 +81,7 @@ typedef UINT32 ColorData; #define COL_YELLOW RGB_COLORDATA( 0xFF, 0xFF, 0x00 ) #define COL_WHITE RGB_COLORDATA( 0xFF, 0xFF, 0xFF ) #define COL_TRANSPARENT TRGB_COLORDATA( 0xFF, 0xFF, 0xFF, 0xFF ) -#define COL_AUTO (UINT32)0xFFFFFFFF +#define COL_AUTO (ColorData)0xFFFFFFFF #define COL_AUTHOR1_DARK RGB_COLORDATA(198, 146, 0) #define COL_AUTHOR1_NORMAL RGB_COLORDATA(255, 255, 158) #define COL_AUTHOR1_LIGHT RGB_COLORDATA(255, 255, 195) -- cgit From e9c63b9abda64757d66a0cc6be27bff143cdf029 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Feb 2010 13:57:14 +0100 Subject: vcl110: #i109007# workaround atexit handler in kde3 plugin --- vcl/unx/source/plugadapt/salplug.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 08820b2cb7f9..a1ff77a4d96c 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -98,6 +98,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase ) { pCloseModule = NULL; } + /* + * #i109007# KDE3 seems to have the same problem; an atexit cleanup + * handler, which cannot be resolved anymore if the plugin is already unloaded. + */ + else if( rModuleBase.equalsAscii("kde") ) + { + pCloseModule = NULL; + } GetSalData()->m_pPlugin = aMod; } -- cgit From 33490f377b3f762b82de9e5663b1a8cad3877a02 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Feb 2010 17:41:50 +0100 Subject: vcl110: #i109453# fix degenerate drawLine case --- vcl/aqua/source/gdi/salgdi.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index dedae3ac7cfc..35569c66ba2c 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -694,6 +694,13 @@ void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor ) void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) { + if( nX1 == nX2 && nY1 == nY2 ) + { + // #i109453# platform independent code expects at least one pixel to be drawn + drawPixel( nX1, nY1 ); + return; + } + if( !CheckContext() ) return; -- cgit From 384eadc23010eba913416b04d0bc87f9411df0f1 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 23 Feb 2010 16:13:04 -0500 Subject: calctabcolor: Use static constant values instead of macro define for more type safety. --- svtools/inc/tabbar.hxx | 10 ++++---- svtools/source/control/tabbar.cxx | 51 +++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx index 35d65c037a7a..a19790a68d55 100644 --- a/svtools/inc/tabbar.hxx +++ b/svtools/inc/tabbar.hxx @@ -323,9 +323,6 @@ typedef USHORT TabBarPageBits; // - TabBar-Types - // ---------------- -#define TABBAR_APPEND ((USHORT)0xFFFF) -#define TABBAR_PAGE_NOTFOUND ((USHORT)0xFFFF) - #define TABBAR_RENAMING_YES ((long)TRUE) #define TABBAR_RENAMING_NO ((long)FALSE) #define TABBAR_RENAMING_CANCEL ((long)2) @@ -403,6 +400,9 @@ private: DECL_DLLPRIVATE_LINK( ImplClickHdl, ImplTabButton* ); public: + static const sal_uInt16 APPEND; + static const sal_uInt16 PAGE_NOT_FOUND; + TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR ); virtual ~TabBar(); @@ -427,7 +427,7 @@ public: void InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits = 0, - USHORT nPos = TABBAR_APPEND ); + USHORT nPos = TabBar::APPEND ); void RemovePage( USHORT nPageId ); void MovePage( USHORT nPageId, USHORT nNewPos ); @@ -461,7 +461,7 @@ public: void SelectPage( USHORT nPageId, BOOL bSelect = TRUE ); void SelectPageRange( BOOL bSelect = FALSE, USHORT nStartPos = 0, - USHORT nEndPos = TABBAR_APPEND ); + USHORT nEndPos = TabBar::APPEND ); USHORT GetSelectPage( USHORT nSelIndex = 0 ) const; USHORT GetSelectPageCount() const; BOOL IsPageSelected( USHORT nPageId ) const; diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 50618901798c..112787dd3f00 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -357,6 +357,9 @@ struct TabBar_Impl // ======================================================================= +const sal_uInt16 TabBar::APPEND = ::std::numeric_limits::max(); +const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits::max(); + void TabBar::ImplInit( WinBits nWinStyle ) { mpItemList = new ImplTabBarList; @@ -1594,7 +1597,7 @@ void TabBar::InsertPage( USHORT nPageId, const XubString& rText, TabBarPageBits nBits, USHORT nPos ) { DBG_ASSERT( nPageId, "TabBar::InsertPage(): PageId == 0" ); - DBG_ASSERT( GetPagePos( nPageId ) == TABBAR_PAGE_NOTFOUND, + DBG_ASSERT( GetPagePos( nPageId ) == PAGE_NOT_FOUND, "TabBar::InsertPage(): PageId already exists" ); DBG_ASSERT( nBits <= TPB_SPECIAL, "TabBar::InsertPage(): nBits is wrong" ); @@ -1620,7 +1623,7 @@ Color TabBar::GetTabBgColor( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maTabBgColor; else return Color( COL_AUTO ); @@ -1630,7 +1633,7 @@ void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) { USHORT nPos = GetPagePos( nPageId ); ImplTabBarItem* pItem; - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { pItem = mpItemList->GetObject( nPos ); // TODO: Need to take the text color specification out of this code! @@ -1657,7 +1660,7 @@ void TabBar::RemovePage( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( mnCurPageId == nPageId ) mnCurPageId = 0; @@ -1692,7 +1695,7 @@ void TabBar::MovePage( USHORT nPageId, USHORT nNewPos ) return; // Existiert Item - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // TabBar-Item in der Liste verschieben ImplTabBarItem* pItem = mpItemList->Remove( nPos ); @@ -1730,7 +1733,7 @@ void TabBar::Clear() if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) TABBAR_PAGE_NOTFOUND ); + CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) PAGE_NOT_FOUND ); } // ----------------------------------------------------------------------- @@ -1739,7 +1742,7 @@ void TabBar::EnablePage( USHORT nPageId, BOOL bEnable ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1762,7 +1765,7 @@ BOOL TabBar::IsPageEnabled( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbEnable; else return FALSE; @@ -1774,7 +1777,7 @@ void TabBar::SetPageBits( USHORT nPageId, TabBarPageBits nBits ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -1795,7 +1798,7 @@ TabBarPageBits TabBar::GetPageBits( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnBits; else return FALSE; @@ -1832,7 +1835,7 @@ USHORT TabBar::GetPagePos( USHORT nPageId ) const pItem = mpItemList->Next(); } - return TABBAR_PAGE_NOTFOUND; + return PAGE_NOT_FOUND; } // ----------------------------------------------------------------------- @@ -1857,7 +1860,7 @@ Rectangle TabBar::GetPageRect( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maRect; else return Rectangle(); @@ -1870,7 +1873,7 @@ void TabBar::SetCurPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { // Wenn sich aktuelle Page nicht geaendert hat, dann muessen wir // jetzt nichts mehr machen @@ -1962,7 +1965,7 @@ void TabBar::MakeVisible( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann nichts machen - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos < mnFirstPos ) SetFirstPageId( nPageId ); @@ -2011,7 +2014,7 @@ void TabBar::SetFirstPageId( USHORT nPageId ) USHORT nPos = GetPagePos( nPageId ); // Wenn Item nicht existiert, dann FALSE zurueckgeben - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { if ( nPos != mnFirstPos ) { @@ -2045,7 +2048,7 @@ void TabBar::SelectPage( USHORT nPageId, BOOL bSelect ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); @@ -2126,7 +2129,7 @@ USHORT TabBar::GetSelectPageCount() const BOOL TabBar::IsPageSelected( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mbSelect; else return FALSE; @@ -2137,7 +2140,7 @@ BOOL TabBar::IsPageSelected( USHORT nPageId ) const BOOL TabBar::StartEditMode( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); - if ( mpEdit || (nPos == TABBAR_PAGE_NOTFOUND) || (mnLastOffX < 8) ) + if ( mpEdit || (nPos == PAGE_NOT_FOUND) || (mnLastOffX < 8) ) return FALSE; mnEditId = nPageId; @@ -2358,7 +2361,7 @@ void TabBar::SetSelectTextColor( const Color& rColor ) void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { mpItemList->GetObject( nPos )->maText = rText; mbSizeFormat = TRUE; @@ -2376,7 +2379,7 @@ void TabBar::SetPageText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetPageText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->maText; else return XubString(); @@ -2387,7 +2390,7 @@ XubString TabBar::GetPageText( USHORT nPageId ) const void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->maHelpText = rText; } @@ -2396,7 +2399,7 @@ void TabBar::SetHelpText( USHORT nPageId, const XubString& rText ) XubString TabBar::GetHelpText( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) { ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); if ( !pItem->maHelpText.Len() && pItem->mnHelpId ) @@ -2417,7 +2420,7 @@ XubString TabBar::GetHelpText( USHORT nPageId ) const void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) mpItemList->GetObject( nPos )->mnHelpId = nHelpId; } @@ -2426,7 +2429,7 @@ void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId ) ULONG TabBar::GetHelpId( USHORT nPageId ) const { USHORT nPos = GetPagePos( nPageId ); - if ( nPos != TABBAR_PAGE_NOTFOUND ) + if ( nPos != PAGE_NOT_FOUND ) return mpItemList->GetObject( nPos )->mnHelpId; else return 0; -- cgit From 3ce790b86ebe030d549eb5e4543307f2d5416679 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 24 Feb 2010 15:32:39 +0100 Subject: sb118: #i80788# second part of fix for Toolkit test --- toolkit/qa/unoapi/knownissues.xcl | 5 ----- toolkit/qa/unoapi/toolkit.sce | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index ef954f00eeeb..70513019e9d3 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -90,11 +90,6 @@ toolkit.AccessibleRadioButton toolkit.AccessibleToolBox # -> disabled in toolkit.sce -### i80788 ### -toolkit.Toolkit -toolkit.UnoControlDialog -# -> disabled in toolkit.sce - ### i86011 ### toolkit.UnoControlFileControl # -> disabled in toolkit.sce diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce index dad24165e2d2..9c6948255559 100644 --- a/toolkit/qa/unoapi/toolkit.sce +++ b/toolkit/qa/unoapi/toolkit.sce @@ -26,7 +26,7 @@ -o toolkit.MutableTreeNode -o toolkit.TabController -o toolkit.TabControllerModel -#i80788 -o toolkit.Toolkit +-o toolkit.Toolkit -o toolkit.UnoControlButton -o toolkit.UnoControlButtonModel -o toolkit.UnoControlCheckBox @@ -39,7 +39,7 @@ -o toolkit.UnoControlCurrencyFieldModel -o toolkit.UnoControlDateField -o toolkit.UnoControlDateFieldModel -#i80788 -o toolkit.UnoControlDialog +#allegedly was i80788, but still broken: -o toolkit.UnoControlDialog -o toolkit.UnoControlDialogModel -o toolkit.UnoControlEdit -o toolkit.UnoControlEditModel -- cgit From d91dbfa6a18a7a0b531be3e9d47177250cc87605 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 25 Feb 2010 12:42:38 +0100 Subject: vcl110: #i103596# add a state change showing for tool tips (workaround) --- vcl/unx/gtk/a11y/atkwindow.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx index 1bda4eea774e..4327b7a6660a 100644 --- a/vcl/unx/gtk/a11y/atkwindow.cxx +++ b/vcl/unx/gtk/a11y/atkwindow.cxx @@ -146,6 +146,22 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *) return FALSE; } +static gboolean ooo_tooltip_map( GtkWidget* pToolTip, gpointer ) +{ + AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip ); + if( pAccessible ) + atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, TRUE ); + return FALSE; +} + +static gboolean ooo_tooltip_unmap( GtkWidget* pToolTip, gpointer ) +{ + AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip ); + if( pAccessible ) + atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, FALSE ); + return FALSE; +} + /*****************************************************************************/ static bool @@ -211,6 +227,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data) g_signal_connect_after( GTK_WIDGET( data ), "focus-out-event", G_CALLBACK (ooo_window_wrapper_real_focus_gtk), NULL); + + if( obj->role == ATK_ROLE_TOOL_TIP ) + { + g_signal_connect_after( GTK_WIDGET( data ), "map-event", + G_CALLBACK (ooo_tooltip_map), + NULL); + g_signal_connect_after( GTK_WIDGET( data ), "unmap-event", + G_CALLBACK (ooo_tooltip_unmap), + NULL); + } } /*****************************************************************************/ -- cgit From d6e31ec5296abe96bdb64b53184db98098f82ceb Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 25 Feb 2010 16:10:53 +0100 Subject: sb118: #i109607# do not call back listeners from DesktopTerminationObserver::revokeTerminationListener --- unotools/source/misc/desktopterminationobserver.cxx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/unotools/source/misc/desktopterminationobserver.cxx b/unotools/source/misc/desktopterminationobserver.cxx index 23d5089f545e..3900449f03c9 100644 --- a/unotools/source/misc/desktopterminationobserver.cxx +++ b/unotools/source/misc/desktopterminationobserver.cxx @@ -211,12 +211,6 @@ namespace utl void DesktopTerminationObserver::revokeTerminationListener( ITerminationListener* _pListener ) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( getListenerAdminData().bAlreadyTerminated ) - { - _pListener->notifyTermination(); - return; - } - Listeners& rListeners = getListenerAdminData().aListeners; for ( Listeners::iterator lookup = rListeners.begin(); lookup != rListeners.end(); -- cgit From 8b5bd31f499be69932875bf5e77f3135f6696a78 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 25 Feb 2010 16:29:45 +0100 Subject: ppp02: #i104784# workaround limitations in our text subsystem --- vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 9 +++++++- vcl/aqua/source/gdi/salgdi.cxx | 3 ++- vcl/inc/vcl/prndlg.hxx | 1 + vcl/source/window/printdlg.cxx | 31 +++++++++++++++++++++------ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 798fefef1b25..66d97996109c 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -321,6 +321,12 @@ class ControllerProperties double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width()); double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height()); double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY; + // #i104784# if we render the page too small, the corresponding small fonts lead to + // layout artifacts looking really bad. So scale the page unto a device that is not + // full page size but not too small either. This is a workaround for the limitations of + // our text system. + if( fScale < 0.1 ) + fScale = 0.1; aMtf.WindStart(); aMtf.Scale( fScale, fScale ); aMtf.WindStart(); @@ -361,9 +367,10 @@ class ControllerProperties NSSize aMargins = [mpPreviewBox contentViewMargins]; aPreviewFrame.origin.x = 0; aPreviewFrame.origin.y = 34; + aPreviewFrame.size.width -= 2*(aMargins.width+1); aPreviewFrame.size.height -= 61; mpPreview = [[NSImageView alloc] initWithFrame: aPreviewFrame]; - [mpPreview setImageScaling: NSScaleNone]; + [mpPreview setImageScaling: NSScaleProportionally]; [mpPreview setImageAlignment: NSImageAlignCenter]; [mpPreview setImageFrameStyle: NSImageFrameNone]; [mpPreviewBox addSubview: [mpPreview autorelease]]; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index dedae3ac7cfc..5f564d8ef5fa 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -1095,7 +1095,8 @@ void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGrap DBG_ASSERT( pSrc->mxLayer!=NULL, "AquaSalGraphics::copyBits() from non-layered graphics" ); const CGPoint aDstPoint = { +pPosAry->mnDestX - pPosAry->mnSrcX, pPosAry->mnDestY - pPosAry->mnSrcY }; - if( !mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth ) // workaround a Quartz crasher + if( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth && pPosAry->mnSrcHeight == pPosAry->mnDestHeight) && + (!mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth) ) // workaround a Quartz crasher { // in XOR mode the drawing context is redirected to the XOR mask // if source and target are identical then copyBits() paints onto the target context though diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index f9ead1570b35..6ac22e0708db 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -58,6 +58,7 @@ namespace vcl { GDIMetaFile maMtf; Size maOrigSize; + Size maPreviewSize; VirtualDevice maPageVDev; rtl::OUString maReplacementString; rtl::OUString maToolTipString; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 3bb78e8e42fa..33eb21259da2 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -191,6 +191,23 @@ void PrintDialog::PrintPreviewWindow::Resize() } aScaledSize.Width() = long(aScaledSize.Width()*fScale); aScaledSize.Height() = long(aScaledSize.Height()*fScale); + + maPreviewSize = aScaledSize; + + // #i104784# if we render the page too small, the corresponding small fonts lead to + // layout artifacts looking really bad. So scale the page unto a device that is not + // full page size but not too small either. This is a workaround for the limitations of + // our text system. + // find a good scaling factor + Size aPreviewMMSize( maPageVDev.PixelToLogic( aScaledSize, MapMode( MAP_100TH_MM ) ) ); + double fZoom = double(maOrigSize.Height())/double(aPreviewMMSize.Height()); + while( fZoom > 10 ) + { + aScaledSize.Width() *= 2; + aScaledSize.Height() *= 2; + fZoom /= 2.0; + } + maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); } @@ -219,11 +236,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) { GDIMetaFile aMtf( maMtf ); - Size aPreviewSize = maPageVDev.GetOutputSizePixel(); - Point aOffset( (aSize.Width() - aPreviewSize.Width()) / 2, - (aSize.Height() - aPreviewSize.Height()) / 2 ); + Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2, + (aSize.Height() - maPreviewSize.Height()) / 2 ); - const Size aLogicSize( maPageVDev.PixelToLogic( aPreviewSize, MapMode( MAP_100TH_MM ) ) ); + Size aVDevSize( maPageVDev.GetOutputSizePixel() ); + const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) ); Size aOrigSize( maOrigSize ); if( aOrigSize.Width() < 1 ) aOrigSize.Width() = aLogicSize.Width(); @@ -243,11 +260,11 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) SetMapMode( MAP_PIXEL ); maPageVDev.SetMapMode( MAP_PIXEL ); - DrawOutDev( aOffset, aPreviewSize, Point( 0, 0 ), aPreviewSize, maPageVDev ); + DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, maPageVDev ); DecorationView aVw( this ); - aOffset.X() -= 1; aOffset.Y() -=1; aPreviewSize.Width() += 2; aPreviewSize.Height() += 2; - aVw.DrawFrame( Rectangle( aOffset, aPreviewSize ), FRAME_DRAW_GROUP ); + Rectangle aFrame( aOffset + Point( -1, -1 ), Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) ); + aVw.DrawFrame( aFrame, FRAME_DRAW_GROUP ); } } -- cgit From c024a5107e5f4f66b3ceeffc1337c0b1dcdeb6d4 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Thu, 25 Feb 2010 18:41:05 +0100 Subject: ppp02: #i104784# fix misleading comments --- vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 6 +++--- vcl/source/window/printdlg.cxx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 66d97996109c..abd1e8d07588 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -321,10 +321,10 @@ class ControllerProperties double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width()); double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height()); double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY; - // #i104784# if we render the page too small, the corresponding small fonts lead to + // #i104784# if we render the page too small then rounding issues result in // layout artifacts looking really bad. So scale the page unto a device that is not - // full page size but not too small either. This is a workaround for the limitations of - // our text system. + // full page size but not too small either. This also results in much better visual + // quality of the preview, e.g. when its height approaches the number of text lines if( fScale < 0.1 ) fScale = 0.1; aMtf.WindStart(); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 33eb21259da2..6b0282d24e1e 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -194,10 +194,10 @@ void PrintDialog::PrintPreviewWindow::Resize() maPreviewSize = aScaledSize; - // #i104784# if we render the page too small, the corresponding small fonts lead to + // #i104784# if we render the page too small then rounding issues result in // layout artifacts looking really bad. So scale the page unto a device that is not - // full page size but not too small either. This is a workaround for the limitations of - // our text system. + // full page size but not too small either. This also results in much better visual + // quality of the preview, e.g. when its height approaches the number of text lines // find a good scaling factor Size aPreviewMMSize( maPageVDev.PixelToLogic( aScaledSize, MapMode( MAP_100TH_MM ) ) ); double fZoom = double(maOrigSize.Height())/double(aPreviewMMSize.Height()); -- cgit From 9c39f6a473b309712ae9e45d161642bba9413cc3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Feb 2010 13:47:19 +0100 Subject: fix a warning --- vcl/source/window/printdlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 6b0282d24e1e..a64e6820dc71 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1148,7 +1148,7 @@ static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) ); } -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 -- cgit From 8c5e8ddecc685d4183e5038df5af9da3222c2db3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Feb 2010 16:04:18 +0100 Subject: vcl110: #i45043# draw native list nodes --- vcl/win/source/gdi/salnativewidgets-luna.cxx | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 5c85d5d67144..c1c2d8e0a482 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -294,6 +294,10 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Progress"); break; + case CTRL_LISTNODE: + if( nPart == PART_ENTIRE_CONTROL ) + hTheme = getThemeHandle( mhWnd, L"TreeView" ); + break; default: hTheme = NULL; break; @@ -893,6 +897,27 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, PP_CHUNK, iState, aProgressRect, aCaption ); } + if( nType == CTRL_LISTNODE ) + { + if( nPart != PART_ENTIRE_CONTROL ) + return FALSE; + + ButtonValue aButtonValue = aValue.getTristateVal(); + iPart = TVP_GLYPH; + switch( aButtonValue ) + { + case BUTTONVALUE_ON: + iState = GLPS_OPENED; + break; + case BUTTONVALUE_OFF: + iState = GLPS_CLOSED; + break; + default: + return FALSE; + } + return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption ); + } + return false; } @@ -973,6 +998,10 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Progress"); break; + case CTRL_LISTNODE: + if( nPart == PART_ENTIRE_CONTROL ) + hTheme = getThemeHandle( mhWnd, L"TreeView"); + break; default: hTheme = NULL; break; -- cgit From e6694e6614a9360c98df4ee611be09b8385b48a4 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 26 Feb 2010 17:02:40 +0100 Subject: sb118: #i109643# disable tests that fail when run in parallel with other applications --- toolkit/qa/unoapi/knownissues.xcl | 6 +++++- toolkit/qa/unoapi/toolkit.sce | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 70513019e9d3..eed2d3208e09 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -234,4 +234,8 @@ toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleComponent toolkit.UnoScrollBarControl::com::sun::star::awt::XScrollBar ### i94344 ### -toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText \ No newline at end of file +toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText + +### i109643 ### +toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue +toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce index 9c6948255559..1c8ad0c95181 100644 --- a/toolkit/qa/unoapi/toolkit.sce +++ b/toolkit/qa/unoapi/toolkit.sce @@ -17,8 +17,8 @@ -o toolkit.AccessibleScrollBar -o toolkit.AccessibleStatusBar -o toolkit.AccessibleStatusBarItem --o toolkit.AccessibleTabControl --o toolkit.AccessibleTabPage +#i109643 -o toolkit.AccessibleTabControl +#i109643 -o toolkit.AccessibleTabPage #i86287 -o toolkit.AccessibleToolBox #i88605 -o toolkit.AccessibleToolBoxItem -o toolkit.AccessibleWindow -- cgit From d68e0df79add4afc10d5c61920bff198d743e8ff Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Feb 2010 17:58:07 +0100 Subject: vcl110: #i47904# support WM_CLIENT_MACHING, _NET_WM_PID and _NET_WM_PING --- vcl/unx/inc/saldata.hxx | 4 ++ vcl/unx/inc/wmadaptor.hxx | 14 ++++++ vcl/unx/source/app/saldata.cxx | 1 + vcl/unx/source/app/saldisp.cxx | 6 +-- vcl/unx/source/app/wmadaptor.cxx | 54 +++++++++++++++++++++- vcl/unx/source/window/salframe.cxx | 92 +++++++++++++++++++++----------------- 6 files changed, 127 insertions(+), 44 deletions(-) diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx index 2d09bd35649e..62db98bb08c0 100644 --- a/vcl/unx/inc/saldata.hxx +++ b/vcl/unx/inc/saldata.hxx @@ -65,6 +65,7 @@ protected: SalXLib *pXLib_; SalDisplay *m_pSalDisplay; pthread_t hMainThread_; + rtl::OUString maLocalHostName; public: X11SalData(); @@ -90,6 +91,9 @@ public: inline void StopTimer(); void Timeout() const; + const rtl::OUString& GetLocalHostName() const + { return maLocalHostName; } + static int XErrorHdl( Display*, XErrorEvent* ); static int XIOErrorHdl( Display* ); diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index 314854926ba1..47b9310a2702 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -61,6 +61,8 @@ public: NET_WM_NAME, NET_WM_DESKTOP, NET_WM_ICON_NAME, + NET_WM_PID, + NET_WM_PING, NET_WM_STATE, NET_WM_STATE_MAXIMIZED_HORZ, NET_WM_STATE_MAXIMIZED_VERT, @@ -222,6 +224,18 @@ public: */ virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const; + /* + * set NET_WM_PID + */ + virtual void setPID( X11SalFrame* pFrame ) const; + + /* + * set WM_CLIENT_MACHINE + */ + virtual void setClientMachine( X11SalFrame* pFrame ) const; + + virtual void answerPing( X11SalFrame*, XClientMessageEvent* ) const; + /* * maximizes frame * maximization can be toggled in either direction diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx index b1f5a113828f..50b62b644585 100644 --- a/vcl/unx/source/app/saldata.cxx +++ b/vcl/unx/source/app/saldata.cxx @@ -279,6 +279,7 @@ X11SalData::X11SalData() m_pPlugin = NULL; hMainThread_ = pthread_self(); + osl_getLocalHostname( &maLocalHostName.pData ); } X11SalData::~X11SalData() diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 558ae3714358..32a624bb0feb 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -325,12 +325,12 @@ sal_IsLocalDisplay( Display *pDisplay ) if( pPtr != NULL ) { - OUString aLocalHostname; - if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok) + const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() ); + if( rLocalHostname.getLength() ) { *pPtr = '\0'; OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() ); - bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname ); + bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname ); bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 ); } } diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index d15433865450..3bf7e05c9af6 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -121,6 +122,7 @@ static const WMAdaptorProtocol aProtocolTab[] = { "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS }, { "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP }, { "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME }, + { "_NET_WM_PING", WMAdaptor::NET_WM_PING }, { "_NET_WM_STATE", WMAdaptor::NET_WM_STATE }, { "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP }, { "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN }, @@ -182,7 +184,8 @@ static const WMAdaptorProtocol aAtomTab[] = { "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS }, { "_XEMBED", WMAdaptor::XEMBED }, { "_XEMBED_INFO", WMAdaptor::XEMBED_INFO }, - { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME } + { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME }, + { "_NET_WM_PID", WMAdaptor::NET_WM_PID } }; extern "C" { @@ -2415,3 +2418,52 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const ); } } + +/* + * WMAdaptor::setPID + */ +void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const +{ + if( m_aWMAtoms[NET_WM_PID] ) + { + long nPID = (long)getpid(); + XChangeProperty( m_pDisplay, + i_pFrame->GetShellWindow(), + m_aWMAtoms[NET_WM_PID], + XA_CARDINAL, + 32, + PropModeReplace, + (unsigned char*)&nPID, + 1 + ); + } +} + +/* +* WMAdaptor::setClientMachine +*/ +void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const +{ + rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) ); + XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() }; + XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp ); +} + +void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const +{ + if( m_aWMAtoms[NET_WM_PING] && + i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] && + (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] ) + { + XEvent aEvent; + aEvent.xclient = *i_pEvent; + aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ); + XSendEvent( m_pDisplay, + m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ), + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &aEvent + ); + XFlush( m_pDisplay ); + } +} diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 68c99e05da77..0943353bab65 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -531,6 +531,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa Atom a[4]; int n = 0; a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); + if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) + a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); if( ! s_pSaveYourselfFrame && ! mpParent) { // at all times have only one frame with SaveYourself @@ -557,6 +559,10 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa pHints ); XFree (pHints); + // set PID and WM_CLIENT_MACHINE + pDisplay_->getWMAdaptor()->setClientMachine( this ); + pDisplay_->getWMAdaptor()->setPID( this ); + // set client leader if( aClientLeader ) { @@ -738,6 +744,8 @@ void X11SalFrame::passOnSaveYourSelf() int n = 0; a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW ); a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF ); + if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) ) + a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ); XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n ); } } @@ -3930,52 +3938,56 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent ) Close(); // ??? return 1; } - else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) - && ! ( nStyle_ & SAL_FRAME_STYLE_PLUG ) - && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) - ) + else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) ) { - if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) ) - { - Close(); - return 1; - } - else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) ) - { - // do nothing, we set the input focus in ToTop() if necessary -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n", - (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ? - "ownerdraw" : "NON OWNERDRAW" ); -#endif - } - else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) ) + if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) ) + rWMAdaptor.answerPing( this, pEvent ); + else if( ! ( nStyle_ & SAL_FRAME_STYLE_PLUG ) + && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + ) { - bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" ); - - if( ! bSession ) + if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) ) { - if( this == s_pSaveYourselfFrame ) + Close(); + return 1; + } + else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) ) + { + // do nothing, we set the input focus in ToTop() if necessary + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n", + (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ? + "ownerdraw" : "NON OWNERDRAW" ); + #endif + } + else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) ) + { + bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" ); + + if( ! bSession ) { - ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); - const char* argv[2]; - argv[0] = "/bin/sh"; - argv[1] = const_cast(aExec.GetBuffer()); -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); -#endif - XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 ); + if( this == s_pSaveYourselfFrame ) + { + ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); + const char* argv[2]; + argv[0] = "/bin/sh"; + argv[1] = const_cast(aExec.GetBuffer()); + #if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] ); + #endif + XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 ); + } + else + // can only happen in race between WM and window closing + XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); } else - // can only happen in race between WM and window closing - XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 ); - } - else - { - // save open documents; would be good for non Dtwm, too, - // but there is no real Shutdown message in the ancient - // SM protocol; on Dtwm SaveYourself really means Shutdown, too. - IceSalSession::handleOldX11SaveYourself( this ); + { + // save open documents; would be good for non Dtwm, too, + // but there is no real Shutdown message in the ancient + // SM protocol; on Dtwm SaveYourself really means Shutdown, too. + IceSalSession::handleOldX11SaveYourself( this ); + } } } } -- cgit From b8e0731cd9c084e59f86fc18ce3ee149c868240e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 26 Feb 2010 20:50:25 +0100 Subject: vcl110: #i90907# rework mac wheel events, prepare wheel event for pixel scroll data --- vcl/aqua/inc/salframe.h | 2 + vcl/aqua/source/window/salframe.cxx | 17 +++++--- vcl/aqua/source/window/salframeview.mm | 78 +++++++++++++++++----------------- vcl/inc/vcl/cmdevt.hxx | 8 +++- vcl/inc/vcl/salwtype.hxx | 5 +++ vcl/source/window/winproc.cxx | 3 +- 6 files changed, 66 insertions(+), 47 deletions(-) diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index 5ddd96dae34d..7ce961c60c31 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -187,6 +187,8 @@ public: NSView* getView() const { return mpView; } unsigned int getStyleMask() const { return mnStyleMask; } + void getResolution( long& o_rDPIX, long& o_rDPIY ); + // actually the follwing methods do the same thing: flipping y coordinates // but having two of them makes clearer what the coordinate system // is supposed to be before and after diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 7fe3b93ef2e8..aa700db235f5 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1131,6 +1131,16 @@ static Font getFont( NSFont* pFont, long nDPIY, const Font& rDefault ) return aResult; } +void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY ) +{ + if( ! mpGraphics ) + { + GetGraphics(); + ReleaseGraphics( mpGraphics ); + } + mpGraphics->GetResolution( o_rDPIX, o_rDPIY ); +} + // on OSX-Aqua the style settings are independent of the frame, so it does // not really belong here. Since the connection to the Appearance_Manager // is currently done in salnativewidgets.cxx this would be a good place. @@ -1160,13 +1170,8 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) // get the system font settings Font aAppFont = aStyleSettings.GetAppFont(); - if( ! mpGraphics ) - { - GetGraphics(); - ReleaseGraphics( mpGraphics ); - } long nDPIX = 72, nDPIY = 72; - mpGraphics->GetResolution( nDPIX, nDPIY ); + getResolution( nDPIX, nDPIY ); aAppFont = getFont( [NSFont systemFontOfSize: 0], nDPIY, aAppFont ); // TODO: better mapping of aqua<->ooo font settings diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 51f1b1a3b63c..086f35214fd2 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -40,7 +40,9 @@ #include "vcl/window.hxx" #include "vcl/svapp.hxx" - + +#define WHEEL_EVENT_FACTOR 1.5 + static USHORT ImplGetModifierMask( unsigned int nMask ) { USHORT nRet = 0; @@ -657,11 +659,12 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); - aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -670,11 +673,11 @@ private: if( dZ != 0.0 ) { aEvent.mnDelta = static_cast(floor(dZ)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dZ < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dZ < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; + aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines == 0 ) aEvent.mnScrollLines = 1; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -715,10 +718,11 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -727,9 +731,9 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast(floor(dX)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -737,9 +741,9 @@ private: if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame )) { aEvent.mnDelta = static_cast(floor(dY)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); @@ -774,10 +778,11 @@ private: mpFrame->CocoaToVCL( aPt ); SalWheelMouseEvent aEvent; - aEvent.mnTime = mpFrame->mnLastEventTime; - aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; - aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; - aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mnTime = mpFrame->mnLastEventTime; + aEvent.mnX = static_cast(aPt.x) - mpFrame->maGeometry.nX; + aEvent.mnY = static_cast(aPt.y) - mpFrame->maGeometry.nY; + aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags ); + aEvent.mbDeltaIsPixel = TRUE; // --- RTL --- (mirror mouse pos) if( Application::GetSettings().GetLayoutRTL() ) @@ -786,30 +791,27 @@ private: if( dX != 0.0 ) { aEvent.mnDelta = static_cast(floor(dX)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dX < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = TRUE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; + aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR; if( aEvent.mnScrollLines == 0 ) aEvent.mnScrollLines = 1; - if( aEvent.mnScrollLines > 15 ) - aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; + mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); } if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) ) { aEvent.mnDelta = static_cast(floor(dY)); - aEvent.mnNotchDelta = aEvent.mnDelta / 8; - if( aEvent.mnNotchDelta == 0 ) - aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1; + aEvent.mnNotchDelta = dY < 0 ? -1 : 1; + if( aEvent.mnDelta == 0 ) + aEvent.mnDelta = aEvent.mnNotchDelta; aEvent.mbHorz = FALSE; - aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta; - if( aEvent.mnScrollLines == 0 ) + aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR; + if( aEvent.mnScrollLines < 1 ) aEvent.mnScrollLines = 1; - if( aEvent.mnScrollLines > 15 ) - aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; - + mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent ); } } diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx index ac9f852cd54c..6451a0b32ee8 100644 --- a/vcl/inc/vcl/cmdevt.hxx +++ b/vcl/inc/vcl/cmdevt.hxx @@ -141,18 +141,20 @@ private: USHORT mnMode; USHORT mnCode; BOOL mbHorz; + BOOL mbDeltaIsPixel; public: CommandWheelData(); CommandWheelData( long nWheelDelta, long nWheelNotchDelta, ULONG nScrollLines, USHORT nWheelMode, USHORT nKeyModifier, - BOOL mbHorz = FALSE ); + BOOL bHorz = FALSE, BOOL bDeltaIsPixel = FALSE ); long GetDelta() const { return mnDelta; } long GetNotchDelta() const { return mnNotchDelta; } ULONG GetScrollLines() const { return mnLines; } BOOL IsHorz() const { return mbHorz; } + BOOL IsDeltaPixel() const { return mbDeltaIsPixel; } USHORT GetMode() const { return mnMode; } @@ -176,12 +178,13 @@ inline CommandWheelData::CommandWheelData() mnMode = 0; mnCode = 0; mbHorz = FALSE; + mbDeltaIsPixel = FALSE; } inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta, ULONG nScrollLines, USHORT nWheelMode, USHORT nKeyModifier, - BOOL bHorz ) + BOOL bHorz, BOOL bDeltaIsPixel ) { mnDelta = nWheelDelta; mnNotchDelta = nWheelNotchDelta; @@ -189,6 +192,7 @@ inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDel mnMode = nWheelMode; mnCode = nKeyModifier; mbHorz = bHorz; + mbDeltaIsPixel = bDeltaIsPixel; } // --------------------- diff --git a/vcl/inc/vcl/salwtype.hxx b/vcl/inc/vcl/salwtype.hxx index 0d5f23e28d2f..e16b6388a696 100644 --- a/vcl/inc/vcl/salwtype.hxx +++ b/vcl/inc/vcl/salwtype.hxx @@ -183,6 +183,11 @@ struct SalWheelMouseEvent ULONG mnScrollLines; // Aktuelle Anzahl zu scrollende Zeilen USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT) BOOL mbHorz; // Horizontal + BOOL mbDeltaIsPixel; // delta value is a pixel value (on mac) + + SalWheelMouseEvent() + : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( FALSE ), mbDeltaIsPixel( FALSE ) + {} }; // MOUSEACTIVATE diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 8c69c2a45daf..cf512cf2b180 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1477,6 +1477,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv USHORT nMode; USHORT nCode = rEvt.mnCode; bool bHorz = rEvt.mbHorz; + bool bPixel = rEvt.mbDeltaIsPixel; if ( nCode & KEY_MOD1 ) nMode = COMMAND_WHEEL_ZOOM; else if ( nCode & KEY_MOD2 ) @@ -1489,7 +1490,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv bHorz = true; } - CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz ); + CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel ); Point aMousePos( rEvt.mnX, rEvt.mnY ); BOOL bRet = TRUE; -- cgit From 89bbb94e03df0ccd5cf3f5737c12b7c29fd4fae7 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Sat, 27 Feb 2010 13:33:22 +0100 Subject: vcl110: #i101458# silence warning --- vcl/unx/gtk/a11y/atkbridge.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx index c8db1538a3a0..4d47a6914bf9 100644 --- a/vcl/unx/gtk/a11y/atkbridge.cxx +++ b/vcl/unx/gtk/a11y/atkbridge.cxx @@ -43,10 +43,7 @@ bool InitAtkBridge(void) { const char* pVersion = atk_get_toolkit_version(); if( ! pVersion ) - { - g_warning( "unable to get gail version number" ); return false; - } unsigned int major, minor, micro; -- cgit From 0ca31b024fbc215489c9ff9ed199cbe189344141 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Sat, 27 Feb 2010 14:34:41 +0100 Subject: ppp02: #i108326# missing mac implementation --- vcl/aqua/source/gdi/salprn.cxx | 202 ++++++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 91 deletions(-) diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index 47c027a033aa..ffbccd3f2fb0 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -535,8 +535,6 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, PrintAccessoryViewState aAccViewState; sal_Int32 nAllPages = 0; - aAccViewState.bNeedRestart = true; - // reset IsLastPage i_rController.setLastPage( sal_False ); @@ -552,111 +550,133 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, if( ! i_rController.isShowDialogs() ) bShowProgressPanel = sal_False; + // possibly create one job for collated output + sal_Bool bSinglePrintJobs = sal_False; + beans::PropertyValue* pSingleValue = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) ); + if( pSingleValue ) + { + pSingleValue->Value >>= bSinglePrintJobs; + } + // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ? i_rController.jobStarted(); - do - { - if( aAccViewState.bNeedRestart ) - { - mnCurPageRangeStart = 0; - mnCurPageRangeCount = 0; - nAllPages = i_rController.getFilteredPageCount(); - } - aAccViewState.bNeedRestart = false; - Size aCurSize( 21000, 29700 ); - if( nAllPages > 0 ) + int nCopies = i_rController.getPrinter()->GetCopyCount(); + int nJobs = 1; + if( bSinglePrintJobs ) + { + nJobs = nCopies; + nCopies = 1; + } + + for( int nCurJob = 0; nCurJob < nJobs; nCurJob++ ) + { + aAccViewState.bNeedRestart = true; + do { - mnCurPageRangeCount = 1; - aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); - Size aNextSize( aCurSize ); + if( aAccViewState.bNeedRestart ) + { + mnCurPageRangeStart = 0; + mnCurPageRangeCount = 0; + nAllPages = i_rController.getFilteredPageCount(); + } - // print pages up to a different size - while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) + aAccViewState.bNeedRestart = false; + + Size aCurSize( 21000, 29700 ); + if( nAllPages > 0 ) { - aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); - if( aCurSize == aNextSize // same page size - || - (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation - ) + mnCurPageRangeCount = 1; + aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); + Size aNextSize( aCurSize ); + + // print pages up to a different size + while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) { - mnCurPageRangeCount++; + aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); + if( aCurSize == aNextSize // same page size + || + (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation + ) + { + mnCurPageRangeCount++; + } + else + break; } - else - break; } - } - else - mnCurPageRangeCount = 0; - - // now for the current run - mnStartPageOffsetX = mnStartPageOffsetY = 0; - // setup the paper size and orientation - // do this on our associated Printer object, since that is - // out interface to the applications which occasionally rely on the paper - // information (e.g. brochure printing scales to the found paper size) - // also SetPaperSizeUser has the advantage that we can share a - // platform independent paper matching algorithm - boost::shared_ptr pPrinter( i_rController.getPrinter() ); - pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); - pPrinter->SetPaperSizeUser( aCurSize, true ); - - // create view - NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; - - NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; - - // set filename - if( i_pFileName ) - { - [mpPrintInfo setJobDisposition: NSPrintSaveJob]; - NSString* pPath = CreateNSString( *i_pFileName ); - [pPrintDict setObject: pPath forKey: NSPrintSavePath]; - [pPath release]; - } + else + mnCurPageRangeCount = 0; + + // now for the current run + mnStartPageOffsetX = mnStartPageOffsetY = 0; + // setup the paper size and orientation + // do this on our associated Printer object, since that is + // out interface to the applications which occasionally rely on the paper + // information (e.g. brochure printing scales to the found paper size) + // also SetPaperSizeUser has the advantage that we can share a + // platform independent paper matching algorithm + boost::shared_ptr pPrinter( i_rController.getPrinter() ); + pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + pPrinter->SetPaperSizeUser( aCurSize, true ); + + // create view + NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; + + NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; + + // set filename + if( i_pFileName ) + { + [mpPrintInfo setJobDisposition: NSPrintSaveJob]; + NSString* pPath = CreateNSString( *i_pFileName ); + [pPrintDict setObject: pPath forKey: NSPrintSavePath]; + [pPath release]; + } - [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; - [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; - [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; - // #i103253# weird: for some reason, autoreleasing the value below like the others above - // leads do a double free malloc error. Why this value should behave differently from all the others - // is a mystery. - [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; + [pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies]; + [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; + [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; + // #i103253# weird: for some reason, autoreleasing the value below like the others above + // leads do a double free malloc error. Why this value should behave differently from all the others + // is a mystery. + [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; - // create print operation - NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; + // create print operation + NSPrintOperation* pPrintOperation = [NSPrintOperation printOperationWithView: pPrintView printInfo: mpPrintInfo]; - if( pPrintOperation ) - { - NSObject* pReleaseAfterUse = nil; - bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() ); - [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; - [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; - - // set job title (since MacOSX 10.5) - if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] ) - [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; - - if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view - pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; - - bSuccess = TRUE; - mbJob = true; - pInst->startedPrintJob(); - [pPrintOperation runOperation]; - pInst->endedPrintJob(); - bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame; - mbJob = false; - if( pReleaseAfterUse ) - [pReleaseAfterUse release]; - } + if( pPrintOperation ) + { + NSObject* pReleaseAfterUse = nil; + bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() ); + [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; + [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; + + // set job title (since MacOSX 10.5) + if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] ) + [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; + + if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accesory view + pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; + + bSuccess = TRUE; + mbJob = true; + pInst->startedPrintJob(); + [pPrintOperation runOperation]; + pInst->endedPrintJob(); + bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame; + mbJob = false; + if( pReleaseAfterUse ) + [pReleaseAfterUse release]; + } - mnCurPageRangeStart += mnCurPageRangeCount; - mnCurPageRangeCount = 1; - } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); + mnCurPageRangeStart += mnCurPageRangeCount; + mnCurPageRangeCount = 1; + } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); + } // inform application that it can release its data // this is awkward, but the XRenderable interface has no method for this, -- cgit From e3c5a94658ee2daa115a1393376f747d7470c680 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Sat, 27 Feb 2010 14:50:28 +0100 Subject: fix a layout problem --- vcl/source/window/printdlg.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index a64e6820dc71..588cbb70fe35 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1766,6 +1766,7 @@ void PrintDialog::checkControlDependencies() maJobPage.maCollateImage.SetSizePixel( aImgSize ); maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg ); maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST ); + maJobPage.maLayout.resize(); // enable setup button only for printers that can be setup bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); -- cgit From 2c72edc36403323b2978124e82bdd0069504be45 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 1 Mar 2010 11:46:25 +0100 Subject: sb118: release DisplayConnection::m_aMutex before calling event handlers --- vcl/source/helper/xconnection.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 19ac9103bf96..caf7ee237d67 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -141,12 +141,16 @@ bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) SolarMutexReleaser aRel; DisplayConnection* This = (DisplayConnection*)pThis; - MutexGuard aGuard( This->m_aMutex ); Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aHandlers.begin(); it != This->m_aHandlers.end(); ++it ) + ::std::list< Reference< XEventHandler > > handlers; + { + MutexGuard aGuard( This->m_aMutex ); + handlers = This->m_aHandlers; + } + for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; return false; @@ -157,12 +161,16 @@ bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes SolarMutexReleaser aRel; DisplayConnection* This = (DisplayConnection*)pThis; - MutexGuard aGuard( This->m_aMutex ); Sequence< sal_Int8 > aSeq( (sal_Int8*)pData, nBytes ); Any aEvent; aEvent <<= aSeq; - for( ::std::list< Reference< XEventHandler > >::const_iterator it = This->m_aErrorHandlers.begin(); it != This->m_aErrorHandlers.end(); ++it ) + ::std::list< Reference< XEventHandler > > handlers; + { + MutexGuard aGuard( This->m_aMutex ); + handlers = This->m_aErrorHandlers; + } + for( ::std::list< Reference< XEventHandler > >::const_iterator it = handlers.begin(); it != handlers.end(); ++it ) if( (*it)->handleEvent( aEvent ) ) return true; -- cgit From 0e4d294db8bc143bb686fd845a46c80d5cb5ad02 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 2 Mar 2010 17:45:26 +0100 Subject: vcl110: #i106575# fix erase from list (thanks thb) --- toolkit/source/layout/core/box-base.cxx | 5 +++-- toolkit/source/layout/core/box-base.hxx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx index 63cb49901ec4..20377ea97c4e 100644 --- a/toolkit/source/layout/core/box-base.cxx +++ b/toolkit/source/layout/core/box-base.cxx @@ -108,15 +108,16 @@ Box_Base::addChild (uno::Reference const& xChild) } Box_Base::ChildData* -Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) +Box_Base::removeChildData( std::list< ChildData* >& lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) { for ( std::list< ChildData* >::iterator it = lst.begin(); it != lst.end(); it++ ) { if ( (*it)->mxChild == xChild ) { + ChildData* pRet = *it; lst.erase( it ); - return *it; + return pRet; } } return 0; diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx index c4958a303540..26e147772a66 100644 --- a/toolkit/source/layout/core/box-base.hxx +++ b/toolkit/source/layout/core/box-base.hxx @@ -66,7 +66,7 @@ protected: virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0; virtual ChildProps *createChildProps( ChildData* pData ) = 0; - ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child ); + ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child ); public: void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child); -- cgit From e1e8b8334a9f1c028d2191534941d5b3e550dd41 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 3 Mar 2010 15:44:53 +0100 Subject: sb118: #i109643# further test disabled --- toolkit/qa/unoapi/knownissues.xcl | 1 + 1 file changed, 1 insertion(+) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index eed2d3208e09..6f57f37536a2 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -238,4 +238,5 @@ toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText ### i109643 ### toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue +toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection -- cgit From 0ad03b2c717ec7cb61ac5a598f56935599fa0298 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 3 Mar 2010 16:36:43 +0100 Subject: #109634# password to modify dialog --- vcl/inc/vcl/abstdlg.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) mode change 100644 => 100755 vcl/inc/vcl/abstdlg.hxx diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx old mode 100644 new mode 100755 index 66468fc0b3db..16d30c8f161f --- a/vcl/inc/vcl/abstdlg.hxx +++ b/vcl/inc/vcl/abstdlg.hxx @@ -69,6 +69,15 @@ public: virtual void Sync() = 0; }; +class AbstractPasswordToOpenModifyDialog : public VclAbstractDialog +{ +public: + virtual String GetPasswordToOpen() const = 0; + virtual String GetPasswordToModify() const = 0; +}; + +//------------------------------------------------------------- + class VCL_DLLPUBLIC VclAbstractDialogFactory { public: @@ -76,6 +85,9 @@ public: // nDialogId was previously a ResId without ResMgr; the ResourceId is now // an implementation detail of the factory virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ) = 0; + + // creates instance of PasswordToOpenModifyDialog from cui + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent ) = 0; }; #endif -- cgit From 622ca3aa67232d56ee8fff25bc49ba3839e642e0 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 3 Mar 2010 16:55:16 +0100 Subject: "#i101552# avoid fonts with obsolete CMAP tables for glyph fallback" and some minor changes --- vcl/win/source/gdi/salgdi3.cxx | 57 +++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index babc968ca859..981ee89d665d 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -393,7 +393,6 @@ const LanguageType MapCharToLanguage( sal_UCS4 uChar ) return LANGUAGE_DONTKNOW; } -//class ImplWinFontData; void ImplGetLogFontFromFontSelect( HDC hDC, const ImplFontSelectData* pFont, LOGFONTW& rLogFont, @@ -423,7 +422,8 @@ inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC, bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const { const ImplWinFontData* pWinFont = static_cast(pFace); - if( !pWinFont->GetImplFontCharMap() ) + const ImplFontCharMap* pCharMap = pWinFont->GetImplFontCharMap(); + if( !pCharMap ) { // construct a Size structure as the parameter of constructor of class ImplFontSelectData const Size aSize( pFace->GetWidth(), pFace->GetHeight() ); @@ -438,26 +438,42 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, // select the new font into device HFONT hOldFont = ::SelectFont( mhDC, hNewFont ); - // read CMAP table + // read CMAP table to update their pCharMap pWinFont->UpdateFromHDC( mhDC );; + // cleanup temporary font ::SelectFont( mhDC, hOldFont ); ::DeleteFont( hNewFont ); + + // get the new charmap + pCharMap = pWinFont->GetImplFontCharMap(); + } + + // avoid fonts with unknown CMAP subtables for glyph fallback + if( !pCharMap || pCharMap->IsDefaultMap() ) + return false; + + int nMatchCount = 0; + // static const int nMaxMatchCount = 1; // TODO: check more missing characters? + const sal_Int32 nStrLen = rMissingChars.getLength(); + for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx ) + { + const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx ); + nMatchCount += pCharMap->HasChar( uChar ); + break; // for now } - sal_Int32 nStrIndex = 0; // TODO: check more missing characters? - const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIndex ); - const bool bHasChar = pWinFont->HasChar( uChar ); - return bHasChar; + const bool bHasMatches = (nMatchCount > 0); + return bHasMatches; } -//get fallback font for missing characters +// find a fallback font for missing characters +// TODO: should stylistic matches be searched and prefered? bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const { - //g et locale by the language type of missing string + // guess a locale matching to the missing chars com::sun::star::lang::Locale aLocale; - // what are langauge and mapping locale of the missing characters? sal_Int32 nStrIdx = 0; const sal_Int32 nStrLen = rMissingChars.getLength(); while( nStrIdx < nStrLen ) @@ -470,19 +486,21 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo break; } - // fall back to default UI locale + // fall back to default UI locale if the missing characters are inconclusive if( nStrIdx >= nStrLen ) aLocale = Application::GetSettings().GetUILocale(); - // first level fallback, get font type face by locale + // first level fallback: + // try use the locale specific default fonts in VCL.xcu /*const*/ ImplDevFontListData* pDevFont = mpFontList->ImplFindByLocale( aLocale ); if( pDevFont ) { -// const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); -// if( HasMissingChas( pFace, MissingChars) ) { + const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); + if( HasMissingChars( pFace, rMissingChars ) ) + { rFontSelData.maSearchName = pDevFont->GetSearchName(); return true; -// } + } } // are the missing characters symbols? @@ -1115,8 +1133,8 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const { - if(!mpUnicodeMap) - return 0; + if( !mpUnicodeMap ) + return NULL; mpUnicodeMap->AddReference(); return mpUnicodeMap; } @@ -2456,9 +2474,8 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) bImplSalCourierNew = aInfo.mbImplSalCourierNew; } - //set font fallback hook - static WinGlyphFallbackSubstititution aSubstFallback(mhDC, pFontList); - //aSubstFallback.SetHDC(mhDC); + // set font fallback hook + static WinGlyphFallbackSubstititution aSubstFallback( mhDC, pFontList ); pFontList->SetFallbackHook( &aSubstFallback ); } -- cgit From 9dbddaf44155708bee14f898dbfea5de06fdbdae Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Wed, 3 Mar 2010 21:01:44 +0100 Subject: sb118: add --with-system-cppunit --- basegfx/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basegfx/prj/build.lst b/basegfx/prj/build.lst index e4122616e769..fe3354b3f256 100644 --- a/basegfx/prj/build.lst +++ b/basegfx/prj/build.lst @@ -1,4 +1,4 @@ -fx basegfx : o3tl sal offuh cppuhelper cppu cppunit NULL +fx basegfx : o3tl sal offuh cppuhelper cppu CPPUNIT:cppunit NULL fx basegfx usr1 - all fx_mkout NULL fx basegfx\inc nmake - all fx_inc NULL fx basegfx\prj get - all fx_prj NULL -- cgit From 17feb1f6049deb8a388f0bf6fa625c95231dccae Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Wed, 3 Mar 2010 21:04:06 +0100 Subject: sb118: add forgotten CPPUNIT: in o3tl --- o3tl/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/o3tl/prj/build.lst b/o3tl/prj/build.lst index fe6b53d1c732..2606d1df8586 100644 --- a/o3tl/prj/build.lst +++ b/o3tl/prj/build.lst @@ -1,4 +1,4 @@ -ot o3tl : sal cppunit BOOST:boost NULL +ot o3tl : sal CPPUNIT:cppunit BOOST:boost NULL ot o3tl usr1 - all ot_mkout NULL ot o3tl\inc get - all ot_inc NULL ot o3tl\prj get - all ot_prj NULL -- cgit From 7c85f9d5fe0c0d387115d8ad863b39496349bb1b Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Thu, 4 Mar 2010 00:11:19 +0100 Subject: sb118: add missing CFLAGS+= $(CPPUNIT_CFLAGS) to loads of other makefiles, too --- basebmp/test/makefile.mk | 4 ++++ basegfx/test/makefile.mk | 4 ++++ comphelper/qa/makefile.mk | 4 ++++ o3tl/qa/makefile.mk | 5 +++++ svl/qa/makefile.mk | 4 ++++ tools/qa/makefile.mk | 4 ++++ tools/test/makefile.mk | 4 ++++ 7 files changed, 29 insertions(+) diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 610468b313fe..7dd374898641 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -60,6 +60,10 @@ CDEFS+=-xalias_level=compatible .ENDIF .ENDIF +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS += $(CPPUNIT_CFLAGS) +.ENDIF + # --- Common ---------------------------------------------------------- .IF "$(L10N_framework)"=="" diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 73a157e7dc3a..e29f69bd3516 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -36,6 +36,10 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS += $(CPPUNIT_CFLAGS) +.ENDIF + # --- Common ---------------------------------------------------------- SHL1OBJS= \ diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk index 6e715675bb03..7c91456ac084 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/makefile.mk @@ -33,6 +33,10 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS+= $(CPPUNIT_CFLAGS) +.ENDIF + DLLPRE = # no leading "lib" on .so files INCPRE += $(MISC)$/$(TARGET)$/inc diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index c75c3e972eea..c126c90b0771 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -35,6 +35,11 @@ ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk + +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS+= $(CPPUNIT_CFLAGS) +.ENDIF + .IF "$(L10N_framework)"=="" # --- Common ---------------------------------------------------------- diff --git a/svl/qa/makefile.mk b/svl/qa/makefile.mk index 4e107e31f924..072dfe7093bc 100644 --- a/svl/qa/makefile.mk +++ b/svl/qa/makefile.mk @@ -35,6 +35,10 @@ ENABLE_EXCEPTIONS = true .INCLUDE : settings.mk +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS+= $(CPPUNIT_CFLAGS) +.ENDIF + # BEGIN ---------------------------------------------------------------- # auto generated Target:job by codegen.pl SHL1OBJS= \ diff --git a/tools/qa/makefile.mk b/tools/qa/makefile.mk index 66ed19e20737..4c633aad1946 100644 --- a/tools/qa/makefile.mk +++ b/tools/qa/makefile.mk @@ -32,6 +32,10 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS+= $(CPPUNIT_CFLAGS) +.ENDIF + DLLPRE = # no leading "lib" on .so files SHL1TARGET = test_pathutils diff --git a/tools/test/makefile.mk b/tools/test/makefile.mk index 5dea8ce6f960..7f00fe2748b3 100644 --- a/tools/test/makefile.mk +++ b/tools/test/makefile.mk @@ -36,6 +36,10 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(SYSTEM_CPPUNIT)"=="YES" +CFLAGS+= $(CPPUNIT_CFLAGS) +.ENDIF + # --- Common ---------------------------------------------------------- SHL1OBJS= \ -- cgit From 1254cf4c7f21439fcbe9e86326bcdb4b23448ecb Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Thu, 4 Mar 2010 11:59:48 +0100 Subject: tl78: #i109779# move new functionality to comphelper::MediaDescriptor --- comphelper/inc/comphelper/mediadescriptor.hxx | 51 ++++++++++++++ comphelper/source/misc/mediadescriptor.cxx | 99 +++++++++++++++------------ 2 files changed, 107 insertions(+), 43 deletions(-) diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index e388c0b4ca3c..8b52b401c677 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -129,6 +129,9 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap //------------------------------------------- // interface public: + /** Value type of the 'ComponentData' property. + */ + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > ComponentDataSequence; //--------------------------------------- /** @short these ctors do nothing - excepting that they forward @@ -199,6 +202,54 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap */ sal_Bool isStreamReadOnly() const; + //--------------------------------------- + /** Returns a value from the sequence contained in the property + 'ComponentData' of this media descriptor. + + @descr The property 'ComponentData' should be empty or should + contain a value of type ComponentDataSequence (see above). + + @return The value with the specified name, if existing in the + sequence of the 'ComponentData' property, otherwise an empty + Any. + */ + ::com::sun::star::uno::Any getComponentDataEntry( + const ::rtl::OUString& rName ) const; + + //--------------------------------------- + /** Inserts a value into the sequence contained in the property + 'ComponentData' of the media descriptor. + + @descr The property 'ComponentData' should be empty or should + contain a value of type ComponentDataSequence (see above). The + passed value will be inserted into the sequence, or, if already + existing, will be overwritten. + + @param rName The name of the value to be inserted into the + sequence of the 'ComponentData' property. + + @param rValue The value to be inserted into the sequence of the + 'ComponentData' property. + */ + void setComponentDataEntry( + const ::rtl::OUString& rName, + const ::com::sun::star::uno::Any& rValue ); + + //--------------------------------------- + /** Removes a value from the sequence contained in the property + 'ComponentData' of the media descriptor. + + @descr The property 'ComponentData' should be empty or should + contain a value of type ComponentDataSequence (see above). The + value with the passed name will be removed from the sequence, + if existing. + + @param rName The name of the value to be removed from the sequence + of the 'ComponentData' property. + */ + void clearComponentDataEntry( + const ::rtl::OUString& rName ); + //------------------------------------------- // helper private: diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 44578f840da9..5eed72d86e0a 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -32,59 +32,21 @@ #include "precompiled_comphelper.hxx" #include -//_______________________________________________ -// includes - -#ifndef __COM_SUN_STAR_UCB_XCONTENT_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_IO_XSTREAM_HPP__ #include -#endif #include #include - -#ifndef __COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP__ #include -#endif #include - -#ifndef __COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_URI_XURIREFERENCEFACTORY_HPP__ #include -#endif - -#ifndef __COM_SUN_STAR_URI_XURIREFERENCE_HPP__ #include -#endif #include #include @@ -95,11 +57,7 @@ #include #include -#if OSL_DEBUG_LEVEL>0 - #ifndef _RTL_USTRBUF_HXX_ - #include - #endif -#endif +#include //_______________________________________________ // namespace @@ -511,6 +469,61 @@ sal_Bool MediaDescriptor::isStreamReadOnly() const return bReadOnly; } +// ---------------------------------------------------------------------------- + +css::uno::Any MediaDescriptor::getComponentDataEntry( const ::rtl::OUString& rName ) const +{ + SequenceAsHashMap aCompDataMap( getUnpackedValueOrDefault( PROP_COMPONENTDATA(), ComponentDataSequence() ) ); + SequenceAsHashMap::iterator aIt = aCompDataMap.find( rName ); + return (aIt == aCompDataMap.end()) ? css::uno::Any() : aIt->second; +} + +void MediaDescriptor::setComponentDataEntry( const ::rtl::OUString& rName, const css::uno::Any& rValue ) +{ + if( rValue.hasValue() ) + { + // get or craete the 'ComponentData' property entry + css::uno::Any& rCompDataAny = operator[]( PROP_COMPONENTDATA() ); + // check type, insert the value + OSL_ENSURE( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >(), + "MediaDescriptor::setComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); + if( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >() ) + { + // insert or overwrite the passed value + SequenceAsHashMap aCompDataMap( rCompDataAny ); + aCompDataMap[ rName ] = rValue; + // write back the sequence (sal_False = use NamedValue instead of PropertyValue) + rCompDataAny = aCompDataMap.getAsConstAny( sal_False ); + } + } + else + { + // if an empty Any is passed, clear the entry + clearComponentDataEntry( rName ); + } +} + +void MediaDescriptor::clearComponentDataEntry( const ::rtl::OUString& rName ) +{ + SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA() ); + if( aPropertyIter != end() ) + { + OSL_ENSURE( aPropertyIter->second.has< ComponentDataSequence >(), + "MediaDescriptor::clearComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); + if( aPropertyIter->second.has< ComponentDataSequence >() ) + { + // remove the value with the passed name + SequenceAsHashMap aCompDataMap( aPropertyIter->second ); + aCompDataMap.erase( rName ); + // write back the sequence, or remove it completely if it is empty + if( aCompDataMap.empty() ) + erase( aPropertyIter ); + else + aPropertyIter->second = aCompDataMap.getAsConstAny( sal_False ); + } + } +} + /*----------------------------------------------- 10.03.2004 09:02 -----------------------------------------------*/ -- cgit From 96f94b2462fb61d9457545112f939937d3b9e20d Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Thu, 4 Mar 2010 13:27:03 +0100 Subject: #i101552# adjust language detection for CJK unified chars --- vcl/win/source/gdi/salgdi3.cxx | 71 +++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 981ee89d665d..a71022ed57b8 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -327,9 +327,12 @@ struct Unicode2LangType LanguageType mnLangID; }; +// entries marked with default-CJK get replaced with the default-CJK language +#define LANGUAGE_DEFAULT_CJK 0xFFF0 + // map unicode ranges to languages supported by OOo // NOTE: due to the binary search used this list must be sorted by mnMinCode -static const Unicode2LangType aLangFromCodeChart[]= { +static Unicode2LangType aLangFromCodeChart[]= { {0x0000, 0x007f, LANGUAGE_ENGLISH}, // Basic Latin {0x0080, 0x024f, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B {0x0250, 0x02af, LANGUAGE_SYSTEM}, // IPA Extensions @@ -349,19 +352,19 @@ static const Unicode2LangType aLangFromCodeChart[]= { {0x1e00, 0x1eff, LANGUAGE_ENGLISH}, // Latin Extended Additional {0x2c60, 0x2c7f, LANGUAGE_ENGLISH}, // Latin Extended-C {0x2e80, 0x2fff, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters - {0x3000, 0x303F, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Symbols and punctuation + {0x3000, 0x303F, LANGUAGE_DEFAULT_CJK}, // CJK Symbols and punctuation {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana {0x3100, 0x312f, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo {0x3130, 0x318f, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific {0x3190, 0x319f, LANGUAGE_JAPANESE}, // Kanbun {0x31a0, 0x31bf, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended - {0x31c0, 0x31ef, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Strokes + {0x31c0, 0x31ef, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs {0x31f0, 0x31ff, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions - {0x3400, 0x4dbf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Unified Ideographs Extension A - {0x4e00, 0x9fcf, LANGUAGE_CHINESE_SIMPLIFIED}, // Unified CJK Ideographs + {0x3400, 0x4dbf, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A + {0x4e00, 0x9fcf, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs {0xa720, 0xa7ff, LANGUAGE_ENGLISH}, // Latin Extended-D {0xac00, 0xd7af, LANGUAGE_KOREAN}, // Hangul Syllables, Kocrean-specific - {0xF900, 0xFAFF, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Compatibility Ideographs + {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs {0xfb00, 0xfb4f, LANGUAGE_HEBREW}, // Hibrew present forms {0xfb50, 0xfdff, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A {0xfe70, 0xfefe, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B @@ -369,13 +372,47 @@ static const Unicode2LangType aLangFromCodeChart[]= { {0xffa0, 0xffDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant {0x10140, 0x1018f, LANGUAGE_GREEK}, // Ancient Greak numbers {0x1d200, 0x1d24f, LANGUAGE_GREEK}, // Ancient Greek Musical - {0x20000, 0x2a6df, LANGUAGE_CHINESE}, // CJK Unified Ideographs Extension B - {0x2f800, 0x2fa1f, LANGUAGE_CHINESE} // CJK Compatibility Ideographs Supplement + {0x20000, 0x2a6df, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B + {0x2f800, 0x2fa1f, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement }; -// get language type in accordance of a missing char -const LanguageType MapCharToLanguage( sal_UCS4 uChar ) +// get language matching to the missing char +LanguageType MapCharToLanguage( sal_UCS4 uChar ) { + // entries marked with default-CJK should get replaced with a default-CJK language + static bool bFirst = true; + if( bFirst ) + { + bFirst = false; + // TODO: use the default-CJK language instead + // when the setting from Tools->Options->LangSettings->Languages becomes available here + LanguageType nDefaultCJK = LANGUAGE_CHINESE; + const LanguageType nUILang = Application::GetSettings().GetUILanguage(); + switch( nUILang ) + { + case LANGUAGE_JAPANESE: + case LANGUAGE_KOREAN: + case LANGUAGE_KOREAN_JOHAB: + case LANGUAGE_CHINESE_SIMPLIFIED: + case LANGUAGE_CHINESE_TRADITIONAL: + case LANGUAGE_CHINESE_SINGAPORE: + case LANGUAGE_CHINESE_HONGKONG: + case LANGUAGE_CHINESE_MACAU: + nDefaultCJK = nUILang; + break; + default: + nDefaultCJK = LANGUAGE_CHINESE; + break; + } + + static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)); + for( int i = 0; i < nCount; ++i ) + { + if( aLangFromCodeChart[ i].mnLangID == LANGUAGE_DEFAULT_CJK ) + aLangFromCodeChart[ i].mnLangID = nDefaultCJK; + } + } + // binary search int nLow = 0; int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1; @@ -393,19 +430,12 @@ const LanguageType MapCharToLanguage( sal_UCS4 uChar ) return LANGUAGE_DONTKNOW; } -void ImplGetLogFontFromFontSelect( HDC hDC, - const ImplFontSelectData* pFont, - LOGFONTW& rLogFont, - bool /*bTestVerticalAvail*/ ); - class WinGlyphFallbackSubstititution : public ImplGlyphFallbackFontSubstitution { public: - WinGlyphFallbackSubstititution( HDC hDC, ImplDevFontList* pDFL ); + WinGlyphFallbackSubstititution( HDC, ImplDevFontList* ); -// void SetHDC( HDC hDC ) { mhDC = hDC; } -// void SetFontList( ImplDevFontList* pFontLiest ) { mpFontList = pFontList; } bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const; private: HDC mhDC; @@ -418,6 +448,9 @@ inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC, , mpFontList( pDFL ) {} +void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, + LOGFONTW&, bool /*bTestVerticalAvail*/ ); + // does a font face hold the given missing characters? bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const { @@ -491,7 +524,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo aLocale = Application::GetSettings().GetUILocale(); // first level fallback: - // try use the locale specific default fonts in VCL.xcu + // try use the locale specific default fonts defined in VCL.xcu /*const*/ ImplDevFontListData* pDevFont = mpFontList->ImplFindByLocale( aLocale ); if( pDevFont ) { -- cgit From 81c3196a00d8a780e01ad399f05d26f2dc719613 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Thu, 4 Mar 2010 14:25:05 +0100 Subject: #161491# further support for own generic schemes --- tools/source/fsys/urlobj.cxx | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index b742e6c9a074..b127f33e5d0a 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1605,7 +1605,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, STATE_DONE }; rtl::OUStringBuffer aSynAbsURIRef; - aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } aSynAbsURIRef.append(sal_Unicode(':')); sal_Char cEscapePrefix = getEscapePrefix(); @@ -3814,7 +3830,27 @@ INetURLObject::getAbbreviated( OSL_ENSURE(rStringWidth.is(), "specification violation"); sal_Char cEscapePrefix = getEscapePrefix(); rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aBuffer.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + if (m_aAbsURIRef) + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } + } aBuffer.append(static_cast< sal_Unicode >(':')); bool bAuthority = getSchemeInfo().m_bAuthority; sal_Unicode const * pCoreBegin -- cgit From ec2d9aa11250e94588f9ff89190303da01c8bbf2 Mon Sep 17 00:00:00 2001 From: Steffen Grund Date: Thu, 4 Mar 2010 14:25:05 +0100 Subject: #161491# further support for own generic schemes --- tools/source/fsys/urlobj.cxx | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 68a66b596f5c..d5f48a552916 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1603,7 +1603,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, STATE_DONE }; rtl::OUStringBuffer aSynAbsURIRef; - aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } aSynAbsURIRef.append(sal_Unicode(':')); sal_Char cEscapePrefix = getEscapePrefix(); @@ -3812,7 +3828,27 @@ INetURLObject::getAbbreviated( OSL_ENSURE(rStringWidth.is(), "specification violation"); sal_Char cEscapePrefix = getEscapePrefix(); rtl::OUStringBuffer aBuffer; - aBuffer.appendAscii(getSchemeInfo().m_pScheme); + // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme + // is empty ("") in that case, so take the scheme from m_aAbsURIRef + if (m_eScheme != INET_PROT_GENERIC) + { + aBuffer.appendAscii(getSchemeInfo().m_pScheme); + } + else + { + if (m_aAbsURIRef) + { + sal_Unicode const * pSchemeBegin + = m_aAbsURIRef.getStr(); + sal_Unicode const * pSchemeEnd = pSchemeBegin; + + while (pSchemeEnd[0] != ':') + { + ++pSchemeEnd; + } + aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin); + } + } aBuffer.append(static_cast< sal_Unicode >(':')); bool bAuthority = getSchemeInfo().m_bAuthority; sal_Unicode const * pCoreBegin -- cgit From afda5098bec9e54ff29eeb147effc1894c2d2cf8 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 4 Mar 2010 16:14:56 +0100 Subject: #i109634# password to open/modify dialog --- vcl/inc/vcl/abstdlg.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx index 16d30c8f161f..c4ca98f6c459 100755 --- a/vcl/inc/vcl/abstdlg.hxx +++ b/vcl/inc/vcl/abstdlg.hxx @@ -74,6 +74,7 @@ class AbstractPasswordToOpenModifyDialog : public VclAbstractDialog public: virtual String GetPasswordToOpen() const = 0; virtual String GetPasswordToModify() const = 0; + virtual bool IsRecommendToOpenReadonly() const = 0; }; //------------------------------------------------------------- @@ -87,7 +88,7 @@ public: virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ) = 0; // creates instance of PasswordToOpenModifyDialog from cui - virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent ) = 0; + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen ) = 0; }; #endif -- cgit From 1f8c841f58229855518cf09a3058288b0a65e403 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 4 Mar 2010 22:13:08 +0100 Subject: sb118: #i109791# improved CPPUNIT_CFLAGS handling --- basebmp/test/makefile.mk | 4 +--- basegfx/test/makefile.mk | 4 +--- comphelper/qa/makefile.mk | 4 +--- o3tl/qa/makefile.mk | 4 +--- svl/qa/makefile.mk | 4 +--- tools/qa/makefile.mk | 5 +---- tools/test/makefile.mk | 4 +--- 7 files changed, 7 insertions(+), 22 deletions(-) diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 7dd374898641..ca77721716f7 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -60,9 +60,7 @@ CDEFS+=-xalias_level=compatible .ENDIF .ENDIF -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS += $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) # --- Common ---------------------------------------------------------- .IF "$(L10N_framework)"=="" diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index e29f69bd3516..79e65f1af5fa 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -36,9 +36,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS += $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) # --- Common ---------------------------------------------------------- diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk index 7c91456ac084..0360d308529e 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/makefile.mk @@ -33,9 +33,7 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS+= $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index c126c90b0771..c6fbc52ce2b1 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -36,9 +36,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS+= $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) .IF "$(L10N_framework)"=="" # --- Common ---------------------------------------------------------- diff --git a/svl/qa/makefile.mk b/svl/qa/makefile.mk index 072dfe7093bc..7e8c7ee795cc 100644 --- a/svl/qa/makefile.mk +++ b/svl/qa/makefile.mk @@ -35,9 +35,7 @@ ENABLE_EXCEPTIONS = true .INCLUDE : settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS+= $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) # BEGIN ---------------------------------------------------------------- # auto generated Target:job by codegen.pl diff --git a/tools/qa/makefile.mk b/tools/qa/makefile.mk index 4c633aad1946..abaea848c1db 100644 --- a/tools/qa/makefile.mk +++ b/tools/qa/makefile.mk @@ -32,10 +32,7 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS+= $(CPPUNIT_CFLAGS) -.ENDIF - +CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files SHL1TARGET = test_pathutils diff --git a/tools/test/makefile.mk b/tools/test/makefile.mk index 7f00fe2748b3..ab2cfd8e6676 100644 --- a/tools/test/makefile.mk +++ b/tools/test/makefile.mk @@ -36,9 +36,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -.IF "$(SYSTEM_CPPUNIT)"=="YES" -CFLAGS+= $(CPPUNIT_CFLAGS) -.ENDIF +CFLAGSCXX += $(CPPUNIT_CFLAGS) # --- Common ---------------------------------------------------------- -- cgit From fb85b7b2cd5ffe32d061ea58027f84872c6e923f Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Fri, 5 Mar 2010 00:30:14 +0100 Subject: dr73: #i109823# uninitialized variable; patch from --- svl/source/numbers/zformat.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 52d37b9cd26f..5aac50347c34 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -678,7 +678,7 @@ SvNumberformat::SvNumberformat(String& rString, xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr); if (nAnzChars > 0) { - short F_Type; + short F_Type = NUMBERFORMAT_UNDEFINED; if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) || ( F_Type != NUMBERFORMAT_NUMBER && F_Type != NUMBERFORMAT_SCIENTIFIC) ) -- cgit From 9d74616d0eed1f8cf3c8533bd83a6c09e5327d78 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Fri, 5 Mar 2010 11:39:15 +0100 Subject: sw33a11y01: #i92232# - provide tracked changes text markups as text attributes in ATK bridge. --- vcl/unx/gtk/a11y/atktext.cxx | 136 ++++++++++++++++++++++++++------- vcl/unx/gtk/a11y/atktextattributes.cxx | 46 +++++++++++ vcl/unx/gtk/a11y/atktextattributes.hxx | 5 ++ 3 files changed, 158 insertions(+), 29 deletions(-) diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index f346a6a5a02c..e6d3276891de 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -454,6 +454,84 @@ text_wrapper_set_caret_offset (AtkText *text, return FALSE; } +// --> OD 2010-03-04 #i92232# +AtkAttributeSet* +handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup, + const gint nTextMarkupType, + const gint offset, + AtkAttributeSet* pSet, + gint *start_offset, + gint *end_offset ) +{ + const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) ); + if ( nTextMarkupCount > 0 ) + { + for ( gint nTextMarkupIndex = 0; + nTextMarkupIndex < nTextMarkupCount; + ++nTextMarkupIndex ) + { + accessibility::TextSegment aTextSegment = + pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType ); + const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart; + const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd; + if ( nStartOffsetTextMarkup <= offset ) + { + if ( offset < nEndOffsetTextMarkup ) + { + // text markup at + *start_offset = ::std::max( *start_offset, + nStartOffsetTextMarkup ); + *end_offset = ::std::min( *end_offset, + nEndOffsetTextMarkup ); + switch ( nTextMarkupType ) + { + case com::sun::star::text::TextMarkupType::SPELLCHECK: + { + pSet = attribute_set_prepend_misspelled( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION: + { + pSet = attribute_set_prepend_tracked_change_insertion( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION: + { + pSet = attribute_set_prepend_tracked_change_deletion( pSet ); + } + break; + case com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE: + { + pSet = attribute_set_prepend_tracked_change_formatchange( pSet ); + } + break; + default: + { + OSL_ASSERT( false ); + } + } + break; // no further iteration needed. + } + else + { + *start_offset = ::std::max( *start_offset, + nEndOffsetTextMarkup ); + // continue iteration. + } + } + else + { + *end_offset = ::std::min( *end_offset, + nStartOffsetTextMarkup ); + break; // no further iteration. + } + } // eof iteration over text markups + } + + return pSet; +} +// <-- + static AtkAttributeSet * text_wrapper_get_run_attributes( AtkText *text, gint offset, @@ -491,41 +569,41 @@ text_wrapper_get_run_attributes( AtkText *text, } } - // Special handling for missspelled + // Special handling for misspelled text + // --> OD 2010-03-01 #i92232# + // - add special handling for tracked changes and refactor the + // corresponding code for handling misspelled text. accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text ); if( pTextMarkup ) { - uno::Sequence< accessibility::TextSegment > aTextSegmentSeq = - pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK ); - if( aTextSegmentSeq.getLength() > 0 ) + // Get attribute run here if it hasn't been done before + if( !bOffsetsAreValid ) { - accessibility::TextSegment aTextSegment = aTextSegmentSeq[0]; - gint nStartOffsetMisspelled = aTextSegment.SegmentStart; - gint nEndOffsetMisspelled = aTextSegment.SegmentEnd; - - // Get attribute run here if it hasn't been done before - if( !bOffsetsAreValid ) - { - accessibility::TextSegment aAttributeTextSegment = - pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); - *start_offset = aAttributeTextSegment.SegmentStart; - *end_offset = aAttributeTextSegment.SegmentEnd; - } - - if( nEndOffsetMisspelled <= offset ) - *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled ); - else if( nStartOffsetMisspelled <= offset ) - *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled ); - - if( nStartOffsetMisspelled > offset ) - *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled ); - else if( nEndOffsetMisspelled > offset ) - *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled ); - - if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset ) - pSet = attribute_set_prepend_misspelled( pSet ); + accessibility::TextSegment aAttributeTextSegment = + pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); + *start_offset = aAttributeTextSegment.SegmentStart; + *end_offset = aAttributeTextSegment.SegmentEnd; } + // handle misspelled text + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::SPELLCHECK, + offset, pSet, start_offset, end_offset ); + // handle tracked changes + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION, + offset, pSet, start_offset, end_offset ); + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION, + offset, pSet, start_offset, end_offset ); + pSet = handle_text_markup_as_run_attribute( + pTextMarkup, + com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE, + offset, pSet, start_offset, end_offset ); } + // <-- } catch(const uno::Exception& e){ diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 02624a9628cf..2b2dfec02653 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -74,6 +74,9 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID; static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; +// --> OD 2010-03-01 #i92232# +static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID; +// <-- /*****************************************************************************/ @@ -1308,6 +1311,49 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se return attribute_set; } +// --> OD 2010-03-01 #i92232# +AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "insertion" ) ); + + return attribute_set; +} + +AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "deletion" ) ); + + return attribute_set; +} + +AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set ) +{ + if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change ) + { + atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" ); + } + + attribute_set = attribute_set_prepend( attribute_set, + atk_text_attribute_tracked_change, + g_strdup_printf( "attribute-change" ) ); + + return attribute_set; +} +// <-- /*****************************************************************************/ diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx index e363460bb578..9c7628bf927e 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.hxx +++ b/vcl/unx/gtk/a11y/atktextattributes.hxx @@ -45,5 +45,10 @@ attribute_set_map_to_property_values( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList ); AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set ); +// --> OD 2010-03-01 #i92232# +AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set ); +AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set ); +AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set ); +// <-- #endif -- cgit From 64b01b14d1b43bcb67ccf1ac7337555803c5ddd0 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 8 Mar 2010 13:04:29 +0100 Subject: vcl110: #i109912# removed unused funtion (thanks cmc) --- rsc/inc/rsctools.hxx | 1 - rsc/source/tools/rscchar.cxx | 133 ------------------------------------------- 2 files changed, 134 deletions(-) diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index fd8e49135eb0..c5e73dbd9df7 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -71,7 +71,6 @@ class RscChar { public: static char * MakeUTF8( char * pStr, UINT16 nTextEncoding ); - static char * MakeUTF8FromL( char * pStr ); }; /****************** R s c P t r P t r ************************************/ diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx index 4f6c4ed7be5e..45c375e7b70d 100644 --- a/rsc/source/tools/rscchar.cxx +++ b/rsc/source/tools/rscchar.cxx @@ -197,136 +197,3 @@ char * RscChar::MakeUTF8( char * pStr, UINT16 nTextEncoding ) return pUtf8; }; - -/************************************************************************* -|* -|* RscChar::MakeChar() -|* -|* Beschreibung Der String wird nach C-Konvention umgesetzt -|* Ersterstellung MM 20.03.91 -|* Letzte Aenderung MM 20.03.91 -|* -*************************************************************************/ -char * RscChar::MakeUTF8FromL( char * pStr ) -{ - sal_Size nUniPos = 0; - sal_Unicode * pUniCode = new sal_Unicode[ strlen( pStr ) + 1 ]; - - char cOld = '1'; - while( cOld != 0 ) - { - sal_Unicode c; - if( *pStr == '\\' ) - { - ++pStr; - switch( *pStr ) - { - case 'a': - c = '\a'; - break; - case 'b': - c = '\b'; - break; - case 'f': - c = '\f'; - break; - case 'n': - c = '\n'; - break; - case 'r': - c = '\r'; - break; - case 't': - c = '\t'; - break; - case 'v': - c = '\v'; - break; - case '\\': - c = '\\'; - break; - case '?': - c = '\?'; - break; - case '\'': - c = '\''; - break; - case '\"': - c = '\"'; - break; - default: - { - if( '0' <= *pStr && '7' >= *pStr ) - { - UINT32 nChar = 0; - int i = 0; - while( '0' <= *pStr && '7' >= *pStr && i != 6 ) - { - nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0'; - ++pStr; - i++; - } - if( nChar > 0xFFFF ) - // Wert zu gross, oder kein 3 Ziffern - return( FALSE ); - c = (UINT16)nChar; - pStr--; - } - else if( 'x' == *pStr || 'X' == *pStr ) - { - UINT32 nChar = 0; - int i = 0; - ++pStr; - while( isxdigit( *pStr ) && i != 4 ) - { - if( isdigit( *pStr ) ) - nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0'; - else if( isupper( *pStr ) ) - nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10; - else - nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10; - ++pStr; - i++; - } - c = (UINT16)nChar; - pStr--; - } - else - c = *pStr; - }; - } - } - else - c = *pStr; - - pUniCode[ nUniPos++ ] = c; - cOld = *pStr; - pStr++; - } - - // factor fo 6 is the maximum size of an UNICODE character as utf8 - sal_Size nMaxUtf8Len = nUniPos * 6; - if( nUniPos * 6 > 0x0FFFFF ) - RscExit( 10 ); - - char * pUtf8 = (char *)rtl_allocateMemory( nMaxUtf8Len ); - rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 ); - - sal_uInt32 nInfo; - sal_Size nSrcCvtBytes; - rtl_convertUnicodeToText( hConv, 0, - pUniCode, nUniPos, - pUtf8, nMaxUtf8Len, - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT - | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT - | RTL_UNICODETOTEXT_FLAGS_FLUSH, - &nInfo, - &nSrcCvtBytes ); - - rtl_destroyUnicodeToTextConverter( hConv ); - - delete[] pUniCode; - - return pUtf8; -}; - -- cgit From 32229ffc22ef9256ee77ac0c2a4b0f966cc9a2b1 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 8 Mar 2010 14:02:49 +0100 Subject: vcl110: #i109913# use NoToglleOff bit (thanks dtardon) --- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index d42e736960d2..fcb3bdca7717 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -11526,7 +11526,7 @@ sal_Int32 PDFWriterImpl::findRadioGroupWidget( const PDFWriter::RadioButtonWidge m_aWidgets.back().m_nPage = m_nCurrentPage; m_aWidgets.back().m_eType = PDFWriter::RadioButton; m_aWidgets.back().m_nRadioGroup = rBtn.RadioGroup; - m_aWidgets.back().m_nFlags |= 0x00008000; + m_aWidgets.back().m_nFlags |= 0x0000C000; // NoToggleToOff and Radio bits // create radio button field name const rtl::OUString& rName = (m_aContext.Version > PDFWriter::PDF_1_2) ? -- cgit From 17ec95d14959b6475e60b15fa7da2c3a0568172e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 8 Mar 2010 14:17:21 +0100 Subject: vcl110: #i109924# remove uninitialized and unused return value (thanks cmc) --- vcl/os2/source/window/salframe.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 5e4b843c7cff..c751e48f5ea8 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -3035,10 +3035,8 @@ static void ImplHandleMoveMsg( HWND hWnd) // ----------------------------------------------------------------------- -static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) +static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) { - long nRet; - Os2SalFrame* pFrame = GetWindowPtr( hWnd ); if ( pFrame ) { @@ -3050,11 +3048,10 @@ static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); // Status merken ImplSaveFrameState( pFrame ); - nRet = pFrame->CallCallback( SALEVENT_RESIZE, 0 ); + pFrame->CallCallback( SALEVENT_RESIZE, 0 ); if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) WinUpdateWindow( pFrame->mhWndClient ); } - return nRet; } // ----------------------------------------------------------------------- -- cgit From 155791b70804fb83964c66db1c283c0b4e1ea19d Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 8 Mar 2010 14:31:48 +0100 Subject: #i101552# use current screenfont list for dynamic glyph fallback --- vcl/win/source/gdi/salgdi3.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index a71022ed57b8..42509649ca3f 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -385,6 +385,7 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar ) { bFirst = false; // TODO: use the default-CJK language instead + // TODO: use default language determined by #i97086# // when the setting from Tools->Options->LangSettings->Languages becomes available here LanguageType nDefaultCJK = LANGUAGE_CHINESE; const LanguageType nUILang = Application::GetSettings().GetUILanguage(); @@ -434,18 +435,16 @@ class WinGlyphFallbackSubstititution : public ImplGlyphFallbackFontSubstitution { public: - WinGlyphFallbackSubstititution( HDC, ImplDevFontList* ); + WinGlyphFallbackSubstititution( HDC ); bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const; private: HDC mhDC; - ImplDevFontList* mpFontList; bool HasMissingChars( const ImplFontData*, const rtl::OUString& rMissingChars ) const; }; -inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC, ImplDevFontList* pDFL ) +inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC ) : mhDC( hDC ) -, mpFontList( pDFL ) {} void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*, @@ -525,7 +524,8 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo // first level fallback: // try use the locale specific default fonts defined in VCL.xcu - /*const*/ ImplDevFontListData* pDevFont = mpFontList->ImplFindByLocale( aLocale ); + const ImplDevFontList* pDevFontList = ImplGetSVData()->maGDIData.mpScreenFontList; + /*const*/ ImplDevFontListData* pDevFont = pDevFontList->ImplFindByLocale( aLocale ); if( pDevFont ) { const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData ); @@ -537,7 +537,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo } // are the missing characters symbols? - pDevFont = mpFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, + pDevFont = pDevFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL, rFontSelData.meWeight, rFontSelData.meWidthType, rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName ); if( pDevFont ) @@ -551,7 +551,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFo } // last level fallback, check each font type face one by one - const ImplGetDevFontList* pTestFontList = mpFontList->GetDevFontList(); + const ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList(); // limit the count of fonts to be checked to prevent hangs static const int MAX_GFBFONT_COUNT = 600; int nTestFontCount = pTestFontList->Count(); @@ -2507,8 +2507,8 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) bImplSalCourierNew = aInfo.mbImplSalCourierNew; } - // set font fallback hook - static WinGlyphFallbackSubstititution aSubstFallback( mhDC, pFontList ); + // set glyph fallback hook + static WinGlyphFallbackSubstititution aSubstFallback( mhDC ); pFontList->SetFallbackHook( &aSubstFallback ); } -- cgit From 176b670a1142752950dddfab4bda587c8e8c3bf5 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 9 Mar 2010 11:38:53 +0100 Subject: ##i101552# use default CJK language determined from the registry --- vcl/win/source/gdi/salgdi3.cxx | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 42509649ca3f..c991d1db2be0 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -379,17 +379,34 @@ static Unicode2LangType aLangFromCodeChart[]= { // get language matching to the missing char LanguageType MapCharToLanguage( sal_UCS4 uChar ) { - // entries marked with default-CJK should get replaced with a default-CJK language + // entries marked with default-CJK get replaced with the prefered CJK language static bool bFirst = true; if( bFirst ) { bFirst = false; - // TODO: use the default-CJK language instead - // TODO: use default language determined by #i97086# - // when the setting from Tools->Options->LangSettings->Languages becomes available here + + // use method suggested in #i97086# to determnine the systems default language + // TODO: move into i18npool or sal/osl/w32/nlsupport.c + LanguageType nDefaultLang = 0; + HKEY hKey = NULL; + LONG lResult = ::RegOpenKeyExA( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\Nls\\Language", + 0, KEY_QUERY_VALUE, &hKey ); + char aKeyValBuf[16]; + DWORD nKeyValSize = sizeof(aKeyValBuf); + if( ERROR_SUCCESS == lResult ) + lResult = RegQueryValueExA( hKey, "Default", NULL, NULL, (LPBYTE)aKeyValBuf, &nKeyValSize ); + aKeyValBuf[ sizeof(aKeyValBuf)-1 ] = '\0'; + if( ERROR_SUCCESS == lResult ) + nDefaultLang = (LanguageType)rtl_str_toInt32( aKeyValBuf, 16 ); + + // TODO: use the default-CJK language selected in + // Tools->Options->LangSettings->Languages when it becomes available here + if( !nDefaultLang ) + nDefaultLang = Application::GetSettings().GetUILanguage(); + LanguageType nDefaultCJK = LANGUAGE_CHINESE; - const LanguageType nUILang = Application::GetSettings().GetUILanguage(); - switch( nUILang ) + switch( nDefaultLang ) { case LANGUAGE_JAPANESE: case LANGUAGE_KOREAN: @@ -399,13 +416,14 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar ) case LANGUAGE_CHINESE_SINGAPORE: case LANGUAGE_CHINESE_HONGKONG: case LANGUAGE_CHINESE_MACAU: - nDefaultCJK = nUILang; + nDefaultCJK = nDefaultLang; break; default: nDefaultCJK = LANGUAGE_CHINESE; break; } + // change the marked entries to prefered language static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)); for( int i = 0; i < nCount; ++i ) { -- cgit From 293546a2d9e2826d6102d8c2c8f5ab1dab6e08b1 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 9 Mar 2010 15:59:00 +0100 Subject: sw33a11y01 #i92233# - provide mm to pixel ratio as default paragraph attribute at Writer's implementation of for paragraphs --- vcl/unx/gtk/a11y/atktextattributes.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx index 2b2dfec02653..04498810597f 100644 --- a/vcl/unx/gtk/a11y/atktextattributes.cxx +++ b/vcl/unx/gtk/a11y/atktextattributes.cxx @@ -77,6 +77,9 @@ static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID; // --> OD 2010-03-01 #i92232# static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID; // <-- +// --> OD 2010-03-05 #i92233# +static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID; +// <-- /*****************************************************************************/ @@ -106,6 +109,9 @@ enum ExportedAttribute TEXT_ATTRIBUTE_STRIKETHROUGH, TEXT_ATTRIBUTE_UNDERLINE, TEXT_ATTRIBUTE_WEIGHT, + // --> OD 2010-03-05 #i92233# + TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO, + // <-- TEXT_ATTRIBUTE_JUSTIFICATION, TEXT_ATTRIBUTE_BOTTOM_MARGIN, TEXT_ATTRIBUTE_FIRST_LINE_INDENT, @@ -140,6 +146,9 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] = "CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH "CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE "CharWeight", // TEXT_ATTRIBUTE_WEIGHT + // --> OD 2010-03-05 #i92233# + "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO + // <-- "ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION "ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN "ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT @@ -1296,6 +1305,14 @@ attribute_set_new_from_property_values( attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops, get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String)); + // --> OD 2010-03-05 #i92233# + if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio ) + atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio"); + + attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio, + get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String)); + // <-- + return attribute_set; } -- cgit From 4093882718bdd989f2f4d46f8565e3ec6d552af0 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 9 Mar 2010 17:31:37 +0100 Subject: sb120: #i109978# removed --disable-qadevooo --- comphelper/qa/complex/makefile.mk | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/comphelper/qa/complex/makefile.mk b/comphelper/qa/complex/makefile.mk index 341b6868e1ec..ec0efdd1188c 100644 --- a/comphelper/qa/complex/makefile.mk +++ b/comphelper/qa/complex/makefile.mk @@ -32,9 +32,6 @@ PRJNAME = comphelper # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk - -.IF "$(BUILD_QADEVOOO)" == "YES" - #----- compile .java files ----------------------------------------- JARFILES := ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar @@ -63,8 +60,6 @@ RUNNER_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket, RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex $(RUNNER_APPEXECCOMMAND) -.END # "$(BUILD_QADEVOOO)" == "YES" - # --- Targets ------------------------------------------------------ .IF "$(depend)" == "" @@ -78,7 +73,6 @@ ALL: ALLDEP .INCLUDE : target.mk -.IF "$(BUILD_QADEVOOO)" == "YES" show_targets: +@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s#.java##:s#./#complex.#)) @@ -87,11 +81,3 @@ run: run_%: +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//) - -.ELSE -run: show_targets - -show_targets: - +@echo "Built without qadevOOo, no QA tests" - -.ENDIF -- cgit From dc354f51b456f9415765d4c40338cd96697a2709 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 10 Mar 2010 12:00:53 +0000 Subject: cmcfixes73: #i109922# fix new[]/delete mismatch --- tools/source/fsys/tdir.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index 429835d35ab3..b6bf48a8cdf9 100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -266,7 +266,7 @@ void Dir::Construct( DirEntryKind nKindFlags ) strcpy( pBuffer, aTStr.GetBuffer() ); CharLowerBuff( pBuffer, aTStr.Len() ); aNameMask = WildCard( String(pBuffer, osl_getThreadTextEncoding()), ';' ); - delete pBuffer; + delete [] pBuffer; } #else aNameMask = WildCard( CutName(), ';' ); -- cgit From 6bc4ab1dd2d46cd6d0a96c859109bf8013dc6ff7 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 10 Mar 2010 18:24:59 +0100 Subject: vcl110: #i109855# grow printer listbox if possible --- vcl/source/window/printdlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 649ca21a32b8..5f10fda14492 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -560,7 +560,7 @@ void PrintDialog::JobTabPage::setupLayout() // add printer fixed line maLayout.addWindow( &maPrinterFL ); // add print LB - maLayout.addWindow( &maPrinters ); + maLayout.addWindow( &maPrinters, 3 ); // create a row for details button/text and properties button boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) ); -- cgit From ce39973f507b24585f38bcb6f0687dff9e24f854 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 11 Mar 2010 07:31:52 +0100 Subject: dtardon02: #i108509# remove empty files in l10ntools --- l10ntools/inc/wrdtrans.hxx | 87 --------------- l10ntools/source/wrdtrans.cxx | 245 ------------------------------------------ 2 files changed, 332 deletions(-) delete mode 100644 l10ntools/inc/wrdtrans.hxx delete mode 100644 l10ntools/source/wrdtrans.cxx diff --git a/l10ntools/inc/wrdtrans.hxx b/l10ntools/inc/wrdtrans.hxx deleted file mode 100644 index b0b65526a2a2..000000000000 --- a/l10ntools/inc/wrdtrans.hxx +++ /dev/null @@ -1,87 +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. - * - ************************************************************************/ -/* - -// OBSOLETE // - -#ifndef TX3_WRDTRANS_HXX -#define TX3_WRDTRANS_HXX - -// USED - // Base Classes - // Components -class WordTransTree; -class WordTrans_ErrorList; - // Parameters -#include - -class WordTransformer -{ - public: - enum E_Error - { - OK = 0, - ERROR_NO_WORDLIST, - ERROR_HOTKEY, - ERROR_OUTPUTSTRING_TOO_LONG, - OTHER_ERROR - }; - - // LIFECYCLE - WordTransformer(); - ~WordTransformer(); - BOOL LoadWordlist( /// @return False, if file could not be read, or there is already a wordlist loaded. - const ByteString & i_sWordlist_Filepath, - CharSet i_nWorkingCharSet = RTL_TEXTENCODING_MS_1252, - CharSet i_nFileCharSet = RTL_TEXTENCODING_MS_1252 ); - - // OPERATIONS - USHORT Transform( /// @return The number of errors during transforming. - ByteString & io_sText); - - // INQUIRY - USHORT NrOfErrors() const; - E_Error GetError( - USHORT i_nNr, /// [0 .. NrOfErrors()-1], other values return an empty error. - ByteString * o_pErrorText = 0) const; /// If o_pErrorText != 0, the String is filled with the description of the error. - - private: - // SERVICE FUNCTION - void CreateError(); - - // DATA - WordTransTree * dpTransformer; - WordTrans_ErrorList * - dpErrors; -}; - - - -#endif - - -*/ diff --git a/l10ntools/source/wrdtrans.cxx b/l10ntools/source/wrdtrans.cxx deleted file mode 100644 index 10d6f472640f..000000000000 --- a/l10ntools/source/wrdtrans.cxx +++ /dev/null @@ -1,245 +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_l10ntools.hxx" - -/* -#include "wrdtrans.hxx" - - -// NOT FULLY DECLARED SERVICES -#include -#include - - -#include -#include "wtratree.hxx" - -#include -*/ -//************** Declaration WordTrans_ErrorList ******************// -/* -typedef NAMESPACE_STD(vector) Stl_ByteStringList; - -class WordTrans_ErrorList -{ - public: - // OPERATIONS - void AddError( - WordTransformer::E_Error - i_eType, - const char * i_sErrorDescription ); - void Clear(); /// Empties the list. - - // INQUIRY - USHORT NrOfErrors() const; - WordTransformer::E_Error - GetError( - USHORT i_nNr, /// [0 .. NrOfErrors()-1], other values return an empty error. - ByteString * o_pErrorText ) const; /// If o_pErrorText != 0, the String is filled with the description of the error. - private: - // DATA - Stl_ByteStringList aErrors; -}; - -*/ - -//************** Implementation WordTransformer ******************// - -/* -WordTransformer::WordTransformer() - : dpTransformer(0), - dpErrors(new WordTrans_ErrorList) -{ -} - -WordTransformer::~WordTransformer() -{ - if (dpTransformer != 0) - delete dpTransformer; - delete dpErrors; -} - -BOOL -WordTransformer::LoadWordlist( const ByteString & i_sWordlist_Filepath, - CharSet i_nWorkingCharSet, - CharSet i_nFileCharSet ) -{ - if (dpTransformer != 0) - return FALSE; - - SvFileStream aFile(String(i_sWordlist_Filepath,RTL_TEXTENCODING_ASCII_US),STREAM_STD_READ); - if (! aFile.IsOpen()) - return FALSE; - aFile.SetStreamCharSet( i_nFileCharSet ) ; -// aFile.SetTargetCharSet( i_nWorkingCharSet ); - - dpTransformer = new WordTransTree; - - ByteString sTrans; - while ( aFile.ReadLine(sTrans) ) - { - dpTransformer->AddWordPair(sTrans.GetToken(0,';'),sTrans.GetToken(1,';')); - } - - aFile.Close(); - return TRUE; -} - -USHORT -WordTransformer::Transform(ByteString & io_sText) -{ - // Initialization and precondition testing: - dpErrors->Clear(); - if (dpTransformer == 0) - { - dpErrors->AddError(ERROR_NO_WORDLIST,"Error: No wordlist was loaded."); - return dpErrors->NrOfErrors(); - } - else if (io_sText.Len() > 63 * 1024) - { - dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Inputstring was too long (bigger than 63 KB)."); - return dpErrors->NrOfErrors(); - } - else if (io_sText.Len() == 0) - { - return 0; - } - - // Transform: - dpTransformer->InitTransformation( - io_sText.GetBuffer(), - io_sText.Len() ); - - for ( ; !dpTransformer->TextEndReached(); ) - { - if (dpTransformer->TransformNextToken() != WordTransTree::OK) - { - CreateError(); - } - } - io_sText = dpTransformer->Output(); - return dpErrors->NrOfErrors(); -} - -USHORT -WordTransformer::NrOfErrors() const -{ - return dpErrors->NrOfErrors(); -} - -WordTransformer::E_Error -WordTransformer::GetError( USHORT i_nNr, - ByteString * o_pErrorText) const -{ - return dpErrors->GetError(i_nNr,o_pErrorText); -} - -void -WordTransformer::CreateError() -{ - ByteString sErr; - - switch (dpTransformer->CurResult()) - { - case WordTransTree::OK: - break; - case WordTransTree::HOTKEY_LOST: - sErr = ByteString("Error: By replacement of string "); - sErr += dpTransformer->CurReplacedString(); - sErr += " by "; - sErr += dpTransformer->CurReplacingString(); - sErr += "the hotkey at char '"; - sErr += dpTransformer->CurHotkey(); - sErr += "' was lost."; - dpErrors->AddError( ERROR_HOTKEY,sErr.GetBufferAccess()); - sErr.ReleaseBufferAccess(); - break; - case WordTransTree::OUTPUT_OVERFLOW: - dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Output buffer overflow."); - break; - default: - dpErrors->AddError(OTHER_ERROR,"Error: Unknown error."); - } -} -*/ -//************** Implementation WordTrans_ErrorList ******************// -/* -void -WordTrans_ErrorList::AddError( WordTransformer::E_Error i_eType, - const char * i_sErrorDescription ) -{ - ByteString sErrorType = "xxx"; - char * pErrorChars = sErrorType.GetBufferAccess(); - pErrorChars[0] = char(i_eType / 100 + '0'); - pErrorChars[1] = char( (i_eType % 100) / 10 + '0'); - pErrorChars[2] = char(i_eType % 10 + '0'); - sErrorType += i_sErrorDescription; - - aErrors.push_back(sErrorType); - sErrorType.ReleaseBufferAccess(); -} - -void -WordTrans_ErrorList::Clear() -{ - aErrors.erase(aErrors.begin(),aErrors.end()); -} - -USHORT -WordTrans_ErrorList::NrOfErrors() const -{ - return aErrors.size(); -} - -WordTransformer::E_Error -WordTrans_ErrorList::GetError( USHORT i_nNr, - ByteString * o_pErrorText ) const -{ - if ( i_nNr < aErrors.size() ) - { - const ByteString & rError = aErrors[i_nNr]; - const char * pErrorChars = rError.GetBuffer(); - - USHORT nError = USHORT( (pErrorChars[0] - '0') ) * 100 - + (pErrorChars[1] - '0') * 10 - + pErrorChars[2] - '0'; - - if (o_pErrorText != 0) - *o_pErrorText = pErrorChars+3; - - return WordTransformer::E_Error(nError); - } - else - { - if (o_pErrorText != 0) - *o_pErrorText = ""; - return WordTransformer::OK; - } -} -*/ -- cgit From 9a992be38e9a362fc38a6ef567b0abe035858a23 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 11 Mar 2010 11:08:03 +0100 Subject: dba33f: #i110044#: when calculating entry heights, also care for entries without text and image --- vcl/source/control/ilstbox.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index ab353a4d4798..8b82b330a78a 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -744,6 +744,13 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) aMetrics.nEntryHeight ); } + if ( !aMetrics.bText && !aMetrics.bImage && !IsUserDrawEnabled() ) + { + // entries which have no (aka an empty) text, and no image, and are not user-drawn, should be + // shown nonetheless + aMetrics.nEntryHeight = mnTextHeight + mnBorder; + } + if ( aMetrics.nEntryWidth > mnMaxWidth ) mnMaxWidth = aMetrics.nEntryWidth; if ( aMetrics.nEntryHeight > mnMaxHeight ) -- cgit From d69aec985db024d46f35080a047d9df3dad2aa75 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 11 Mar 2010 13:13:07 +0100 Subject: tkr33: fixed spurious merge error --- ucbhelper/inc/ucbhelper/registerucb.hxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ucbhelper/inc/ucbhelper/registerucb.hxx b/ucbhelper/inc/ucbhelper/registerucb.hxx index 9f7e6533adf3..e2427248dce2 100644 --- a/ucbhelper/inc/ucbhelper/registerucb.hxx +++ b/ucbhelper/inc/ucbhelper/registerucb.hxx @@ -127,7 +127,3 @@ UCBHELPER_DLLPUBLIC bool registerAtUcb( } #endif // _UCBHELPER_REGISTERUCB_HXX_ -:star::uno::RuntimeException); - -} -#endif // _UCBHELPER_REGISTERUCB_HXX_ -- cgit From 27aa543a8a2fac7aa1367cc7a378a34077d3308e Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Thu, 11 Mar 2010 17:56:43 +0100 Subject: bugs fixed for build on macOS --- svtools/inc/svtools/accessibletable.hxx | 1 - svtools/source/table/gridtablerenderer.cxx | 2 ++ svtools/source/table/tablecontrol_impl.cxx | 16 +++++++--------- svtools/source/uno/svtxgridcontrol.cxx | 4 ++-- toolkit/source/controls/grid/defaultgriddatamodel.cxx | 2 +- toolkit/source/controls/grid/gridcolumn.cxx | 9 +++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index e13a0afe9469..cce4990aa758 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -34,7 +34,6 @@ #include #include #include -#include // ============================================================================ diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 7e721832c04c..4518cb2c0512 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -108,6 +108,7 @@ namespace svt { namespace table _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); _rDevice.Pop(); + (void)_rStyle; (void)_bIsColHeaderArea; (void)_bIsRowHeaderArea; } @@ -254,6 +255,7 @@ namespace svt { namespace table // TODO: active? selected? (void)_bActive; (void)_bSelected; + (void)_rStyle; //at the moment no special paint for selected row header _rDevice.Pop(); } diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 9bc8644276f1..d738d4312d46 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1117,8 +1117,6 @@ namespace svt { namespace table ::com::sun::star::uno::Any rCellData; if(!aCellData.empty() && iter != aCellData.begin()+m_nLeftColumn+nActualCols) { - TableSize nPartlyVisibleCols = impl_getVisibleColumns(false); - TableSize nPartlyVisibleRows = impl_getVisibleRows(false); rCellData = *iter; ++iter; Size siz = m_rAntiImpl.GetSizePixel(); @@ -2099,9 +2097,9 @@ namespace svt { namespace table { m_nResizingColumn = m_nCurColumn; PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); - sal_Int32 colWidth = pColumn->getWidth(); - //impl_ni_getAccVisibleColWidths(); - int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + //sal_Int32 colWidth = pColumn->getWidth(); + ////impl_ni_getAccVisibleColWidths(); + //int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable()) { m_pDataWindow->CaptureMouse(); @@ -2118,7 +2116,7 @@ namespace svt { namespace table PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); int maxWidth = pColumn->getMaxWidth(); int minWidth = pColumn->getMinWidth(); - int colWidth = pColumn->getWidth(); + //int colWidth = pColumn->getWidth(); int resizeCol = m_nResizingColumn-m_nLeftColumn; //new position of mouse int actX = rPoint.X(); @@ -2234,9 +2232,9 @@ namespace svt { namespace table //-------------------------------------------------------------------- rtl::OUString TableControl_Impl::impl_convertToString(::com::sun::star::uno::Any value) { - sal_Int32 nInt; - sal_Bool bBool; - double fDouble; + sal_Int32 nInt = 0; + sal_Bool bBool = false; + double fDouble = 0; ::rtl::OUString sNewString; ::rtl::OUString sConvertString; if(value >>= sConvertString) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index ce04078687b1..8a6f8f350e49 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -216,7 +216,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_TEXTCOLOR: { - com::sun::star::util::Color colorText; + sal_Int32 colorText = 0xFFFFFF; if( aValue >>= colorText ) { m_pTableModel->setTextColor(colorText); @@ -225,7 +225,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_VERTICALALIGN: { - com::sun::star::style::VerticalAlignment vAlign; + com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0)); if( aValue >>= vAlign ) { switch( vAlign ) diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index c564618336af..2d695a9bad0a 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" -#include "DefaultGridDataModel.hxx" +#include "defaultgriddatamodel.hxx" #include #include #include diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index e8dadc527fbd..6ae502de7157 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -52,9 +52,10 @@ namespace toolkit GridColumn::GridColumn() : identifier(Any()) -,horizontalAlign(HorizontalAlignment(0)) -,columnWidth(4) +,columnWidth(10) ,bResizeable(true) +,horizontalAlign(HorizontalAlignment(0)) + { } @@ -162,13 +163,13 @@ void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star: bResizeable = value; } //--------------------------------------------------------------------- -HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() +HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException) { return horizontalAlign; } //--------------------------------------------------------------------- -void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) +void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException) { horizontalAlign = align; } -- cgit From 61664303ef9f75e30a109f114a5e10348eb5b8ec Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 11 Mar 2010 18:15:22 +0100 Subject: allow popup windows without tear off --- vcl/inc/vcl/dockwin.hxx | 4 ++- vcl/source/window/dockmgr.cxx | 62 ++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/vcl/inc/vcl/dockwin.hxx b/vcl/inc/vcl/dockwin.hxx index 982180e945fd..f99f774a18be 100644 --- a/vcl/inc/vcl/dockwin.hxx +++ b/vcl/inc/vcl/dockwin.hxx @@ -155,7 +155,7 @@ public: void Unlock(); BOOL IsLocked() const; - void StartPopupMode( ToolBox* pParentToolBox ); + void StartPopupMode( ToolBox* pParentToolBox, ULONG nPopupModeFlags ); BOOL IsInPopupMode() const; void TitleButtonClick( USHORT nButton ); @@ -237,6 +237,8 @@ public: BOOL IsLocked( const Window *pWin ); void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin ); + void StartPopupMode( ToolBox *pParentToolBox, const Window *pWin, ULONG nPopupModeFlags ); + BOOL IsInPopupMode( const Window *pWin ); void EndPopupMode( const Window *pWin ); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 5b028e511e24..f8dcb0265c81 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -429,11 +429,19 @@ void DockingManager::SetFloatingMode( const Window *pWindow, BOOL bFloating ) pWrapper->SetFloatingMode( bFloating ); } -void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow ) +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, ULONG nFlags ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) - pWrapper->StartPopupMode( pParentToolBox ); + pWrapper->StartPopupMode( pParentToolBox, nFlags ); +} + +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow ) +{ + StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF | + FLOATWIN_POPUPMODE_NOFOCUSCLOSE | + FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | + FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); } BOOL DockingManager::IsInPopupMode( const Window *pWindow ) @@ -533,10 +541,11 @@ private: Point maDelta; Point maTearOffPosition; bool mbGripAtBottom; + bool mbHasGrip; void ImplSetBorder(); public: - ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ); + ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ); ~ImplPopupFloatWin(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); @@ -553,9 +562,11 @@ public: Point GetTearOffPosition() const; void DrawGrip(); void DrawBorder(); + + bool hasGrip() const { return mbHasGrip; } }; -ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin ) : +ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) : FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW) { mpWindowImpl->mbToolbarFloatingWindow = TRUE; // indicate window type, required for accessibility @@ -565,6 +576,7 @@ ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* mbMoving = FALSE; mbTrackingEnabled = FALSE; mbGripAtBottom = TRUE; + mbHasGrip = bHasGrip; ImplSetBorder(); } @@ -600,7 +612,9 @@ void ImplPopupFloatWin::ImplSetBorder() // we're using a special border for the grip // by setting those members the method SetOutputSizePixel() can // be used to set the proper window size - mpWindowImpl->mnTopBorder = 1 + POPUP_DRAGHEIGHT+2; + mpWindowImpl->mnTopBorder = 1; + if( hasGrip() ) + mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2; mpWindowImpl->mnBottomBorder = 1; mpWindowImpl->mnLeftBorder = 1; mpWindowImpl->mnRightBorder = 1; @@ -614,21 +628,24 @@ void ImplPopupFloatWin::Resize() Rectangle ImplPopupFloatWin::GetDragRect() const { - Rectangle aRect( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); - if( mbGripAtBottom ) + Rectangle aRect; + if( hasGrip() ) { - int height = GetOutputSizePixel().Height(); - aRect.Top() = height - 3 - POPUP_DRAGHEIGHT; - aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT; + aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); + if( mbGripAtBottom ) + { + int height = GetOutputSizePixel().Height(); + aRect.Top() = height - 3 - POPUP_DRAGHEIGHT; + aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT; + } } - return aRect; } Point ImplPopupFloatWin::GetToolboxPosition() const { // return inner position where a toolbox could be placed - Point aPt( 1, 1 + (mbGripAtBottom ? 0 : GetDragRect().getHeight()) ); // grip + border + Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border return aPt; } @@ -643,7 +660,6 @@ Point ImplPopupFloatWin::GetTearOffPosition() const void ImplPopupFloatWin::DrawBorder() { SetFillColor(); - SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); Point aPt; Rectangle aRect( aPt, GetOutputSizePixel() ); @@ -653,9 +669,16 @@ void ImplPopupFloatWin::DrawBorder() if( !aItemClipRect.IsEmpty() ) { aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); + + // draw the excluded border part with the background color of a toolbox + SetClipRegion( Region( aItemClipRect ) ); + SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() ); + DrawRect( aRect ); + aClipRgn.Exclude( aItemClipRect ); SetClipRegion( aClipRgn ); } + SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); DrawRect( aRect ); SetClipRegion( oldClipRgn ); } @@ -751,7 +774,8 @@ void ImplPopupFloatWin::Paint( const Rectangle& ) Rectangle aRect( aPt, GetOutputSizePixel() ); DrawWallpaper( aRect, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) ); DrawBorder(); - DrawGrip(); + if( hasGrip() ) + DrawGrip(); } void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) @@ -1220,7 +1244,7 @@ BOOL ImplDockingWindowWrapper::IsTitleButtonVisible( USHORT nButton ) const // ----------------------------------------------------------------------- -void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) +void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, ULONG nFlags ) { // do nothing if window is floating if( IsFloatingMode() ) @@ -1235,7 +1259,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) mpOldBorderWin = NULL; // no border window found // the new parent for popup mode - ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this ); + ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) ); pWin->SetText( GetWindow()->GetText() ); @@ -1265,12 +1289,6 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox ) // (SetPosPixel etc. check for valid mpFloatWin pointer) mpFloatWin = pWin; - ULONG nFlags = FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOFOCUSCLOSE | - FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; -// |FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; - // if the subtoolbar was opened via keyboard make sure that key events // will go into subtoolbar if( pParentToolBox->IsKeyEvent() ) -- cgit From d701c3f7c839d146790c1f63d705330a1668ab01 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 11 Mar 2010 18:18:08 +0100 Subject: moved toolbarmenu to svtools and reworked to non sfx2 code --- svtools/inc/svtools/popupwindowcontroller.hxx | 83 ++ svtools/inc/svtools/toolbarmenu.hxx | 153 +++ svtools/inc/svtools/toolboxcontroller.hxx | 4 + svtools/inc/svtools/valueset.hxx | 3 + svtools/source/control/makefile.mk | 10 +- svtools/source/control/toolbarmenu.cxx | 1652 +++++++++++++++++++++++++ svtools/source/control/toolbarmenuacc.cxx | 956 ++++++++++++++ svtools/source/control/toolbarmenuimp.hxx | 307 +++++ svtools/source/control/valueimp.hxx | 1 + svtools/source/control/valueset.cxx | 28 +- svtools/source/uno/makefile.mk | 9 +- svtools/source/uno/popupwindowcontroller.cxx | 215 ++++ svtools/source/uno/toolboxcontroller.cxx | 21 + 13 files changed, 3426 insertions(+), 16 deletions(-) create mode 100644 svtools/inc/svtools/popupwindowcontroller.hxx create mode 100644 svtools/inc/svtools/toolbarmenu.hxx create mode 100644 svtools/source/control/toolbarmenu.cxx create mode 100644 svtools/source/control/toolbarmenuacc.cxx create mode 100644 svtools/source/control/toolbarmenuimp.hxx create mode 100644 svtools/source/uno/popupwindowcontroller.cxx diff --git a/svtools/inc/svtools/popupwindowcontroller.hxx b/svtools/inc/svtools/popupwindowcontroller.hxx new file mode 100644 index 000000000000..e9f586724bc4 --- /dev/null +++ b/svtools/inc/svtools/popupwindowcontroller.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_ +#define __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_ + +#include "svtools/svtdllapi.h" + +#include + +#include "svtools/toolboxcontroller.hxx" +#include "boost/scoped_ptr.hpp" + +class Window; + +namespace svt +{ +class PopupWindowControllerImpl; + +class SVT_DLLPUBLIC PopupWindowController : public svt::ToolboxController, public ::com::sun::star::lang::XServiceInfo +{ +public: + PopupWindowController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + const rtl::OUString& aCommandURL ); + ~PopupWindowController(); + + virtual ::Window* createPopupWindow( ::Window* pParent ) = 0; + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) = 0; + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) = 0; + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + +private: + boost::scoped_ptr< PopupWindowControllerImpl > mpImpl; +}; + +} // namespace svt + +#endif // __SVTOOLS_POPUPWINDOWCONTROLLER_HXX_ diff --git a/svtools/inc/svtools/toolbarmenu.hxx b/svtools/inc/svtools/toolbarmenu.hxx new file mode 100644 index 000000000000..943f714b0097 --- /dev/null +++ b/svtools/inc/svtools/toolbarmenu.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _SVTOOLS_TOOLBARMENU_HXX_ +#define _SVTOOLS_TOOLBARMENU_HXX_ + +#include "svtools/svtdllapi.h" + +#include +#include +#include + +#include + +#include + +#include +#include +#include + +class ValueSet; + +namespace svtools { + +class ToolbarMenuEntry; +struct ToolbarMenu_Impl; + +class SVT_DLLPUBLIC ToolbarMenu : public DockingWindow +{ + friend class ToolbarMenuStatusListener; + friend struct ToolbarMenu_Impl; +public: + ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + WinBits nBits ); + + ToolbarMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, + Window* pParentWindow, + const ResId& rResId ); + + ~ToolbarMenu(); + + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvent ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void RequestHelp( const HelpEvent& rHEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); + + void appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits = 0 ); + void appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits = 0 ); + void appendSeparator(); + + /** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */ + ValueSet* createEmptyValueSetControl(); + + void checkEntry( int nEntryId, bool bCheck = true ); + bool isEntryChecked( int nEntryId ) const; + + void enableEntry( int nEntryId, bool bEnable = true ); + bool isEntryEnabled( int nEntryId ) const; + + void setEntryText( int nEntryId, const String& rStr ); + const String& getEntryText( int nEntryId ) const; + + void setEntryImage( int nEntryId, const Image& rImage ); + const Image& getEntryImage( int nEntryId ) const; + + const Size& getMenuSize() const; + + void SetSelectHdl( const Link& rLink ); + const Link& GetSelectHdl() const; + + int getSelectedEntryId() const; + int getHighlightedEntryId() const; + +protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + + // todo: move to new base class that will replace SfxPopupWindow + void AddStatusListener( const rtl::OUString& rCommandURL ); + void RemoveStatusListener( const rtl::OUString& rCommandURL ); + void UpdateStatus( const rtl::OUString& rCommandURL ); + + bool IsInPopupMode(); + void EndPopupMode(); + + // XStatusListener (subclasses must override this one to get the status updates + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + void StateChanged( StateChangedType nType ); + void DataChanged( const DataChangedEvent& rDCEvt ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetFrame() const; +private: + DECL_LINK( HighlightHdl, Control * ); + + void initStatusListener(); + + void implInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + void initWindow(); + + Size implCalcSize(); + + void appendEntry( ToolbarMenuEntry* pEntry ); + + void implPaint( ToolbarMenuEntry* pThisOnly = NULL, bool bHighlight = false ); + + void implHighlightEntry( int nHighlightEntry, bool bHighlight ); + void implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ); + + void implChangeHighlightEntry( int nEntry ); + void implSelectEntry( int nSelectedEntry ); + + ToolbarMenuEntry* implCursorUpDown( bool bUp, bool bHomeEnd ); + ToolbarMenuEntry* implGetEntry( int nEntry ) const; + ToolbarMenuEntry* implSearchEntry( int nEntryId ) const; + + ToolbarMenu_Impl* mpImpl; +}; + +} // namespace svtools + +#endif diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index 740c6999f909..2253d6bf0806 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -106,6 +106,10 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + const rtl::OUString& getCommandURL() const { return m_aCommandURL; } + + void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + protected: struct Listener { diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx index fc12f9517b6d..7beffc5eb34a 100644 --- a/svtools/inc/svtools/valueset.hxx +++ b/svtools/inc/svtools/valueset.hxx @@ -429,6 +429,9 @@ public: void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; } const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } + void SetHighlightHdl( const Link& rLink ); + const Link& GetHighlightHdl() const; + private: /** Determine whether RTL (right to left writing) is active. For this method to return two conditions have to be fullfilled: diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk index eecf983ab756..08764b3f60af 100644 --- a/svtools/source/control/makefile.mk +++ b/svtools/source/control/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -54,7 +50,9 @@ EXCEPTIONSFILES=\ $(SLO)$/scriptedtext.obj\ $(SLO)$/fmtfield.obj \ $(SLO)$/inettbc.obj \ - $(SLO)$/valueacc.obj + $(SLO)$/valueacc.obj \ + $(SLO)$/toolbarmenu.obj \ + $(SLO)$/toolbarmenuacc.obj SLOFILES=\ $(EXCEPTIONSFILES) \ diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx new file mode 100644 index 000000000000..a16f60bc5822 --- /dev/null +++ b/svtools/source/control/toolbarmenu.cxx @@ -0,0 +1,1652 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_svtools.hxx" + +#include +#include + +#include +#include +#include +#include + +#include "svtools/valueset.hxx" +#include "svtools/toolbarmenu.hxx" +#include "toolbarmenuimp.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::accessibility; + +namespace svtools { + +// -------------------------------------------------------------------- + +static Window* GetTopMostParentSystemWindow( Window* pWindow ) +{ + OSL_ASSERT( pWindow ); + if ( pWindow ) + { + // ->manually search topmost system window + // required because their might be another system window between this and the top window + pWindow = pWindow->GetParent(); + SystemWindow* pTopMostSysWin = NULL; + while ( pWindow ) + { + if ( pWindow->IsSystemWindow() ) + pTopMostSysWin = (SystemWindow*)pWindow; + pWindow = pWindow->GetParent(); + } + pWindow = pTopMostSysWin; + OSL_ASSERT( pWindow ); + return pWindow; + } + + return NULL; +} + +// -------------------------------------------------------------------- + +void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits ) +{ + mnEntryId = nEntryId; + mnBits = nBits; + + mbHasText = false; + mbHasImage = false; + mbHasControl = false; + mbChecked = false; + mbEnabled = true; + + mpControl = NULL; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits ) +: mrMenu( rMenu ) +{ + init( nEntryId, nBits ); + + maText = rText; + mbHasText = true; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits ) +: mrMenu( rMenu ) +{ + init( nEntryId, nBits ); + + maImage = rImage; + mbHasImage = true; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ) +: mrMenu( rMenu ) +{ + init( nEntryId, nBits ); + + maText = rText; + mbHasText = true; + + maImage = rImage; + mbHasImage = true; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry::ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits ) +: mrMenu( rMenu ) +{ + init( nEntryId, nBits ); + + if( pControl ) + { + mpControl = pControl; + mpControl->Show(); + } +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry::~ToolbarMenuEntry() +{ + if( mxAccContext.is() ) + { + Reference< XComponent > xComponent( mxAccContext, UNO_QUERY ); + if( xComponent.is() ) + xComponent->dispose(); + mxAccContext.clear(); + } + delete mpControl; +} + +// -------------------------------------------------------------------- + +const Reference< XAccessibleContext >& ToolbarMenuEntry::GetAccessible( bool bCreate /* = false */ ) +{ + if( !mxAccContext.is() && bCreate ) + { + if( mpControl ) + { + mxAccContext = Reference< XAccessibleContext >( mpControl->GetAccessible( TRUE ), UNO_QUERY ); + } + else + { + mxAccContext = Reference< XAccessibleContext >( new ToolbarMenuEntryAcc( this ) ); + } + } + + return mxAccContext; +} + +// -------------------------------------------------------------------- + +sal_Int32 ToolbarMenuEntry::getAccessibleChildCount() throw (RuntimeException) +{ + if( mpControl ) + { + const Reference< XAccessibleContext >& xContext = GetAccessible( true ); + if( xContext.is() ) + { + return xContext->getAccessibleChildCount(); + } + } + return 1; +} + +// -------------------------------------------------------------------- + +Reference< XAccessible > ToolbarMenuEntry::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const Reference< XAccessibleContext >& xContext = GetAccessible( true ); + if( mpControl ) + { + if( xContext.is() ) + { + return xContext->getAccessibleChild(index); + } + } + else if( index == 0 ) + { + Reference< XAccessible > xRet( xContext, UNO_QUERY ); + if( xRet.is() ) + return xRet; + } + + throw IndexOutOfBoundsException(); +} + +// -------------------------------------------------------------------- + +ToolbarMenu_Impl::ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ) +: mrMenu( rMenu ) +, mxFrame( xFrame ) +, mxServiceManager( ::comphelper::getProcessServiceFactory() ) +, mnCheckPos(0) +, mnImagePos(0) +, mnTextPos(0) +, mnHighlightedEntry(-1) +, mnSelectedEntry(-1) +, mnLastColumn(0) +{ +} + +// -------------------------------------------------------------------- + +ToolbarMenu_Impl::~ToolbarMenu_Impl() +{ + setAccessible( 0 ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu_Impl::setAccessible( ToolbarMenuAcc* pAccessible ) +{ + if( mxAccessible.get() != pAccessible ) + { + if( mxAccessible.is() ) + mxAccessible->dispose(); + + mxAccessible.set( pAccessible ); + } +} + +// ----------------------------------------------------------------------- + +void ToolbarMenu_Impl::fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ) +{ + if( mxAccessible.is() ) + mxAccessible->FireAccessibleEvent( nEventId, rOldValue, rNewValue ); +} + +// ----------------------------------------------------------------------- + +bool ToolbarMenu_Impl::hasAccessibleListeners() +{ + return( mxAccessible.is() && mxAccessible->HasAccessibleListeners() ); +} + +// -------------------------------------------------------------------- + +sal_Int32 ToolbarMenu_Impl::getAccessibleChildCount() throw (RuntimeException) +{ + sal_Int32 nCount = 0; + const int nEntryCount = maEntryVector.size(); + for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; + if( pEntry ); + { + if( pEntry->mpControl ) + { + nCount += pEntry->getAccessibleChildCount(); + } + else + { + nCount += 1; + } + } + } + + return nCount; +} + +// -------------------------------------------------------------------- + +Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( sal_Int32 index ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const int nEntryCount = maEntryVector.size(); + for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; + if( pEntry ) + { + const sal_Int32 nCount = pEntry->getAccessibleChildCount(); + if( index < nCount ) + { + return pEntry->getAccessibleChild( index ); + } + index -= nCount; + } + } + + throw IndexOutOfBoundsException(); +} + +void ToolbarMenu_Impl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const int nEntryCount = maEntryVector.size(); + for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; + if( pEntry ) + { + const sal_Int32 nCount = pEntry->getAccessibleChildCount(); + if( nChildIndex < nCount ) + { + if( pEntry->mpControl ) + { + Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW ); + xSel->selectAccessibleChild(nChildIndex); + } + else if( pEntry->mnEntryId != TITLE_ID ) + { + mrMenu.implSelectEntry( nEntry ); + } + return; + } + nChildIndex -= nCount; + } + } + + throw IndexOutOfBoundsException(); +} + +// -------------------------------------------------------------------- + +sal_Bool ToolbarMenu_Impl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const int nEntryCount = maEntryVector.size(); + for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; + if( pEntry ) + { + const sal_Int32 nCount = pEntry->getAccessibleChildCount(); + if( nChildIndex < nCount ) + { + if( mnHighlightedEntry == nEntry ) + { + if( pEntry->mpControl ) + { + Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW ); + xSel->isAccessibleChildSelected(nChildIndex); + } + return true; + } + else + { + return false; + } + } + nChildIndex -= nCount; + } + } + + throw IndexOutOfBoundsException(); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu_Impl::clearAccessibleSelection() +{ + if( mnHighlightedEntry != -1 ) + { + mrMenu.implHighlightEntry( mnHighlightedEntry, false ); + mnHighlightedEntry = -1; + } +} + +// -------------------------------------------------------------------- + +IMPL_LINK( ToolbarMenu, HighlightHdl, Control *, pControl ) +{ + (void)pControl; + if( mpImpl->hasAccessibleListeners() ) + mpImpl->fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + return 0; +} + +// ==================================================================== + +ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, WinBits nBits ) +: DockingWindow(pParentWindow, nBits) +{ + implInit(rFrame); +} + +// -------------------------------------------------------------------- + +ToolbarMenu::ToolbarMenu( const Reference< XFrame >& rFrame, Window* pParentWindow, const ResId& rResId ) +: DockingWindow(pParentWindow, rResId) +{ + implInit(rFrame); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implInit(const Reference< XFrame >& rFrame) +{ + mpImpl = new ToolbarMenu_Impl( *this, rFrame ); + + initWindow(); + + Window* pWindow = GetTopMostParentSystemWindow( this ); + if ( pWindow ) + ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); +} + +// -------------------------------------------------------------------- + +ToolbarMenu::~ToolbarMenu() +{ + Window* pWindow = GetTopMostParentSystemWindow( this ); + if ( pWindow ) + ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); + + if ( mpImpl->mxStatusListener.is() ) + { + mpImpl->mxStatusListener->dispose(); + mpImpl->mxStatusListener.clear(); + } + + // delete all menu entries + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + delete mpImpl->maEntryVector[nEntry]; + } + + delete mpImpl; +} + +// -------------------------------------------------------------------- + +int ToolbarMenu::getSelectedEntryId() const +{ + ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnSelectedEntry ); + return pEntry ? pEntry->mnEntryId : -1; +} + +// -------------------------------------------------------------------- + +int ToolbarMenu::getHighlightedEntryId() const +{ + ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry ); + return pEntry ? pEntry->mnEntryId : -1; +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::checkEntry( int nEntryId, bool bChecked ) +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry && pEntry->mbChecked != bChecked ) + { + pEntry->mbChecked = bChecked; + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +bool ToolbarMenu::isEntryChecked( int nEntryId ) const +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + return pEntry && pEntry->mbChecked; +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::enableEntry( int nEntryId, bool bEnable ) +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry && pEntry->mbEnabled != bEnable ) + { + pEntry->mbEnabled = bEnable; + if( pEntry->mpControl ) + { + pEntry->mpControl->Enable( bEnable ); + + // hack for the valueset to make it paint itself anew + pEntry->mpControl->Resize(); + } + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +bool ToolbarMenu::isEntryEnabled( int nEntryId ) const +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + return pEntry && pEntry->mbEnabled; +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::setEntryText( int nEntryId, const String& rStr ) +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry && pEntry->maText != rStr ) + { + pEntry->maText = rStr; + mpImpl->maSize = implCalcSize(); + if( IsVisible() ) + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +const String& ToolbarMenu::getEntryText( int nEntryId ) const +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry ) + return pEntry->maText; + else + { + static String aEmptyStr; + return aEmptyStr; + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::setEntryImage( int nEntryId, const Image& rImage ) +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry && pEntry->maImage != rImage ) + { + pEntry->maImage = rImage; + mpImpl->maSize = implCalcSize(); + if( IsVisible() ) + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +const Image& ToolbarMenu::getEntryImage( int nEntryId ) const +{ + ToolbarMenuEntry* pEntry = implSearchEntry( nEntryId ); + if( pEntry ) + return pEntry->maImage; + else + { + static Image aEmptyImage; + return aEmptyImage; + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::initWindow() +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); + + SetPointFont( rStyleSettings.GetMenuFont() ); + SetBackground( Wallpaper( GetControlBackground() ) ); + SetTextColor( rStyleSettings.GetMenuTextColor() ); + SetTextFillColor(); + SetLineColor(); + + mpImpl->maSize = implCalcSize(); +} + +// -------------------------------------------------------------------- + +Size ToolbarMenu::implCalcSize() +{ + const long nFontHeight = GetTextHeight(); + long nExtra = nFontHeight/4; + + Size aSz; + Size aMaxImgSz; + long nMaxTextWidth = 0; + long nMinMenuItemHeight = nFontHeight; + sal_Bool bCheckable = sal_False; + + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + + const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + if ( rSettings.GetUseImagesInMenus() ) + { + nMinMenuItemHeight = 16; + + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + if( pEntry && pEntry->mbHasImage ) + { + Size aImgSz = pEntry->maImage.GetSizePixel(); + if ( aImgSz.Height() > aMaxImgSz.Height() ) + aMaxImgSz.Height() = aImgSz.Height(); + if ( aImgSz.Height() > nMinMenuItemHeight ) + nMinMenuItemHeight = aImgSz.Height(); + break; + } + } + } + + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + + if( pEntry ) + { + pEntry->maSize.Height() = 0; + pEntry->maSize.Width() = 0; + + + if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) + bCheckable = sal_True; + + // Image: + if( pEntry->mbHasImage ) + { + Size aImgSz = pEntry->maImage.GetSizePixel(); + if ( (aImgSz.Width() + 4) > aMaxImgSz.Width() ) + aMaxImgSz.Width() = aImgSz.Width() + 4; + if ( (aImgSz.Height() + 4) > aMaxImgSz.Height() ) + aMaxImgSz.Height() = aImgSz.Height() + 4; + if ( (aImgSz.Height() + 4) > pEntry->maSize.Height() ) + pEntry->maSize.Height() = aImgSz.Height() + 4; + } + } + } + + int gfxExtra = Max( nExtra, 7L ); + + if ( aMaxImgSz.Width() ) + mpImpl->mnTextPos += gfxExtra; + if ( bCheckable ) + mpImpl->mnTextPos += 16; + + mpImpl->mnCheckPos = nExtra; + mpImpl->mnImagePos = nExtra; + mpImpl->mnTextPos = mpImpl->mnImagePos + aMaxImgSz.Width(); + + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + + if( pEntry ) + { + // Text: + if( pEntry->mbHasText ) + { + long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mpImpl->mnTextPos; + nMaxTextWidth = Max( nTextWidth, nMaxTextWidth ); + + pEntry->maSize.Height() = Max( Max( GetTextHeight(), pEntry->maSize.Height() ), nMinMenuItemHeight ); + } + // Control: + else if( pEntry->mpControl ) + { + Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); + + nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); + pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ) + 1; + } + aSz.Height() += pEntry->maSize.Height(); + } + else + { + aSz.Height() += SEPARATOR_HEIGHT; + } + } + + aSz.Width() = nMaxTextWidth + (BORDER_X<<1); + aSz.Height() += BORDER_Y<<1; + + // positionate controls + int nY = BORDER_Y; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + + if( pEntry ) + { + if( pEntry->mpControl ) + { + Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); + Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY); + if( pEntry->mbHasText ) + aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; + + pEntry->mpControl->SetPosPixel( aControlPos ); + + pEntry->maRect = Rectangle( aControlPos, aControlSize ); + } + else + { + pEntry->maRect = Rectangle( Point( 0, nY ), pEntry->maSize ); + } + + nY += pEntry->maSize.Height(); + } + else + { + nY += SEPARATOR_HEIGHT; + } + } + + return aSz; +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::GetFocus() +{ + if( mpImpl->mnHighlightedEntry == -1 ) + implChangeHighlightEntry( 0 ); + + DockingWindow::GetFocus(); + + // Tell the accessible object that we got the focus. + if( mpImpl->mxAccessible.is() ) + mpImpl->mxAccessible->GetFocus(); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::LoseFocus() +{ + if( mpImpl->mnHighlightedEntry != -1 ) + implChangeHighlightEntry( -1 ); + + DockingWindow::LoseFocus(); + + // Tell the accessible object that we lost the focus. + if( mpImpl->mxAccessible.is() ) + mpImpl->mxAccessible->LoseFocus(); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nItemBits ) +{ + appendEntry( new ToolbarMenuEntry( *this, nEntryId, rStr, nItemBits ) ); +} + + +#if 0 +todo acc selectentry? + if( ImplHasAccessibleListeners() ) + { + // focus event (deselect) + if( nOldItem ) + { + const USHORT nPos = GetItemPos( nItemId ); + + if( nPos != VALUESET_ITEM_NOTFOUND ) + { + ValueItemAcc* pItemAcc = ValueItemAcc::getImplementation( + mpImpl->mpItemList->GetObject( nPos )->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); + + if( pItemAcc ) + { + ::com::sun::star::uno::Any aOldAny, aNewAny; + if( !mpImpl->mbIsTransientChildrenDisabled) + { + aOldAny <<= ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( + static_cast< ::cppu::OWeakObject* >( pItemAcc )); + ImplFireAccessibleEvent (::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny ); + } + else + { + aOldAny <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + pItemAcc->FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); + } + } + } + } + + // focus event (select) + const USHORT nPos = GetItemPos( mnSelItemId ); + + ValueSetItem* pItem; + if( nPos != VALUESET_ITEM_NOTFOUND ) + pItem = mpImpl->mpItemList->GetObject(nPos); + else + pItem = mpNoneItem; + + ValueItemAcc* pItemAcc = NULL; + if (pItem != NULL) + pItemAcc = ValueItemAcc::getImplementation(pItem->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); + + if( pItemAcc ) + { + ::com::sun::star::uno::Any aOldAny, aNewAny; + if( !mpImpl->mbIsTransientChildrenDisabled) + { + aNewAny <<= ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( + static_cast< ::cppu::OWeakObject* >( pItemAcc )); + ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny ); + } + else + { + aNewAny <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; + pItemAcc->FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); + } + } + + // selection event + ::com::sun::star::uno::Any aOldAny, aNewAny; + ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny ); + } + } +} + +#endif + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits ) +{ + appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, nItemBits ) ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, const Image& rImage, MenuItemBits nItemBits ) +{ + appendEntry( new ToolbarMenuEntry( *this, nEntryId, rImage, rStr, nItemBits ) ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendEntry( int nEntryId, Control* pControl, MenuItemBits nItemBits ) +{ + appendEntry( new ToolbarMenuEntry( *this, nEntryId, pControl, nItemBits ) ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendEntry( ToolbarMenuEntry* pEntry ) +{ + mpImpl->maEntryVector.push_back( pEntry ); + mpImpl->maSize = implCalcSize(); + if( IsVisible() ) + Invalidate(); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::appendSeparator() +{ + appendEntry( 0 ); +} + +// -------------------------------------------------------------------- + +/** creates an empty ValueSet that is initialized and can be inserted with appendEntry. */ +ValueSet* ToolbarMenu::createEmptyValueSetControl() +{ + ValueSet* pSet = new ValueSet( this, WB_TABSTOP | WB_MENUSTYLEVALUESET | WB_FLATVALUESET | WB_NOBORDER | WB_NO_DIRECTSELECT ); + pSet->EnableFullItemMode( FALSE ); + pSet->SetColor( GetControlBackground() ); + pSet->SetHighlightHdl( LINK( this, ToolbarMenu, HighlightHdl ) ); + return pSet; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const +{ + if( (nEntry < 0) || (nEntry >= (int)mpImpl->maEntryVector.size() ) ) + return NULL; + + return mpImpl->maEntryVector[nEntry]; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const +{ + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* p = mpImpl->maEntryVector[nEntry]; + if( p && p->mnEntryId == nEntryId ) + { + return p; + } + } + + return NULL; +} + +// -------------------------------------------------------------------- + +static void implDeselectControl( Control* pControl ) +{ + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); + if( pValueSet ) + { + pValueSet->SetNoSelection(); + pValueSet->Invalidate(); + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) +{ + Size aSz = GetOutputSizePixel(); + long nY = BORDER_Y; + long nX = BORDER_X; + + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* p = mpImpl->maEntryVector[nEntry]; + if( p ) + { + if(nEntry == nHighlightEntry) + { + if( p->mpControl == NULL ) + { + Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); + SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); + SetLineColor(); + DrawRect( aRect ); + + if( bHighlight ) + { + aRect.nLeft += 1; + aRect.nTop += 1; + aRect.nBottom -= 1; + aRect.nRight -= 1; + DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); + } + } + else + { + if( !bHighlight ) + implDeselectControl( p->mpControl ); + } + + implPaint( p, bHighlight ); + break; + } + + nY += p->maSize.Height(); + } + else + { + nY += SEPARATOR_HEIGHT; + } + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implSelectEntry( int nSelectedEntry ) +{ + mpImpl->mnSelectedEntry = nSelectedEntry; + + ToolbarMenuEntry* pEntry = NULL; + if( nSelectedEntry != -1 ) + pEntry = mpImpl->maEntryVector[ nSelectedEntry ]; + + if( pEntry ) + mpImpl->maSelectHdl.Call( this ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::MouseButtonDown( const MouseEvent& rMEvt ) +{ + implHighlightEntry( rMEvt, true ); + + implSelectEntry( mpImpl->mnHighlightedEntry ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::MouseButtonUp( const MouseEvent& ) +{ +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) +{ + if ( !IsVisible() ) + return; + + implHighlightEntry( rMEvt, false ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) +{ + long nY = 0; + long nMouseY = rMEvt.GetPosPixel().Y(); + Size aOutSz = GetOutputSizePixel(); + if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) + { + bool bHighlighted = FALSE; + + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + if( pEntry ) + { + long nOldY = nY; + nY += pEntry->maSize.Height(); + + if( pEntry->mnEntryId != TITLE_ID ) + { + if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) ) + { + if( bMBDown ) + { + if( nEntry != mpImpl->mnHighlightedEntry ) + { + implChangeHighlightEntry( nEntry ); + } + } + else + { + if ( nEntry != mpImpl->mnHighlightedEntry ) + { + implChangeHighlightEntry( nEntry ); + } + } + bHighlighted = true; + } + } + } + else + { + nY += SEPARATOR_HEIGHT; + } + } + if ( !bHighlighted ) + implChangeHighlightEntry( -1 ); + } + else + { + implChangeHighlightEntry( -1 ); + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implChangeHighlightEntry( int nEntry ) +{ + if( mpImpl->mnHighlightedEntry != -1 ) + { + implHighlightEntry( mpImpl->mnHighlightedEntry, false ); + } + + mpImpl->mnHighlightedEntry = nEntry; + Invalidate(); + + if( mpImpl->mnHighlightedEntry != -1 ) + { + implHighlightEntry( mpImpl->mnHighlightedEntry, true ); + } + + if( mpImpl->hasAccessibleListeners() ) + mpImpl->fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); +} + +// -------------------------------------------------------------------- + +static bool implCheckSubControlCursorMove( Control* pControl, bool bUp, int& nLastColumn ) +{ + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); + if( pValueSet ) + { + USHORT nItemPos = pValueSet->GetItemPos( pValueSet->GetSelectItemId() ); + if( nItemPos != VALUESET_ITEM_NOTFOUND ) + { + const USHORT nColCount = pValueSet->GetColCount(); + const USHORT nLine = nItemPos / nColCount; + + nLastColumn = nItemPos - (nLine * nColCount); + + if( bUp ) + { + return nLine > 0; + } + else + { + const USHORT nLineCount = (pValueSet->GetItemCount() + nColCount - 1) / nColCount; + return (nLine+1) < nLineCount; + } + } + } + + return false; +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) +{ + int n = 0, nLoop = 0; + if( !bHomeEnd ) + { + n = mpImpl->mnHighlightedEntry; + if( n == -1 ) + { + if( bUp ) + n = 0; + else + n = mpImpl->maEntryVector.size()-1; + } + else + { + // if we have a currently selected entry and + // cursor keys are used than check if this entry + // has a control that can use those cursor keys + ToolbarMenuEntry* pData = mpImpl->maEntryVector[n]; + if( pData && pData->mpControl && !pData->mbHasText ) + { + if( implCheckSubControlCursorMove( pData->mpControl, bUp, mpImpl->mnLastColumn ) ) + return pData; + } + } + nLoop = n; + } + else + { + // absolute positioning + if( bUp ) + { + n = mpImpl->maEntryVector.size(); + nLoop = n-1; + } + else + { + n = -1; + nLoop = mpImpl->maEntryVector.size()-1; + } + } + + do + { + if( bUp ) + { + if ( n ) + n--; + else + if( mpImpl->mnHighlightedEntry == -1 ) + n = mpImpl->maEntryVector.size()-1; + else + break; + } + else + { + if( n < ((int)mpImpl->maEntryVector.size()-1) ) + n++; + else + if( mpImpl->mnHighlightedEntry == -1 ) + n = 0; + else + break; + } + + ToolbarMenuEntry* pData = mpImpl->maEntryVector[n]; + if( pData && (pData->mnEntryId != TITLE_ID) ) + { + implChangeHighlightEntry( n ); + return pData; + } + } while ( n != nLoop ); + + return 0; +} + +// -------------------------------------------------------------------- + +static void implHighlightControl( USHORT nCode, Control* pControl, int nLastColumn ) +{ + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); + if( pValueSet ) + { + const USHORT nItemCount = pValueSet->GetItemCount(); + USHORT nItemPos = VALUESET_ITEM_NOTFOUND; + switch( nCode ) + { + case KEY_UP: + { + const USHORT nColCount = pValueSet->GetColCount(); + const USHORT nLastLine = nItemCount / nColCount; + nItemPos = std::min( ((nLastLine-1) * nColCount) + nLastColumn, nItemCount-1 ); + break; + } + case KEY_DOWN: + nItemPos = std::min( nLastColumn, nItemCount-1 ); + break; + case KEY_END: + nItemPos = nItemCount -1; + break; + case KEY_HOME: + nItemPos = 0; + break; + } + pValueSet->SelectItem( pValueSet->GetItemId( nItemPos ) ); + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) +{ + Control* pForwardControl = 0; + USHORT nCode = rKEvent.GetKeyCode().GetCode(); + switch ( nCode ) + { + case KEY_UP: + case KEY_DOWN: + { + int nOldEntry = mpImpl->mnHighlightedEntry; + ToolbarMenuEntry*p = implCursorUpDown( nCode == KEY_UP, false ); + if( p && p->mpControl ) + { + if( nOldEntry != mpImpl->mnHighlightedEntry ) + { + implHighlightControl( nCode, p->mpControl, mpImpl->mnLastColumn ); + } + else + { + // in case we are in a system floating window, GrabFocus does not work :-/ + pForwardControl = p->mpControl; + } + } + } + break; + case KEY_END: + case KEY_HOME: + { + ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); + if( p && p->mpControl ) + { + implHighlightControl( nCode, p->mpControl, mpImpl->mnLastColumn ); + } + } + break; + case KEY_F6: + case KEY_ESCAPE: + { + // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document + if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() ) + break; + + implSelectEntry( -1 ); + } + break; + + case KEY_RETURN: + { + ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry ); + if ( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) ) + { + if( pEntry->mpControl ) + { + pForwardControl = pEntry->mpControl; + } + else + { + implSelectEntry( mpImpl->mnHighlightedEntry ); + } + } + } + break; + default: + { + ToolbarMenuEntry* pEntry = implGetEntry( mpImpl->mnHighlightedEntry ); + if ( pEntry && pEntry->mbEnabled && pEntry->mpControl && !pEntry->mbHasText ) + { + pForwardControl = pEntry->mpControl; + } + } + + } + if( pForwardControl ) + pForwardControl->KeyInput( rKEvent ); + +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) +{ + const long nFontHeight = GetTextHeight(); + const long nExtra = nFontHeight/4; + + DecorationView aDecoView( this ); + const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + + const Size aOutSz( GetOutputSizePixel() ); + + Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; + + const int nEntryCount = mpImpl->maEntryVector.size(); + int nEntry; + for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + Point aPos( aTopLeft ); + + USHORT nTextStyle = 0; + USHORT nSymbolStyle = 0; + USHORT nImageStyle = 0; + if( pEntry && !pEntry->mbEnabled ) + { + nTextStyle |= TEXT_DRAW_DISABLE; + nSymbolStyle |= SYMBOL_DRAW_DISABLE; + nImageStyle |= IMAGE_DRAW_DISABLE; + } + + // Separator + if( pEntry == NULL ) + { + if( pThisOnly == NULL ) + { + aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); + + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); + aTmpPos.Y()++; + SetLineColor( rSettings.GetLightColor() ); + DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); + SetLineColor(); + } + + aTopLeft.Y() += SEPARATOR_HEIGHT; + } + else + { + if( !pThisOnly || ( pEntry == pThisOnly ) ) + { + const bool bTitle = pEntry->mnEntryId == TITLE_ID; + + if( pThisOnly && bHighlighted ) + SetTextColor( rSettings.GetMenuHighlightTextColor() ); + else + SetTextColor( rSettings.GetMenuTextColor() ); + + Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); + if( bTitle ) + { + // fill the background + SetFillColor(rSettings.GetDialogColor()); + SetLineColor(); + DrawRect(aRect); + SetLineColor( rSettings.GetLightColor() ); + DrawLine( aRect.TopLeft(), aRect.TopRight() ); + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); + } + else if( pEntry->mpControl ) + { + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); + } + + long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); + + // Image + if( pEntry->mbHasImage ) + { + aTmpPos.X() = aPos.X() + mpImpl->mnImagePos; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; + DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); + } + // Text: + if( pEntry->mbHasText ) + { + aTmpPos.X() = aPos.X() + (bTitle ? 4 : mpImpl->mnTextPos); + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nTextOffsetY; + USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; + + DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); + } + + // CheckMark + if( pEntry->mbChecked ) + { + if( pEntry->mbHasImage ) + { + aTmpPos.X() = aPos.X() + mpImpl->mnImagePos; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; + + Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); + aSelRect.nLeft -= 2; + aSelRect.nTop -= 2; + aSelRect.nRight += 2; + aSelRect.nBottom += 2; + DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); + } + else + { + Rectangle aSelRect; + SymbolType eSymbol; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nExtra/2; + aTmpPos.Y() += pEntry->maSize.Height() / 2; + if ( pEntry->mnBits & MIB_RADIOCHECK ) + { + aTmpPos.X() = aPos.X() + mpImpl->mnCheckPos; + eSymbol = SYMBOL_RADIOCHECKMARK; + aTmpPos.Y() -= nFontHeight/4; + aSelRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); + } + else + { + aTmpPos.X() = aPos.X() + mpImpl->mnCheckPos; + eSymbol = SYMBOL_CHECKMARK; + aTmpPos.Y() -= nFontHeight/4; + aSelRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); + } + aDecoView.DrawSymbol( aSelRect, eSymbol, GetTextColor(), nSymbolStyle ); + } + } + } + + aTopLeft.Y() += pEntry->maSize.Height(); + } + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::Paint( const Rectangle& ) +{ + implPaint(); + + if( mpImpl->mnHighlightedEntry != -1 ) + implHighlightEntry( mpImpl->mnHighlightedEntry, true ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::RequestHelp( const HelpEvent& rHEvt ) +{ + DockingWindow::RequestHelp( rHEvt ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::StateChanged( StateChangedType nType ) +{ + DockingWindow::StateChanged( nType ); + + if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) ) + { + initWindow(); + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::DataChanged( const DataChangedEvent& rDCEvt ) +{ + DockingWindow::DataChanged( rDCEvt ); + + if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || + (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || + ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) + { + initWindow(); + Invalidate(); + } +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::Command( const CommandEvent& rCEvt ) +{ + if ( rCEvt.GetCommand() == COMMAND_WHEEL ) + { + const CommandWheelData* pData = rCEvt.GetWheelData(); + if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) + { + implCursorUpDown( pData->GetDelta() > 0L, false ); + } + } +} + +// -------------------------------------------------------------------- + +Reference< ::com::sun::star::accessibility::XAccessible > ToolbarMenu::CreateAccessible() +{ + mpImpl->setAccessible( new ToolbarMenuAcc( *mpImpl ) ); + return Reference< XAccessible >( mpImpl->mxAccessible.get() ); +} + +// -------------------------------------------------------------------- + +// todo: move to new base class that will replace SfxPopupWindo +void ToolbarMenu::AddStatusListener( const rtl::OUString& rCommandURL ) +{ + initStatusListener(); + mpImpl->mxStatusListener->addStatusListener( rCommandURL ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::RemoveStatusListener( const rtl::OUString& rCommandURL ) +{ + mpImpl->mxStatusListener->removeStatusListener( rCommandURL ); +} +// -------------------------------------------------------------------- + + +void ToolbarMenu::UpdateStatus( const rtl::OUString& rCommandURL ) +{ + mpImpl->mxStatusListener->updateStatus( rCommandURL ); +} + +// -------------------------------------------------------------------- + +// XStatusListener (subclasses must override this one to get the status updates +void SAL_CALL ToolbarMenu::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& /*Event*/ ) throw ( ::com::sun::star::uno::RuntimeException ) +{ +} + +// -------------------------------------------------------------------- + +class ToolbarMenuStatusListener : public svt::FrameStatusListener +{ +public: + ToolbarMenuStatusListener( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolbarMenu& rToolbarMenu ); + + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + ToolbarMenu* mpMenu; +}; + +// -------------------------------------------------------------------- + +ToolbarMenuStatusListener::ToolbarMenuStatusListener( + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + ToolbarMenu& rToolbarMenu ) +: svt::FrameStatusListener( xServiceManager, xFrame ) +, mpMenu( &rToolbarMenu ) +{ +} + +// -------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuStatusListener::dispose() throw (::com::sun::star::uno::RuntimeException) +{ + mpMenu = 0; + svt::FrameStatusListener::dispose(); +} + +// -------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) +{ + if( mpMenu ) + mpMenu->statusChanged( Event ); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::initStatusListener() +{ + if( !mpImpl->mxStatusListener.is() ) + mpImpl->mxStatusListener.set( new ToolbarMenuStatusListener( mpImpl->mxServiceManager, mpImpl->mxFrame, *this ) ); +} + +// -------------------------------------------------------------------- + +bool ToolbarMenu::IsInPopupMode() +{ + return GetDockingManager()->IsInPopupMode(this); +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::EndPopupMode() +{ + GetDockingManager()->EndPopupMode(this); +} + +// -------------------------------------------------------------------- + +const Size& ToolbarMenu::getMenuSize() const +{ + return mpImpl->maSize; +} + +// -------------------------------------------------------------------- + +void ToolbarMenu::SetSelectHdl( const Link& rLink ) +{ + mpImpl->maSelectHdl = rLink; +} + +// -------------------------------------------------------------------- + +const Link& ToolbarMenu::GetSelectHdl() const +{ + return mpImpl->maSelectHdl; +} + +// -------------------------------------------------------------------- + +Reference< XFrame > ToolbarMenu::GetFrame() const +{ + return mpImpl->mxFrame; +} + +// -------------------------------------------------------------------- + + +// -------------------------------------------------------------------- + +} + + diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx new file mode 100644 index 000000000000..702c1f72b83d --- /dev/null +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -0,0 +1,956 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_svtools.hxx" + +#include +#include +#include + +#include + +#include + +#include "svtools/toolbarmenu.hxx" + +#include "toolbarmenuimp.hxx" + +using ::rtl::OUString; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; + +namespace svtools { + +// ------------------ +// - ToolbarMenuAcc - +// ------------------ + +ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl& rParent ) +: ToolbarMenuAccComponentBase(m_aMutex) +, mpParent( &rParent ) +, mbIsFocused(false) +{ +} + +// ----------------------------------------------------------------------------- + +ToolbarMenuAcc::~ToolbarMenuAcc() +{ +} + +// ----------------------------------------------------------------------- + +void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue ) +{ + if( nEventId ) + { + EventListenerVector aTmpListeners( mxEventListeners ); + EventListenerVector::const_iterator aIter( aTmpListeners.begin() ); + AccessibleEventObject aEvtObject; + + aEvtObject.EventId = nEventId; + aEvtObject.Source = static_cast(this); + aEvtObject.NewValue = rNewValue; + aEvtObject.OldValue = rOldValue; + + while( aIter != aTmpListeners.end() ) + { + try + { + (*aIter)->notifyEvent( aEvtObject ); + } + catch( Exception& ) + { + } + + aIter++; + } + } +} + +// ----------------------------------------------------------------------------- + +void ToolbarMenuAcc::GetFocus (void) +{ + mbIsFocused = true; + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any( AccessibleStateType::FOCUSED ) ); +} + +// ----------------------------------------------------------------------------- + +void ToolbarMenuAcc::LoseFocus (void) +{ + mbIsFocused = false; + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any( AccessibleStateType::FOCUSED ), Any() ); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException) +{ + ThrowIfDisposed(); + return this; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + return mpParent->getAccessibleChildCount(); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + return mpParent->getAccessibleChild(i); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + + Reference< XAccessible > xRet; + + Window* pParent = mpParent->mrMenu.GetParent(); + if( pParent ) + xRet = pParent->GetAccessible(); + + return xRet; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + Window* pParent = mpParent->mrMenu.GetParent(); + if( pParent ) + { + for( USHORT i = 0, nCount = pParent->GetChildCount(); i < nCount ; i++ ) + { + if( pParent->GetChild( i ) == &mpParent->mrMenu ) + return i; + } + } + + return 0; +} + +// ----------------------------------------------------------------------------- + +sal_Int16 SAL_CALL ToolbarMenuAcc::getAccessibleRole() throw (RuntimeException) +{ + ThrowIfDisposed(); + return AccessibleRole::LIST; +} + +// ----------------------------------------------------------------------------- + +OUString SAL_CALL ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeException) +{ + ThrowIfDisposed(); + return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu" ) ); +} + +// ----------------------------------------------------------------------------- + +OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + OUString aRet; + + if( mpParent ) + aRet = mpParent->mrMenu.GetAccessibleName(); + + if( !aRet.getLength() ) + { + Window* pLabel = mpParent->mrMenu.GetLabeledBy(); + if( pLabel && pLabel != &mpParent->mrMenu ) + aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() ); + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuAcc::getAccessibleRelationSet() throw (RuntimeException) +{ + ThrowIfDisposed(); + return Reference< XAccessibleRelationSet >(); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuAcc::getAccessibleStateSet() throw (RuntimeException) +{ + ThrowIfDisposed(); + ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper(); + + // Set some states. + pStateSet->AddState (AccessibleStateType::ENABLED); + pStateSet->AddState (AccessibleStateType::SENSITIVE); + pStateSet->AddState (AccessibleStateType::SHOWING); + pStateSet->AddState (AccessibleStateType::VISIBLE); + pStateSet->AddState (AccessibleStateType::MANAGES_DESCENDANTS); + pStateSet->AddState (AccessibleStateType::FOCUSABLE); + if (mbIsFocused) + pStateSet->AddState (AccessibleStateType::FOCUSED); + + return pStateSet; +} + +// ----------------------------------------------------------------------------- + +Locale SAL_CALL ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const ::rtl::OUString aEmptyStr; + Reference< XAccessible > xParent( getAccessibleParent() ); + Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); + + if( xParent.is() ) + { + Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); + + if( xParentContext.is() ) + aRet = xParentContext->getLocale (); + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) +{ + ThrowIfDisposed(); + ::osl::MutexGuard aGuard(m_aMutex); + + if( rxListener.is() ) + { + EventListenerVector::const_iterator aIter = mxEventListeners.begin(); + bool bFound = false; + + while( !bFound && ( aIter != mxEventListeners.end() ) ) + { + if( *aIter == rxListener ) + bFound = true; + else + aIter++; + } + + if (!bFound) + mxEventListeners.push_back( rxListener ); + } +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) +{ + ThrowIfDisposed(); + ::osl::MutexGuard aGuard(m_aMutex); + + if( rxListener.is() ) + { + EventListenerVector::iterator aIter = mxEventListeners.begin(); + bool bFound = false; + + while( !bFound && ( aIter != mxEventListeners.end() ) ) + { + if( *aIter == rxListener ) + { + mxEventListeners.erase( aIter ); + bFound = true; + } + else + aIter++; + } + } +} + +// ----------------------------------------------------------------------------- + +sal_Bool SAL_CALL ToolbarMenuAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException) +{ + ThrowIfDisposed(); + const awt::Rectangle aRect( getBounds() ); + const Point aSize( aRect.Width, aRect.Height ); + const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y ); + + return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint ); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point& aPoint ) throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + Reference< XAccessible > xRet; + + const Point aVclPoint( aPoint.X, aPoint.Y ); + + const int nEntryCount = mpParent->maEntryVector.size(); + for( int nEntry = 0; (nEntry < nEntryCount) && !xRet.is(); nEntry++ ) + { + ToolbarMenuEntry* pEntry = mpParent->maEntryVector[nEntry]; + if( pEntry && pEntry->maRect.IsInside( aVclPoint ) ) + { + if( pEntry->mpControl ) + { + awt::Point aChildPoint( aPoint.X - pEntry->maRect.Left(), aPoint.Y - pEntry->maRect.Top() ); + Reference< XAccessibleComponent > xComp( pEntry->GetAccessible(true), UNO_QUERY_THROW ); + xRet = xComp->getAccessibleAtPoint(aChildPoint); + } + else + { + xRet = Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY ); + } + } + } + return xRet; +} + +// ----------------------------------------------------------------------------- + +awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const Point aOutPos( mpParent->mrMenu.GetPosPixel() ); + const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() ); + awt::Rectangle aRet; + + aRet.X = aOutPos.X(); + aRet.Y = aOutPos.Y(); + aRet.Width = aOutSize.Width(); + aRet.Height = aOutSize.Height(); + + return aRet; +} + +// ----------------------------------------------------------------------------- + +awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const Point aOutPos( mpParent->mrMenu.GetPosPixel() ); + return awt::Point( aOutPos.X(), aOutPos.Y() ); +} + +// ----------------------------------------------------------------------------- + +awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( Point() ) ); + return awt::Point( aScreenPos.X(), aScreenPos.Y() ); +} + +// ----------------------------------------------------------------------------- + +awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() ); + return awt::Size( aOutSize.Width(), aOutSize.Height() ); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::grabFocus() throw (RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + mpParent->mrMenu.GrabFocus(); +} + +// ----------------------------------------------------------------------------- + +Any SAL_CALL ToolbarMenuAcc::getAccessibleKeyBinding() throw (RuntimeException) +{ + ThrowIfDisposed(); + return Any(); +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuAcc::getForeground() throw (RuntimeException) +{ + ThrowIfDisposed(); + UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor(); + return static_cast(nColor); +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuAcc::getBackground() throw (RuntimeException) +{ + ThrowIfDisposed(); + UINT32 nColor = Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor(); + return static_cast(nColor); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + mpParent->selectAccessibleChild( nChildIndex ); +} + +// ----------------------------------------------------------------------------- + +sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + return mpParent->isAccessibleChildSelected( nChildIndex ); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + mpParent->clearAccessibleSelection(); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeException) +{ + ThrowIfDisposed(); + // unsupported due to single selection only +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ThrowIfDisposed(); + + return mpParent->mnHighlightedEntry != -1 ? 1 : 0; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + + if( (mpParent->mnHighlightedEntry != -1) && (nSelectedChildIndex == 0) ) + { + ToolbarMenuEntry* pEntry = mpParent->maEntryVector[ mpParent->mnHighlightedEntry ]; + if( pEntry ) + { + if( pEntry->mpControl ) + { + Reference< XAccessibleSelection > xSel( pEntry->GetAccessible(true), UNO_QUERY_THROW ); + return xSel->getSelectedAccessibleChild(0); + } + else + return Reference< XAccessible >( pEntry->GetAccessible(true), UNO_QUERY ); + } + } + + throw IndexOutOfBoundsException(); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ThrowIfDisposed(); + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + // Because of the single selection we can reset the whole selection when + // the specified child is currently selected. + if (isAccessibleChildSelected(nChildIndex)) + mpParent->clearAccessibleSelection(); +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuAcc::disposing (void) +{ + EventListenerVector aListenerListCopy; + + { + // Make a copy of the list and clear the original. + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard (m_aMutex); + aListenerListCopy = mxEventListeners; + mxEventListeners.clear(); + + // Reset the pointer to the parent. It has to be the one who has + // disposed us because he is dying. + mpParent = NULL; + } + + // Inform all listeners that this objects is disposing. + EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin()); + EventObject aEvent (static_cast(this)); + while(aListenerIterator != aListenerListCopy.end()) + { + try + { + (*aListenerIterator)->disposing (aEvent); + } + catch( Exception& ) + { + // Ignore exceptions. + } + + ++aListenerIterator; + } +} + +void ToolbarMenuAcc::ThrowIfDisposed (void) throw (DisposedException) +{ + if(rBHelper.bDisposed || rBHelper.bInDispose) + { + throw DisposedException ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), static_cast(this)); + } +} + +// ----------------------- +// - ToolbarMenuEntryAcc - +// ----------------------- + +ToolbarMenuEntryAcc::ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent ) +: ToolbarMenuEntryAccBase( m_aMutex ) +, mpParent( pParent ) +{ +} + +// ----------------------------------------------------------------------------- + +ToolbarMenuEntryAcc::~ToolbarMenuEntryAcc() +{ +} + +// ----------------------------------------------------------------------- + +void ToolbarMenuEntryAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue ) +{ + if( nEventId ) + { + EventListenerVector aTmpListeners( mxEventListeners ); + ::std::vector< Reference< XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ); + AccessibleEventObject aEvtObject; + + aEvtObject.EventId = nEventId; + aEvtObject.Source = static_cast(this); + aEvtObject.NewValue = rNewValue; + aEvtObject.OldValue = rOldValue; + + while( aIter != aTmpListeners.end() ) + { + (*aIter)->notifyEvent( aEvtObject ); + aIter++; + } + } +} + + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuEntryAcc::disposing (void) +{ + EventListenerVector aListenerListCopy; + + { + // Make a copy of the list and clear the original. + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard (m_aMutex); + aListenerListCopy = mxEventListeners; + mxEventListeners.clear(); + + // Reset the pointer to the parent. It has to be the one who has + // disposed us because he is dying. + mpParent = NULL; + } + + // Inform all listeners that this objects is disposing. + EventListenerVector::const_iterator aListenerIterator (aListenerListCopy.begin()); + EventObject aEvent (static_cast(this)); + while(aListenerIterator != aListenerListCopy.end()) + { + try + { + (*aListenerIterator)->disposing (aEvent); + } + catch( Exception& ) + { + // Ignore exceptions. + } + + ++aListenerIterator; + } +} +// ----------------------------------------------------------------------------- + +Reference< XAccessibleContext > SAL_CALL ToolbarMenuEntryAcc::getAccessibleContext() throw (RuntimeException) +{ + return this; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleChildCount() throw (RuntimeException) +{ + return 0; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException) +{ + throw IndexOutOfBoundsException(); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + Reference< XAccessible > xRet; + + if( mpParent ) + xRet = mpParent->mrMenu.GetAccessible(); + + return xRet; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + // The index defaults to -1 to indicate the child does not belong to its + // parent. + sal_Int32 nIndexInParent = -1; + + if( mpParent ) + { + Reference< XAccessibleContext > xParent( mpParent->mrMenu.GetAccessible(), UNO_QUERY ); + + if( xParent.is() ) + { + Reference< XAccessible > xThis( this ); + + const sal_Int32 nCount = xParent->getAccessibleChildCount(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + if( xParent->getAccessibleChild(nIndex) == xThis ) + { + nIndexInParent = nIndex; + break; + } + } + } + } + + return nIndexInParent; +} + +// ----------------------------------------------------------------------------- + +sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeException) +{ + return AccessibleRole::LIST_ITEM; +} + +// ----------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu item" ) ); +} + +// ----------------------------------------------------------------------------- + +::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + String aRet; + + if( mpParent ) + { + aRet = mpParent->maText; + + if( !aRet.Len() ) + { + aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) ); + aRet += String::CreateFromInt32( mpParent->mnEntryId ); + } + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleRelationSet() throw (RuntimeException) +{ + return Reference< XAccessibleRelationSet >(); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper; + + if( mpParent ) + { + pStateSet->AddState (AccessibleStateType::ENABLED); + pStateSet->AddState (AccessibleStateType::SENSITIVE); + pStateSet->AddState (AccessibleStateType::SHOWING); + pStateSet->AddState (AccessibleStateType::VISIBLE); + pStateSet->AddState (AccessibleStateType::TRANSIENT); + if( mpParent->mnEntryId != TITLE_ID ) + { + pStateSet->AddState( AccessibleStateType::SELECTABLE ); + + // SELECTED + if( mpParent->mrMenu.getHighlightedEntryId() == mpParent->mnEntryId ) + pStateSet->AddState( AccessibleStateType::SELECTED ); + } + } + + return pStateSet; +} + +// ----------------------------------------------------------------------------- + +Locale SAL_CALL ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException) +{ + const ::rtl::OUString aEmptyStr; + Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); + + Reference< XAccessible > xParent( getAccessibleParent() ); + if( xParent.is() ) + { + Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); + + if( xParentContext.is() ) + aRet = xParentContext->getLocale(); + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) +{ + const ::vos::OGuard aGuard( maMutex ); + + if( rxListener.is() ) + { + EventListenerVector::const_iterator aIter( mxEventListeners.begin() ); + bool bFound = false; + + while( !bFound && ( aIter != mxEventListeners.end() ) ) + { + if( *aIter == rxListener ) + bFound = true; + else + aIter++; + } + + if (!bFound) + mxEventListeners.push_back( rxListener ); + } +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) +{ + const ::vos::OGuard aGuard( maMutex ); + + if( rxListener.is() ) + { + EventListenerVector::iterator aIter = mxEventListeners.begin(); + bool bFound = false; + + while( !bFound && ( aIter != mxEventListeners.end() ) ) + { + if( *aIter == rxListener ) + { + mxEventListeners.erase( aIter ); + bFound = true; + } + else + aIter++; + } + } +} + +// ----------------------------------------------------------------------------- + +sal_Bool SAL_CALL ToolbarMenuEntryAcc::containsPoint( const awt::Point& aPoint ) throw (RuntimeException) +{ + const awt::Rectangle aRect( getBounds() ); + const Point aSize( aRect.Width, aRect.Height ); + const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y ); + + return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint ); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) +{ + Reference< XAccessible > xRet; + return xRet; +} + +// ----------------------------------------------------------------------------- + +awt::Rectangle SAL_CALL ToolbarMenuEntryAcc::getBounds() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + awt::Rectangle aRet; + + if( mpParent ) + { + Rectangle aRect( mpParent->maRect ); + Point aOrigin; + Rectangle aParentRect( aOrigin, mpParent->mrMenu.GetOutputSizePixel() ); + + aRect.Intersection( aParentRect ); + + aRet.X = aRect.Left(); + aRet.Y = aRect.Top(); + aRet.Width = aRect.GetWidth(); + aRet.Height = aRect.GetHeight(); + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocation() throw (RuntimeException) +{ + const awt::Rectangle aRect( getBounds() ); + return awt::Point( aRect.X, aRect.Y ); +} + +// ----------------------------------------------------------------------------- + +awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException) +{ + const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + awt::Point aRet; + + if( mpParent ) + { + const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) ); + + aRet.X = aScreenPos.X(); + aRet.Y = aScreenPos.Y(); + } + + return aRet; +} + +// ----------------------------------------------------------------------------- + +awt::Size SAL_CALL ToolbarMenuEntryAcc::getSize() throw (RuntimeException) +{ + const awt::Rectangle aRect( getBounds() ); + awt::Size aRet; + + aRet.Width = aRect.Width; + aRet.Height = aRect.Height; + + return aRet; +} + +// ----------------------------------------------------------------------------- + +void SAL_CALL ToolbarMenuEntryAcc::grabFocus() throw (RuntimeException) +{ + // nothing to do +} + +// ----------------------------------------------------------------------------- + +Any SAL_CALL ToolbarMenuEntryAcc::getAccessibleKeyBinding() throw (RuntimeException) +{ + return Any(); +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getForeground( ) throw (RuntimeException) +{ + return static_cast(Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor()); +} + +// ----------------------------------------------------------------------------- + +sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getBackground( ) throw (RuntimeException) +{ + return static_cast(Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor()); +} + +} diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx new file mode 100644 index 000000000000..96ad5070671d --- /dev/null +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "svtools/framestatuslistener.hxx" + +#include "svtools/valueset.hxx" + +namespace svtools { + +struct ToolbarMenu_Impl; +class ToolbarMenu; +class ToolbarMenuEntry; + +typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > EventListenerVector; +typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; + +const int EXTRAITEMHEIGHT = 0; // 4; +const int SEPARATOR_HEIGHT = 4; +const int TITLE_ID = -1; +const int BORDER_X = 0; +const int BORDER_Y = 0; + +// -------------------- +// - ToolbarMenuEntry - +// -------------------- + +class ToolbarMenuEntry +{ +public: + ToolbarMenu& mrMenu; + + int mnEntryId; + MenuItemBits mnBits; + Size maSize; + + bool mbHasText; + bool mbHasImage; + bool mbHasControl; + bool mbChecked; + bool mbEnabled; + + String maText; + Image maImage; + Control* mpControl; + Rectangle maRect; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccContext; + +public: + ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const String& rText, MenuItemBits nBits ); + ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, MenuItemBits nBits ); + ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, const Image& rImage, const String& rText, MenuItemBits nBits ); + ToolbarMenuEntry( ToolbarMenu& rMenu, int nEntryId, Control* pControl, MenuItemBits nBits ); + ~ToolbarMenuEntry(); + + void init( int nEntryId, MenuItemBits nBits ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& GetAccessible( bool bCreate = false ); + + sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + +// --------------- +// - ToolbarMenuAcc - +// --------------- + +typedef ::cppu::WeakComponentImplHelper5< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleSelection > + ToolbarMenuAccComponentBase; + +class ToolbarMenuAcc : + public ::comphelper::OBaseMutex, + public ToolbarMenuAccComponentBase +{ +public: + + ToolbarMenuAcc( ToolbarMenu_Impl& rParent ); + ~ToolbarMenuAcc(); + + void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); + bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); } + +public: + + /** Called by the corresponding ToolbarMenu when it gets the focus. + Stores the new focus state and broadcasts a state change event. + */ + void GetFocus (void); + + /** Called by the corresponding ToolbarMenu when it loses the focus. + Stores the new focus state and broadcasts a state change event. + */ + void LoseFocus (void); + + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + using cppu::WeakComponentImplHelper5::addEventListener; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + using cppu::WeakComponentImplHelper5::removeEventListener; + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + +private: + EventListenerVector mxEventListeners; + ToolbarMenu_Impl* mpParent; + /// The current FOCUSED state. + bool mbIsFocused; + + /** Tell all listeners that the object is dying. This callback is + usually called from the WeakComponentImplHelper class. + */ + virtual void SAL_CALL disposing (void); + + /** Check whether or not the object has been disposed (or is in the + state of beeing disposed). If that is the case then + DisposedException is thrown to inform the (indirect) caller of the + foul deed. + */ + void ThrowIfDisposed (void) throw (::com::sun::star::lang::DisposedException); +}; + +// ----------------------- +// - ToolbarMenuEntryAcc - +// ----------------------- + +typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent > ToolbarMenuEntryAccBase; + +class ToolbarMenuEntryAcc : public ::comphelper::OBaseMutex, + public ToolbarMenuEntryAccBase +{ +public: + ToolbarMenuEntryAcc( ToolbarMenuEntry* pParent ); + ~ToolbarMenuEntryAcc(); + + void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); + bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); } + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + +private: + EventListenerVector mxEventListeners; + ::vos::OMutex maMutex; + ToolbarMenuEntry* mpParent; + + /** Tell all listeners that the object is dying. This callback is + usually called from the WeakComponentImplHelper class. + */ + virtual void SAL_CALL disposing (void); +}; + +// ----------------------------------------------------------------------------- + +struct ToolbarMenu_Impl +{ + ToolbarMenu& mrMenu; + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; + rtl::Reference< svt::FrameStatusListener > mxStatusListener; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; + rtl::Reference< ToolbarMenuAcc > mxAccessible; + ToolbarMenuEntryVector maEntryVector; + + int mnCheckPos; + int mnImagePos; + int mnTextPos; + + int mnHighlightedEntry; + int mnSelectedEntry; + int mnLastColumn; + + Size maSize; + + Link maSelectHdl; + + ToolbarMenu_Impl( ToolbarMenu& rMenu, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); + ~ToolbarMenu_Impl(); + + void setAccessible( ToolbarMenuAcc* pAccessible ); + + void fireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); + bool hasAccessibleListeners(); + + sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + sal_Bool isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void clearAccessibleSelection(); +}; + +} diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index c176629953ae..65f6b8ffaccb 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -114,6 +114,7 @@ struct ValueSet_Impl { ::std::auto_ptr< ValueItemList > mpItemList; bool mbIsTransientChildrenDisabled; + Link maHighlightHdl; ValueSet_Impl() : mpItemList( ::std::auto_ptr< ValueItemList >( new ValueItemList() ) ), mbIsTransientChildrenDisabled( false ) diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 4033a9df7bb5..dffc155901c3 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1421,7 +1421,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) { USHORT nLastItem = (USHORT)mpImpl->mpItemList->Count(); USHORT nItemPos = VALUESET_ITEM_NOTFOUND; - USHORT nCurPos; + USHORT nCurPos = VALUESET_ITEM_NONEITEM; USHORT nCalcPos; if ( !nLastItem || !ImplGetFirstItem() ) @@ -1434,8 +1434,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) if ( mnSelItemId ) nCurPos = GetItemPos( mnSelItemId ); - else - nCurPos = VALUESET_ITEM_NONEITEM; nCalcPos = nCurPos; //switch off selection mode if key travelling is used @@ -1531,6 +1529,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) nCalcPos - ( nLineCount * mnCols )); else { +#if 0 if( (KEY_UP == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) ) { Window* pParent = GetParent(); @@ -1539,6 +1538,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) break; } else +#endif { if ( mpNoneItem ) { @@ -1583,6 +1583,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) nCalcPos + ( nLineCount * mnCols )); else { +#if 0 if( (KEY_DOWN == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) ) { Window* pParent = GetParent(); @@ -1591,6 +1592,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) break; } else +#endif { if ( mpNoneItem ) { @@ -1623,7 +1625,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) bDefault = TRUE; break; } - if(!bDefault) EndSelection(); if ( nItemPos != VALUESET_ITEM_NOTFOUND ) @@ -1633,6 +1634,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) nItemId = GetItemId( nItemPos ); else nItemId = 0; + if ( nItemId != mnSelItemId ) { SelectItem( nItemId ); @@ -2280,6 +2282,8 @@ void ValueSet::SelectItem( USHORT nItemId ) // selection event ::com::sun::star::uno::Any aOldAny, aNewAny; ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny ); + + mpImpl->maHighlightHdl.Call(this); } } } @@ -2752,3 +2756,19 @@ bool ValueSet::IsRTLActive (void) return Application::GetSettings().GetLayoutRTL() && IsRTLEnabled(); } +// ----------------------------------------------------------------------- + +void ValueSet::SetHighlightHdl( const Link& rLink ) +{ + mpImpl->maHighlightHdl = rLink; +} + +// ----------------------------------------------------------------------- + +const Link& ValueSet::GetHighlightHdl() const +{ + return mpImpl->maHighlightHdl; +} + +// ----------------------------------------------------------------------- + diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 82e509f1ce08..0081d4a5fd9e 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.21 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -59,7 +55,8 @@ SLOFILES= \ $(SLO)$/unoevent.obj \ $(SLO)$/unoiface.obj \ $(SLO)$/unoimap.obj \ - $(SLO)$/svtxgridcontrol.obj + $(SLO)$/svtxgridcontrol.obj \ + $(SLO)$/popupwindowcontroller.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx new file mode 100644 index 000000000000..e83c76c0182e --- /dev/null +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_svtools.hxx" + +#include + +#include +#include + +#include + +#include "svtools/popupwindowcontroller.hxx" + +using rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + + +namespace svt +{ + +class PopupWindowControllerImpl +{ +public: + PopupWindowControllerImpl(); + ~PopupWindowControllerImpl(); + + void SetPopupWindow( ::Window* pPopupWindow ); + + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window* ); + +private: + ::Window* mpPopupWindow; +}; + +PopupWindowControllerImpl::PopupWindowControllerImpl() +: mpPopupWindow( 0 ) +{ +} + +PopupWindowControllerImpl::~PopupWindowControllerImpl() +{ + if( mpPopupWindow ) + SetPopupWindow(0); +} + +void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow ) +{ + if( mpPopupWindow ) + { + mpPopupWindow->RemoveEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener ) ); + Application::PostUserEvent( STATIC_LINK( this, PopupWindowControllerImpl, AsyncDeleteWindowHdl ), mpPopupWindow ); + } + mpPopupWindow = pPopupWindow; + if( mpPopupWindow ) + { + mpPopupWindow->AddEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener )); + } +} + +IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEvent ) +{ + VclWindowEvent* pWindowEvent = dynamic_cast< VclWindowEvent* >( pEvent ); + if( pWindowEvent ) + { + switch( pWindowEvent->GetId() ) + { + case VCLEVENT_WINDOW_CLOSE: + case VCLEVENT_WINDOW_ENDPOPUPMODE: + SetPopupWindow(0); + break; + } + } + return 1; +} + +//-------------------------------------------------------------------- + +IMPL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window*, pWindow ) +{ + (void)*pThis; + delete pWindow; + return 0; +} + +//======================================================================== +// class PopupWindowController +//======================================================================== + +PopupWindowController::PopupWindowController( const Reference< lang::XMultiServiceFactory >& rServiceManager, + const Reference< frame::XFrame >& xFrame, + const OUString& aCommandURL ) +: svt::ToolboxController( rServiceManager, xFrame, aCommandURL ) +, mpImpl( new PopupWindowControllerImpl() ) +{ +} + +PopupWindowController::~PopupWindowController() +{ +} + +// XInterface +Any SAL_CALL PopupWindowController::queryInterface( const Type& aType ) +throw (RuntimeException) +{ + Any a( ToolboxController::queryInterface( aType ) ); + if ( a.hasValue() ) + return a; + + return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this )); +} + +void SAL_CALL PopupWindowController::acquire() throw () +{ + ToolboxController::acquire(); +} + +void SAL_CALL PopupWindowController::release() throw () +{ + ToolboxController::release(); +} + +// XServiceInfo +sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& ServiceName ) throw(RuntimeException) +{ + const Sequence< OUString > aSNL( getSupportedServiceNames() ); + const OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +// XComponent +void SAL_CALL PopupWindowController::dispose() throw (RuntimeException) +{ + svt::ToolboxController::dispose(); +} + +// XStatusListener +void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException ) +{ + svt::ToolboxController::statusChanged(rEvent); +} + +// XToolbarController +void SAL_CALL PopupWindowController::execute( sal_Int16 KeyModifier ) throw (RuntimeException) +{ + svt::ToolboxController::execute( KeyModifier ); +} + +void SAL_CALL PopupWindowController::click() throw (RuntimeException) +{ + svt::ToolboxController::click(); +} + +void SAL_CALL PopupWindowController::doubleClick() throw (RuntimeException) +{ + svt::ToolboxController::doubleClick(); +} + +Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() throw (RuntimeException) +{ + ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + if( pToolBox ) + { + ::Window* pWin = createPopupWindow(pToolBox); + if( pWin ) + { + pWin->EnableDocking(true); + mpImpl->SetPopupWindow(pWin); + ::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + } + } + return Reference< awt::XWindow >(); +} + +Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( const Reference< awt::XWindow >& Parent ) + throw (RuntimeException) +{ + return Reference< awt::XWindow >(); +} + +} + diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index a8d05c49a7ae..b2b60f7ec623 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -46,6 +46,8 @@ #endif #include +using ::rtl::OUString; + using namespace ::cppu; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; @@ -707,4 +709,23 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const { return m_pImpl->m_xParentWindow; } + + +void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs ) +{ + try + { + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW ); + URL aURL; + aURL.Complete = sCommandURL; + getURLTransformer()->parseStrict( aURL ); + + Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW ); + xDispatch->dispatch( aURL, rArgs ); + } + catch( Exception& ) + { + } +} + } // svt -- cgit From 03abcba9c53630795987c7a1545de6376c36849d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 12 Mar 2010 09:15:29 +0000 Subject: cmcfixes73: #i110068# unify headers in one place --- tools/inc/tools/postextstl.h | 36 +++++++++++++++++++ tools/inc/tools/preextstl.h | 64 +++++++++++++++++++++++++++++++++ tools/prj/d.lst | 3 ++ vcl/inc/postgraphitestl.h | 9 ----- vcl/inc/pregraphitestl.h | 30 ---------------- vcl/inc/vcl/graphite_adaptors.hxx | 6 ++-- vcl/inc/vcl/graphite_features.hxx | 4 +-- vcl/inc/vcl/graphite_layout.hxx | 4 +-- vcl/source/glyphs/graphite_adaptors.cxx | 2 +- vcl/source/glyphs/graphite_cache.cxx | 4 +-- vcl/source/glyphs/graphite_features.cxx | 6 ++-- vcl/source/glyphs/graphite_layout.cxx | 12 +++---- vcl/source/glyphs/graphite_textsrc.cxx | 10 +++--- vcl/source/glyphs/graphite_textsrc.hxx | 6 ++-- vcl/util/makefile2.pmk | 2 +- 15 files changed, 131 insertions(+), 67 deletions(-) create mode 100644 tools/inc/tools/postextstl.h create mode 100644 tools/inc/tools/preextstl.h delete mode 100644 vcl/inc/postgraphitestl.h delete mode 100644 vcl/inc/pregraphitestl.h diff --git a/tools/inc/tools/postextstl.h b/tools/inc/tools/postextstl.h new file mode 100644 index 000000000000..81a21e25c15b --- /dev/null +++ b/tools/inc/tools/postextstl.h @@ -0,0 +1,36 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#ifdef std_was_redefined_as_stlport +// put things back the way they were +# define std std_was_redefined_as_stlport +# undef _STLP_OUTERMOST_HEADER_ID +// force config to be re-read +# undef _STLP_NOTHROW_INHERENTLY +# undef _STLP_CONFIG_H +# include +#endif diff --git a/tools/inc/tools/preextstl.h b/tools/inc/tools/preextstl.h new file mode 100644 index 000000000000..4d0418d01c57 --- /dev/null +++ b/tools/inc/tools/preextstl.h @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if defined(ADAPT_EXT_STL) +# include +# include +# include +# include +# include +# include +# include +# include +# if defined(std) +# define std_was_redefined_as_stlport std +# undef std +# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf +# pragma GCC visibility push(default) +# include _STLP_NATIVE_HEADER(exception_defines.h) +# include _STLP_NATIVE_HEADER(limits) +# include _STLP_NATIVE_HEADER(memory) +# include _STLP_NATIVE_HEADER(exception) +# include _STLP_NATIVE_HEADER(iosfwd) +# include _STLP_NATIVE_HEADER(algorithm) +# include _STLP_NATIVE_HEADER(string) +# include _STLP_NATIVE_HEADER(streambuf) +# include _STLP_NATIVE_HEADER(ios) +# include _STLP_NATIVE_HEADER(locale) +# include _STLP_NATIVE_HEADER(stdexcept) +# include _STLP_NATIVE_HEADER(ostream) +# include _STLP_NATIVE_HEADER(istream) +# include _STLP_NATIVE_HEADER(iostream) +# include _STLP_NATIVE_HEADER(vector) +# include _STLP_NATIVE_HEADER(list) +# include _STLP_NATIVE_HEADER(map) +# pragma GCC visibility pop +# endif +#endif +//ext_std resolves to the std that external c++ libs, e.g. Graphite were built +//against regardless of whether that is stlport or system stl +namespace ext_std = std; diff --git a/tools/prj/d.lst b/tools/prj/d.lst index 76cb0107453c..6b4a99a3a676 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -34,6 +34,9 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\postx.h %_DEST%\inc%_EXT%\tools\postx.h ..\inc\tools\prex.h %_DEST%\inc%_EXT%\tools\prex.h +..\inc\tools\postextstl.h %_DEST%\inc%_EXT%\tools\postextstl.h +..\inc\tools\preextstl.h %_DEST%\inc%_EXT%\tools\preextstl.h + ..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx ..\inc\tools\wintypes.hxx %_DEST%\inc%_EXT%\tools\wintypes.hxx ..\inc\tools\mapunit.hxx %_DEST%\inc%_EXT%\tools\mapunit.hxx diff --git a/vcl/inc/postgraphitestl.h b/vcl/inc/postgraphitestl.h deleted file mode 100644 index 736aa248b7ff..000000000000 --- a/vcl/inc/postgraphitestl.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef std_was_redefined_as_stlport -// put things back the way they were -# define std std_was_redefined_as_stlport -# undef _STLP_OUTERMOST_HEADER_ID -// force config to be re-read -# undef _STLP_NOTHROW_INHERENTLY -# undef _STLP_CONFIG_H -# include -#endif diff --git a/vcl/inc/pregraphitestl.h b/vcl/inc/pregraphitestl.h deleted file mode 100644 index ece0af477113..000000000000 --- a/vcl/inc/pregraphitestl.h +++ /dev/null @@ -1,30 +0,0 @@ -#if defined(GRAPHITEADAPTSTL) && defined(std) -# include -# include -# include -# include -# include -# include -# define std_was_redefined_as_stlport std -# undef std -# define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf -# pragma GCC visibility push(default) -# include _STLP_NATIVE_HEADER(exception_defines.h) -# include _STLP_NATIVE_HEADER(limits) -# include _STLP_NATIVE_HEADER(memory) -# include _STLP_NATIVE_HEADER(exception) -# include _STLP_NATIVE_HEADER(iosfwd) -# include _STLP_NATIVE_HEADER(algorithm) -# include _STLP_NATIVE_HEADER(string) -# include _STLP_NATIVE_HEADER(streambuf) -# include _STLP_NATIVE_HEADER(ios) -# include _STLP_NATIVE_HEADER(locale) -# include _STLP_NATIVE_HEADER(stdexcept) -# include _STLP_NATIVE_HEADER(ostream) -# include _STLP_NATIVE_HEADER(istream) -# include _STLP_NATIVE_HEADER(iostream) -# include _STLP_NATIVE_HEADER(vector) -# pragma GCC visibility pop -#endif -//sil_std resolves to the std that Graphite was built with -namespace sil_std = std; diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx index 0b5f88184ce4..43c2e37a5fb2 100644 --- a/vcl/inc/vcl/graphite_adaptors.hxx +++ b/vcl/inc/vcl/graphite_adaptors.hxx @@ -55,11 +55,11 @@ #include "vcl/dllapi.h" // Libraries -#include "pregraphitestl.h" +#include #include #include #include -#include "postgraphitestl.h" +#include // Module type definitions and forward declarations. // @@ -119,7 +119,7 @@ public: const grutils::GrFeatureParser * features() const { return mpFeatures; }; private: - virtual void UniqueCacheInfo(sil_std::wstring &, bool &, bool &); + virtual void UniqueCacheInfo(ext_std::wstring &, bool &, bool &); FreetypeServerFont& mrFont; FontProperties maFontProperties; diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx index 9f63a029eb5f..47f4c3a01e7f 100644 --- a/vcl/inc/vcl/graphite_features.hxx +++ b/vcl/inc/vcl/graphite_features.hxx @@ -29,11 +29,11 @@ // Parse a string of features specified as ; separated pairs. // e.g. // 1001=1&2002=2&fav1=0 -#include "pregraphitestl.h" +#include #include #include #include -#include "postgraphitestl.h" +#include namespace grutils { diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx index b3a3814e9ce6..1fbb11211ca0 100644 --- a/vcl/inc/vcl/graphite_layout.hxx +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -40,13 +40,13 @@ #include #include // Libraries -#include "pregraphitestl.h" +#include #include #include #include #include #include -#include "postgraphitestl.h" +#include // Platform #include #include diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 4afced765612..f66f5b48e39e 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -168,7 +168,7 @@ GraphiteFontAdaptor::~GraphiteFontAdaptor() throw() mpFeatures = NULL; } -void GraphiteFontAdaptor::UniqueCacheInfo(sil_std::wstring & face_name_out, bool & bold_out, bool & italic_out) +void GraphiteFontAdaptor::UniqueCacheInfo(ext_std::wstring & face_name_out, bool & bold_out, bool & italic_out) { face_name_out = maFontProperties.szFaceName; bold_out = maFontProperties.fBold; diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx index 713f3c1ed088..64bbb0a38d60 100644 --- a/vcl/source/glyphs/graphite_cache.cxx +++ b/vcl/source/glyphs/graphite_cache.cxx @@ -36,10 +36,10 @@ #include #include -#include "pregraphitestl.h" +#include #include #include -#include "postgraphitestl.h" +#include #include #include diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx index bae96642da30..1cb25306c4ee 100644 --- a/vcl/source/glyphs/graphite_features.cxx +++ b/vcl/source/glyphs/graphite_features.cxx @@ -88,7 +88,7 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co gr::isocode aLang = maLang; for (size_t i = pos; i < nFeatEnd; i++) aLang.rgch[i-pos] = features[i]; - sil_std::pair aSupported + ext_std::pair aSupported = font.getSupportedLanguages(); gr::LanguageIterator iL = aSupported.first; while (iL != aSupported.second) @@ -139,7 +139,7 @@ void GrFeatureParser::setLang(gr::Font & font, const std::string & lang) if (lang[i] == '-') break; aLang.rgch[i] = lang[i]; } - sil_std::pair aSupported + ext_std::pair aSupported = font.getSupportedLanguages(); gr::LanguageIterator iL = aSupported.first; while (iL != aSupported.second) @@ -186,7 +186,7 @@ bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting) { return false; } - sil_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator > + ext_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator > validValues = font.getFeatureSettings(i); gr::FeatureSettingIterator j = validValues.first; while (j != validValues.second) diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 25ea77dd07a3..6e75d1fde868 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -63,13 +63,13 @@ #include // Graphite Libraries (must be after vcl headers on windows) -#include "pregraphitestl.h" +#include #include #include #include #include #include -#include "postgraphitestl.h" +#include #include #include @@ -104,8 +104,8 @@ FILE * grLog() namespace { - typedef sil_std::pair glyph_range_t; - typedef sil_std::pair glyph_set_range_t; + typedef ext_std::pair glyph_range_t; + typedef ext_std::pair glyph_set_range_t; inline long round(const float n) { return long(n + (n < 0 ? -0.5 : 0.5)); @@ -170,7 +170,7 @@ GraphiteLayout::Glyphs::fill_from(gr::Segment & rSegment, ImplLayoutArgs &rArgs, bool bRtl, long &rWidth, float fScaling, std::vector & rChar2Base, std::vector & rGlyph2Char, std::vector & rCharDxs) { // Create a glyph item for each of the glyph and append it to the base class glyph list. - typedef sil_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet; + typedef ext_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet; int nChar = rArgs.mnEndCharPos - rArgs.mnMinCharPos; glyph_range_t iGlyphs = rSegment.glyphs(); int nGlyphs = iGlyphs.second - iGlyphs.first; @@ -585,7 +585,7 @@ public: sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures) { // is this sufficient? - sil_std::wstring aFace; + ext_std::wstring aFace; bool bBold; bool bItalic; UniqueCacheInfo(aFace, bBold, bItalic); diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx index d7547662e065..5764ba9454c9 100644 --- a/vcl/source/glyphs/graphite_textsrc.cxx +++ b/vcl/source/glyphs/graphite_textsrc.cxx @@ -135,16 +135,16 @@ gr::isocode TextSourceAdaptor::getLanguage(gr::toffset) return unknown; } -sil_std::pair TextSourceAdaptor::propertyRange(gr::toffset nCharIdx) +ext_std::pair TextSourceAdaptor::propertyRange(gr::toffset nCharIdx) { if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos)) - return sil_std::make_pair(0, maLayoutArgs.mnMinCharPos); + return ext_std::make_pair(0, maLayoutArgs.mnMinCharPos); if (nCharIdx < mnEnd) - return sil_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd); + return ext_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd); - return sil_std::make_pair(mnEnd, maLayoutArgs.mnLength); + return ext_std::make_pair(mnEnd, maLayoutArgs.mnLength); } size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings) @@ -156,7 +156,7 @@ size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * sett bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2) { - const sil_std::pair + const ext_std::pair range1 = propertyRange(char_idx1), range2 = propertyRange(char_idx2); diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx index 2397d6a5f701..2b9c705a5ea7 100644 --- a/vcl/source/glyphs/graphite_textsrc.hxx +++ b/vcl/source/glyphs/graphite_textsrc.hxx @@ -59,11 +59,11 @@ #include "vcl/dllapi.h" // Libraries -#include "pregraphitestl.h" +#include #include #include #include -#include "postgraphitestl.h" +#include // Module type definitions and forward declarations. // @@ -90,7 +90,7 @@ public: virtual float getVerticalOffset(gr::toffset ich); virtual gr::isocode getLanguage(gr::toffset ich); - virtual sil_std::pair propertyRange(gr::toffset ich); + virtual ext_std::pair propertyRange(gr::toffset ich); virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset); virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2); diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk index 56102a256ea3..df9ba1a214d7 100644 --- a/vcl/util/makefile2.pmk +++ b/vcl/util/makefile2.pmk @@ -36,6 +36,6 @@ CFLAGSCXX+=$(OBJCXXFLAGS) #building with stlport, but graphite was not built with stlport .IF "$(USE_SYSTEM_STL)"!="YES" .IF "$(SYSTEM_GRAPHITE)"=="YES" -CDEFS += -DGRAPHITEADAPTSTL +CDEFS += -DADAPT_EXT_STL .ENDIF .ENDIF -- cgit From 6f9dd6728ba68934d678a6caf66edcdf2900537a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 12 Mar 2010 09:42:49 +0000 Subject: cmcfixes73: #i110069# add 61 count for ia64 as well --- basegfx/test/basegfx2d.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index b169d35ed96a..bbf5045b5832 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -481,16 +481,15 @@ public: } while ( nIndex >= 0 ); - // Adapted number of spaces to 50 and 67 because of the new circle construction - // methods which produce more points and thus more spaces, too. Use both since - // depending on float precision and the getContinuity() implemetation using - // fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32 - // uses more 'S' statements (as it should be for circles) -#ifdef S390X - CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==61 ); -#else - CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==67 || nCount==50 ); -#endif + // Adapted number of spaces to 50, 67 and 61 because of the new circle + // construction methods which produce more points and thus more spaces, + // too. Use both since depending on float precision and the + // getContinuity() implemetation using fTools::equal, linux and mac + // produce more 'C' than 'S' statements, while WIN32 uses more 'S' + // statements (as it should be for circles) + + // 61 elements for S390x, and IA64 + CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==67 || nCount==50 || nCount == 61); const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); -- cgit From d4ba2aa9c5f60d1eccb923daff4a6fcd0c063aba Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 12 Mar 2010 11:28:15 +0100 Subject: sb121: #i109146# fixed assertion logic --- svl/source/misc/inettype.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index bec8b91e7c22..74c900a2bcfc 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -806,16 +806,18 @@ namespace unnamed_svl_inettype { MediaTypeEntry const * seekEntry(UniString const & rTypeName, MediaTypeEntry const * pMap, sal_Size nSize) { -#if defined DBG_UTIL || defined INETTYPE_DEBUG +#if defined DBG_UTIL static bool bChecked = false; if (!bChecked) { for (sal_Size i = 0; i < nSize - 1; ++i) - DBG_ASSERT(pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName, - "seekEntry(): Bad map"); + DBG_ASSERT( + rtl_str_compare( + pMap[i].m_pTypeName, pMap[i + 1].m_pTypeName) < 0, + "seekEntry(): Bad map"); bChecked = true; } -#endif // DBG_UTIL, INETTYPE_DEBUG +#endif sal_Size nLow = 0; sal_Size nHigh = nSize; -- cgit From 438d3eef38d0b13ee54f5ab2f0365893dbdff68a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 18 Mar 2010 17:02:39 +0000 Subject: cmcfixes73: #i110069# remove platform-dependent test --- basegfx/test/basegfx2d.cxx | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index bbf5045b5832..7258563fe52d 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -465,32 +465,6 @@ public: CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)", !aExport.compareToAscii(sExportString2)); - const B2DPolygon aCircle( - tools::createPolygonFromEllipse( B2DPoint(4000,4000), - 1000.0, 2000.0 )); - aExport = tools::exportToSvgD( B2DPolyPolygon(aCircle), false, false); - - // count number of spaces, in lieu of a better way - no real - // point in comparing with a gold standard, as fractional - // parts of the coordinates will differ between systems. - sal_Int32 nIndex=0, nCount=0; - do - { - rtl::OUString aToken = aExport.getToken( 0, ' ', nIndex ); - ++nCount; - } - while ( nIndex >= 0 ); - - // Adapted number of spaces to 50, 67 and 61 because of the new circle - // construction methods which produce more points and thus more spaces, - // too. Use both since depending on float precision and the - // getContinuity() implemetation using fTools::equal, linux and mac - // produce more 'C' than 'S' statements, while WIN32 uses more 'S' - // statements (as it should be for circles) - - // 61 elements for S390x, and IA64 - CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", nCount==67 || nCount==50 || nCount == 61); - const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false); -- cgit From ffdc043d7272d2e0a664f530bbc112f952acadab Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 15 Mar 2010 09:22:49 +0100 Subject: cws sw321bf01: #i107843# em-dash/en-dash breakiterator fix for spell checking --- i18npool/source/breakiterator/data/dict_word.txt | 2 +- i18npool/source/breakiterator/data/dict_word_prepostdash.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/i18npool/source/breakiterator/data/dict_word.txt b/i18npool/source/breakiterator/data/dict_word.txt index 367a82db9e6f..f69f038e7f7e 100644 --- a/i18npool/source/breakiterator/data/dict_word.txt +++ b/i18npool/source/breakiterator/data/dict_word.txt @@ -35,7 +35,7 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT $MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] - [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; + [:name = HYPHEN-MINUS:] ]; $SufixLetter = [:name= FULL STOP:]; diff --git a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt index 1bf94451fae2..0a60cc5d4924 100644 --- a/i18npool/source/breakiterator/data/dict_word_prepostdash.txt +++ b/i18npool/source/breakiterator/data/dict_word_prepostdash.txt @@ -27,7 +27,7 @@ $Hangul = [:Script = HANGUL:]; # list of dashes or hyphens that should be accepted as part of the word if a single one of these # pre- or postfixes a word. E.g. in German: "Arbeits-" or "-nehmer" where that hyphen needs to # be part of the word in order to have it properly spell checked etc. -$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; +$PrePostDashHyphen = [ [:name = HYPHEN-MINUS:] ]; $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCTUATION GERESH:] @@ -41,7 +41,7 @@ $ALetter = [\u0002 [:Alphabetic:] [:name= COMMERCIAL AT:] [:name= HEBREW PUNCT $MidLetter = [[:name = APOSTROPHE:] [:name = GRAVE ACCENT:] \u0084 [:name = SOFT HYPHEN:] [:name = MIDDLE DOT:] [:name = GREEK TONOS:] [:name= FULL STOP:] [:name = HEBREW PUNCTUATION GERSHAYIM:] [:name = DOUBLE VERTICAL LINE:] [:name = LEFT SINGLE QUOTATION MARK:] [:name = RIGHT SINGLE QUOTATION MARK:] [:name = HYPHENATION POINT:] [:name = PRIME:] - [:name = HYPHEN-MINUS:] [:name = EN DASH:] [:name = EM DASH:] ]; + [:name = HYPHEN-MINUS:] ]; $SufixLetter = [:name= FULL STOP:]; -- cgit From b02197c94c5ea37f388d359583b04a2595626d57 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 15 Mar 2010 16:30:16 +0100 Subject: sb121: #i109146# further fix in assertion logic (see ) --- svl/source/misc/inettype.cxx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index 74c900a2bcfc..ee9aa5932525 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -807,16 +807,11 @@ MediaTypeEntry const * seekEntry(UniString const & rTypeName, MediaTypeEntry const * pMap, sal_Size nSize) { #if defined DBG_UTIL - static bool bChecked = false; - if (!bChecked) - { - for (sal_Size i = 0; i < nSize - 1; ++i) - DBG_ASSERT( - rtl_str_compare( - pMap[i].m_pTypeName, pMap[i + 1].m_pTypeName) < 0, - "seekEntry(): Bad map"); - bChecked = true; - } + for (sal_Size i = 0; i < nSize - 1; ++i) + DBG_ASSERT( + rtl_str_compare( + pMap[i].m_pTypeName, pMap[i + 1].m_pTypeName) < 0, + "seekEntry(): Bad map"); #endif sal_Size nLow = 0; -- cgit From ba3dcaf1573d133ba0eba24e1d06ce54c2c51fac Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 15 Mar 2010 16:02:56 +0000 Subject: linuxaxp01: #i110145# first cut --- tools/inc/tools/solar.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 1d248853f895..2ae0fa5f2f32 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -384,6 +384,8 @@ template inline T Abs(T a) { return (a>=0?a:-a); } #define __DLLEXTENSION "lm.so" #elif defined LINUX && defined HPPA #define __DLLEXTENSION "lh.so" +#elif defined LINUX && defined AXP + #define __DLLEXTENSION "ll.so" #elif defined LINUX #error unknown plattform #elif defined FREEBSD && defined X86 -- cgit From f72097df9157ed2fa3682933969ff75461535b3f Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 16 Mar 2010 11:00:53 +0100 Subject: cws tl79: #i110053# remove old svtools LoginDialog --- svtools/inc/svtools/logindlg.hxx | 118 -------------- svtools/source/dialogs/logindlg.cxx | 312 ------------------------------------ svtools/source/dialogs/logindlg.hrc | 57 ------- svtools/source/dialogs/logindlg.src | 200 ----------------------- svtools/source/dialogs/makefile.mk | 4 +- 5 files changed, 1 insertion(+), 690 deletions(-) delete mode 100644 svtools/inc/svtools/logindlg.hxx delete mode 100644 svtools/source/dialogs/logindlg.cxx delete mode 100644 svtools/source/dialogs/logindlg.hrc delete mode 100644 svtools/source/dialogs/logindlg.src mode change 100644 => 100755 svtools/source/dialogs/makefile.mk diff --git a/svtools/inc/svtools/logindlg.hxx b/svtools/inc/svtools/logindlg.hxx deleted file mode 100644 index 9cf12dd70610..000000000000 --- a/svtools/inc/svtools/logindlg.hxx +++ /dev/null @@ -1,118 +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 _SVTOOLS_LOGINDLG_HXX_ -#define _SVTOOLS_LOGINDLG_HXX_ - -#include "svtools/svtdllapi.h" -#include -#ifndef _SV_BUTTON_HXX -#include -#endif -#include -#include -#include - -//============================================================================ -#define LF_NO_PATH 0x0001 // hide "path" -#define LF_NO_USERNAME 0x0002 // hide "name" -#define LF_NO_PASSWORD 0x0004 // hide "password" -#define LF_NO_SAVEPASSWORD 0x0008 // hide "save password" -#define LF_NO_ERRORTEXT 0x0010 // hide message -#define LF_PATH_READONLY 0x0020 // "path" readonly -#define LF_USERNAME_READONLY 0x0040 // "name" readonly -#define LF_NO_ACCOUNT 0x0080 // hide "account" - -//............................................................................ -namespace svt -{ -//............................................................................ - -//============================================================================ -class SVT_DLLPUBLIC LoginDialog : public ModalDialog -{ - FixedInfo aErrorInfo; - FixedLine aErrorGB; - FixedInfo aRequestInfo; - FixedText aPathFT; - Edit aPathED; - FixedInfo aPathInfo; - PushButton aPathBtn; - FixedText aNameFT; - Edit aNameED; - FixedInfo aNameInfo; - FixedText aPasswordFT; - Edit aPasswordED; - FixedText aAccountFT; - Edit aAccountED; - CheckBox aSavePasswdBtn; - FixedLine aLoginGB; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - SVT_DLLPRIVATE void HideControls_Impl( USHORT nFlags ); - - DECL_DLLPRIVATE_LINK( OKHdl_Impl, OKButton * ); - DECL_DLLPRIVATE_LINK( PathHdl_Impl, PushButton * ); - -public: - LoginDialog( Window* pParent, USHORT nFlags, - const String& rServer, const String* pRealm = NULL ); - - String GetPath() const { return aPathED.GetText(); } - void SetPath( const String& rNewPath ) - { aPathED.SetText( rNewPath ); - aPathInfo.SetText( rNewPath );} - String GetName() const { return aNameED.GetText(); } - void SetName( const String& rNewName ); - String GetPassword() const { return aPasswordED.GetText(); } - void SetPassword( const String& rNew ) - { aPasswordED.SetText( rNew ); } - String GetAccount() const { return aAccountED.GetText(); } - void SetAccount( const String& rNew ) - { aAccountED.SetText( rNew ); } - BOOL IsSavePassword() const - { return aSavePasswdBtn.IsChecked(); } - void SetSavePassword( BOOL bSave ) - { aSavePasswdBtn.Check( bSave ); } - void SetSavePasswordText( const String& rTxt ) - { aSavePasswdBtn.SetText( rTxt ); } - void SetErrorText( const String& rTxt ) - { aErrorInfo.SetText( rTxt ); } - void SetLoginRequestText( const String& rTxt ) - { aRequestInfo.SetText( rTxt ); } - void ClearPassword(); - void ClearAccount(); -}; - -//............................................................................ -} // namespace svt -//............................................................................ - -#endif // _SVTOOLS_LOGINDLG_HXX_ - diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx deleted file mode 100644 index c9edf632d2ec..000000000000 --- a/svtools/source/dialogs/logindlg.cxx +++ /dev/null @@ -1,312 +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_svtools.hxx" -#include -#include -#include - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#include "logindlg.hrc" -#endif -#ifndef _SVTOOLS_HRC -#include -#endif -#include - -#ifdef UNX -#include -#define _MAX_PATH PATH_MAX -#endif - -// LoginDialog ------------------------------------------------------- - -//............................................................................ -namespace svt -{ -//............................................................................ - -void LoginDialog::HideControls_Impl( USHORT nFlags ) -{ - FASTBOOL bPathHide = FALSE; - FASTBOOL bErrorHide = FALSE; - FASTBOOL bAccountHide = FALSE; - - if ( ( nFlags & LF_NO_PATH ) == LF_NO_PATH ) - { - aPathFT.Hide(); - aPathED.Hide(); - aPathBtn.Hide(); - bPathHide = TRUE; - } - else if ( ( nFlags & LF_PATH_READONLY ) == LF_PATH_READONLY ) - { - aPathED.Hide(); - aPathInfo.Show(); - aPathBtn.Hide(); - } - - if ( ( nFlags & LF_NO_USERNAME ) == LF_NO_USERNAME ) - { - aNameFT.Hide(); - aNameED.Hide(); - } - else if ( ( nFlags & LF_USERNAME_READONLY ) == LF_USERNAME_READONLY ) - { - aNameED.Hide(); - aNameInfo.Show(); - } - - if ( ( nFlags & LF_NO_PASSWORD ) == LF_NO_PASSWORD ) - { - aPasswordFT.Hide(); - aPasswordED.Hide(); - } - - if ( ( nFlags & LF_NO_SAVEPASSWORD ) == LF_NO_SAVEPASSWORD ) - aSavePasswdBtn.Hide(); - - if ( ( nFlags & LF_NO_ERRORTEXT ) == LF_NO_ERRORTEXT ) - { - aErrorInfo.Hide(); - aErrorGB.Hide(); - bErrorHide = TRUE; - } - - if ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT ) - { - aAccountFT.Hide(); - aAccountED.Hide(); - bAccountHide = TRUE; - } - - if ( bErrorHide ) - { - long nOffset = aLoginGB.GetPosPixel().Y() - - aErrorGB.GetPosPixel().Y(); - Point aNewPnt = aRequestInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aRequestInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathFT.SetPosPixel( aNewPnt ); - aNewPnt = aPathED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathED.SetPosPixel( aNewPnt ); - aNewPnt = aPathInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPathBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPathBtn.SetPosPixel( aNewPnt ); - aNewPnt = aNameFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameFT.SetPosPixel( aNewPnt ); - aNewPnt = aNameED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameED.SetPosPixel( aNewPnt ); - aNewPnt = aNameInfo.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aNameInfo.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordFT.SetPosPixel( aNewPnt ); - aNewPnt = aPasswordED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aPasswordED.SetPosPixel( aNewPnt ); - aNewPnt = aAccountFT.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountFT.SetPosPixel( aNewPnt ); - aNewPnt = aAccountED.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aAccountED.SetPosPixel( aNewPnt ); - aNewPnt = aSavePasswdBtn.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aNewPnt ); - aNewPnt = aLoginGB.GetPosPixel(); - aNewPnt.Y() -= nOffset; - aLoginGB.SetPosPixel( aNewPnt ); - Size aNewSiz = GetSizePixel(); - aNewSiz.Height() -= nOffset; - SetSizePixel( aNewSiz ); - } - - if ( bPathHide ) - { - long nOffset = aNameED.GetPosPixel().Y() - - aPathED.GetPosPixel().Y(); - - Point aTmpPnt1 = aNameFT.GetPosPixel(); - Point aTmpPnt2 = aPasswordFT.GetPosPixel(); - aNameFT.SetPosPixel( aPathFT.GetPosPixel() ); - aPasswordFT.SetPosPixel( aTmpPnt1 ); - aAccountFT.SetPosPixel( aTmpPnt2 ); - aTmpPnt1 = aNameED.GetPosPixel(); - aTmpPnt2 = aPasswordED.GetPosPixel(); - aNameED.SetPosPixel( aPathED.GetPosPixel() ); - aPasswordED.SetPosPixel( aTmpPnt1 ); - aAccountED.SetPosPixel( aTmpPnt2 ); - aNameInfo.SetPosPixel( aPathInfo.GetPosPixel() ); - aTmpPnt1 = aSavePasswdBtn.GetPosPixel(); - aTmpPnt1.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt1 ); - Size aNewSz = GetSizePixel(); - aNewSz.Height() -= nOffset; - SetSizePixel( aNewSz ); - } - - if ( bAccountHide ) - { - long nOffset = aAccountED.GetPosPixel().Y() - aPasswordED.GetPosPixel().Y(); - - Point aTmpPnt = aSavePasswdBtn.GetPosPixel(); - aTmpPnt.Y() -= nOffset; - aSavePasswdBtn.SetPosPixel( aTmpPnt ); - Size aNewSz = GetSizePixel(); - aNewSz.Height() -= nOffset; - SetSizePixel( aNewSz ); - } -}; - -// ----------------------------------------------------------------------- - -IMPL_LINK( LoginDialog, OKHdl_Impl, OKButton *, EMPTYARG ) -{ - // trim the strings - aNameED.SetText( aNameED.GetText().EraseLeadingChars(). - EraseTrailingChars() ); - aPasswordED.SetText( aPasswordED.GetText().EraseLeadingChars(). - EraseTrailingChars() ); - EndDialog( RET_OK ); - return 1; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( LoginDialog, PathHdl_Impl, PushButton *, EMPTYARG ) -{ - PathDialog* pDlg = new PathDialog( this, WB_3DLOOK ); -// DirEntry aEntry; -// aEntry.ToAbs(); -// pDlg->SetPath( aEntry.GetFull() ); - - if ( pDlg->Execute() == RET_OK ) - aPathED.SetText( pDlg->GetPath() ); - - delete pDlg; - return 1; -} - -// ----------------------------------------------------------------------- - -LoginDialog::LoginDialog -( - Window* pParent, - USHORT nFlags, - const String& rServer, - const String* pRealm -) : - - ModalDialog( pParent, SvtResId( DLG_LOGIN ) ), - - aErrorInfo ( this, SvtResId( INFO_LOGIN_ERROR ) ), - aErrorGB ( this, SvtResId( GB_LOGIN_ERROR ) ), - aRequestInfo ( this, SvtResId( INFO_LOGIN_REQUEST ) ), - aPathFT ( this, SvtResId( FT_LOGIN_PATH ) ), - aPathED ( this, SvtResId( ED_LOGIN_PATH ) ), - aPathInfo ( this, SvtResId( INFO_LOGIN_PATH ) ), - aPathBtn ( this, SvtResId( BTN_LOGIN_PATH ) ), - aNameFT ( this, SvtResId( FT_LOGIN_USERNAME ) ), - aNameED ( this, SvtResId( ED_LOGIN_USERNAME ) ), - aNameInfo ( this, SvtResId( INFO_LOGIN_USERNAME ) ), - aPasswordFT ( this, SvtResId( FT_LOGIN_PASSWORD ) ), - aPasswordED ( this, SvtResId( ED_LOGIN_PASSWORD ) ), - aAccountFT ( this, SvtResId( FT_LOGIN_ACCOUNT ) ), - aAccountED ( this, SvtResId( ED_LOGIN_ACCOUNT ) ), - aSavePasswdBtn ( this, SvtResId( CB_LOGIN_SAVEPASSWORD ) ), - aLoginGB ( this, SvtResId( GB_LOGIN_LOGIN ) ), - aOKBtn ( this, SvtResId( BTN_LOGIN_OK ) ), - aCancelBtn ( this, SvtResId( BTN_LOGIN_CANCEL ) ), - aHelpBtn ( this, SvtResId( BTN_LOGIN_HELP ) ) - -{ - // Einlog-Ort eintragen - String aServer; - - if ( ( ( nFlags & LF_NO_ACCOUNT ) == LF_NO_ACCOUNT ) && pRealm && pRealm->Len() ) - { - aServer = *pRealm; - ( ( aServer += ' ' ) += String( SvtResId( STR_LOGIN_AT ) ) ) += ' '; - } - aServer += rServer; - String aTxt = aRequestInfo.GetText(); - aTxt.SearchAndReplaceAscii( "%1", aServer ); - aRequestInfo.SetText( aTxt ); - - FreeResource(); - - aPathED.SetMaxTextLen( _MAX_PATH ); - aNameED.SetMaxTextLen( _MAX_PATH ); - - aOKBtn.SetClickHdl( LINK( this, LoginDialog, OKHdl_Impl ) ); - aPathBtn.SetClickHdl( LINK( this, LoginDialog, PathHdl_Impl ) ); - - HideControls_Impl( nFlags ); -}; - -// ----------------------------------------------------------------------- - -void LoginDialog::SetName( const String& rNewName ) -{ - aNameED.SetText( rNewName ); - aNameInfo.SetText( rNewName ); -} - -// ----------------------------------------------------------------------- - -void LoginDialog::ClearPassword() -{ - aPasswordED.SetText( String() ); - - if ( 0 == aNameED.GetText().Len() ) - aNameED.GrabFocus(); - else - aPasswordED.GrabFocus(); -}; - -// ----------------------------------------------------------------------- - -void LoginDialog::ClearAccount() -{ - aAccountED.SetText( String() ); - aAccountED.GrabFocus(); -}; - -//............................................................................ -} // namespace svt -//............................................................................ diff --git a/svtools/source/dialogs/logindlg.hrc b/svtools/source/dialogs/logindlg.hrc deleted file mode 100644 index 7baf6010f531..000000000000 --- a/svtools/source/dialogs/logindlg.hrc +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#define _SVTOOLS_LOGINDLG_HRC_ - -//============================================================================ -#define INFO_LOGIN_ERROR 10 -#define GB_LOGIN_ERROR 11 - -#define INFO_LOGIN_REQUEST 20 -#define FT_LOGIN_PATH 21 -#define ED_LOGIN_PATH 22 -#define INFO_LOGIN_PATH 23 -#define BTN_LOGIN_PATH 24 -#define FT_LOGIN_USERNAME 25 -#define ED_LOGIN_USERNAME 26 -#define INFO_LOGIN_USERNAME 27 -#define FT_LOGIN_PASSWORD 28 -#define ED_LOGIN_PASSWORD 29 -#define FT_LOGIN_ACCOUNT 30 -#define ED_LOGIN_ACCOUNT 31 -#define CB_LOGIN_SAVEPASSWORD 32 -#define GB_LOGIN_LOGIN 33 - -#define BTN_LOGIN_OK 50 -#define BTN_LOGIN_CANCEL 51 -#define BTN_LOGIN_HELP 52 - -#define STR_LOGIN_AT 60 - -#endif // _SVTOOLS_LOGINDLG_HRC_ diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src deleted file mode 100644 index 338b608ab0e4..000000000000 --- a/svtools/source/dialogs/logindlg.src +++ /dev/null @@ -1,200 +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 _SVTOOLS_HRC -#include -#endif - -#ifndef _SVTOOLS_LOGINDLG_HRC_ -#include "logindlg.hrc" -#endif - -ModalDialog DLG_LOGIN -{ -// HelpId = HID_DLG_LOGIN ; - Border = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 265 , 158 ) ; - FixedText INFO_LOGIN_ERROR - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; - WordBreak = TRUE ; - }; - FixedLine GB_LOGIN_ERROR - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Message from server" ; - }; - FixedText INFO_LOGIN_REQUEST - { - Pos = MAP_APPFONT ( 12 , 55 ) ; - Size = MAP_APPFONT ( 185 , 18 ) ; - WordBreak = TRUE ; - Text [ en-US ] = "Please enter user name and password for %1." ; - }; - FixedText FT_LOGIN_PATH - { - Pos = MAP_APPFONT ( 12 , 77 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "~Path" ; - }; - Edit ED_LOGIN_PATH - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 76 ) ; - Size = MAP_APPFONT ( 108 , 12 ) ; - }; - FixedText INFO_LOGIN_PATH - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 77 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; - }; - PushButton BTN_LOGIN_PATH - { - Pos = MAP_APPFONT ( 183 , 75 ) ; - Size = MAP_APPFONT ( 14 , 14 ) ; - Text = "~..." ; - }; - FixedText FT_LOGIN_USERNAME - { - Pos = MAP_APPFONT ( 12 , 92 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "~User name" ; - }; - Edit ED_LOGIN_USERNAME - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 91 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - }; - FixedText INFO_LOGIN_USERNAME - { - Hide = TRUE ; - Pos = MAP_APPFONT ( 72 , 92 ) ; - Size = MAP_APPFONT ( 125 , 10 ) ; - }; - FixedText FT_LOGIN_PASSWORD - { - Pos = MAP_APPFONT ( 12 , 107 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "Pass~word" ; - }; - Edit ED_LOGIN_PASSWORD - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 106 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - PassWord = TRUE ; - }; - FixedText FT_LOGIN_ACCOUNT - { - Pos = MAP_APPFONT ( 12 , 122 ) ; - Size = MAP_APPFONT ( 57 , 10 ) ; - Text [ en-US ] = "A~ccount"; - }; - Edit ED_LOGIN_ACCOUNT - { - Border = TRUE ; - Pos = MAP_APPFONT ( 72 , 121 ) ; - Size = MAP_APPFONT ( 125 , 12 ) ; - PassWord = TRUE ; - }; - CheckBox CB_LOGIN_SAVEPASSWORD - { - Pos = MAP_APPFONT ( 12 , 136 ) ; - Size = MAP_APPFONT ( 185 , 10 ) ; - Text [ en-US ] = "~Save password" ; - }; - FixedLine GB_LOGIN_LOGIN - { - Pos = MAP_APPFONT ( 7 , 44 ) ; - Size = MAP_APPFONT ( 197 , 8 ) ; - Text [ en-US ] = "Log in" ; - }; - OKButton BTN_LOGIN_OK - { - Pos = MAP_APPFONT ( 209 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE ; - }; - CancelButton BTN_LOGIN_CANCEL - { - Pos = MAP_APPFONT ( 209 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - HelpButton BTN_LOGIN_HELP - { - Pos = MAP_APPFONT ( 209 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; - String STR_LOGIN_AT - { - Text [ en-US ] = "to " ; - }; - Text [ en-US ] = "User Name and Password Required" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/dialogs/makefile.mk b/svtools/source/dialogs/makefile.mk old mode 100644 new mode 100755 index 16528ee7d4cd..99c4b59b76ae --- a/svtools/source/dialogs/makefile.mk +++ b/svtools/source/dialogs/makefile.mk @@ -44,7 +44,6 @@ SRC1FILES= filedlg2.src \ prnsetup.src \ printdlg.src \ colrdlg.src \ - logindlg.src \ addresstemplate.src \ wizardmachine.src @@ -69,8 +68,7 @@ SLOFILES= \ $(SLO)$/colrdlg.obj \ $(SLO)$/property.obj \ $(SLO)$/wizdlg.obj \ - $(SLO)$/mcvmath.obj \ - $(SLO)$/logindlg.obj + $(SLO)$/mcvmath.obj # --- Targets ------------------------------------------------------ -- cgit From 584218ca4bd661500aff38d78cffa8d888950bef Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 16 Mar 2010 11:06:23 +0100 Subject: cws tl79: #i110053# remove old svtools LoginDialog --- svl/inc/svl/svtools.hrc | 1 - 1 file changed, 1 deletion(-) mode change 100644 => 100755 svl/inc/svl/svtools.hrc diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc old mode 100644 new mode 100755 index 738bee6cbf21..51db8f8c8d6a --- a/svl/inc/svl/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -412,7 +412,6 @@ #define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) #define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) -#define DLG_LOGIN (RID_SVTOOLS_START+113) #define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) #define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) -- cgit From 9fd504900c9041079effc0a7f7a370089bf4a770 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Mar 2010 10:38:47 +0100 Subject: #i110165# prevent NULL option for cairo_ft_font_options_substitute() --- vcl/unx/source/gdi/salgdi3.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 0c1fcd7c77bd..d60f575ad674 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -1633,11 +1633,13 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* ) void cairosubcallback( void* pPattern ) { CairoWrapper& rCairo = CairoWrapper::get(); - if( rCairo.isValid() ) - { + if( !rCairo.isValid() ) + return; const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rCairo.ft_font_options_substitute( rStyleSettings.GetCairoFontOptions(), pPattern); - } + const void* pFontOptions = rStyleSettings.GetCairoFontOptions(); + if( !pFontOptions ) + return; + rCairo.ft_font_options_substitute( pFontOptions, pPattern ); } bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, -- cgit From 7a416820ab5e03f8b988656e0f6a592cb1e81d07 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Mar 2010 10:49:01 +0100 Subject: #i110078# cache dynamic font options --- vcl/inc/vcl/glyphcache.hxx | 5 +++++ vcl/source/glyphs/glyphcache.cxx | 6 ++++-- vcl/unx/source/gdi/salgdi3.cxx | 28 +++++++++++++++++++++------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx index fa3e99f2373f..a77c1626dc24 100644 --- a/vcl/inc/vcl/glyphcache.hxx +++ b/vcl/inc/vcl/glyphcache.hxx @@ -51,6 +51,7 @@ class RawBitmap; class CmapResult; #include +#include class ServerFontLayout; #include @@ -258,11 +259,15 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry { private: ServerFont* mpServerFont; + ImplFontOptions maFontOptions; + bool mbGotFontOptions; + bool mbValidFontOptions; public: ImplServerFontEntry( ImplFontSelectData& ); virtual ~ImplServerFontEntry(); void SetServerFont( ServerFont* p) { mpServerFont = p; } + void HandleFontOptions(); }; // ======================================================================= diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index ea0f18896b7a..1953ecf553c4 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -519,8 +519,10 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex ) // ======================================================================= ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD ) -: ImplFontEntry( rFSD ), - mpServerFont( NULL ) +: ImplFontEntry( rFSD ) +, mpServerFont( NULL ) +, mbGotFontOptions( false ) +, mbValidFontOptions( false ) {} // ----------------------------------------------------------------------- diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index d60f575ad674..bed6edfbedd6 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev mpServerFont[ nFallbackLevel ] = pServerFont; // apply font specific-hint settings if needed + // TODO: also disable it for reference devices if( !bPrinter_ ) { - // TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry? - ImplFontOptions aFontOptions; - bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&); - if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) ) - pServerFont->SetFontOptions( aFontOptions ); + ImplServerFontEntry* pSFE = static_cast( pEntry->mpFontEntry ); + pSFE->HandleFontOptions(); } return true; @@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev return false; } +void ImplServerFontEntry::HandleFontOptions( void ) +{ + bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& ); + + if( !mpServerFont ) + return; + if( !mbGotFontOptions ) + { + // get and cache the font options + mbGotFontOptions = true; + mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData, + maFontSelData.mnHeight, maFontOptions ); + } + // apply the font options + if( mbValidFontOptions ) + mpServerFont->SetFontOptions( maFontOptions ); +} + //-------------------------------------------------------------------------- inline sal_Unicode SwapBytes( const sal_Unicode nIn ) @@ -1666,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, default: aInfo.m_eItalic = psp::italic::Unknown; break; - } // set weight switch( rFontAttributes.GetWeight() ) @@ -1742,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize, const psp::PrintFontManager& rPFM = psp::PrintFontManager::get(); bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions); - return bOK; } -- cgit From 47e77dffb776edb5f60ec0b5321e554e314dedd3 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 17 Mar 2010 12:00:08 +0100 Subject: #i110023# fix attribute based font matching --- vcl/source/gdi/outdev3.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index e13ae6cbe64a..630e58a1f2bf 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -2091,11 +2091,14 @@ ImplDevFontListData* ImplDevFontList::FindDefaultFont() const ImplDevFontList* ImplDevFontList::Clone( bool bScalable, bool bEmbeddable ) const { ImplDevFontList* pClonedList = new ImplDevFontList; - pClonedList->mbMatchData = mbMatchData; +// pClonedList->mbMatchData = mbMatchData; pClonedList->mbMapNames = mbMapNames; pClonedList->mpPreMatchHook = mpPreMatchHook; pClonedList->mpFallbackHook = mpFallbackHook; + // TODO: clone the config-font attributes too? + pClonedList->mbMatchData = false; + DevFontList::const_iterator it = maDevFontList.begin(); for(; it != maDevFontList.end(); ++it ) { -- cgit From 6f27503a9eb9341d3656149e2fe4b658a643b9ab Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 17 Mar 2010 18:17:41 +0100 Subject: vcl110: #i103230# add row/columns attributes to tables --- vcl/aqua/source/a11y/aqua11yfactory.mm | 3 + vcl/aqua/source/a11y/aqua11ytablewrapper.h | 10 +- vcl/aqua/source/a11y/aqua11ytablewrapper.mm | 182 +++++++++++++++++++++++----- vcl/aqua/source/a11y/aqua11ywrapper.mm | 31 +++-- 4 files changed, 185 insertions(+), 41 deletions(-) diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm index eb745ea24aa5..7732ce202cd2 100644 --- a/vcl/aqua/source/a11y/aqua11yfactory.mm +++ b/vcl/aqua/source/a11y/aqua11yfactory.mm @@ -48,6 +48,7 @@ #include "aqua11ywrappersplitter.h" #include "aqua11ywrappertabgroup.h" #include "aqua11ywrappertoolbar.h" +#include "aqua11ytablewrapper.h" #include using namespace ::com::sun::star::accessibility; @@ -142,6 +143,8 @@ static bool enabled = false; aWrapper = [ [ AquaA11yWrapperList alloc ] initWithAccessibleContext: rxAccessibleContext ]; } else if ( [ nativeRole isEqualToString: NSAccessibilitySplitterRole ] ) { aWrapper = [ [ AquaA11yWrapperSplitter alloc ] initWithAccessibleContext: rxAccessibleContext ]; + } else if ( [ nativeRole isEqualToString: NSAccessibilityTableRole ] ) { + aWrapper = [ [ AquaA11yTableWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ]; } else { aWrapper = [ [ AquaA11yWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ]; } diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.h b/vcl/aqua/source/a11y/aqua11ytablewrapper.h index 8753365377e3..7bf3e44a2945 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.h +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.h @@ -30,9 +30,15 @@ #include "aqua11ywrapper.h" -@interface AquaA11yTableWrapper : NSObject +#define MAXIMUM_ACCESSIBLE_TABLE_CELLS 1000 + +@interface AquaA11yTableWrapper : AquaA11yWrapper { } -+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper; ++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper; ++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject; + +-(id)rowsAttribute; +-(id)columnsAttribute; @end #endif // _SV_AQUA11TABLEWRAPPER_H diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm index 08205ac8a66b..98454ab8d57b 100644 --- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm @@ -35,38 +35,120 @@ using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::uno; -@implementation AquaA11yTableWrapper : NSObject +@implementation AquaA11yTableWrapper : AquaA11yWrapper -+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper ++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper { - try + XAccessibleTable * accessibleTable = [ wrapper accessibleTable ]; + NSArray* pResult = nil; + if( accessibleTable ) { NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; - XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ]; - XAccessibleTable * accessibleTable = [ wrapper accessibleTable ]; - // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell - Size tableSize = accessibleComponent -> getSize(); - Point point; - point.X = 0; - point.Y = 0; - Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point ); - point.X = tableSize.Width - 1; - point.Y = tableSize.Height - 1; - Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point ); - if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() ) + try { - sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent(); - sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent(); - sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft ); - sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft ); - sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight ); - sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight ); - // create an array containing the visible cells - for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ ) + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) { - for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ ) + // make all children visible to the hierarchy + for ( sal_Int32 rowCount = 0; rowCount < nRows; rowCount++ ) { - Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + for ( sal_Int32 columnCount = 0; columnCount < nCols; columnCount++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + } + } + else + { + XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ]; + // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell + Size tableSize = accessibleComponent -> getSize(); + Point point; + point.X = 0; + point.Y = 0; + Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point ); + point.X = tableSize.Width - 1; + point.Y = tableSize.Height - 1; + Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point ); + if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() ) + { + sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent(); + sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent(); + sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft ); + sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft ); + sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight ); + sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight ); + // create an array containing the visible cells + for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ ) + { + for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + } + } + } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + } + [cells autorelease]; + } + + return pResult; +} + ++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject +{ + XAccessibleTable * accessibleTable = [ pObject accessibleTable ]; + if( accessibleTable ) + { + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + + + if( nRows*nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + [ attributeNames addObject: NSAccessibilityRowsAttribute ]; + [ attributeNames addObject: NSAccessibilityColumnsAttribute ]; + } + } +} + +-(id)rowsAttribute +{ + NSArray* pResult = nil; + + XAccessibleTable * accessibleTable = [ self accessibleTable ]; + if( accessibleTable ) + { + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; + try + { + // find out number of rows + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + for( sal_Int32 n = 0; n < nRows; n++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( n, 0 ); if ( rAccessibleCell.is() ) { id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; @@ -74,16 +156,56 @@ using namespace ::com::sun::star::uno; [ cell_wrapper release ]; } } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + pResult = nil; } + [ cells autorelease ]; } - [ cells autorelease ]; - return NSAccessibilityUnignoredChildren( cells ); } - catch (const Exception &e) + + return pResult; +} + +-(id)columnsAttribute +{ + NSArray* pResult = nil; + + XAccessibleTable * accessibleTable = [ self accessibleTable ]; + + if( accessibleTable ) { - // TODO: Log - return nil; + sal_Int32 nRows = accessibleTable->getAccessibleRowCount(); + sal_Int32 nCols = accessibleTable->getAccessibleColumnCount(); + if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS ) + { + NSMutableArray * cells = [ [ NSMutableArray alloc ] init ]; + try + { + // find out number of columns + for( sal_Int32 n = 0; n < nCols; n++ ) + { + Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( 0, n ); + if ( rAccessibleCell.is() ) + { + id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ]; + [ cells addObject: cell_wrapper ]; + [ cell_wrapper release ]; + } + } + pResult = NSAccessibilityUnignoredChildren( cells ); + } + catch (const Exception &e) + { + pResult = nil; + } + [ cells autorelease ]; + } } + + return pResult; } @end diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index 959746d533dc..e86676e725f2 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -29,6 +29,8 @@ #include "precompiled_vcl.hxx" #include "salinst.h" +#include "saldata.hxx" + #include "aqua11ywrapper.h" #include "aqua11yactionwrapper.h" #include "aqua11ycomponentwrapper.h" @@ -41,6 +43,7 @@ #include "aqua11yfocuslistener.hxx" #include "aqua11yfocustracker.hxx" #include "aqua11yrolehelper.h" + #include #include #include @@ -217,7 +220,8 @@ static MacOSBOOL isPopupMenuOpen = NO; -(id)roleAttribute { if ( mActsAsRadioGroup ) { return NSAccessibilityRadioGroupRole; - } else { + } + else { return [ AquaA11yRoleHelper getNativeRoleFrom: [ self accessibleContext ] ]; } } @@ -323,8 +327,10 @@ static MacOSBOOL isPopupMenuOpen = NO; } } return children; - } else if ( [ self accessibleTable ] != nil ) { - return [ AquaA11yTableWrapper childrenAttributeForElement: self ]; + } else if ( [ self accessibleTable ] != nil ) + { + AquaA11yTableWrapper* pTable = [self isKindOfClass: [AquaA11yTableWrapper class]] ? (AquaA11yTableWrapper*)self : nil; + return [ AquaA11yTableWrapper childrenAttributeForElement: pTable ]; } else { try { NSMutableArray * children = [ [ NSMutableArray alloc ] init ]; @@ -663,6 +669,7 @@ static MacOSBOOL isPopupMenuOpen = NO; if ( isPopupMenuOpen ) { return nil; } + id value = nil; // if we are no longer in the wrapper repository, we have been disposed AquaA11yWrapper * theWrapper = [ AquaA11yFactory wrapperForAccessibleContext: [ self accessibleContext ] createIfNotExists: NO ]; @@ -717,6 +724,7 @@ static MacOSBOOL isPopupMenuOpen = NO; NSString * nativeSubrole = nil; NSString * title = nil; NSMutableArray * attributeNames = nil; + sal_Int32 nAccessibleChildren = 0; try { // Default Attributes attributeNames = [ NSMutableArray arrayWithObjects: @@ -737,8 +745,9 @@ static MacOSBOOL isPopupMenuOpen = NO; } try { - if ( [ self accessibleContext ] -> getAccessibleChildCount() > 0 ) { - [ attributeNames addObject: NSAccessibilityChildrenAttribute ]; + nAccessibleChildren = [ self accessibleContext ] -> getAccessibleChildCount(); + if ( nAccessibleChildren > 0 ) { + [ attributeNames addObject: NSAccessibilityChildrenAttribute ]; } } catch( DisposedException& ) {} @@ -754,6 +763,9 @@ static MacOSBOOL isPopupMenuOpen = NO; [ attributeNames addObject: NSAccessibilityServesAsTitleForUIElementsAttribute ]; } // Special Attributes depending on interface + if( [self accessibleContext ] -> getAccessibleRole() == AccessibleRole::TABLE ) + [AquaA11yTableWrapper addAttributeNamesTo: attributeNames object: self]; + if ( [ self accessibleText ] != nil ) { [ AquaA11yTextWrapper addAttributeNamesTo: attributeNames ]; } @@ -953,14 +965,15 @@ static MacOSBOOL isPopupMenuOpen = NO; return hit; } -Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAccessibleContext > rxAccessibleContext ) { +Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point point, + Reference < XAccessibleContext > rxAccessibleContext ) { Reference < XAccessibleContext > hitChild; Reference < XAccessibleContext > emptyReference; try { Reference < XAccessibleComponent > rxAccessibleComponent ( rxAccessibleContext, UNO_QUERY ); if ( rxAccessibleComponent.is() ) { - Point location = rxAccessibleComponent -> getLocationOnScreen(); - Point hitPoint ( point.X - location.X , point.Y - location.Y); + com::sun::star::awt::Point location = rxAccessibleComponent -> getLocationOnScreen(); + com::sun::star::awt::Point hitPoint ( point.X - location.X , point.Y - location.Y); Reference < XAccessible > rxAccessible = rxAccessibleComponent -> getAccessibleAtPoint ( hitPoint ); if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) { if ( rxAccessible -> getAccessibleContext() -> getAccessibleChildCount() > 0 ) { @@ -999,7 +1012,7 @@ Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAcces } Reference < XAccessibleContext > hitChild; NSRect screenRect = [ [ NSScreen mainScreen ] frame ]; - Point hitPoint ( static_cast(point.x) , static_cast(screenRect.size.height - point.y) ); + com::sun::star::awt::Point hitPoint ( static_cast(point.x) , static_cast(screenRect.size.height - point.y) ); // check child windows first NSWindow * window = (NSWindow *) [ self accessibilityAttributeValue: NSAccessibilityWindowAttribute ]; NSArray * childWindows = [ window childWindows ]; -- cgit From 7ea91da6ac4e351d006e09f142f0fd808cd311f0 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 17 Mar 2010 22:53:21 +0100 Subject: whitespace cleanup. --- .../source/provider/simpleauthenticationrequest.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index f292fdf5fc06..b4804912ca38 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -200,18 +200,19 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( //========================================================================= void SimpleAuthenticationRequest::initialize( - const ucb::URLAuthenticationRequest & rRequest, - sal_Bool bCanSetRealm, - sal_Bool bCanSetUserName, - sal_Bool bCanSetPassword, - sal_Bool bCanSetAccount, - sal_Bool bAllowPersistentStoring, - sal_Bool bAllowUseSystemCredentials ) + const ucb::URLAuthenticationRequest & rRequest, + sal_Bool bCanSetRealm, + sal_Bool bCanSetUserName, + sal_Bool bCanSetPassword, + sal_Bool bCanSetAccount, + sal_Bool bAllowPersistentStoring, + sal_Bool bAllowUseSystemCredentials ) { setRequest( uno::makeAny( rRequest ) ); // Fill continuations... - uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 ); + uno::Sequence< ucb::RememberAuthentication > aRememberModes( + bAllowPersistentStoring ? 3 : 2 ); aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; if (bAllowPersistentStoring) -- cgit From e590adb726cb05135bcd04e43117e2a77ec6f41f Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 18 Mar 2010 11:11:15 +0100 Subject: #i110213# - credentials handling improvements. --- ucbhelper/source/provider/simpleauthenticationrequest.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index b4804912ca38..4979d8f5661a 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -67,7 +67,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( sal_True, sal_True, aRequest.HasAccount, - sal_False, + sal_True, sal_False ); } //========================================================================= @@ -149,7 +149,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( eUserNameType == ENTITY_MODIFY, ePasswordType == ENTITY_MODIFY, eAccountType == ENTITY_MODIFY, - sal_False, + sal_True, sal_False ); } @@ -216,7 +216,7 @@ void SimpleAuthenticationRequest::initialize( aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; if (bAllowPersistentStoring) - aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT; + aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT; m_xAuthSupplier = new InteractionSupplyAuthentication( -- cgit From dadd371743f7f904e1f6bf020603b65e0a43e13b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 18 Mar 2010 14:24:20 +0100 Subject: merge --- tools/source/stream/strmunx.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 8a3504a417c0..9e4f501d1823 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -91,7 +91,7 @@ InternalStreamLock::InternalStreamLock( #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "locked %s", aFileName.GetBuffer() ); if( m_nStartPos || m_nEndPos ) - fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos ); + fprintf(stderr, " [ %ld ... %ld ]", m_nStartPos, m_nEndPos ); fprintf( stderr, "\n" ); #endif } @@ -103,7 +103,7 @@ InternalStreamLock::~InternalStreamLock() ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding()); fprintf( stderr, "unlocked %s", aFileName.GetBuffer() ); if( m_nStartPos || m_nEndPos ) - fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos ); + fprintf(stderr, " [ %ld ... %ld ]", m_nStartPos, m_nEndPos ); fprintf( stderr, "\n" ); #endif } @@ -514,7 +514,7 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) if( ! InternalStreamLock::LockFile( nByteOffset, nByteOffset+nBytes, this ) ) { #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "InternalLock on %s [ %d ... %d ] failed\n", + fprintf( stderr, "InternalLock on %s [ %ld ... %ld ] failed\n", ByteString(aFilename, osl_getThreadTextEncoding()).GetBuffer(), nByteOffset, nByteOffset+nBytes ); #endif return sal_False; -- cgit From 6285c33e7998d000f8b043b4c4447114ff2afedb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 18 Mar 2010 16:21:44 +0100 Subject: vcl110: #i110219# remove unnecessary beep --- vcl/source/control/tabctrl.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 5c08cdb8a36b..8c5bbc4042ae 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1096,8 +1096,6 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) ImplTabItem* pItem = ImplGetItem( nPageId ); if( pItem && pItem->mbEnabled ) SelectTabPage( nPageId ); - else - Sound::Beep( SOUND_ERROR, this ); } } } -- cgit From 698effa739ea2b239ef449abc9782301024837e0 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 19 Mar 2010 11:13:29 +0100 Subject: cws tl79: #i110254# new 'Security' tab page --- svtools/inc/svtools/xwindowitem.hxx | 70 ++++++++++++++++++++++++++ svtools/source/misc/makefile.mk | 3 +- svtools/source/misc/xwindowitem.cxx | 97 +++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 1 deletion(-) create mode 100755 svtools/inc/svtools/xwindowitem.hxx mode change 100644 => 100755 svtools/source/misc/makefile.mk create mode 100755 svtools/source/misc/xwindowitem.cxx diff --git a/svtools/inc/svtools/xwindowitem.hxx b/svtools/inc/svtools/xwindowitem.hxx new file mode 100755 index 000000000000..eca425cf1369 --- /dev/null +++ b/svtools/inc/svtools/xwindowitem.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: chrtitem.hxx,v $ + * $Revision: 1.9 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _XWINDOWITEM_HXX_ +#define _XWINDOWITEM_HXX_ + + +#include "svtools/svtdllapi.h" + +#include +#include + +#include + +class Window; + +////////////////////////////////////////////////////////////////////// + +class SVT_DLLPUBLIC XWindowItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWin; + + // disallow use assignment operator + XWindowItem & operator = ( const XWindowItem & ); + +public: + TYPEINFO(); + XWindowItem(); + explicit XWindowItem( USHORT nWhich, Window * pWin ); + XWindowItem( USHORT nWhich, com::sun::star::uno::Reference< com::sun::star::awt::XWindow > & rxWin ); + XWindowItem( const XWindowItem &rItem ); + ~XWindowItem(); + + virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const; + virtual int operator == ( const SfxPoolItem& rAttr ) const; + + Window * GetWindowPtr() const { return VCLUnoHelper::GetWindow( m_xWin ); } + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > GetXWindow() const { return m_xWin; } +}; + +////////////////////////////////////////////////////////////////////// + +#endif + diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk old mode 100644 new mode 100755 index 65e43747a586..32781dbfefb1 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -75,7 +75,8 @@ SLOFILES=\ $(SLO)$/transfer.obj \ $(SLO)$/transfer2.obj \ $(SLO)$/unitconv.obj \ - $(SLO)$/wallitem.obj + $(SLO)$/wallitem.obj \ + $(SLO)$/xwindowitem.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/misc/xwindowitem.cxx b/svtools/source/misc/xwindowitem.cxx new file mode 100755 index 000000000000..7ddddc4c3195 --- /dev/null +++ b/svtools/source/misc/xwindowitem.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "svtools/xwindowitem.hxx" + +#include + + +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////// + +TYPEINIT1_FACTORY( XWindowItem, SfxPoolItem, new XWindowItem ); + + +XWindowItem::XWindowItem() : + SfxPoolItem() +{ +} + + +XWindowItem::XWindowItem( USHORT nWhich, Window * pWin ) : + SfxPoolItem( nWhich ) +{ + if (pWin) + { + m_xWin = uno::Reference< awt::XWindow >( pWin->GetComponentInterface(), uno::UNO_QUERY ); + // the assertion can't possibly fails since VCLXWindow implements XWindow... + DBG_ASSERT( m_xWin.is(), "failed to get XWindow" ); + } +} + + +XWindowItem::XWindowItem( USHORT nWhich, uno::Reference< awt::XWindow > & rxWin ) : + SfxPoolItem( nWhich ), + m_xWin( rxWin ) +{ +} + + +XWindowItem::XWindowItem( const XWindowItem &rItem ) : + SfxPoolItem( Which() ), + m_xWin( rItem.m_xWin ) +{ +} + + +XWindowItem::~XWindowItem() +{ +} + + +SfxPoolItem * XWindowItem::Clone( SfxItemPool* /*pPool*/ ) const +{ + return new XWindowItem( *this ); +} + + +int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); + + const XWindowItem * pItem = dynamic_cast< const XWindowItem * >(&rAttr); + return pItem ? m_xWin == pItem->m_xWin : 0; +} + + +////////////////////////////////////////////////////////////////////// + + -- cgit From c71eb88a08616d55a70574fe5fbd118460e129ac Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 19 Mar 2010 19:20:24 +0100 Subject: vcl110: #i93672# hide fonts button in fontconfig case --- padmin/source/padialog.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 3ea15e28141c..583e14c06caa 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -147,6 +147,11 @@ void PADialog::Init() ::psp::PrintFontManager& rFontManager( ::psp::PrintFontManager::get() ); if( ! rFontManager.checkImportPossible() ) m_aFontsPB.Enable( FALSE ); + if( rFontManager.hasFontconfig() ) + { + m_aFontsPB.Enable( FALSE ); + m_aFontsPB.Show( FALSE ); + } } PADialog::~PADialog() -- cgit From c10f069c3385a7c55a9042315f7fe3a83fc56fd3 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Sun, 21 Mar 2010 20:01:33 +0100 Subject: Adding PopupMenuController to allow PopupMenuControllerBase dervivates to be used in toolbars --- svtools/inc/svtools/popupmenucontrollerbase.hxx | 141 ++++++++ svtools/inc/svtools/popupwindowcontroller.hxx | 4 +- svtools/inc/svtools/toolboxcontroller.hxx | 7 + svtools/source/uno/makefile.mk | 3 +- svtools/source/uno/popupmenucontrollerbase.cxx | 421 ++++++++++++++++++++++++ svtools/source/uno/popupwindowcontroller.cxx | 13 + svtools/source/uno/toolboxcontroller.cxx | 90 ++++- 7 files changed, 667 insertions(+), 12 deletions(-) create mode 100644 svtools/inc/svtools/popupmenucontrollerbase.hxx create mode 100644 svtools/source/uno/popupmenucontrollerbase.cxx diff --git a/svtools/inc/svtools/popupmenucontrollerbase.hxx b/svtools/inc/svtools/popupmenucontrollerbase.hxx new file mode 100644 index 000000000000..706ce076be02 --- /dev/null +++ b/svtools/inc/svtools/popupmenucontrollerbase.hxx @@ -0,0 +1,141 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_ +#define __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_ + +#include "svtools/svtdllapi.h" + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ +#include +#include +#include +#include +#include + +namespace svt +{ + struct PopupMenuControllerBaseDispatchInfo; + + typedef public ::cppu::WeakComponentImplHelper7< + com::sun::star::lang::XServiceInfo , + com::sun::star::frame::XPopupMenuController , + com::sun::star::lang::XInitialization , + com::sun::star::frame::XStatusListener , + com::sun::star::awt::XMenuListener , + com::sun::star::frame::XDispatchProvider , + com::sun::star::frame::XDispatch > PopupMenuControllerBaseType; + + class SVT_DLLPUBLIC PopupMenuControllerBase : protected ::comphelper::OBaseMutex, // Struct for right initalization of mutex member! Must be first of baseclasses. + public PopupMenuControllerBaseType + { + public: + PopupMenuControllerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~PopupMenuControllerBase(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0; + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0; + + // XPopupMenuController + virtual void SAL_CALL setPopupMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& PopupMenu ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updatePopupMenu() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ) = 0; + + // XMenuListener + virtual void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException); + + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTarget, sal_Int32 nFlags ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& lDescriptor ) throw( ::com::sun::star::uno::RuntimeException ); + + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqProperties ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + + protected: + void throwIfDisposed() throw ( ::com::sun::star::uno::RuntimeException ); + + /** helper method to cause statusChanged is called once for the given command url */ + void SAL_CALL updateCommand( const rtl::OUString& rCommandURL ); + + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing(); + + virtual void resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ); + virtual void impl_setPopupMenu(); + virtual void impl_select(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL); + ::rtl::OUString determineBaseURL( const ::rtl::OUString& aURL ); + + DECL_STATIC_LINK( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo* ); + + + bool m_bInitialized; + rtl::OUString m_aCommandURL; + rtl::OUString m_aBaseURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xDispatch; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > m_xPopupMenu; + }; +} + +#endif // __SVTOOLS_POPUPMENUCONTROLLERBASE_HXX_ diff --git a/svtools/inc/svtools/popupwindowcontroller.hxx b/svtools/inc/svtools/popupwindowcontroller.hxx index e9f586724bc4..4877d0184318 100644 --- a/svtools/inc/svtools/popupwindowcontroller.hxx +++ b/svtools/inc/svtools/popupwindowcontroller.hxx @@ -61,6 +61,9 @@ public: virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) = 0; + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + // XComponent virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); @@ -73,7 +76,6 @@ public: virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); - private: boost::scoped_ptr< PopupWindowControllerImpl > mpImpl; }; diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index 749099aaf639..96e48a399831 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -48,6 +48,8 @@ #define INCLUDED_HASH_MAP #endif +class ToolBox; + namespace svt { struct ToolboxController_Impl; @@ -104,10 +106,15 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); const rtl::OUString& getCommandURL() const { return m_aCommandURL; } + const rtl::OUString& getModuleName() const; void dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + void enable( bool bEnable ); + protected: + bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ); + struct Listener { Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 0081d4a5fd9e..665301e9112d 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -56,7 +56,8 @@ SLOFILES= \ $(SLO)$/unoiface.obj \ $(SLO)$/unoimap.obj \ $(SLO)$/svtxgridcontrol.obj \ - $(SLO)$/popupwindowcontroller.obj + $(SLO)$/popupwindowcontroller.obj \ + $(SLO)$/popupmenucontrollerbase.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx new file mode 100644 index 000000000000..457207d317b4 --- /dev/null +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -0,0 +1,421 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_svtools.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include "svtools/popupmenucontrollerbase.hxx" + + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include +#include +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// includes of other projects +//_________________________________________________________________________________________________________________ + +#ifndef _VCL_MENU_HXX_ +#include +#endif +#include +#include +#include +#include + +//_________________________________________________________________________________________________________________ +// Defines +//_________________________________________________________________________________________________________________ +// + +using ::rtl::OUString; + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::frame; +using namespace com::sun::star::beans; +using namespace com::sun::star::util; + +namespace svt +{ + +struct PopupMenuControllerBaseDispatchInfo +{ + Reference< XDispatch > mxDispatch; + const URL maURL; + const Sequence< PropertyValue > maArgs; + + PopupMenuControllerBaseDispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs ) + : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {} +}; + +PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XMultiServiceFactory >& xServiceManager ) : + ::comphelper::OBaseMutex(), + PopupMenuControllerBaseType(m_aMutex), + m_bInitialized( false ), + m_xServiceManager( xServiceManager ) +{ + if ( m_xServiceManager.is() ) + m_xURLTransformer.set( m_xServiceManager->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),UNO_QUERY ); +} + +PopupMenuControllerBase::~PopupMenuControllerBase() +{ +} + +// protected function +void PopupMenuControllerBase::throwIfDisposed() throw ( RuntimeException ) +{ + if (rBHelper.bDisposed || rBHelper.bInDispose) + throw com::sun::star::lang::DisposedException(); +} + +// protected function +void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu ) +{ + VCLXPopupMenu* pPopupMenu = 0; + if ( rPopupMenu.is() && rPopupMenu->getItemCount() > 0 ) + { + pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); + if ( pPopupMenu ) + { + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); + pVCLPopupMenu->Clear(); + } + } +} + +void SAL_CALL PopupMenuControllerBase::disposing() +throw (::com::sun::star::uno::RuntimeException) +{ + // Reset our members and set disposed flag + osl::MutexGuard aLock( m_aMutex ); + m_xFrame.clear(); + m_xDispatch.clear(); + m_xPopupMenu.clear(); + m_xServiceManager.clear(); +} + +// XServiceInfo + +sal_Bool SAL_CALL PopupMenuControllerBase::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) +{ + const Sequence< rtl::OUString > aSNL( getSupportedServiceNames() ); + const rtl::OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return true; + + return false; +} + +// XEventListener +void SAL_CALL PopupMenuControllerBase::disposing( const EventObject& ) throw ( RuntimeException ) +{ + osl::MutexGuard aLock( m_aMutex ); + m_xFrame.clear(); + m_xDispatch.clear(); + m_xPopupMenu.clear(); +} + +// XMenuListener +void SAL_CALL PopupMenuControllerBase::highlight( const awt::MenuEvent& ) throw (RuntimeException) +{ +} + +void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const URL& aURL) +{ + Sequence aArgs; + OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aURL, aArgs ); +} + +void SAL_CALL PopupMenuControllerBase::select( const awt::MenuEvent& rEvent ) throw (RuntimeException) +{ + throwIfDisposed(); + + osl::MutexGuard aLock( m_aMutex ); + + Reference< awt::XMenuExtended > xExtMenu( m_xPopupMenu, UNO_QUERY ); + if( xExtMenu.is() ) + { + Sequence aArgs; + dispatchCommand( xExtMenu->getCommand( rEvent.MenuId ), aArgs ); + } +} + +void PopupMenuControllerBase::dispatchCommand( const ::rtl::OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ) +{ + osl::MutexGuard aLock( m_aMutex ); + + throwIfDisposed(); + + try + { + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW ); + URL aURL; + aURL.Complete = sCommandURL; + m_xURLTransformer->parseStrict( aURL ); + + Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW ); + + Application::PostUserEvent( STATIC_LINK(0, PopupMenuControllerBase, ExecuteHdl_Impl), new PopupMenuControllerBaseDispatchInfo( xDispatch, aURL, rArgs ) ); + + } + catch( Exception& ) + { + } + +} + +IMPL_STATIC_LINK_NOINSTANCE( PopupMenuControllerBase, ExecuteHdl_Impl, PopupMenuControllerBaseDispatchInfo*, pDispatchInfo ) +{ + pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs ); + delete pDispatchInfo; + return 0; +} + +void SAL_CALL PopupMenuControllerBase::activate( const awt::MenuEvent& ) throw (RuntimeException) +{ +} + +void SAL_CALL PopupMenuControllerBase::deactivate( const awt::MenuEvent& ) throw (RuntimeException) +{ +} + +void SAL_CALL PopupMenuControllerBase::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) +{ + osl::ClearableMutexGuard aLock( m_aMutex ); + throwIfDisposed(); + aLock.clear(); + + updateCommand( m_aCommandURL ); +} + +void SAL_CALL PopupMenuControllerBase::updateCommand( const rtl::OUString& rCommandURL ) +{ + osl::ClearableMutexGuard aLock( m_aMutex ); + Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XDispatch > xDispatch( m_xDispatch ); + URL aTargetURL; + aTargetURL.Complete = rCommandURL; + m_xURLTransformer->parseStrict( aTargetURL ); + aLock.clear(); + + // Add/remove status listener to get a status update once + if ( xDispatch.is() ) + { + xDispatch->addStatusListener( xStatusListener, aTargetURL ); + xDispatch->removeStatusListener( xStatusListener, aTargetURL ); + } +} + + +// XDispatchProvider +Reference< XDispatch > SAL_CALL +PopupMenuControllerBase::queryDispatch( + const URL& /*aURL*/, + const rtl::OUString& /*sTarget*/, + sal_Int32 /*nFlags*/ ) +throw( RuntimeException ) +{ + // must be implemented by subclass + osl::MutexGuard aLock( m_aMutex ); + throwIfDisposed(); + + return Reference< XDispatch >(); +} + +Sequence< Reference< XDispatch > > SAL_CALL PopupMenuControllerBase::queryDispatches( const Sequence< DispatchDescriptor >& lDescriptor ) throw( RuntimeException ) +{ + // Create return list - which must have same size then the given descriptor + // It's not allowed to pack it! + osl::ClearableMutexGuard aLock( m_aMutex ); + throwIfDisposed(); + aLock.clear(); + + sal_Int32 nCount = lDescriptor.getLength(); + uno::Sequence< uno::Reference< frame::XDispatch > > lDispatcher( nCount ); + + // Step over all descriptors and try to get any dispatcher for it. + for( sal_Int32 i=0; i& /*seqProperties*/ ) +throw( ::com::sun::star::uno::RuntimeException ) +{ + // must be implemented by subclass + osl::MutexGuard aLock( m_aMutex ); + throwIfDisposed(); +} + +void SAL_CALL +PopupMenuControllerBase::addStatusListener( + const Reference< XStatusListener >& xControl, + const URL& aURL ) +throw( ::com::sun::star::uno::RuntimeException ) +{ + osl::ResettableMutexGuard aLock( m_aMutex ); + throwIfDisposed(); + aLock.clear(); + + bool bStatusUpdate( false ); + rBHelper.addListener( ::getCppuType( &xControl ), xControl ); + + aLock.reset(); + if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) + bStatusUpdate = true; + aLock.clear(); + + if ( bStatusUpdate ) + { + // Dummy update for popup menu controllers + FeatureStateEvent aEvent; + aEvent.FeatureURL = aURL; + aEvent.IsEnabled = sal_True; + aEvent.Requery = sal_False; + aEvent.State = Any(); + xControl->statusChanged( aEvent ); + } +} + +void SAL_CALL PopupMenuControllerBase::removeStatusListener( + const Reference< XStatusListener >& xControl, + const URL& /*aURL*/ ) +throw( ::com::sun::star::uno::RuntimeException ) +{ + rBHelper.removeListener( ::getCppuType( &xControl ), xControl ); +} + +::rtl::OUString PopupMenuControllerBase::determineBaseURL( const ::rtl::OUString& aURL ) +{ + // Just use the main part of the URL for popup menu controllers + sal_Int32 nQueryPart( 0 ); + sal_Int32 nSchemePart( 0 ); + rtl::OUString aMainURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:" )); + + nSchemePart = aURL.indexOf( ':' ); + if (( nSchemePart > 0 ) && + ( aURL.getLength() > ( nSchemePart+1 ))) + { + nQueryPart = aURL.indexOf( '?', nSchemePart ); + if ( nQueryPart > 0 ) + aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart ); + else if ( nQueryPart == -1 ) + aMainURL += aURL.copy( nSchemePart+1 ); + } + + return aMainURL; +} + +// XInitialization +void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) +{ + osl::MutexGuard aLock( m_aMutex ); + + sal_Bool bInitalized( m_bInitialized ); + if ( !bInitalized ) + { + PropertyValue aPropValue; + rtl::OUString aCommandURL; + Reference< XFrame > xFrame; + + for ( int i = 0; i < aArguments.getLength(); i++ ) + { + if ( aArguments[i] >>= aPropValue ) + { + if ( aPropValue.Name.equalsAscii( "Frame" )) + aPropValue.Value >>= xFrame; + else if ( aPropValue.Name.equalsAscii( "CommandURL" )) + aPropValue.Value >>= aCommandURL; + } + } + + if ( xFrame.is() && aCommandURL.getLength() ) + { + m_xFrame = xFrame; + m_aCommandURL = aCommandURL; + m_aBaseURL = determineBaseURL( aCommandURL ); + m_bInitialized = true; + } + } +} +// XPopupMenuController +void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) +{ + osl::MutexGuard aLock( m_aMutex ); + throwIfDisposed(); + + if ( m_xFrame.is() && !m_xPopupMenu.is() ) + { + // Create popup menu on demand + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + + m_xPopupMenu = xPopupMenu; + m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY )); + + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); + + URL aTargetURL; + aTargetURL.Complete = m_aCommandURL; + m_xURLTransformer->parseStrict( aTargetURL ); + m_xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); + + impl_setPopupMenu(); + + updatePopupMenu(); + } +} +void PopupMenuControllerBase::impl_setPopupMenu() +{ +} +} diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index ef5ad6e76967..9d5285250d20 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -159,16 +159,29 @@ sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& Servic return false; } +// XInitialization +void SAL_CALL PopupWindowController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) +{ + svt::ToolboxController::initialize( aArguments ); + if( m_aCommandURL.getLength() ) + addStatusListener( m_aCommandURL ); +} + // XComponent void SAL_CALL PopupWindowController::dispose() throw (RuntimeException) { + if( m_aCommandURL.getLength() ) + removeStatusListener( m_aCommandURL ); + svt::ToolboxController::dispose(); } + // XStatusListener void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException ) { svt::ToolboxController::statusChanged(rEvent); + enable( rEvent.IsEnabled ); } // XToolbarController diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index ee12b8f78d49..d9b84aa2e356 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -56,10 +56,29 @@ using namespace ::com::sun::star::frame; namespace svt { + +struct DispatchInfo +{ + Reference< XDispatch > mxDispatch; + const URL maURL; + const Sequence< PropertyValue > maArgs; + + DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs ) + : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {} +}; + struct ToolboxController_Impl { ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParentWindow; ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer; + rtl::OUString m_sModuleName; + sal_uInt16 m_nToolBoxId; + + DECL_STATIC_LINK( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo* ); + + ToolboxController_Impl() + : m_nToolBoxId( SAL_MAX_UINT16 ) + {} }; ToolboxController::ToolboxController( @@ -168,11 +187,6 @@ void SAL_CALL ToolboxController::release() throw () void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { - const rtl::OUString aFrameName( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - const rtl::OUString aCommandURLName( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )); - const rtl::OUString aServiceManagerName( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); - const rtl::OUString aParentWindow( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); - bool bInitialized( true ); { @@ -194,14 +208,16 @@ throw ( Exception, RuntimeException ) { if ( aArguments[i] >>= aPropValue ) { - if ( aPropValue.Name.equalsAscii( "Frame" )) + if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Frame") )) m_xFrame.set(aPropValue.Value,UNO_QUERY); - else if ( aPropValue.Name.equalsAscii( "CommandURL" )) + else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CommandURL") )) aPropValue.Value >>= m_aCommandURL; - else if ( aPropValue.Name.equalsAscii( "ServiceManager" )) + else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ServiceManager") )) m_xServiceManager.set(aPropValue.Value,UNO_QUERY); - else if ( aPropValue.Name.equalsAscii( "ParentWindow" )) + else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ParentWindow") )) m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY); + else if ( aPropValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ModuleName" ) ) ) + aPropValue.Value >>= m_pImpl->m_sModuleName; } } @@ -707,6 +723,10 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const return m_pImpl->m_xParentWindow; } +const rtl::OUString& ToolboxController::getModuleName() const +{ + return m_pImpl->m_sModuleName; +} void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs ) { @@ -718,11 +738,61 @@ void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequ getURLTransformer()->parseStrict( aURL ); Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW ); - xDispatch->dispatch( aURL, rArgs ); + + Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) ); + } catch( Exception& ) { } } +//-------------------------------------------------------------------- + +IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo ) +{ + pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs ); + delete pDispatchInfo; + return 0; +} + +void ToolboxController::enable( bool bEnable ) +{ + ToolBox* pToolBox = 0; + sal_uInt16 nItemId = 0; + if( getToolboxId( nItemId, &pToolBox ) ) + { + pToolBox->EnableItem( nItemId, bEnable ? TRUE : FALSE ); + } +} + +bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) +{ + if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) ) + return m_pImpl->m_nToolBoxId; + + ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + + if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox ) + { + const sal_uInt16 nCount = pToolBox->GetItemCount(); + for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) + { + const sal_uInt16 nItemId = pToolBox->GetItemId( nPos ); + if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) ) + { + m_pImpl->m_nToolBoxId = nItemId; + break; + } + } + } + + if( ppToolBox ) + *ppToolBox = pToolBox; + + rItemId = m_pImpl->m_nToolBoxId; + + return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) ); +} + } // svt -- cgit From daebd00fedd0b1cdb7b6f17d007581733f493d7f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 22 Mar 2010 08:53:48 +0100 Subject: sw321bf01: #i106861# encode the display name --- svtools/source/misc/transfer.cxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4628c0d4b846..7b30e06220e6 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #ifndef DEBUG_HXX #include #endif @@ -154,6 +155,10 @@ SvStream& operator<<( SvStream& rOStm, const TransferableObjectDescriptor& rObjD } // ----------------------------------------------------------------------------- +// the reading of the parameter is done using the special service ::com::sun::star::datatransfer::MimeContentType, +// a similar approach should be implemented for creation of the mimetype string; +// for now the set of acceptable characters has to be hardcoded, in future it should be part of the service that creates the mimetype +const ::rtl::OUString aQuotedParamChars = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "()<>@,;:\\\"/[]?=!#$%&'*+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~. " ) ); static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescriptor& rObjDesc ) { @@ -177,8 +182,21 @@ static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescripto if( rObjDesc.maDisplayName.Len() ) { + // the display name might contain unacceptable characters, encode all of them + // this seems to be the only parameter currently that might contain such characters + sal_Bool pToAccept[128]; + for ( sal_Int32 nBInd = 0; nBInd < 128; nBInd++ ) + pToAccept[nBInd] = sal_False; + + for ( sal_Int32 nInd = 0; nInd < aQuotedParamChars.getLength(); nInd++ ) + { + sal_Unicode nChar = aQuotedParamChars.getStr()[nInd]; + if ( nChar >= 0 && nChar < 128 ) + pToAccept[nChar] = sal_True; + } + aParams += ::rtl::OUString::createFromAscii( ";displayname=\"" ); - aParams += rObjDesc.maDisplayName; + aParams += ::rtl::Uri::encode( rObjDesc.maDisplayName, pToAccept, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); aParams += aChar; } @@ -248,7 +266,9 @@ static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, cons if( xMimeType->hasParameter( aDisplayNameString ) ) { - rObjDesc.maDisplayName = xMimeType->getParameterValue( aDisplayNameString ); + // the display name might contain unacceptable characters, in this case they should be encoded + // this seems to be the only parameter currently that might contain such characters + rObjDesc.maDisplayName = ::rtl::Uri::decode( xMimeType->getParameterValue( aDisplayNameString ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); } if( xMimeType->hasParameter( aViewAspectString ) ) -- cgit From cb5e4d69f0c8539ef8d60d8c5cd3e50bb6acdc2f Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 22 Mar 2010 10:52:35 +0100 Subject: sb121: acquire solar mutex around Application::Reschedule --- vcl/unx/source/dtrans/X11_selection.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 2d63489dac3d..7f205407b21b 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -70,6 +70,7 @@ #include #include +#include #define DRAG_EVENT_MASK ButtonPressMask |\ ButtonReleaseMask |\ @@ -3807,7 +3808,10 @@ void SelectionManager::shutdown() throw() */ aGuard.clear(); while (osl_isThreadRunning(m_aThread)) + { + vos::OGuard guard2(Application::GetSolarMutex()); Application::Reschedule(); + } osl_joinWithThread( m_aThread ); osl_destroyThread( m_aThread ); m_aThread = NULL; -- cgit From 99d003c030ec5d547c452efdc42be3a3fa6810fa Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 22 Mar 2010 11:17:10 +0100 Subject: recent changes for grid control --- svtools/inc/svtools/accessibletable.hxx | 3 +- svtools/inc/svtools/table/tablecontrol.hxx | 16 +- svtools/inc/svtools/table/tabledatawindow.hxx | 10 +- svtools/source/table/gridtablerenderer.cxx | 22 +- svtools/source/table/tablecontrol.cxx | 66 +++- svtools/source/table/tablecontrol_impl.cxx | 335 ++++++++--------- svtools/source/table/tablecontrol_impl.hxx | 14 +- svtools/source/table/tabledatawindow.cxx | 10 +- svtools/source/uno/svtxgridcontrol.cxx | 407 ++++++++++++++------- svtools/source/uno/svtxgridcontrol.hxx | 33 +- svtools/source/uno/unocontroltablemodel.cxx | 93 +---- svtools/source/uno/unocontroltablemodel.hxx | 5 +- toolkit/inc/toolkit/helper/listenermultiplexer.hxx | 10 +- toolkit/inc/toolkit/helper/property.hxx | 1 + .../controls/grid/defaultgridcolumnmodel.cxx | 170 +++++---- .../controls/grid/defaultgridcolumnmodel.hxx | 20 +- .../source/controls/grid/defaultgriddatamodel.cxx | 7 +- toolkit/source/controls/grid/gridcolumn.cxx | 79 +++- toolkit/source/controls/grid/gridcolumn.hxx | 12 +- toolkit/source/controls/grid/gridcontrol.cxx | 58 ++- toolkit/source/controls/grid/gridcontrol.hxx | 7 +- toolkit/source/helper/listenermultiplexer.cxx | 5 + toolkit/source/helper/property.cxx | 5 +- vcl/inc/vcl/vclevent.hxx | 1 + 24 files changed, 794 insertions(+), 595 deletions(-) diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index e13a0afe9469..86bd2cbbcea1 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -34,7 +34,6 @@ #include #include #include -#include // ============================================================================ @@ -128,6 +127,8 @@ public: virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; virtual std::vector& GetSelectedRows() = 0; + virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0; + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0; }; // ---------------------------------------------------------------------------- diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 59720cfd0602..b3aeb9d587e3 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -67,12 +67,13 @@ namespace svt { namespace table class TableControl : public Control, public IAccessibleTable { private: - DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* ); - DECL_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); TableControl_Impl* m_pImpl; ::com::sun::star::uno::Sequence< sal_Int32 >& m_nCols; ::com::sun::star::uno::Sequence< ::rtl::OUString >& m_aText; + Link m_aSelectHdl; + bool m_bSelectionChanged; public: ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; @@ -152,16 +153,19 @@ namespace svt { namespace table } virtual void Resize(); + virtual void Select(); + void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } + const Link& GetSelectHdl() const { return m_aSelectHdl; } + /**invalidates the table if table has been changed e.g. new row added */ - void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved); + void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved); /**gets the vector, which contains the selected rows */ std::vector& GetSelectedRows(); /**after removing a row, updates the vector which contains the selected rows if the row, which should be removed, is selected, it will be erased from the vector */ - void removeSelectedRow(RowPos _nRowPos); SelectionEngine* getSelEngine(); TableDataWindow* getDataWindow(); @@ -209,10 +213,12 @@ namespace svt { namespace table virtual sal_Bool HasColHeader(); virtual sal_Bool isAccessibleAlive( ) const; virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); - + virtual void RemoveSelectedRow(RowPos _nRowPos); + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos); ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); + void selectionChanged(bool _bChanged); protected: /// retrieves the XAccessible implementation associated with the GridControl instance diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index 564680a39347..1cf98300d790 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -51,15 +51,11 @@ namespace svt { namespace table friend class TableFunctionSet; private: TableControl_Impl& m_rTableControl; - Link m_aMouseButtonDownHdl; - Link m_aMouseButtonUpHdl; - + Link m_aSelectHdl; public: TableDataWindow( TableControl_Impl& _rTableControl ); - inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; } - inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; } - inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; } - inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; } + inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } + inline const Link& GetSelectHdl() const { return m_aSelectHdl; } // Window overridables virtual void Paint( const Rectangle& rRect ); diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 7e721832c04c..313a5e842547 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -80,11 +80,7 @@ namespace svt { namespace table // fill the rows with alternating background colors _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - //Color background = _rStyle.GetBackgroundColor(); Color line = m_pImpl->rModel.getLineColor(); //default background and line color is white //background and lines should have same color, that's means lines aren't visible @@ -102,7 +98,6 @@ namespace svt { namespace table _rDevice.SetFillColor(background); } _rDevice.DrawRect( _rArea ); - // delimiter lines at bottom/right _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); @@ -147,7 +142,10 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_CENTER; else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) nHorFlag = TEXT_DRAW_RIGHT; - _rDevice.DrawText( _rArea, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=4; aRect.Bottom()-=4; + _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.Pop(); @@ -250,7 +248,10 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_CENTER; else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) nHorFlag = TEXT_DRAW_RIGHT; - _rDevice.DrawText( _rArea, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=4; aRect.Bottom()-=4; + _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); // TODO: active? selected? (void)_bActive; (void)_bSelected; @@ -374,8 +375,6 @@ namespace svt { namespace table Rectangle aRect( _rArea ); ++aRect.Left(); --aRect.Right(); aRect.Top(); aRect.Bottom(); - - String sText; if(_bSelected) { _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); @@ -394,7 +393,10 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_CENTER; else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2) nHorFlag = TEXT_DRAW_RIGHT; - _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + Rectangle textRect(_rArea); + textRect.Left()+=4; textRect.Right()-=4; + textRect.Top()+=4; textRect.Bottom()-=4; + _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); } _rDevice.Pop(); diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 427f65557e52..635008d94f94 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -69,15 +69,16 @@ namespace svt { namespace table ,m_pImpl( new TableControl_Impl( *this ) ) ,m_nCols(*( new ::com::sun::star::uno::Sequence< sal_Int32 >(0) )) ,m_aText(*( new ::com::sun::star::uno::Sequence< ::rtl::OUString >(0) )) + ,m_bSelectionChanged(false) { - m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); - m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); + m_pImpl->getDataWindow()->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); } //-------------------------------------------------------------------- TableControl::~TableControl() { + ImplCallEventListeners( VCLEVENT_OBJECT_DYING ); DELETEZ( m_pImpl ); if ( m_pAccessTable->m_pAccessible ) { @@ -107,6 +108,14 @@ namespace svt { namespace table { if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) ) Control::KeyInput( rKEvt ); + else + { + if(m_bSelectionChanged) + { + Select(); + m_bSelectionChanged = false; + } + } } //-------------------------------------------------------------------- void TableControl::Resize() @@ -163,13 +172,21 @@ namespace svt { namespace table return m_pImpl->goTo( _nColPos, _nRowPos ); } //-------------------------------------------------------------------- - void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved) + void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved) { Rectangle _rRect; if(_bRemoved) - return m_pImpl->invalidateRows(_nRowStart, _rRect); + m_pImpl->invalidateRows(_nRowStart, _rRect); else - return m_pImpl->invalidateRow(_nRowStart, _rRect); + { + if(m_bSelectionChanged) + { + m_pImpl->invalidateSelectedRegion(_nRowStart, _nRowEnd, _rRect); + m_bSelectionChanged = false; + } + else + m_pImpl->invalidateRow(_nRowStart, _rRect); + } } //-------------------------------------------------------------------- std::vector& TableControl::GetSelectedRows() @@ -177,7 +194,7 @@ namespace svt { namespace table return m_pImpl->getSelectedRows(); } //-------------------------------------------------------------------- - void TableControl::removeSelectedRow(RowPos _nRowPos) + void TableControl::RemoveSelectedRow(RowPos _nRowPos) { m_pImpl->removeSelectedRow(_nRowPos); } @@ -188,20 +205,6 @@ namespace svt { namespace table return m_pImpl->getCurrentRow( rPoint ); } - //-------------------------------------------------------------------- - - IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData ) - { - CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData ); - return 1; - } - - IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData ) - { - CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData ); - return 1; - } - SelectionEngine* TableControl::getSelEngine() { return m_pImpl->getSelEngine(); @@ -345,6 +348,13 @@ namespace svt { namespace table } // ----------------------------------------------------------------------------- +::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) +{ + ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); + return m_pImpl->impl_convertToString(cellContent); +} +// ----------------------------------------------------------------------------- + void TableControl::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const @@ -553,7 +563,23 @@ void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUSt m_aText = aText; m_nCols = nCols; } +// ----------------------------------------------------------------------- +void TableControl::selectionChanged(bool _bChanged) +{ + m_bSelectionChanged = _bChanged; +} +// ----------------------------------------------------------------------- +IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) +{ + Select(); + return 1; +} +// ----------------------------------------------------------------------- +void TableControl::Select() +{ + ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_aSelectHdl, this ); +} //........................................................................ }} // namespace svt::table //........................................................................ diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 9bc8644276f1..aa22a8239375 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -284,8 +284,8 @@ namespace svt { namespace table :m_rTable( _rTable ) ,m_nSuspendFlags( _nSuspendFlags ) { - DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags, - "SuspendInvariants: cannot suspend what is already suspended!" ); + //DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags, + // "SuspendInvariants: cannot suspend what is already suspended!" ); const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants &= ~m_nSuspendFlags; } ~SuspendInvariants() @@ -365,7 +365,6 @@ namespace svt { namespace table // m_nColHeaderHeightPixel consistent with the model's value? { TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0; - // nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height(); nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height(); if ( nHeaderHeight != m_nColHeaderHeightPixel ) return "column header heights are inconsistent!"; @@ -375,7 +374,6 @@ namespace svt { namespace table if ( !isDummyModel ) { TableMetrics nRowHeight = m_pModel->getRowHeight(); - // nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height(); nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height(); if ( nRowHeight != m_nRowHeightPixel ) return "row heights are inconsistent!"; @@ -384,14 +382,12 @@ namespace svt { namespace table // m_nRowHeaderWidthPixel consistent with the model's value? { TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0; - //nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width(); nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width(); if ( nHeaderWidth != m_nRowHeaderWidthPixel ) return "row header widths are inconsistent!"; } // TODO: check m_aColumnWidthsPixel and m_aAccColumnWidthsPixel - if ( m_nCursorHidden < 0 ) return "invalid hidden count for the cursor!"; @@ -453,6 +449,7 @@ namespace svt { namespace table ,m_nAnchor (-1 ) ,m_bResizing ( false ) ,m_nResizingColumn ( 0 ) + ,m_bResizingGrid ( false ) #if DBG_UTIL ,m_nRequiredInvariants ( INV_SCROLL_POSITION ) #endif @@ -494,14 +491,10 @@ namespace svt { namespace table TempHideCursor aHideCursor( *this ); - // TODO: revoke as table listener from the model - m_pModel = _pModel; if ( !m_pModel) m_pModel.reset( new EmptyTableModel ); - // TODO: register as table listener - //m_pModel->addTableModelListener(PTableModelListener(m_pTableModelListener)); m_nCurRow = ROW_INVALID; m_nCurColumn = COL_INVALID; @@ -571,11 +564,9 @@ namespace svt { namespace table m_pInputHandler.reset(); m_nColumnCount = m_nRowCount = 0; - //m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height(); m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height(); if ( m_pModel->hasColumnHeaders() ) - //m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height(); - m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height(); + m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height(); if ( m_pModel->hasRowHeaders() ) m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width(); @@ -602,7 +593,7 @@ namespace svt { namespace table m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); long accumulatedPixelWidth = 0; - double gridWidth = m_rAntiImpl.GetSizePixel().Width()-1; + double gridWidth = m_rAntiImpl.GetSizePixel().Width()-4; if(m_pModel->hasRowHeaders()) { TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); @@ -612,10 +603,10 @@ namespace svt { namespace table { sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); gridWidth-=scrollbarWidth; - //m_rAntiImpl.LogicToPixel( Size( scrollbarWidth, 0 ), MAP_APPFONT ).Width(); } double colWidthsSum = 0.0; double colWithoutFixedWidthsSum = 0.0; + double minColWithoutFixedSum = 0.0; for ( ColPos col = 0; col < colCount; ++col ) { PColumnModel pColumn = m_pModel->getColumnModel( col ); @@ -624,74 +615,65 @@ namespace svt { namespace table continue; TableMetrics colWidth = 0; TableMetrics colPrefWidth = pColumn->getPreferredWidth(); + bool bResizable = pColumn->isResizable(); + if(pColumn->getMinWidth() == 0 && bResizable) + { + pColumn->setMinWidth(1); + minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + } + if(pColumn->getMaxWidth() == 0 && bResizable) + pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); if( colPrefWidth != 0) { - colWidth = colPrefWidth; - pColumn->setWidth(colPrefWidth); + if(m_bResizingGrid) + { + colWidth = pColumn->getWidth(); + pColumn->setPreferredWidth(0); + } + else + { + colWidth = colPrefWidth; + pColumn->setWidth(colPrefWidth); + } } else colWidth = pColumn->getWidth(); long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - if(pColumn->isResizable() && colPrefWidth == 0) + if(bResizable && colPrefWidth == 0) colWithoutFixedWidthsSum+=pixelWidth; colWidthsSum+=pixelWidth; } - if(colWidthsSum < gridWidth) + gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double scalingFactor = 1.0; + if(m_bResizingGrid) { - gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; - double scalingFactor = 1.0; - if(colWithoutFixedWidthsSum>0) + if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) scalingFactor = gridWidth/colWithoutFixedWidthsSum; - long pixelWidth = 0; - for ( ColPos col = 0; col < colCount; ++col ) + } + else + { + if(colWidthsSum < gridWidth) { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = pColumn->getWidth(); - //if(pColumn->getPreferredWidth() != 0) - // colWidth = pColumn->getPreferredWidth(); - if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) - { - colWidth*=scalingFactor; - pColumn->setWidth(colWidth); - } - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - m_aColumnWidthsPixel.push_back( pixelWidth ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + if(colWithoutFixedWidthsSum>0) + scalingFactor = gridWidth/colWithoutFixedWidthsSum; } - //m_rAntiImpl.SetModel(m_pModel); - } - else + long pixelWidth = 0; + for ( ColPos col = 0; col < colCount; ++col ) { - for ( ColPos col = 0; col < colCount; ++col ) + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = pColumn->getWidth(); + if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - - TableMetrics colWidth = pColumn->getWidth(); - DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ), - "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" ); - - long pixelWidth = 0; - if ( colWidth == COLWIDTH_FIT_TO_VIEW ) - { - // TODO - DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" ); - } - else - { - //pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width(); - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - } - m_aColumnWidthsPixel.push_back( pixelWidth ); - - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); + colWidth*=scalingFactor; + pColumn->setWidth(colWidth); } + pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + m_aColumnWidthsPixel.push_back( pixelWidth ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); } } @@ -925,11 +907,16 @@ namespace svt { namespace table void TableControl_Impl::onResize() { DBG_CHECK_ME(); - if(m_nColumnCount != 0) - impl_ni_updateScrollbars(); - //Rectangle aAllCells; - // impl_getAllVisibleCellsArea( aAllCells ); - //m_pSelEngine->SetVisibleArea(aAllCells); + if(m_nRowCount != 0) + { + if(m_nColumnCount != 0) + { + if(m_bResizingGrid) + impl_ni_updateColumnWidths(); + impl_ni_updateScrollbars(); + m_bResizingGrid = true; + } + } } //-------------------------------------------------------------------- @@ -1061,9 +1048,12 @@ namespace svt { namespace table { if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() ) { - if(m_pModel->hasRowHeaders()) - ++itRowName; - ++it; + if(it < aCellContent.end()-1) + { + if(m_pModel->hasRowHeaders()) + ++itRowName; + ++it; + } continue; } bool isActiveRow = ( aRowIterator.getRow() == getCurRow() ); @@ -1081,7 +1071,8 @@ namespace svt { namespace table if(it != aCellContent.begin()+m_nTopRow+nActualRows) { aCellData = *it; - ++it; + if(it < aCellContent.end()-1) + ++it; } ::std::vector< ::com::sun::star::uno::Any >::iterator iter = aCellData.begin()+m_nLeftColumn; @@ -1096,7 +1087,8 @@ namespace svt { namespace table if(itRowName != aRowHeaderContent.begin()+m_nTopRow+nActualRows) { rowHeaderName = *itRowName; - ++itRowName; + if(itRowName < m_pModel->getRowHeaderName().end()-1) + ++itRowName; } Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); //rStyle.SetBackgroundColor(m_rAntiImpl.getHeaderBackgroundColor()); @@ -1120,7 +1112,8 @@ namespace svt { namespace table TableSize nPartlyVisibleCols = impl_getVisibleColumns(false); TableSize nPartlyVisibleRows = impl_getVisibleRows(false); rCellData = *iter; - ++iter; + if(iter < aCellData.end()-1) + ++iter; Size siz = m_rAntiImpl.GetSizePixel(); ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; if(rCellData>>=xGraphic) @@ -1177,8 +1170,8 @@ namespace svt { namespace table for(std::vector::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) { - invalidateSelectedRow(*it,rCells); - m_pDataWindow->Invalidate(rCells); + invalidateSelectedRegion(*it, *it, rCells); + //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); } @@ -1189,8 +1182,9 @@ namespace svt { namespace table } else m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); ensureVisible(m_nCurColumn,m_nCurRow,false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } else @@ -1198,8 +1192,6 @@ namespace svt { namespace table if ( m_nCurRow < m_nRowCount - 1 ) { bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 ); - if(m_pSelEngine->GetSelectionMode() == MULTIPLE_SELECTION) - m_nAnchor = m_nCurRow; } } break; @@ -1212,8 +1204,8 @@ namespace svt { namespace table for(std::vector::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) { - invalidateSelectedRow(*it,rCells); - m_pDataWindow->Invalidate(rCells); + invalidateSelectedRegion(*it, *it, rCells); + //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); } @@ -1221,14 +1213,15 @@ namespace svt { namespace table { --m_nCurRow; m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } else { m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } ensureVisible(m_nCurColumn,m_nCurRow,false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } else @@ -1236,8 +1229,6 @@ namespace svt { namespace table if ( m_nCurRow > 0 ) { bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 ); - if(m_pSelEngine->GetSelectionMode() == MULTIPLE_SELECTION) - m_nAnchor = m_nCurRow; } } break; @@ -1303,11 +1294,16 @@ namespace svt { namespace table int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow); //if current row is selected, it should be deselected, when ALT+SPACE are pressed if(pos>-1) + { m_nRowSelected.erase(m_nRowSelected.begin()+pos); + if(m_nRowSelected.empty() && m_nAnchor != -1) + m_nAnchor = -1; + } //else select the row->put it in the vector else m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } break; @@ -1325,19 +1321,19 @@ namespace svt { namespace table //there are other selected rows if(m_nRowSelected.size()>0) { - //the anchor wasn't set -> a region is not selected, that's why clear all selection - //and select the current row + // the anchor wasn't set -> a region is not selected, that's why clear all selection + // and select the current row if(m_nAnchor==-1) { for(std::vector::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) { - invalidateSelectedRow(*it,rCells); - m_pDataWindow->Invalidate(rCells); + invalidateSelectedRegion(*it, *it, rCells); + //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } else { @@ -1352,17 +1348,27 @@ namespace svt { namespace table else return bSuccess = true; //if nextRow already selected, deselect it, otherwise select it - if(m_nRowSelected[nextRow] == m_nCurRow) + if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow) { m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); - invalidateSelectedRow(m_nCurRow+1, rCells); + invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells); } else { m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } } + else + { + if(m_nCurRow>0) + { + m_nRowSelected.push_back(m_nCurRow); + m_nCurRow--; + m_nRowSelected.push_back(m_nCurRow); + invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells); + } + } } } else @@ -1380,12 +1386,13 @@ namespace svt { namespace table else { m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } } m_pSelEngine->SetAnchor(TRUE); m_nAnchor = m_nCurRow; ensureVisible(m_nCurColumn, m_nCurRow, false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } } @@ -1409,12 +1416,12 @@ namespace svt { namespace table for(std::vector::iterator it=m_nRowSelected.begin(); it!=m_nRowSelected.end();++it) { - invalidateSelectedRow(*it,rCells); - m_pDataWindow->Invalidate(rCells); + invalidateSelectedRegion(*it, *it, rCells); + //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } else { @@ -1424,27 +1431,37 @@ namespace svt { namespace table if(prevRow>-1) { //if m_nCurRow isn't the last one, can move down, otherwise not - if(m_nCurRow-1 && m_nRowSelected[nextRow] == m_nCurRow) { m_nRowSelected.erase(m_nRowSelected.begin()+prevRow); - invalidateSelectedRow(m_nCurRow-1, rCells); + invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells); } else { m_nRowSelected.push_back(m_nCurRow); - invalidateSelectedRow(m_nCurRow, rCells); + invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells); } } + else + { + if(m_nCurRowSetAnchor(TRUE); m_nAnchor = m_nCurRow; ensureVisible(m_nCurColumn, m_nCurRow, false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } } @@ -1487,6 +1505,7 @@ namespace svt { namespace table m_nAnchor = m_nCurRow; m_pSelEngine->SetAnchor(TRUE); ensureVisible(m_nCurColumn, 0, false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } } @@ -1510,7 +1529,8 @@ namespace svt { namespace table m_nCurRow = m_nRowCount-1; m_nAnchor = m_nCurRow; m_pSelEngine->SetAnchor(TRUE); - ensureVisible(m_nCurColumn, m_nRowCount, false); + ensureVisible(m_nCurColumn, m_nRowCount-1, false); + m_rAntiImpl.selectionChanged(true); bSuccess = true; } break; @@ -1555,11 +1575,6 @@ namespace svt { namespace table return; } - //DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_pModel->getColumnCount() ), - // "TableControl_Impl::impl_getCellRect: invalid column index!" ); - //DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ), - // "TableControl_Impl::impl_getCellRect: invalid row index!" ); - Rectangle aAllCells; impl_getAllVisibleCellsArea( aAllCells ); @@ -1573,7 +1588,6 @@ namespace svt { namespace table Rectangle rCellRect; RowPos newRowPos = -2;//-1 is HeaderRow ColPos newColPos = 0; - //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!! for(int i=-1;iInvalidate(_rCellRect); } - //------------------------------------------------------------------------------- - //To Do: not really needed, because in method above one row can be invalidate. Please Prove this!!! - void TableControl_Impl::invalidateSelectedRow(RowPos _nCurRow, Rectangle& _rCellRect) - { - DBG_CHECK_ME(); - Rectangle aAllCells; - impl_getAllVisibleCellsArea( aAllCells ); - _rCellRect.Left() = aAllCells.Left(); - _rCellRect.Right() = aAllCells.Right(); - Rectangle rCells; - impl_getCellRect(m_nCurColumn,_nCurRow,rCells); - _rCellRect.Top()=--rCells.Top(); - _rCellRect.Bottom()=rCells.Bottom(); - m_pDataWindow->Invalidate(_rCellRect); - } //------------------------------------------------------------------------------- //this method is to be called, when a new row is added void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect) { //DBG_CHECK_ME(); - TempHideCursor aHideCursor( *this ); + if(m_nCurRow < 0) + m_nCurRow = 0; + if(m_nCursorHidden == 2) + --m_nCursorHidden; impl_getAllVisibleCellsArea( _rCellRect ); TableRowGeometry _rRow( *this, _rCellRect, _nRowPos); impl_ni_updateScrollbars(); @@ -1723,28 +1724,6 @@ namespace svt { namespace table //DBG_CHECK_ME(); (void)_nRowStart; (void)_rCellRect; - /*TempHideCursor aHideCursor(*this); - Rectangle aAllCells; - impl_getAllVisibleCellsArea( aAllCells ); - TableRowGeometry _rRow( *this, aAllCells, _nRowStart); - _rCellRect = _rRow.getRect(); - Rectangle rCells1; - impl_getCellRect(m_nCurColumn,m_nRowCount,rCells1); - _rCellRect.Bottom() = rCells1.Bottom();*/ - /*if(_nRowStart != _nRowEnd) - { - TableRowGeometry _rRow( *this, aAllCells, _nRowEnd); - _rCellRect.Bottom() = _rRow.getRect().Bottom(); - } - */ - //_rCellRect.Right() = aAllCells.Right(); - //_rCellRect.Left() = aAllCells.Left(); - //Rectangle rCells1; - //impl_getCellRect(m_nCurColumn,_nRowStart,rCells1); - //_rCellRect.Top()=rCells1.Top(); - //Rectangle rCells2; - //impl_getCellRect(m_nCurColumn,_nRowEnd,rCells2); - //_rCellRect.Bottom()=rCells2.Bottom(); impl_ni_updateScrollbars(); TableSize nVisibleRows = impl_getVisibleRows(true); if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) @@ -1802,20 +1781,6 @@ namespace svt { namespace table // ensure that the new cell is visible ensureVisible( m_nCurColumn, m_nCurRow, false ); - - // TODO: invalidate all and new column/row header, if present, to enforce - // re-painting them - //if(!m_nRowSelected.empty()) - //{ - // Rectangle rCells; - // for(std::vector::iterator it=m_nRowSelected.begin(); - // it!=m_nRowSelected.end();++it) - // { - // invalidateSelectedRow(*it,rCells); - // } - // m_nRowSelected.clear(); - //} - // TODO: notify listeners about new position return true; } @@ -1986,7 +1951,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; if(content>>=xGraphic) - aTooltipText=::rtl::OUString::createFromAscii("IMAGE"); + aTooltipText=::rtl::OUString::createFromAscii(""); else aTooltipText = impl_convertToString(content); } @@ -1996,7 +1961,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; if(content>>=xGraphic) - aTooltipText += ::rtl::OUString::createFromAscii("IMAGE"); + aTooltipText += ::rtl::OUString::createFromAscii(""); else aTooltipText += impl_convertToString(content); } @@ -2034,7 +1999,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; if(content>>=xGraphic) - aTooltipText = ::rtl::OUString::createFromAscii("IMAGE"); + aTooltipText = ::rtl::OUString::createFromAscii(""); else aTooltipText = text[i] + impl_convertToString(content); } @@ -2047,7 +2012,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; if(content>>=xGraphic) - aTooltipText +=::rtl::OUString::createFromAscii("IMAGE"); + aTooltipText +=::rtl::OUString::createFromAscii(""); else aTooltipText += impl_convertToString(content); } @@ -2097,6 +2062,7 @@ namespace svt { namespace table //-------------------------------------------------------------------- bool TableControl_Impl::startResizeColumn(const Point& rPoint) { + m_bResizingGrid = false; m_nResizingColumn = m_nCurColumn; PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); sal_Int32 colWidth = pColumn->getWidth(); @@ -2126,7 +2092,7 @@ namespace svt { namespace table int oldX = m_aVisibleColumnWidthsPixel[resizeCol]; //position of left border if cursor in the first cell int leftX = 0; - if(m_nResizingColumn-1 > 0 && m_nResizingColumn > m_nLeftColumn) + if(m_nResizingColumn > m_nLeftColumn) leftX = m_aVisibleColumnWidthsPixel[resizeCol-1]; else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders()) leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); @@ -2135,11 +2101,6 @@ namespace svt { namespace table //minimize the column width if(oldX > actX && actX >= leftX) { - if(minWidth == 0 && pColumn->isResizable()) - { - minWidth = 1; - //TO DO: set it back to model - } if(minWidth < actWidth) { newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); @@ -2152,11 +2113,6 @@ namespace svt { namespace table } else if(oldX < actX) { - if(maxWidth == 0 && pColumn->isResizable()) - { - maxWidth = m_pDataWindow->GetSizePixel().Width()-1; - //TO DO: set it back to model - } if(actWidth < maxWidth) { newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width(); @@ -2171,6 +2127,7 @@ namespace svt { namespace table m_pDataWindow->Invalidate(INVALIDATE_UPDATE); m_pDataWindow->SetPointer(Pointer()); m_bResizing = false; + m_bResizingGrid = true; } m_pDataWindow->ReleaseMouse(); return m_bResizing; @@ -2362,7 +2319,7 @@ namespace svt { namespace table } if(m_pTableControl->m_nRowSelected.size()>1 && m_pTableControl->m_pSelEngine->GetSelectionMode()!=SINGLE_SELECTION) m_pTableControl->m_pSelEngine->AddAlways(TRUE); - m_pTableControl->invalidateSelectedRow(curRow,rCells); + m_pTableControl->invalidateSelectedRegion(curRow, curRow, rCells); bHandled = TRUE; } m_pTableControl->m_nCurRow = curRow; @@ -2397,7 +2354,7 @@ namespace svt { namespace table if(*it == m_nCurrentRow) { pos = i; - m_pTableControl->invalidateSelectedRow(*it,rCells); + m_pTableControl->invalidateSelectedRegion(*it, *it, rCells); } ++i; } @@ -2411,7 +2368,7 @@ namespace svt { namespace table for(std::vector::iterator it=m_pTableControl->m_nRowSelected.begin(); it!=m_pTableControl->m_nRowSelected.end();++it) { - m_pTableControl->invalidateSelectedRow(*it,rCells); + m_pTableControl->invalidateSelectedRegion(*it, *it, rCells); } m_pTableControl->m_nRowSelected.clear(); } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index a26079a37827..dffa69422599 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -118,6 +118,7 @@ namespace svt { namespace table RowPos m_nAnchor; bool m_bResizing; ColPos m_nResizingColumn; + bool m_bResizingGrid; #if DBG_UTIL #define INV_SCROLL_POSITION 1 @@ -186,15 +187,12 @@ namespace svt { namespace table virtual RowPos getCurrentRow (const Point& rPoint); void setCursorAtCurrentCell(const Point& rPoint); - /** proves whether the vector with the selected rows contains the current row*/ + /** checks whether the vector with the selected rows contains the current row*/ BOOL isRowSelected(::std::vector selectedRows, RowPos current); - /** returns the position of the current row in the selecttion vector */ + /** returns the position of the current row in the selection vector */ int getRowSelectedNumber(::std::vector selectedRows, RowPos current); - /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/ + /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect ); - /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/ - //vielleicht kann man mit den anderen verschmelzen, mit einer Überprüfung ob prev==curr? - void invalidateSelectedRow( RowPos _nCurRow, Rectangle& _rCellRect ); /** to be called when a new row is added to the control*/ void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect ); /** returns the vector, which contains the selected rows*/ @@ -202,7 +200,6 @@ namespace svt { namespace table /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); - //virtual void DoubleClick(); // IAbstractTableControl virtual void hideCursor(); @@ -232,6 +229,8 @@ namespace svt { namespace table minus the row and column header areas. */ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; + + ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); private: /** toggles the cursor visibility @@ -319,7 +318,6 @@ namespace svt { namespace table void impl_ni_getAccVisibleColWidths(); void impl_updateLeftColumn(); - ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); DECL_LINK( OnScroll, ScrollBar* ); }; diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 8631ed76a6c0..6ae2a39443d1 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -44,6 +44,8 @@ namespace svt { namespace table :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) { + //Color backgroundColor = GetControlBackground(); + //SetBackground( backgroundColor ); } //-------------------------------------------------------------------- @@ -75,15 +77,17 @@ namespace svt { namespace table if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) Window::MouseButtonDown( rMEvt ); else - m_aMouseButtonDownHdl.Call( (MouseEvent*) &rMEvt); + { + Point aPoint = rMEvt.GetPosPixel(); + if(m_rTableControl.getCurrentRow(aPoint) >= 0) + m_aSelectHdl.Call( NULL ); + } m_rTableControl.getAntiImpl().LoseFocus(); } void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt ) { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); - else - m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } void TableDataWindow::SetPointer( const Pointer& rPointer ) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index ce04078687b1..4cad623ff3a0 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -50,6 +50,7 @@ #include #include #include +#include using ::rtl::OUString; using namespace ::svt::table; @@ -70,7 +71,10 @@ SVTXGridControl::SVTXGridControl() m_bHasColumnHeaders(false), m_bHasRowHeaders(false), m_bVScroll(false), - m_bHScroll(false) + m_bHScroll(false), + m_bUpdate(false), + m_nSelectedRowCount(0), + m_aSelectionListeners( *this ) { } @@ -85,6 +89,7 @@ SVTXGridControl::~SVTXGridControl() ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ), SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); } @@ -113,12 +118,12 @@ void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) { - (void)listener; + m_aSelectionListeners.addInterface(listener); } void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) { - (void) listener; + m_aSelectionListeners.removeInterface(listener); } void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) @@ -126,6 +131,8 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = (TableControl*)GetWindow(); + const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings(); + com::sun::star::awt::FontDescriptor& aFont = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); switch( GetPropertyId( PropertyName ) ) { @@ -205,7 +212,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } break; } - case BASEPROPERTY_BACKGROUNDCOLOR: + case BASEPROPERTY_GRID_ROW_BACKGROUND: { sal_Int32 colorBackground = 0x000000; if( aValue >>= colorBackground ) @@ -250,26 +257,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_DATAMODEL: { - //m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); - //Sequence > cellData = m_xDataModel->getData(); - //Sequence rowData(0); - //std::vector< std::vector< Window* > > aCellContent(0); - //for(int i = 0; i< m_xDataModel->getRowCount();++i) - //{ - // rowData = cellData[i]; - // std::vector newRow( - // comphelper::sequenceToContainer< std::vector >(rowData)); - // if(newRow.size() < (unsigned)m_pTableModel->getColumnCount()) - // newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); - // aCellContent.push_back(newRow); - //} - //m_pTableModel->setCellContent(aCellContent); - //Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); - //std::vector< rtl::OUString > newRow( - // comphelper::sequenceToContainer< std::vector >(rowHeaders)); - //m_pTableModel->setRowCount(m_xDataModel->getRowCount()); - //m_pTableModel->setRowHeaderName(newRow); - //break; { m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); if(m_xDataModel != NULL) @@ -308,12 +295,16 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An comphelper::sequenceToContainer< std::vector >(rowHeaders)); m_pTableModel->setRowCount(m_xDataModel->getRowCount()); m_pTableModel->setRowHeaderName(newRow); - m_pTableModel->setRowHeight(m_xDataModel->getRowHeight()); - m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth()); } } else throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel); + sal_Int32 fontHeight = aFont.Height+8; + if(m_xDataModel->getRowHeight() == 0) + m_pTableModel->setRowHeight(fontHeight); + else + m_pTableModel->setRowHeight(m_xDataModel->getRowHeight()); + m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth()); } break; } @@ -327,7 +318,11 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An Sequence > columns = m_xColumnModel->getColumns(); std::vector > aNewColumns( comphelper::sequenceToContainer > >(columns)); - m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight()); + sal_Int32 fontHeight = aFont.Height+8; + if(m_xColumnModel->getColumnHeaderHeight() == 0) + m_pTableModel->setColumnHeaderHeight(fontHeight); + else + m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight()); for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) { UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); @@ -405,6 +400,7 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND, BASEPROPERTY_GRID_HEADER_BACKGROUND, BASEPROPERTY_GRID_LINE_COLOR, + BASEPROPERTY_GRID_ROW_BACKGROUND, 0); VCLXWindow::ImplGetPropertyIds( rIds, true ); } @@ -415,17 +411,6 @@ void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun: { pTable->SetModel(PTableModel(m_pTableModel)); pTable->Show( bVisible ); - if(m_xColumnModel != NULL) - { - for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) - { - //set the new widths, which are computed to fill the width of grid, back to uno awt gridcolumn - //so funktioniert es nicht!!! Die Toolkit Klassen müssen notifiziert werden, sonst kommt es nicht an - //herausfinden wie es gehen soll! - m_xColumnModel->getColumn(col)->setColumnWidth(m_pTableModel->getColumnModel()[col]->getWidth()); - } - } - //TO DO: notify uno awt GridModel about hor. /vert. scrollbars } } void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException) @@ -438,49 +423,30 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD { std::vector< Any > newRow; Sequence< Any > rawRowData = Event.rowData; - if(m_xColumnModel->getColumnCount() == 0) + int colCount = m_xColumnModel->getColumnCount(); + if(colCount == 0) { + Reference listener(*this,UNO_QUERY_THROW); + m_xColumnModel->setDefaultColumns(rawRowData.getLength()); for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col ) { UnoControlTableColumn* tableColumn = new UnoControlTableColumn(); m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + m_xColumnModel->getColumn(col)->addColumnListener(listener); } - m_xColumnModel->setDefaultColumns(rawRowData.getLength()); + } - else if((unsigned int)rawRowData.getLength()!=(unsigned)m_xColumnModel->getColumnCount()) + else if((unsigned int)rawRowData.getLength()!=(unsigned)colCount) throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel); + for ( int k = 0; k < rawRowData.getLength(); k++) - { - ::rtl::OUString xCellType; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic> xGraphic; - /*if(xCellType.CellControl!= NULL) - { - xCellType.CellControl->createPeer( getToolkit(), this); - Window* pVclPeer = VCLUnoHelper::GetWindow( xCellType.CellControl->getPeer() ); - xTableCellType->pWindow = pVclPeer; - xTableCellType->pWindow->Hide(); - newRow.push_back(xTableCellType); - } - else - {*/ newRow.push_back(rawRowData[k]); - //} - } m_pTableModel->getCellContent().push_back(newRow); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().push_back(Event.headerName); m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); - //if(m_pTableModel->hasVerticalScrollbar()) - m_bVScroll = m_pTableModel->hasVerticalScrollbar(); - com::sun::star::uno::Any aAny; - aAny <<= m_bVScroll; - setProperty(rtl::OUString::createFromAscii("VScroll"),aAny); - //Reference < XGridControl >( getPeer(), UNO_QUERY_THROW )->ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VSCROLL ), aAny, sal_True ); - - - m_bHScroll = m_pTableModel->hasHorizontalScrollbar(); TableControl* pTable = (TableControl*)GetWindow(); - pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, false); + pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, 0, false); if(pTable->isAccessibleAlive()) { pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, @@ -501,93 +467,79 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { - //TableControl* pTable = (TableControl*)GetWindow(); - ////unsigned int rows =m_pImpl->aCellContent.size()-1; - //if(Event.index == -1) - //{ - // if(m_pTableModel->hasRowHeaders()) - // m_pTableModel->getRowHeaderName().clear(); - // m_pTableModel->getCellContent().clear(); - // if(pTable->isAccessibleAlive()) - // { - // pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, - // makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())), - // Any()); - // } - //} - //else - //{ - // pTable->removeSelectedRow(Event.index); - // if(m_pTableModel->getCellContent().size()>1) - // { - // if(m_pTableModel->hasRowHeaders()) - // m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); - // m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index); - // - // } - // else - // { - // if(m_pTableModel->hasRowHeaders()) - // m_pTableModel->getRowHeaderName().clear(); - // m_pTableModel->getCellContent().clear(); - // //m_pImpl->nRowCount=0; - // } - //} - ////pTable->InvalidateDataWindow(Event.index, true); - //m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); - //pTable->InvalidateDataWindow(Event.index, true); TableControl* pTable = (TableControl*)GetWindow(); if(Event.index == -1) { if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); - //::std::vector >::iterator iter = m_pTableModel->getCellContent().begin(); - //for(;iter!=m_pTableModel->getCellContent().end();++iter) - //{ - // std::vector vectIn = *iter; - // std::vector::iterator iterIn = vectIn.begin(); - // for(;iterIn!=vectIn.end();++iterIn) - // DELETEZ(*iterIn); - //} m_pTableModel->getCellContent().clear(); } else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount()) { - pTable->removeSelectedRow(Event.index); + pTable->RemoveSelectedRow(Event.index); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); std::vector >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index; - //for ( std::vector::iterator iterIn = rowPos->begin(); - // iterIn != rowPos->end(); - // ++iterIn - // ) - //{ - // DELETEZ(*iterIn); - //} m_pTableModel->getCellContent().erase( rowPos ); } m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); - pTable->InvalidateDataWindow(Event.index, true); + pTable->InvalidateDataWindow(Event.index, Event.index, true); if(pTable->isAccessibleAlive()) { pTable->commitGridControlEvent(TABLE_MODEL_CHANGED, makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())), Any()); - //pTable->commitGridControlEvent(CHILD, - // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)), - // Any()); - //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) - //{ - // pTable->commitGridControlEvent( - // CHILD, - // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), - // Any()); - //} } - //pTable->Invalidate(); } +void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize")) + { + bool resizable = m_pTableModel->getColumnModel()[Event.index]->isResizable(); + Event.newValue>>=resizable; + m_pTableModel->getColumnModel()[Event.index]->setResizable(resizable); + } + else if(Event.valueName == rtl::OUString::createFromAscii("ColWidth")) + { + sal_Int32 colWidth = m_pTableModel->getColumnModel()[Event.index]->getWidth(); + Event.newValue>>=colWidth; + m_pTableModel->getColumnModel()[Event.index]->setWidth(colWidth); + } + else if(Event.valueName == rtl::OUString::createFromAscii("MaxWidth")) + { + sal_Int32 maxWidth = m_pTableModel->getColumnModel()[Event.index]->getMaxWidth(); + Event.newValue>>=maxWidth; + m_pTableModel->getColumnModel()[Event.index]->setMaxWidth(maxWidth); + } + else if(Event.valueName == rtl::OUString::createFromAscii("MinWidth")) + { + sal_Int32 minWidth = m_pTableModel->getColumnModel()[Event.index]->getMinWidth(); + Event.newValue>>=minWidth; + m_pTableModel->getColumnModel()[Event.index]->setMinWidth(minWidth); + } + else if(Event.valueName == rtl::OUString::createFromAscii("PrefWidth")) + { + sal_Int32 prefWidth = m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth(); + Event.newValue>>=prefWidth; + m_pTableModel->getColumnModel()[Event.index]->setPreferredWidth(prefWidth); + } + else if(Event.valueName == rtl::OUString::createFromAscii("HAlign")) + { + ::com::sun::star::style::HorizontalAlignment hAlign = m_pTableModel->getColumnModel()[Event.index]->getHorizontalAlign(); + Event.newValue>>=hAlign; + m_pTableModel->getColumnModel()[Event.index]->setHorizontalAlign(hAlign); + } + else if(Event.valueName == rtl::OUString::createFromAscii("UpdateWidth")) + { + if(m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth() != 0) + m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("PrefWidth"), m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth()); + m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("ColWidth"), m_pTableModel->getColumnModel()[Event.index]->getWidth()); + } + pTable->Invalidate(); +} void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { (void) Event; @@ -600,24 +552,91 @@ void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::G ::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) { - return 0; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(selectedRows.empty()) + return -1; + else + { + std::vector::iterator itStart = selectedRows.begin(); + std::vector::iterator itEnd = selectedRows.end(); + return *(std::min_element(itStart, itEnd)); + } } ::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) { - return 0; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(selectedRows.empty()) + return -1; + else + { + std::vector::iterator itStart = selectedRows.begin(); + std::vector::iterator itEnd = selectedRows.end(); + return *(std::max_element(itStart, itEnd)); + } } -void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { - (void)length; - (void)start; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!selectedRows.empty()) + selectedRows.clear(); + sal_Int32 start = rangeOfRows[0]; + int seqSize = rangeOfRows.getLength(); + sal_Int32 end = rangeOfRows[seqSize-1]; + for(int i=0;iselectionChanged(true); + pTable->InvalidateDataWindow(start, end, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); + } -void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) { - (void)end; - (void)start; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!selectedRows.empty()) + selectedRows.clear(); + for(int i=0;igetRowCount();i++) + selectedRows.push_back(i); + pTable->Invalidate(); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); +} +void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + std::vector::iterator itStart = selectedRows.begin(); + std::vector::iterator itEnd = selectedRows.end(); + sal_Int32 start = rangeOfRows[0]; + sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1]; + std::vector::iterator iter = std::find(itStart, itEnd, start); + selectedRows.erase(iter, iter+(end-start)+1); + pTable->selectionChanged(true); + pTable->InvalidateDataWindow(start, end, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); +} + +void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!selectedRows.empty()) + selectedRows.clear(); + pTable->Invalidate(); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); } ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) @@ -635,21 +654,125 @@ void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int ::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) { - return sal_False; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(selectedRows.empty()) + return sal_True; + else + return sal_False; } ::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) { - (void)index; - return sal_False; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + ::std::vector::iterator iter = selectedRows.begin(); + sal_Bool bSelected = sal_False; + for(;iter!=selectedRows.end();iter++) + { + if(*iter == index) + bSelected = sal_True; + } + return bSelected; } -void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) { - (void)y; + if(index<0 || index>=m_pTableModel->getRowCount()) + return; + TableControl* pTable = (TableControl*)GetWindow(); + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!isSelectedIndex(index)) + selectedRows.push_back(index); + pTable->selectionChanged(true); + pTable->InvalidateDataWindow(index, index, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); } void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) { (void)x; } +void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aObj; + aObj.Source = (::cppu::OWeakObject*)this; + m_aSelectionListeners.disposeAndClear( aObj ); + VCLXWindow::dispose(); +} + +void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); + + switch ( rVclWindowEvent.GetId() ) + { + case VCLEVENT_TABLEROW_SELECT: + { + TableControl* pTable = (TableControl*)GetWindow(); + + if( pTable ) + { + if ( m_aSelectionListeners.getLength() ) + { + ImplCallItemListeners(); + } + } + } + break; + + default: + VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); + break; + } +} + +void SVTXGridControl::ImplCallItemListeners() +{ + TableControl* pTable = (TableControl*) GetWindow(); + if ( pTable && m_aSelectionListeners.getLength() ) + { + ::std::vector selRows = pTable->GetSelectedRows(); + ::com::sun::star::awt::grid::GridSelectionEvent aEvent; + aEvent.Source = (::cppu::OWeakObject*)this; + aEvent.Column = 0; + sal_Int32 actSelRowCount = selRows.size(); + sal_Int32 diff = actSelRowCount - m_nSelectedRowCount; + //row added to selection + if(diff >= 1) + { + aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0); + aEvent.Row = selRows[actSelRowCount-1]; + aEvent.Range = diff; + } + //selected row changed + else if(diff == 0) + { + aEvent.Row = selRows[actSelRowCount-1]; + aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); + aEvent.Range = 0; + } + else + { + //selection changed: multiple row deselected, only 1 row is selected + if(actSelRowCount == 1) + { + aEvent.Row = selRows[actSelRowCount-1]; + aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); + } + //row is deselected + else + { + aEvent.Row = pTable->GetCurrentRow(); + aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1); + } + aEvent.Range = 0; + } + m_nSelectedRowCount=actSelRowCount; + m_aSelectionListeners.selectionChanged( aEvent ); + } +} diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index c8b8af574a61..cd4dc698f8db 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -35,21 +35,23 @@ #include #include #include +#include #include +#include #include #include #include #include #include #include -#include -//#include +#include +#include using namespace ::svt::table; -class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, - ::com::sun::star::awt::grid::XGridDataListener> +class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, + ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener> { private: UnoControlTableModel* m_pTableModel; @@ -59,6 +61,13 @@ private: bool m_bHasRowHeaders; bool m_bVScroll; bool m_bHScroll; + bool m_bUpdate; + sal_Int32 m_nSelectedRowCount; + SelectionListenerMultiplexer m_aSelectionListeners; + +protected: + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + void ImplCallItemListeners(); public: SVTXGridControl(); @@ -67,6 +76,12 @@ public: virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + + //XGridColumnListener overridables + //virtual void SAL_CALL columnAdded(const ::com::sun::star::awt::grid::GridColumnEvent& Event) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL columnRemoved(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); @@ -80,8 +95,10 @@ public: //::com::sun::star::awt::grid::XGridControl virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); @@ -98,6 +115,8 @@ public: static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); - ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); }; #endif // _SVT_GRIDCONTROL_HXX_ diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index d1eaee98e7bb..2b53b65de471 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -70,6 +70,7 @@ using namespace ::com::sun::star::uno; ,m_nWidth( 4 ) ,m_nMinWidth( 0 ) // no min width ,m_nMaxWidth( 0 ) // no max width + ,m_nPrefWidth ( 0 ) ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { } @@ -83,11 +84,7 @@ using namespace ::com::sun::star::uno; //-------------------------------------------------------------------- bool UnoControlTableColumn::setID( const ColumnID _nID ) { - // TODO: conflict check - m_nID = _nID; - // TODO: notifications? - return true; } @@ -101,7 +98,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setName( const String& _rName ) { m_sName = _rName; - // TODO: notifications? } //-------------------------------------------------------------------- bool UnoControlTableColumn::isResizable() const @@ -113,7 +109,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setResizable( bool _bResizable ) { m_bIsResizable = _bResizable; - // TODO: notifications? } //-------------------------------------------------------------------- @@ -126,7 +121,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setWidth( TableMetrics _nWidth ) { m_nWidth = _nWidth; - // TODO: notifications? } //-------------------------------------------------------------------- @@ -139,7 +133,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setMinWidth( TableMetrics _nMinWidth ) { m_nMinWidth = _nMinWidth; - // TODO: notifications? } //-------------------------------------------------------------------- @@ -152,7 +145,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setMaxWidth( TableMetrics _nMaxWidth ) { m_nMaxWidth = _nMaxWidth; - // TODO: notifications? } //-------------------------------------------------------------------- TableMetrics UnoControlTableColumn::getPreferredWidth() const @@ -164,7 +156,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth ) { m_nPrefWidth = _nPrefWidth; - // TODO: notifications? } //-------------------------------------------------------------------- ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign() @@ -195,7 +186,6 @@ using namespace ::com::sun::star::uno; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; std::vector& aRowHeadersTitle; - //std::vector >& aCellContent; std::vector >& aCellContent; ::com::sun::star::util::Color m_xLineColor; ::com::sun::star::util::Color m_xHeaderColor; @@ -213,11 +203,10 @@ using namespace ::com::sun::star::uno; ,bHScroll ( false ) ,pRenderer ( ) ,pInputHandler ( ) - ,nRowHeight ( 15 ) // 40 mm - ,nColumnHeaderHeight( 10 ) // 50 mm - ,nRowHeaderWidth ( 10 ) // 50 mm + ,nRowHeight ( 0 ) + ,nColumnHeaderHeight( 0 ) + ,nRowHeaderWidth ( 10 ) ,aRowHeadersTitle ( *(new std::vector(0))) - //,aCellContent ( *(new std::vector >(0))) ,aCellContent ( *(new std::vector >(0)) ) ,m_xLineColor( 0xFFFFFF ) ,m_xHeaderColor( 0xFFFFFF ) @@ -245,24 +234,12 @@ using namespace ::com::sun::star::uno; //-------------------------------------------------------------------- UnoControlTableModel::~UnoControlTableModel() { - //if(!m_pImpl->aCellContent.empty()) - //{ - // ::std::vector >::iterator iter = m_pImpl->aCellContent.begin(); - // for(;iter!=m_pImpl->aCellContent.end();++iter) - // { - // std::vector vectIn = *iter; - // std::vector::iterator iterIn = vectIn.begin(); - // for(;iterIn!=vectIn.end();++iterIn) - // DELETEZ(*iterIn); - // } - //} DELETEZ( m_pImpl ); } //-------------------------------------------------------------------- TableSize UnoControlTableModel::getColumnCount() const { - //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); return (TableSize)m_pImpl->aColumns.size(); } @@ -454,54 +431,9 @@ using namespace ::com::sun::star::uno; return m_pImpl->bHScroll; } //-------------------------------------------------------------------- - // void UnoControlTableModel::setCellContent(std::vector > cellContent) - // { - // //if(cellContent.empty()) - // //{ - // // unsigned int i = m_pImpl->aColumns.size(); - // // std::vector& emptyCells; - // // while(i!=0) - // // { - // // cellContent.push_back(emptyCells); - // // --i; - // // } - // //} - // //std::vector cCC; - // //for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - // //{ - // // cCC = *iter; - // // m_pImpl->aCellContent.push_back(cCC); - // //} - // m_pImpl->aCellContent.swap( cellContent ); - // } - - //std::vector >& UnoControlTableModel::getCellContent() - // { - // return m_pImpl->aCellContent; - // } - //-------------------------------------------------------------------- void UnoControlTableModel::setCellContent(std::vector > cellContent) { - //::vos::OGuard aGuard( GetMutex() ); - /* - if(cellContent.empty()) - { - unsigned int i = m_pImpl->aColumns.size(); - std::vector emptyCells; - while(i!=0) - { - cellContent.push_back(emptyCells); - --i; - } - } - */ - - m_pImpl->aCellContent.swap( cellContent ); - - /*for(::std::vector >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - { - m_pImpl->aCellContent.push_back(*iter); - }*/ + m_pImpl->aCellContent = cellContent; } std::vector >& UnoControlTableModel::getCellContent() @@ -512,20 +444,7 @@ using namespace ::com::sun::star::uno; //-------------------------------------------------------------------- void UnoControlTableModel::setRowHeaderName(std::vector cellColumnContent) { - if(cellColumnContent.empty()) - { - unsigned int i = m_pImpl->aColumns.size(); - while(i!=0) - { - cellColumnContent.push_back(rtl::OUString::createFromAscii("")); - --i; - } - } - for(::std::vector::iterator iter = cellColumnContent.begin(); iter!= cellColumnContent.end();++iter) - { - rtl::OUString s = *iter; - m_pImpl->aRowHeadersTitle.push_back(*iter); - } + m_pImpl->aRowHeadersTitle = cellColumnContent; } std::vector& UnoControlTableModel::getRowHeaderName() diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index cff18f4d9be2..ae0a5ce76a9e 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -47,7 +47,6 @@ #include #include #include -//#include using namespace ::svt::table; @@ -55,7 +54,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt::grid; class UnoControlTableColumn : public IColumnModel - { +{ private: ColumnID m_nID; String m_sName; @@ -124,8 +123,6 @@ class UnoControlTableColumn : public IColumnModel /// retrieves the width of a column, in 1/100th millimeters inline TableMetrics GetColumnWidth( ColPos _nColumn ); - // TODO: setters and getters for ID, Name, Resizable, MinWidth, MaxWidth - public: // ITableModel overridables virtual TableSize getColumnCount() const; diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx index 543c8a85c401..0c1c5b631fee 100644 --- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx +++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx @@ -57,7 +57,7 @@ #include #include #include - +#include // ---------------------------------------------------- // class ListenerMultiplexerBase // ---------------------------------------------------- @@ -247,8 +247,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun:: virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException); DECL_LISTENERMULTIPLEXER_END - - +// ---------------------------------------------------- +// class SelectionListenerMultiplexer +// ---------------------------------------------------- +DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener ) + void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); +DECL_LISTENERMULTIPLEXER_END #endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index 6fa223cc7b26..cbc0dd05248c 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -201,6 +201,7 @@ namespace rtl { #define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 147 #define BASEPROPERTY_GRID_HEADER_BACKGROUND 148 #define BASEPROPERTY_GRID_LINE_COLOR 149 +#define BASEPROPERTY_GRID_ROW_BACKGROUND 150 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 337076bdfaa9..f68239f9712c 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -33,6 +33,7 @@ #include "defaultgridcolumnmodel.hxx" #include #include +#include #include using ::rtl::OUString; @@ -42,7 +43,8 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::style; -#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" )) +//#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" )) +//#define COLUMNRESIZED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResized" )) namespace toolkit { @@ -53,7 +55,7 @@ namespace toolkit DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory) : columns(std::vector< Reference< XGridColumn > >()) - ,m_nColumnHeaderHeight(10) + ,m_nColumnHeaderHeight(0) ,m_xFactory(xFactory) { } @@ -66,68 +68,68 @@ DefaultGridColumnModel::~DefaultGridColumnModel() //--------------------------------------------------------------------- -void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent ) -{ - ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() ); - if( pIter ) - { - ::cppu::OInterfaceIteratorHelper aListIter(*pIter); - while(aListIter.hasMoreElements()) - { - XGridColumnListener* pListener = static_cast(aListIter.next()); - switch( eType ) - { - case column_added: pListener->columnAdded(aEvent); break; - case column_removed: pListener->columnRemoved(aEvent); break; - case column_changed: pListener->columnChanged(aEvent); break; - } - } - } -} - -//--------------------------------------------------------------------- - -void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) -{ - Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL ); - broadcast( column_changed, aEvent); -} - -//--------------------------------------------------------------------- - -void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) -{ - Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); - broadcast( column_added, aEvent); -} - -//--------------------------------------------------------------------- - -void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) -{ - Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); - broadcast( column_removed, aEvent); -} +//void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent ) +//{ +// ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() ); +// if( pIter ) +// { +// ::cppu::OInterfaceIteratorHelper aListIter(*pIter); +// while(aListIter.hasMoreElements()) +// { +// XGridColumnListener* pListener = static_cast(aListIter.next()); +// switch( eType ) +// { +// case column_added: pListener->columnAdded(aEvent); break; +// case column_removed: pListener->columnRemoved(aEvent); break; +// case column_changed: pListener->columnChanged(aEvent); break; +// } +// } +// } +//} +// +////--------------------------------------------------------------------- +// +//void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue) +//{ +// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); +// GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL ); +// broadcast( column_changed, aEvent); +//} +// +////--------------------------------------------------------------------- +// +//void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) +//{ +// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); +// GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); +// broadcast( column_added, aEvent); +//} +// +////--------------------------------------------------------------------- +// +//void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) +//{ +// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); +// GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); +// broadcast( column_removed, aEvent); +//} //--------------------------------------------------------------------- // XDefaultGridColumnModel //--------------------------------------------------------------------- -::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException) -{ - return selectionAllowed; -} - -//--------------------------------------------------------------------- - -void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException) -{ - sal_Bool oldValue = selectionAllowed; - selectionAllowed = value; - broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed)); -} +//::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException) +//{ +// return selectionAllowed; +//} +// +////--------------------------------------------------------------------- +// +//void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException) +//{ +// sal_Bool oldValue = selectionAllowed; +// selectionAllowed = value; +// broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed)); +//} //--------------------------------------------------------------------- @@ -141,10 +143,10 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value ::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - columns.push_back(column); + Reference xColumn(column); + columns.push_back(xColumn); sal_Int32 index = columns.size() - 1; - broadcast_add(index, column ); + xColumn->setIndex(index); return index; } @@ -160,22 +162,24 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) { if ( index >=0 && index < ((sal_Int32)columns.size())) + { return columns[index]; + } else return Reference< XGridColumn >(); } //--------------------------------------------------------------------- -void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) -{ - BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); -} - -//--------------------------------------------------------------------- - -void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) -{ - BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); -} +//void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +//{ +// BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); +//} +// +////--------------------------------------------------------------------- +// +//void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +//{ +// BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); +//} //--------------------------------------------------------------------- void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException) @@ -193,9 +197,25 @@ void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) t { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY ); for(sal_Int32 i=0;i xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY ); columns.push_back(xColumn); + xColumn->setIndex(i); + } +} +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException) +{ + Reference xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY ); + xColumn->setColumnWidth(column->getColumnWidth()); + xColumn->setPreferredWidth(column->getPreferredWidth()); + xColumn->setMaxWidth(column->getMaxWidth()); + xColumn->setMinWidth(column->getMinWidth()); + xColumn->setPreferredWidth(column->getPreferredWidth()); + xColumn->setResizeable(column->getResizeable()); + xColumn->setTitle(column->getTitle()); + xColumn->setHorizontalAlign(column->getHorizontalAlign()); + return xColumn; } //--------------------------------------------------------------------- // XComponent diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx index d700a6b07b5d..bfa9892b3777 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx @@ -32,7 +32,7 @@ #include "precompiled_toolkit.hxx" #include #include -#include +//#include #include #include #include @@ -43,6 +43,7 @@ #include #include #include +#include using ::rtl::OUString; using namespace ::com::sun::star; @@ -54,7 +55,7 @@ using namespace ::com::sun::star::lang; namespace toolkit { -enum broadcast_type { column_added, column_removed, column_changed}; +//enum broadcast_type { column_added, column_removed, column_changed}; class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >, public MutexAndBroadcastHelper @@ -65,17 +66,18 @@ public: // XGridColumnModel - virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException); + //virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); - virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); + //virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); + //virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); @@ -87,10 +89,10 @@ public: virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); private: - void broadcast( broadcast_type eType, const GridColumnEvent& aEvent ); - void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ); + /*void broadcast( broadcast_type eType, const GridColumnEvent& aEvent ); + void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue, sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ); void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ); - void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ); + void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );*/ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns; sal_Bool selectionAllowed; diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 2d695a9bad0a..528e0e17c3e0 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -35,9 +35,6 @@ #include #include -#include -#include - using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -57,9 +54,9 @@ namespace toolkit /////////////////////////////////////////////////////////////////////// DefaultGridDataModel::DefaultGridDataModel() -: rowHeight(10), +: rowHeight(0), rowHeaders(std::vector< ::rtl::OUString >()), - m_nRowHeaderWidth(7) + m_nRowHeaderWidth(10) { } diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index 40c2018c4cc5..b367ee908f3a 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -43,6 +43,15 @@ using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::style; +#define COLWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColWidth" )) +#define MAXWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MaxWidth" )) +#define MINWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MinWidth" )) +#define PREFWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PrefWidth" )) +#define HALIGN ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HAlign" )) +#define TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" )) +#define COLRESIZE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResize" )) +#define UPDATE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UpdateWidth" )) + namespace toolkit { @@ -54,7 +63,9 @@ GridColumn::GridColumn() : identifier(Any()) ,horizontalAlign(HorizontalAlignment(0)) ,columnWidth(4) +,preferredWidth(0) ,bResizeable(true) +,index(0) { } @@ -66,6 +77,39 @@ GridColumn::~GridColumn() //--------------------------------------------------------------------- +void GridColumn::broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent ) +{ + ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() ); + if( pIter ) + { + ::cppu::OInterfaceIteratorHelper aListIter(*pIter); + while(aListIter.hasMoreElements()) + { + XGridColumnListener* pListener = static_cast(aListIter.next()); + switch( eType ) + { + case column_attribute_changed: pListener->columnChanged(aEvent); break; + } + } + } +} + +//--------------------------------------------------------------------- + +void GridColumn::broadcast_changed(::rtl::OUString name, Any oldValue, Any newValue) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridColumnEvent aEvent( xSource, name, oldValue, newValue, index); + broadcast( column_attribute_changed, aEvent); +} + +void SAL_CALL GridColumn::updateColumn(const ::rtl::OUString& name, sal_Int32 width) throw (::com::sun::star::uno::RuntimeException) +{ + if(PREFWIDTH == name) + preferredWidth = width; + else if (COLWIDTH == name) + columnWidth = width; +} //--------------------------------------------------------------------- // XGridColumn //--------------------------------------------------------------------- @@ -86,6 +130,7 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException) { + broadcast_changed(UPDATE, Any(columnWidth), Any()); return columnWidth; } @@ -94,11 +139,13 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) { columnWidth = value; + broadcast_changed(COLWIDTH, Any(columnWidth),Any(value)); } //-------------------------------------------------------------------- ::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException) { + broadcast_changed(UPDATE, Any(preferredWidth), Any()); return preferredWidth; } @@ -107,6 +154,7 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) { preferredWidth = value; + broadcast_changed(PREFWIDTH, Any(preferredWidth),Any(value)); } //-------------------------------------------------------------------- @@ -120,6 +168,7 @@ void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) { maxWidth = value; + broadcast_changed(MAXWIDTH, Any(maxWidth),Any(value)); } //-------------------------------------------------------------------- @@ -133,6 +182,7 @@ void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) { minWidth = value; + broadcast_changed(MINWIDTH, Any(minWidth),Any(value)); } //-------------------------------------------------------------------- @@ -147,6 +197,7 @@ void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException) { title = value; + broadcast_changed(TITLE, Any(title),Any(value)); } //-------------------------------------------------------------------- @@ -160,6 +211,7 @@ sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::Runt void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException) { bResizeable = value; + broadcast_changed(COLRESIZE, Any(bResizeable),Any(value)); } //--------------------------------------------------------------------- HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException) @@ -171,6 +223,19 @@ HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun: void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException) { horizontalAlign = align; + broadcast_changed(HALIGN, Any(horizontalAlign),Any(align)); +} +//--------------------------------------------------------------------- +void SAL_CALL GridColumn::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); } //--------------------------------------------------------------------- @@ -179,22 +244,30 @@ void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (: void SAL_CALL GridColumn::dispose() throw (RuntimeException) { + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); + BrdcstHelper.aLC.disposeAndClear( aEvent ); } //--------------------------------------------------------------------- void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) { - (void) xListener; + BrdcstHelper.addListener( XEventListener::static_type(), xListener ); } //--------------------------------------------------------------------- void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) { - (void) xListener; + BrdcstHelper.removeListener( XEventListener::static_type(), xListener ); +} +void SAL_CALL GridColumn::setIndex(sal_Int32 _nIndex) throw (::com::sun::star::uno::RuntimeException) +{ + index = _nIndex; } - //--------------------------------------------------------------------- // XServiceInfo //--------------------------------------------------------------------- diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx index a458a07ffda8..d7651a2e00ab 100644 --- a/toolkit/source/controls/grid/gridcolumn.hxx +++ b/toolkit/source/controls/grid/gridcolumn.hxx @@ -31,6 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_toolkit.hxx" #include +#include +#include #include #include #include @@ -51,6 +53,7 @@ using namespace ::com::sun::star::lang; namespace toolkit { +enum broadcast_column_type { column_attribute_changed}; class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >, public MutexAndBroadcastHelper { @@ -75,6 +78,9 @@ public: virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateColumn( const ::rtl::OUString& name, ::sal_Int32 width ) throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); @@ -85,9 +91,13 @@ public: virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - + virtual void SAL_CALL setIndex(sal_Int32 _nIndex)throw (::com::sun::star::uno::RuntimeException); private: + void broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent ); + void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue); + Any identifier; + sal_Int32 index; sal_Int32 columnWidth; sal_Int32 preferredWidth; sal_Int32 maxWidth; diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx index fa0c3de3adb3..b279ace0ef12 100644 --- a/toolkit/source/controls/grid/gridcontrol.cxx +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -86,7 +86,7 @@ UnoGridModel::UnoGridModel() ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND ); ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND ); ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR ); - + ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND ); } UnoGridModel::UnoGridModel( const UnoGridModel& rModel ) @@ -112,6 +112,22 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) ); case BASEPROPERTY_GRID_SELECTIONMODE: return uno::makeAny( SelectionType(1) ); + case BASEPROPERTY_GRID_SHOWROWHEADER: + return uno::makeAny( (sal_Bool)sal_False ); + case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: + return uno::makeAny( (sal_Bool)sal_False ); + case BASEPROPERTY_GRID_DATAMODEL: + return uno::makeAny( Reference ()); + case BASEPROPERTY_GRID_COLUMNMODEL: + return uno::makeAny(Reference() ); + case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND: + return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) ); + case BASEPROPERTY_GRID_HEADER_BACKGROUND: + return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) ); + case BASEPROPERTY_GRID_LINE_COLOR: + return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) ); + case BASEPROPERTY_GRID_ROW_BACKGROUND: + return uno::makeAny(com::sun::star::util::Color(0xFFFFFF) ); default: return UnoControlModel::ImplGetDefaultValue( nPropId ); } @@ -141,7 +157,8 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime // class UnoGridControl // ---------------------------------------------------- UnoGridControl::UnoGridControl() -: mSelectionMode(SelectionType(1)) +: mSelectionMode(SelectionType(1)), + m_aSelectionListeners( *this ) { } @@ -152,6 +169,9 @@ OUString UnoGridControl::GetComponentServiceName() void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException) { + lang::EventObject aEvt; + aEvt.Source = (::cppu::OWeakObject*)this; + m_aSelectionListeners.disposeAndClear( aEvt ); UnoControl::dispose(); } @@ -160,17 +180,23 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk UnoControlBase::createPeer( rxToolkit, rParentPeer ); Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW ); + xGrid->addSelectionListener(&m_aSelectionListeners); Reference xListener ( getPeer(), UNO_QUERY_THROW ); - //Reference xColListener ( getPeer(), UNO_QUERY_THROW ); + Reference xColListener ( getPeer(), UNO_QUERY_THROW ); Reference xPropSet ( getModel(), UNO_QUERY_THROW ); Reference xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW ); if(xGridDataModel != NULL) xGridDataModel->addDataListener(xListener); - //Reference xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW ); - //if(xGridColumnModel != NULL) - // xGridColumnModel->addColumnListener(xColListener); + Reference xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW ); + if(xGridColumnModel != NULL) + { + for(int i = 0;igetColumnCount();i++) + { + xGridColumnModel->getColumn(i)->addColumnListener(xColListener); + } + } } @@ -212,16 +238,24 @@ void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::R return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex(); } -void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length); + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows); } -void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length ); + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows(); +} +void SAL_CALL UnoGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows); } +void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows(); +} ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) { return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection(); @@ -244,12 +278,12 @@ void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star:: void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener ); + m_aSelectionListeners.addInterface( listener ); } void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) { - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener ); + m_aSelectionListeners.removeInterface( listener ); } }//namespace toolkit diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index 8b219e70a0f2..c566569d7dbf 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -101,8 +101,10 @@ public: virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); @@ -116,6 +118,7 @@ public: using UnoControl::getPeer; private: ::com::sun::star::view::SelectionType mSelectionMode; + SelectionListenerMultiplexer m_aSelectionListeners; }; } // toolkit diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index cdbb156cd0f5..ee4c9bf4c144 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -209,3 +209,8 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com // ---------------------------------------------------- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener ) +// ---------------------------------------------------- +// class SelectionListenerMultiplexer +// ---------------------------------------------------- +IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener ) +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent ) \ No newline at end of file diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 9438cb93541b..beb746e02f36 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -286,8 +286,9 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ), DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ) - }; + DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ) + }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); } diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index 570c8ad0a342..fe9e566f75e3 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -195,6 +195,7 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos #define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText) +#define VCLEVENT_TABLEROW_SELECT 1225 class VCL_DLLPUBLIC VclSimpleEvent { -- cgit From 39729842721782d31746846dca9ad5f69cb93b6b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 22 Mar 2010 11:37:14 +0100 Subject: vcl110: #i110227# fix default wheel behavior --- vcl/source/app/settings.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 5ad3f6787461..980e0f1c5b58 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -188,7 +188,7 @@ ImplMouseData::ImplMouseData() mnActionDelay = 250; mnMenuDelay = 150; mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST; - mnWheelBehavior = MOUSE_WHEEL_FOCUS_ONLY; + mnWheelBehavior = MOUSE_WHEEL_ALWAYS; } // ----------------------------------------------------------------------- -- cgit From b73bee2f1e62be1832fe3e4bca36122a78b53092 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 22 Mar 2010 12:21:23 +0100 Subject: #i101552 update the win-gfb unicode->language list --- vcl/win/source/gdi/salgdi3.cxx | 109 ++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 39 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index c991d1db2be0..932d1749396d 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -319,7 +319,8 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag ) // =========================================================================== // platform specific font substitution hooks for glyph fallback enhancement -// TODO: move into i18n module (maybe merge with svx/ucsubset.*) +// TODO: move into i18n module (maybe merge with svx/ucsubset.* +// or merge with i18nutil/source/utility/unicode_data.h) struct Unicode2LangType { sal_UCS4 mnMinCode; @@ -333,47 +334,77 @@ struct Unicode2LangType // map unicode ranges to languages supported by OOo // NOTE: due to the binary search used this list must be sorted by mnMinCode static Unicode2LangType aLangFromCodeChart[]= { - {0x0000, 0x007f, LANGUAGE_ENGLISH}, // Basic Latin - {0x0080, 0x024f, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B - {0x0250, 0x02af, LANGUAGE_SYSTEM}, // IPA Extensions - {0x0370, 0x03ff, LANGUAGE_GREEK}, // Greek - {0x0590, 0x05ff, LANGUAGE_HEBREW}, // Hebrew - {0x0600, 0x06ff, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic - {0x0900, 0x097f, LANGUAGE_HINDI}, // Devanagari - {0x0980, 0x09ff, LANGUAGE_BENGALI}, // Bengali - {0x0a80, 0x0aff, LANGUAGE_GUJARATI}, // Gujarati - {0x0b00, 0x0b7f, LANGUAGE_ORIYA}, // Oriya - {0x0b80, 0x0bff, LANGUAGE_TAMIL}, // Tamil - {0x0e00, 0x0e7f, LANGUAGE_THAI}, // Thai - {0x0e80, 0x0eff, LANGUAGE_LAO}, // Lao - {0x1000, 0x109f, LANGUAGE_BURMESE}, // Burmese - {0x1100, 0x11ff, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific - {0x1780, 0x17ff, LANGUAGE_KHMER}, // Khmer - {0x1e00, 0x1eff, LANGUAGE_ENGLISH}, // Latin Extended Additional - {0x2c60, 0x2c7f, LANGUAGE_ENGLISH}, // Latin Extended-C - {0x2e80, 0x2fff, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters + {0x0000, 0x007F, LANGUAGE_ENGLISH}, // Basic Latin + {0x0080, 0x024F, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B + {0x0250, 0x02AF, LANGUAGE_SYSTEM}, // IPA Extensions + {0x0370, 0x03FF, LANGUAGE_GREEK}, // Greek + {0x0590, 0x05FF, LANGUAGE_HEBREW}, // Hebrew + {0x0600, 0x06FF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic + {0x0900, 0x097F, LANGUAGE_HINDI}, // Devanagari + {0x0980, 0x09FF, LANGUAGE_BENGALI}, // Bengali + {0x0A80, 0x0AFF, LANGUAGE_GUJARATI}, // Gujarati + {0x0B00, 0x0B7F, LANGUAGE_ORIYA}, // Oriya + {0x0B80, 0x0BFF, LANGUAGE_TAMIL}, // Tamil + {0x0C00, 0x0C7F, LANGUAGE_TELUGU}, // Telugu + {0x0C80, 0x0CFF, LANGUAGE_KANNADA}, // Kannada + {0x0D00, 0x0D7F, LANGUAGE_MALAYALAM}, // Malayalam + {0x0D80, 0x0D7F, LANGUAGE_SINHALESE_SRI_LANKA}, // Sinhala + {0x0E00, 0x0E7F, LANGUAGE_THAI}, // Thai + {0x0E80, 0x0EFF, LANGUAGE_LAO}, // Lao + {0x0F00, 0x0FFF, LANGUAGE_TIBETAN}, // Tibetan + {0x1000, 0x109F, LANGUAGE_BURMESE}, // Burmese + {0x10A0, 0x10FF, LANGUAGE_GEORGIAN}, // Georgian + {0x1100, 0x11FF, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific +// {0x1200, 0x139F, LANGUAGE_AMHARIC_ETHIOPIA}, // Ethiopic +// {0x1200, 0x139F, LANGUAGE_TIGRIGNA_ETHIOPIA}, // Ethiopic + {0x13A0, 0x13FF, LANGUAGE_CHEROKEE_UNITED_STATES}, // Cherokee +// {0x1400, 0x167F, LANGUAGE_CANADIAN_ABORIGINAL}, // Canadian Aboriginial Syllabics +// {0x1680, 0x169F, LANGUAGE_OGHAM}, // Ogham +// {0x16A0, 0x16F0, LANGUAGE_RUNIC}, // Runic +// {0x1700, 0x171F, LANGUAGE_TAGALOG}, // Tagalog +// {0x1720, 0x173F, LANGUAGE_HANUNOO}, // Hanunoo +// {0x1740, 0x175F, LANGUAGE_BUHID}, // Buhid +// {0x1760, 0x177F, LANGUAGE_TAGBANWA}, // Tagbanwa + {0x1780, 0x17FF, LANGUAGE_KHMER}, // Khmer + {0x18A0, 0x18AF, LANGUAGE_MONGOLIAN}, // Mongolian +// {0x1900, 0x194F, LANGUAGE_LIMBU}, // Limbu +// {0x1950, 0x197F, LANGUAGE_TAILE}, // Tai Le +// {0x1980, 0x19DF, LANGUAGE_TAILUE}, // Tai Lue + {0x19E0, 0x19FF, LANGUAGE_KHMER}, // Khmer Symbols +// {0x1A00, 0x1A1F, LANGUAGE_BUGINESE}, // Buginese/Lontara +// {0x1B00, 0x1B7F, LANGUAGE_BALINESE}, // Balinese +// {0x1D00, 0x1DFF, LANGUAGE_NONE}, // Phonetic Symbols + {0x1E00, 0x1EFF, LANGUAGE_ENGLISH}, // Latin Extended Additional + {0x1F00, 0x1FFF, LANGUAGE_GREEK}, // Greek Extended + {0x2C60, 0x2C7F, LANGUAGE_ENGLISH}, // Latin Extended-C + {0x2E80, 0x2FFf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters {0x3000, 0x303F, LANGUAGE_DEFAULT_CJK}, // CJK Symbols and punctuation {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana - {0x3100, 0x312f, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo - {0x3130, 0x318f, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific - {0x3190, 0x319f, LANGUAGE_JAPANESE}, // Kanbun - {0x31a0, 0x31bf, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended - {0x31c0, 0x31ef, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs - {0x31f0, 0x31ff, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions - {0x3400, 0x4dbf, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A - {0x4e00, 0x9fcf, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs - {0xa720, 0xa7ff, LANGUAGE_ENGLISH}, // Latin Extended-D - {0xac00, 0xd7af, LANGUAGE_KOREAN}, // Hangul Syllables, Kocrean-specific + {0x3100, 0x312F, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo + {0x3130, 0x318F, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific + {0x3190, 0x319F, LANGUAGE_JAPANESE}, // Kanbun + {0x31A0, 0x31BF, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended + {0x31C0, 0x31EF, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs + {0x31F0, 0x31FF, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions + {0x3200, 0x321F, LANGUAGE_KOREAN}, + {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, + {0x3260, 0x327F, LANGUAGE_KOREAN}, + {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, + {0x32d0, 0x32FF, LANGUAGE_JAPANESE}, // Japanese Circled Katakana + {0x3400, 0x4DBF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A + {0x4E00, 0x9FCF, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs + {0xA720, 0xA7FF, LANGUAGE_ENGLISH}, // Latin Extended-D + {0xAC00, 0xD7AF, LANGUAGE_KOREAN}, // Hangul Syllables, Korean-specific {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs - {0xfb00, 0xfb4f, LANGUAGE_HEBREW}, // Hibrew present forms - {0xfb50, 0xfdff, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A - {0xfe70, 0xfefe, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B - {0xff65, 0xff9f, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant - {0xffa0, 0xffDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant - {0x10140, 0x1018f, LANGUAGE_GREEK}, // Ancient Greak numbers - {0x1d200, 0x1d24f, LANGUAGE_GREEK}, // Ancient Greek Musical - {0x20000, 0x2a6df, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B - {0x2f800, 0x2fa1f, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement + {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew present forms + {0xFB50, 0xFDFF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A + {0xFE70, 0xFEFE, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B + {0xFF65, 0xFF9F, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant + {0xFFA0, 0xFFDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant + {0x10140, 0x1018F, LANGUAGE_GREEK}, // Ancient Greak numbers + {0x1D200, 0x1D24F, LANGUAGE_GREEK}, // Ancient Greek Musical + {0x20000, 0x2A6DF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B + {0x2F800, 0x2FA1F, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement }; // get language matching to the missing char -- cgit From 68761cb20d4aa261b671166a5658942a0069a58a Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 22 Mar 2010 15:05:10 +0100 Subject: #i101552# minor finishing touches on CWS gfb4win02 --- vcl/win/source/gdi/salgdi3.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 932d1749396d..2145de5abce3 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -386,17 +386,17 @@ static Unicode2LangType aLangFromCodeChart[]= { {0x31A0, 0x31BF, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended {0x31C0, 0x31EF, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs {0x31F0, 0x31FF, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions - {0x3200, 0x321F, LANGUAGE_KOREAN}, - {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, - {0x3260, 0x327F, LANGUAGE_KOREAN}, - {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, + {0x3200, 0x321F, LANGUAGE_KOREAN}, // Parenthesized Hangul + {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, // Parenthesized Ideographs + {0x3260, 0x327F, LANGUAGE_KOREAN}, // Circled Hangul + {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, // Circled Ideographs {0x32d0, 0x32FF, LANGUAGE_JAPANESE}, // Japanese Circled Katakana {0x3400, 0x4DBF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A {0x4E00, 0x9FCF, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs {0xA720, 0xA7FF, LANGUAGE_ENGLISH}, // Latin Extended-D {0xAC00, 0xD7AF, LANGUAGE_KOREAN}, // Hangul Syllables, Korean-specific {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs - {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew present forms + {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew Presentation Forms {0xFB50, 0xFDFF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A {0xFE70, 0xFEFE, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B {0xFF65, 0xFF9F, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant @@ -484,7 +484,7 @@ class WinGlyphFallbackSubstititution : public ImplGlyphFallbackFontSubstitution { public: - WinGlyphFallbackSubstititution( HDC ); + explicit WinGlyphFallbackSubstititution( HDC ); bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const; private: -- cgit From b09453118d699ce2c7e00cda02ffb1247dd29ac2 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 22 Mar 2010 15:15:28 +0100 Subject: fixed bugs for linux build --- svtools/inc/svtools/table/tablemodel.hxx | 4 +- svtools/source/table/tablecontrol.cxx | 5 -- svtools/source/table/tablecontrol_impl.cxx | 21 +----- svtools/source/table/tablecontrol_impl.hxx | 2 +- svtools/source/table/tabledatawindow.cxx | 2 - svtools/source/uno/svtxgridcontrol.cxx | 6 +- svtools/source/uno/svtxgridcontrol.hxx | 2 - svtools/source/uno/unocontroltablemodel.cxx | 16 ++--- svtools/source/uno/unocontroltablemodel.hxx | 4 +- .../controls/grid/defaultgridcolumnmodel.cxx | 80 ---------------------- .../source/controls/grid/defaultgriddatamodel.cxx | 19 ----- toolkit/source/controls/grid/gridcontrol.cxx | 11 --- 12 files changed, 14 insertions(+), 158 deletions(-) diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 18d4db16c123..786af87db12d 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -447,13 +447,13 @@ namespace svt { namespace table virtual bool hasHorizontalScrollbar() = 0; /** fills cells with content */ - virtual void setCellContent(std::vector< std::vector< ::com::sun::star::uno::Any > > cellContent)=0; + virtual void setCellContent(const std::vector< std::vector< ::com::sun::star::uno::Any > >& cellContent)=0; /** gets the content of the cells */ virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; /**sets title of header rows */ - virtual void setRowHeaderName(std::vector cellColumnContent)=0; + virtual void setRowHeaderName(const std::vector& cellColumnContent)=0; /** gets title of header rows */ virtual std::vector& getRowHeaderName() = 0; diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 635008d94f94..f4d328261cba 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -260,7 +260,6 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); break; case TCTYPE_TABLECELL: - //Window* pWin = GetCellContent(_nRow, _nCol); aRetText = GetRowName(_nRow); break; case TCTYPE_ROWHEADERCELL: @@ -387,10 +386,6 @@ void TableControl::FillAccessibleStateSet( break; case TCTYPE_TABLECELL: { - //sal_Int32 nRow = GetCurRow(); - //sal_uInt16 nColumn = GetCurColumnId(); - //if ( IsFieldVisible(nRow,nColumn) ) - // rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::TRANSIENT ); rStateSet.AddState( AccessibleStateType::SELECTABLE); if( GetSelectedRowCount()>0) diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 7220f964a99e..39286903b11f 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -190,9 +190,8 @@ namespace svt { namespace table { return false; } - virtual void setCellContent(std::vector > pCellEntryType) + virtual void setCellContent(const std::vector >& ) { - (void)pCellEntryType; } virtual ::com::sun::star::util::Color getLineColor() { @@ -248,9 +247,8 @@ namespace svt { namespace table { return *( new std::vector >); } - virtual void setRowHeaderName(std::vector pCellEntryType) + virtual void setRowHeaderName(const std::vector& ) { - (void)pCellEntryType; } virtual std::vector& getRowHeaderName() { @@ -1169,7 +1167,6 @@ namespace svt { namespace table it!=m_nRowSelected.end();++it) { invalidateSelectedRegion(*it, *it, rCells); - //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); } @@ -1203,7 +1200,6 @@ namespace svt { namespace table it!=m_nRowSelected.end();++it) { invalidateSelectedRegion(*it, *it, rCells); - //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); } @@ -1327,7 +1323,6 @@ namespace svt { namespace table it!=m_nRowSelected.end();++it) { invalidateSelectedRegion(*it, *it, rCells); - //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); m_nRowSelected.push_back(m_nCurRow); @@ -1415,7 +1410,6 @@ namespace svt { namespace table it!=m_nRowSelected.end();++it) { invalidateSelectedRegion(*it, *it, rCells); - //m_pDataWindow->Invalidate(rCells); } m_nRowSelected.clear(); m_nRowSelected.push_back(m_nCurRow); @@ -1547,7 +1541,6 @@ namespace svt { namespace table Rectangle aCellRect; impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect ); - // const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings(); if ( _bShow ) { pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect); @@ -1673,7 +1666,6 @@ namespace svt { namespace table //this method is to be called, when a new row is added void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect) { - //DBG_CHECK_ME(); if(m_nCurRow < 0) m_nCurRow = 0; if(m_nCursorHidden == 2) @@ -1719,7 +1711,6 @@ namespace svt { namespace table //------------------------------------------------------------------------------- void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect) { - //DBG_CHECK_ME(); (void)_nRowStart; (void)_rCellRect; impl_ni_updateScrollbars(); @@ -1728,7 +1719,6 @@ namespace svt { namespace table m_nTopRow--; else m_nTopRow = 0; - //m_pDataWindow->Invalidate(_rCellRect); m_pDataWindow->Invalidate(); } @@ -2063,9 +2053,6 @@ namespace svt { namespace table m_bResizingGrid = false; m_nResizingColumn = m_nCurColumn; PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); - //sal_Int32 colWidth = pColumn->getWidth(); - ////impl_ni_getAccVisibleColWidths(); - //int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable()) { m_pDataWindow->CaptureMouse(); @@ -2082,7 +2069,6 @@ namespace svt { namespace table PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); int maxWidth = pColumn->getMaxWidth(); int minWidth = pColumn->getMinWidth(); - //int colWidth = pColumn->getWidth(); int resizeCol = m_nResizingColumn-m_nLeftColumn; //new position of mouse int actX = rPoint.X(); @@ -2260,9 +2246,6 @@ namespace svt { namespace table { //selecting region, int diff = m_pTableControl->m_nCurRow - curRow; - //bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor); - /* if(!isAlreadySelected && m_nCurrentRow != m_pTableControl->m_nCurRow) - m_pTableControl->m_nRowSelected.push_back(m_nAnchor);*/ //selected region lies above the last selection if( diff >= 0) { diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index dffa69422599..8bc6b371d1d8 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -321,7 +321,7 @@ namespace svt { namespace table DECL_LINK( OnScroll, ScrollBar* ); }; - //see seleng.hxx, seleng.cxx, FunctionSet overwritables, part of selection engine + //see seleng.hxx, seleng.cxx, FunctionSet overridables, part of selection engine class TableFunctionSet : public FunctionSet { friend class TableDataWindow; diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 6ae2a39443d1..8d7b08c4e255 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -44,8 +44,6 @@ namespace svt { namespace table :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) { - //Color backgroundColor = GetControlBackground(); - //SetBackground( backgroundColor ); } //-------------------------------------------------------------------- diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 482d01224073..81ca6e2afd0f 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -111,8 +111,6 @@ sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); - /*std::vector< sal_Int32 > newCols( - comphelper::sequenceToContainer< std::vector< sal_Int32 > >(columns));*/ pTable->setTooltip(text, columns); } @@ -268,9 +266,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An { std::vector< Any > newRow; Sequence< Any > rawRowData = cellData[i]; - //check whether the data row vector length matches with the column count, - //all cells must have some content even if it is empty string - //preventing errors + //check whether the data row vector length matches with the column count if(m_xColumnModel->getColumnCount() == 0) { for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col ) diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index cd4dc698f8db..232eaea4349f 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -78,8 +78,6 @@ public: virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); //XGridColumnListener overridables - //virtual void SAL_CALL columnAdded(const ::com::sun::star::awt::grid::GridColumnEvent& Event) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL columnRemoved(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 2b53b65de471..6d04098e0f78 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -53,13 +53,11 @@ using namespace ::com::sun::star::uno; ,m_sName() ,m_bIsResizable( true ) ,m_nWidth( 4 ) - ,m_nMinWidth( 0 ) // no min width - ,m_nMaxWidth( 0 ) // no max width + ,m_nMinWidth( 0 ) + ,m_nMaxWidth( 0 ) ,m_nPrefWidth ( 0 ) ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { - //m_nID = m_xGridColumn->getIdentifier(); - //m_nWidth = m_xGridColumn->getColumnWidth(); m_sName = m_xGridColumn->getTitle(); } //-------------------------------------------------------------------- @@ -68,8 +66,8 @@ using namespace ::com::sun::star::uno; ,m_sName() ,m_bIsResizable( true ) ,m_nWidth( 4 ) - ,m_nMinWidth( 0 ) // no min width - ,m_nMaxWidth( 0 ) // no max width + ,m_nMinWidth( 0 ) + ,m_nMaxWidth( 0 ) ,m_nPrefWidth ( 0 ) ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0)) { @@ -293,7 +291,6 @@ using namespace ::com::sun::star::uno; void UnoControlTableModel::addTableModelListener( const PTableModelListener& listener ) { (void) listener; - //listener->onTableModelChanged(PTableModel(this)); // TODO DBG_ERROR( "DefaultTableModel::addTableModelListener: not yet implemented!" ); } @@ -431,18 +428,17 @@ using namespace ::com::sun::star::uno; return m_pImpl->bHScroll; } //-------------------------------------------------------------------- - void UnoControlTableModel::setCellContent(std::vector > cellContent) + void UnoControlTableModel::setCellContent(const std::vector >& cellContent) { m_pImpl->aCellContent = cellContent; } std::vector >& UnoControlTableModel::getCellContent() { - //::vos::OGuard aGuard( GetMutex() ); return m_pImpl->aCellContent; } //-------------------------------------------------------------------- - void UnoControlTableModel::setRowHeaderName(std::vector cellColumnContent) + void UnoControlTableModel::setRowHeaderName(const std::vector& cellColumnContent) { m_pImpl->aRowHeadersTitle = cellColumnContent; } diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index ae0a5ce76a9e..c72db4e7ba87 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -148,9 +148,9 @@ class UnoControlTableColumn : public IColumnModel virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const; virtual void setVerticalScrollbarVisibility(bool _bVScroll) const; virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const; - virtual void setCellContent(std::vector > cellContent); + virtual void setCellContent(const std::vector >& cellContent); virtual std::vector >& getCellContent(); - virtual void setRowHeaderName(std::vector cellColumnContent); + virtual void setRowHeaderName(const std::vector& cellColumnContent); virtual std::vector& getRowHeaderName(); virtual ::com::sun::star::util::Color getLineColor(); virtual void setLineColor(::com::sun::star::util::Color _rColor); diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index f68239f9712c..c61023f7cf2e 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -43,8 +43,6 @@ using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::style; -//#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" )) -//#define COLUMNRESIZED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResized" )) namespace toolkit { @@ -68,71 +66,6 @@ DefaultGridColumnModel::~DefaultGridColumnModel() //--------------------------------------------------------------------- -//void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent ) -//{ -// ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() ); -// if( pIter ) -// { -// ::cppu::OInterfaceIteratorHelper aListIter(*pIter); -// while(aListIter.hasMoreElements()) -// { -// XGridColumnListener* pListener = static_cast(aListIter.next()); -// switch( eType ) -// { -// case column_added: pListener->columnAdded(aEvent); break; -// case column_removed: pListener->columnRemoved(aEvent); break; -// case column_changed: pListener->columnChanged(aEvent); break; -// } -// } -// } -//} -// -////--------------------------------------------------------------------- -// -//void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue) -//{ -// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); -// GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL ); -// broadcast( column_changed, aEvent); -//} -// -////--------------------------------------------------------------------- -// -//void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) -//{ -// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); -// GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); -// broadcast( column_added, aEvent); -//} -// -////--------------------------------------------------------------------- -// -//void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) -//{ -// Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); -// GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); -// broadcast( column_removed, aEvent); -//} - -//--------------------------------------------------------------------- -// XDefaultGridColumnModel -//--------------------------------------------------------------------- -//::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException) -//{ -// return selectionAllowed; -//} -// -////--------------------------------------------------------------------- -// -//void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException) -//{ -// sal_Bool oldValue = selectionAllowed; -// selectionAllowed = value; -// broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed)); -//} - -//--------------------------------------------------------------------- - ::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException) { return columns.size(); @@ -168,19 +101,6 @@ DefaultGridColumnModel::~DefaultGridColumnModel() else return Reference< XGridColumn >(); } -//--------------------------------------------------------------------- -//void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) -//{ -// BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); -//} -// -////--------------------------------------------------------------------- -// -//void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) -//{ -// BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); -//} - //--------------------------------------------------------------------- void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException) { diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 528e0e17c3e0..91bdd30225ed 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -41,7 +41,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt::grid; using namespace ::com::sun::star::lang; -//using namespace ::com::sun::star::style; #define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" )) #define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" )) @@ -182,18 +181,6 @@ void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, c std::vector< Any > newRow; for ( int i = 0; i < rRowdata.getLength();i++) { - //OUString title(rRowdata[i]); - - // create and use interal a UnoControlFixedText for text content - //Reference< XFixedText > xFixedText( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedText" ) ), UNO_QUERY_THROW ); - //Reference< XControl > xFixedTextControl( xFixedText , UNO_QUERY ); - // - //Reference< XControlModel > xFixedTextModel( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.UnoControlFixedTextModel" ) ), UNO_QUERY ); - //Reference< ::com::sun::star::beans::XPropertySet > xFixedTextModelPropSet( xFixedTextModel, UNO_QUERY ); - //xFixedTextModelPropSet->setPropertyValue( OUString::createFromAscii( "Label"), makeAny( title ) ); - - //xFixedTextControl->setModel( xFixedTextModel ); - newRow.push_back(rRowdata[i]); } @@ -209,12 +196,6 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s { if ( index >= 0 && index <= getRowCount()-1) { - /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index )) - { - ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection(); - selectedRow.erase(selectedRows.begin()+index); - }*/ - ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] ); rowHeaders.erase(rowHeaders.begin() + index); diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx index b279ace0ef12..e397ad8158f0 100644 --- a/toolkit/source/controls/grid/gridcontrol.cxx +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -213,17 +213,6 @@ void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< { Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns ); } -/* -void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener ); -} - -void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener ); -} -*/ // ------------------------------------------------------------------- // XGridSelection // ------------------------------------------------------------------- -- cgit From 96f3fde8e6bad2e339fea0f8e70434096b412b8f Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 22 Mar 2010 15:34:06 +0100 Subject: fixed bugs for linux build 2 --- toolkit/source/helper/listenermultiplexer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx index ee4c9bf4c144..68bb791bb2d0 100644 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ b/toolkit/source/helper/listenermultiplexer.cxx @@ -213,4 +213,4 @@ IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::s // class SelectionListenerMultiplexer // ---------------------------------------------------- IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent ) \ No newline at end of file +IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent ) -- cgit From 0f1df8f471390de177610ee2bb9cc2f424d740c2 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Mon, 22 Mar 2010 16:21:58 +0100 Subject: fixed bugs for linux build 3 --- svtools/source/uno/svtxgridcontrol.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 81ca6e2afd0f..40616c2a4d87 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -130,7 +130,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An TableControl* pTable = (TableControl*)GetWindow(); const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings(); - com::sun::star::awt::FontDescriptor& aFont = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); + const com::sun::star::awt::FontDescriptor& aFont = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); switch( GetPropertyId( PropertyName ) ) { -- cgit From 43bd6eb856b003dcc31df1a5b7c612b53984868c Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 23 Mar 2010 13:35:44 +0100 Subject: fixing build problems on unix --- svtools/source/control/toolbarmenuimp.hxx | 2 ++ svtools/source/uno/popupwindowcontroller.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index d1c574da4d33..c69944ec0999 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -227,7 +227,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleEventBroadcaster + using ToolbarMenuEntryAccBase::addEventListener; virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + using ToolbarMenuEntryAccBase::removeEventListener; virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleContext diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 9d5285250d20..d431dd7911a8 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -216,7 +216,7 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th return Reference< awt::XWindow >(); } -Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( const Reference< awt::XWindow >& Parent ) +Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( const Reference< awt::XWindow >& /*Parent*/ ) throw (RuntimeException) { return Reference< awt::XWindow >(); -- cgit From e95181408ebf1a010c9286e0059cccfeb6425619 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 23 Mar 2010 13:56:35 +0100 Subject: adjusted spacing of menu items --- svtools/source/control/toolbarmenu.cxx | 95 +++++++++++-------------------- svtools/source/control/toolbarmenuimp.hxx | 4 +- 2 files changed, 36 insertions(+), 63 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index a16f60bc5822..47c95ecb0038 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -591,102 +591,73 @@ Size ToolbarMenu::implCalcSize() Size aSz; Size aMaxImgSz; long nMaxTextWidth = 0; - long nMinMenuItemHeight = nFontHeight; + long nMinMenuItemHeight = nFontHeight+2; sal_Bool bCheckable = sal_False; const int nEntryCount = mpImpl->maEntryVector.size(); int nEntry; const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - if ( rSettings.GetUseImagesInMenus() ) - { - nMinMenuItemHeight = 16; + const bool bUseImages = rSettings.GetUseImagesInMenus(); + // get maximum image size + if( bUseImages ) + { for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; if( pEntry && pEntry->mbHasImage ) { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( aImgSz.Height() > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height(); - if ( aImgSz.Height() > nMinMenuItemHeight ) - nMinMenuItemHeight = aImgSz.Height(); - break; - } - } - } - - for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) - { - ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; - - if( pEntry ) - { - pEntry->maSize.Height() = 0; - pEntry->maSize.Width() = 0; - - - if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) - bCheckable = sal_True; - - // Image: - if( pEntry->mbHasImage ) - { - Size aImgSz = pEntry->maImage.GetSizePixel(); - if ( (aImgSz.Width() + 4) > aMaxImgSz.Width() ) - aMaxImgSz.Width() = aImgSz.Width() + 4; - if ( (aImgSz.Height() + 4) > aMaxImgSz.Height() ) - aMaxImgSz.Height() = aImgSz.Height() + 4; - if ( (aImgSz.Height() + 4) > pEntry->maSize.Height() ) - pEntry->maSize.Height() = aImgSz.Height() + 4; + Size aImgSz( pEntry->maImage.GetSizePixel() ); + nMinMenuItemHeight = std::max( nMinMenuItemHeight, aImgSz.Height() + 6 ); + aMaxImgSz.Width() = std::max( aMaxImgSz.Width(), aImgSz.Width() ); } } } - int gfxExtra = Max( nExtra, 7L ); + mpImpl->mnCheckPos = nExtra; + mpImpl->mnImagePos = nExtra; + mpImpl->mnTextPos = mpImpl->mnImagePos + aMaxImgSz.Width(); if ( aMaxImgSz.Width() ) - mpImpl->mnTextPos += gfxExtra; + mpImpl->mnTextPos += std::max( nExtra, 7L ); if ( bCheckable ) mpImpl->mnTextPos += 16; - mpImpl->mnCheckPos = nExtra; - mpImpl->mnImagePos = nExtra; - mpImpl->mnTextPos = mpImpl->mnImagePos + aMaxImgSz.Width(); - + // set heights, calc maximum width for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; if( pEntry ) { + if ( ( pEntry->mnBits ) & ( MIB_RADIOCHECK | MIB_CHECKABLE ) ) + bCheckable = sal_True; + // Text: - if( pEntry->mbHasText ) + if( pEntry->mbHasText || pEntry->mbHasImage ) { - long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mpImpl->mnTextPos; - nMaxTextWidth = Max( nTextWidth, nMaxTextWidth ); + pEntry->maSize.Height() = nMinMenuItemHeight; - pEntry->maSize.Height() = Max( Max( GetTextHeight(), pEntry->maSize.Height() ), nMinMenuItemHeight ); + if( pEntry->mbHasText ) + { + long nTextWidth = GetCtrlTextWidth( pEntry->maText ) + mpImpl->mnTextPos + nExtra; + nMaxTextWidth = std::max( nTextWidth, nMaxTextWidth ); + } } // Control: else if( pEntry->mpControl ) { Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); - nMaxTextWidth = Max( aControlSize.Width(), nMaxTextWidth ); - pEntry->maSize.Height() = Max( aControlSize.Height(), pEntry->maSize.Height() ) + 1; + nMaxTextWidth = std::max( aControlSize.Width(), nMaxTextWidth ); + pEntry->maSize.Height() = aControlSize.Height() + 1; } - aSz.Height() += pEntry->maSize.Height(); - } - else - { - aSz.Height() += SEPARATOR_HEIGHT; + } } aSz.Width() = nMaxTextWidth + (BORDER_X<<1); - aSz.Height() += BORDER_Y<<1; // positionate controls int nY = BORDER_Y; @@ -696,12 +667,12 @@ Size ToolbarMenu::implCalcSize() if( pEntry ) { + pEntry->maSize.Width() = nMaxTextWidth; + if( pEntry->mpControl ) { Size aControlSize( pEntry->mpControl->GetOutputSizePixel() ); Point aControlPos( (aSz.Width() - aControlSize.Width())>>1, nY); - if( pEntry->mbHasText ) - aControlPos.X() += GetCtrlTextWidth( pEntry->maText ) + 4*gfxExtra; pEntry->mpControl->SetPosPixel( aControlPos ); @@ -720,6 +691,8 @@ Size ToolbarMenu::implCalcSize() } } + aSz.Height() += nY + BORDER_Y; + return aSz; } @@ -1415,10 +1388,10 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aSelRect.nLeft -= 2; - aSelRect.nTop -= 2; - aSelRect.nRight += 2; - aSelRect.nBottom += 2; + aSelRect.nLeft -= 1; + aSelRect.nTop -= 1; + aSelRect.nRight += 1; + aSelRect.nBottom += 1; DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); } else diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index d1c574da4d33..9e30ac24666c 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -61,8 +61,8 @@ typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; const int EXTRAITEMHEIGHT = 0; // 4; const int SEPARATOR_HEIGHT = 4; const int TITLE_ID = -1; -const int BORDER_X = 0; -const int BORDER_Y = 0; +const int BORDER_X = 2; +const int BORDER_Y = 2; // -------------------- // - ToolbarMenuEntry - -- cgit From 10bd32766e95739de595cc4f99375020846e16b9 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Mar 2010 15:41:21 +0100 Subject: vcl110: #i103162# avoid busy loop in non mainthread execute --- vcl/aqua/inc/salinst.h | 2 ++ vcl/aqua/source/app/salinst.cxx | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 8a44f7ef3304..0bceb99d1d0e 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -32,6 +32,7 @@ #include "vos/mutex.hxx" #include "vos/thread.hxx" #include "vcl/salinst.hxx" +#include "osl/conditn.h" #include "aquavcltypes.h" @@ -96,6 +97,7 @@ public: int mnActivePrintJobs; std::list< SalUserEvent > maUserEvents; oslMutex maUserEventListMutex; + oslCondition maWaitingYieldCond; typedef std::list AppEventList; static AppEventList aAppEventList; diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 62c59e78c963..b8a2261ed9db 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -474,6 +474,7 @@ AquaSalInstance::AquaSalInstance() mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); mnActivePrintJobs = 0; + maWaitingYieldCond = osl_createCondition(); } // ----------------------------------------------------------------------- @@ -484,6 +485,7 @@ AquaSalInstance::~AquaSalInstance() mpSalYieldMutex->release(); delete mpSalYieldMutex; osl_destroyMutex( maUserEventListMutex ); + osl_destroyCondition( maWaitingYieldCond ); } // ----------------------------------------------------------------------- @@ -713,6 +715,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( aEvent.mpFrame && AquaSalFrame::isAlive( aEvent.mpFrame ) ) { aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData ); + osl_setCondition( maWaitingYieldCond ); // return if only one event is asked for if( ! bHandleAllCurrentEvents ) return; @@ -785,6 +788,18 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) (*it)->maInvalidRect.SetEmpty(); } } + osl_setCondition( maWaitingYieldCond ); + } + else if( bWait ) + { + // #i103162# + // wait until any thread (most likely the main thread) + // has dispatched an event, cop out at 200 ms + osl_resetCondition( maWaitingYieldCond ); + TimeValue aVal = { 0, 200000000 }; + ULONG nCount = ReleaseYieldMutex(); + osl_waitCondition( maWaitingYieldCond, &aVal ); + AcquireYieldMutex( nCount ); } // we get some apple events way too early -- cgit From dd69e7d54931e7510482a35a0a605f0c8792ee7c Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Mar 2010 16:18:47 +0100 Subject: vcl110: #i103162# avoid busy loop in non mainthread execute --- vcl/unx/gtk/app/gtkdata.cxx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index b1529e060270..0b3e443c40ec 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -800,15 +800,12 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) */ bool bDispatchThread = false; + gboolean wasEvent = FALSE; { // release YieldMutex (and re-acquire at block end) YieldMutexReleaser aReleaser; if( osl_tryToAcquireMutex( m_aDispatchMutex ) ) - { - // we are the dispatch thread - osl_resetCondition( m_aDispatchCondition ); bDispatchThread = true; - } else if( ! bWait ) return; // someone else is waiting already, return @@ -816,7 +813,7 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( bDispatchThread ) { int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1; - gboolean wasEvent = FALSE, wasOneEvent = TRUE; + gboolean wasOneEvent = TRUE; while( nMaxEvents-- && wasOneEvent ) { wasOneEvent = g_main_context_iteration( NULL, FALSE ); @@ -824,17 +821,17 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) wasEvent = TRUE; } if( bWait && ! wasEvent ) - g_main_context_iteration( NULL, TRUE ); + wasEvent = g_main_context_iteration( NULL, TRUE ); } - else if( userEventFn( this ) ) + else if( bWait ) { /* #i41693# in case the dispatch thread hangs in join * for this thread the condition will never be set * workaround: timeout of 1 second a emergency exit */ - TimeValue aValue; - aValue.Seconds = 1; - aValue.Nanosec = 0; + // we are the dispatch thread + osl_resetCondition( m_aDispatchCondition ); + TimeValue aValue = { 1, 0 }; osl_waitCondition( m_aDispatchCondition, &aValue ); } } @@ -842,8 +839,8 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents ) if( bDispatchThread ) { osl_releaseMutex( m_aDispatchMutex ); - osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields - osl_resetCondition( m_aDispatchCondition ); + if( wasEvent ) + osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields } } -- cgit From 8e24fa4567fb4d3fc47190be1f9bf058061d0ec4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 23 Mar 2010 18:54:21 +0100 Subject: vcl110: #i60481# fix HasGreyPalette for 1 bit --- vcl/source/gdi/bitmap.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 51c76b5a4626..074935086b0b 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -323,7 +323,23 @@ BOOL Bitmap::HasGreyPalette() const BOOL bRet = FALSE; if( 1 == nBitCount ) - bRet = TRUE; + { + BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); + + if( pRAcc ) + { + const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) ); + const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) ); + if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() && + rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() ) + { + bRet = TRUE; + } + ( (Bitmap*) this )->ReleaseAccess( pRAcc ); + } + else + bRet = TRUE; + } else if( 4 == nBitCount || 8 == nBitCount ) { BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess(); -- cgit From 88dd19cf2a0f3ad4d9a6e53342aeb4262cddbbad Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 24 Mar 2010 09:22:50 +0100 Subject: sw321bf01: fix compiler warning --- svtools/source/misc/transfer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 7b30e06220e6..268533ebb8c8 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -191,7 +191,7 @@ static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescripto for ( sal_Int32 nInd = 0; nInd < aQuotedParamChars.getLength(); nInd++ ) { sal_Unicode nChar = aQuotedParamChars.getStr()[nInd]; - if ( nChar >= 0 && nChar < 128 ) + if ( nChar < 128 ) pToAccept[nChar] = sal_True; } -- cgit From 5ce0b830dc8d9e3ec411182693901d95812e390e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 24 Mar 2010 11:52:17 +0100 Subject: vcl110: #i110356# spelling --- vcl/source/src/print.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 3158926f5e6d..58f0a477c848 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -356,7 +356,7 @@ ModalDialog SV_DLG_PRINT { Pos = MAP_APPFONT( 5, 35 ); Size = MAP_APPFONT( 150, 10 ); - Text [en-US] = "Range and Copies"; + Text [en-US] = "Range and copies"; }; FixedText SV_PRINT_COPYCOUNT { -- cgit From 9fb6554349b5ef27eff08281fcb999322551cf18 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Thu, 25 Mar 2010 11:17:21 +0100 Subject: gridcontrol_03:scrollbar bug fixed --- svtools/source/table/tablecontrol_impl.cxx | 150 ++++++++--------------------- 1 file changed, 41 insertions(+), 109 deletions(-) diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index f391a9912e2e..bd5f188e3889 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -103,22 +103,22 @@ namespace svt { namespace table { return false; } - virtual void setRowHeaders(bool _bRowHeaders) + virtual void setRowHeaders(bool _bRowHeaders) { (void)_bRowHeaders; } - virtual void setColumnHeaders(bool _bColumnHeaders) + virtual void setColumnHeaders(bool _bColumnHeaders) { - (void)_bColumnHeaders; - } - void setColumnCount(TableSize _nColCount) - { - (void) _nColCount; - } - void setRowCount(TableSize _nRowCount) - { - (void)_nRowCount; + (void)_bColumnHeaders; } + void setColumnCount(TableSize _nColCount) + { + (void) _nColCount; + } + void setRowCount(TableSize _nRowCount) + { + (void)_nRowCount; + } virtual bool isCellEditable( ColPos col, RowPos row ) const { (void)col; @@ -919,21 +919,15 @@ namespace svt { namespace table // our current style settings, to be passed to the renderer const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings(); - + m_nRowCount = m_pModel->getRowCount(); + TableSize nVisibleRows = impl_getVisibleRows(true); + TableSize nActualRows = m_nRowCount; + if(m_nRowCount>nVisibleRows) + nActualRows = nVisibleRows; // the area occupied by all (at least partially) visible cells, including // headers Rectangle aAllCellsWithHeaders; impl_getAllVisibleCellsArea( aAllCellsWithHeaders ); - - m_nRowCount = m_pModel->getRowCount(); - TableSize nVisibleRows = impl_getVisibleRows(true); - TableSize nVisibleColumns = impl_getVisibleColumns(true); - TableSize nActualRows = m_nRowCount; - TableSize nActualCols = m_nColumnCount; - if(m_nRowCount>nVisibleRows) - nActualRows = nVisibleRows; - if(m_nColumnCount>nVisibleColumns) - nActualCols = nVisibleColumns; // ............................ // draw the header column area if ( getModel()->hasColumnHeaders() ) @@ -964,17 +958,15 @@ namespace svt { namespace table // the area occupied by the row header, if any Rectangle aRowHeaderArea; - if ( getModel()->hasRowHeaders() ) + if ( m_pModel->hasRowHeaders() ) { aRowHeaderArea = aAllCellsWithHeaders; aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1; - if(m_nTopRow+nActualRows>m_nRowCount) - aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1; - else - aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1; - pRenderer->PaintHeaderArea( - *m_pDataWindow, aRowHeaderArea, false, true, rStyle - ); + if(m_nTopRow+nActualRows>m_nRowCount) + aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1; + else + aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1; + pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle); // Note that strictly, aRowHeaderArea also contains the intersection between column // and row header area. However, below we go to paint this intersection, again, // so this hopefully doesn't hurt if we already paint it here. @@ -997,51 +989,13 @@ namespace svt { namespace table // paint all rows Rectangle aAllDataCellsArea; impl_getAllVisibleDataCellArea( aAllDataCellsArea ); - - //get the vector, which contains row vectors, each containing the data for the cells in this row - std::vector >& aCellContent = m_pModel->getCellContent(); - //if the vector is empty, fill it with empty data, so the table can be painted - if(aCellContent.empty()) - { - std::vector< ::com::sun::star::uno::Any > emptyCells; - while(m_nRowCount!=0) - { - aCellContent.push_back( emptyCells); - --m_nRowCount; - } - } - std::vector >::iterator it = aCellContent.begin()+m_nTopRow; - //get the vector, which contains the row header titles - std::vector& aRowHeaderContent = m_pModel->getRowHeaderName(); - ::std::vector::iterator itRowName = aRowHeaderContent.begin(); - - if(m_pModel->hasRowHeaders()) - { - //if the vector is empty, fill it with empty strings, so the table can be painted - if(aRowHeaderContent.empty()) - { - while(m_nRowCount!=0) - { - aRowHeaderContent.push_back(rtl::OUString::createFromAscii("")); - --m_nRowCount; - } - } - itRowName = aRowHeaderContent.begin()+m_nTopRow; - } + ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent(); for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() ); aRowIterator.isValid(); aRowIterator.moveDown() ) { if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() ) - { - if(it < aCellContent.end()-1) - { - if(m_pModel->hasRowHeaders()) - ++itRowName; - ++it; - } - continue; - } + continue; bool isActiveRow = ( aRowIterator.getRow() == getCurRow() ); bool isSelectedRow = false; if(!m_nRowSelected.empty()) @@ -1053,15 +1007,6 @@ namespace svt { namespace table isSelectedRow = true; } } - std::vector< ::com::sun::star::uno::Any > aCellData; - if(it != aCellContent.begin()+m_nTopRow+nActualRows) - { - aCellData = *it; - if(it < aCellContent.end()-1) - ++it; - } - ::std::vector< ::com::sun::star::uno::Any >::iterator iter = aCellData.begin()+m_nLeftColumn; - // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle ); @@ -1069,20 +1014,13 @@ namespace svt { namespace table // paint the row header if ( m_pModel->hasRowHeaders() ) { - rtl::OUString rowHeaderName; - if(itRowName != aRowHeaderContent.begin()+m_nTopRow+nActualRows) - { - rowHeaderName = *itRowName; - if(itRowName < m_pModel->getRowHeaderName().end()-1) - ++itRowName; - } - Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); - pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, + Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); + rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()]; + pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, rStyle, rowHeaderName ); } if ( !colCount ) continue; - // paint all cells in this row for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn ); aCell.isValid(); @@ -1090,29 +1028,23 @@ namespace svt { namespace table ) { bool isSelectedColumn = false; - ::com::sun::star::uno::Any rCellData; - if(!aCellData.empty() && iter != aCellData.begin()+m_nLeftColumn+nActualCols) + Size siz = m_rAntiImpl.GetSizePixel(); + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()]; + if(rCellData>>=xGraphic) { - rCellData = *iter; - if(iter < aCellData.end()-1) - ++iter; - Size siz = m_rAntiImpl.GetSizePixel(); - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(rCellData>>=xGraphic) - { - Image* pImage = new Image(xGraphic); - if(pImage!=NULL) - pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + Image* pImage = new Image(xGraphic); + if(pImage!=NULL) + pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, pImage ); - } - else - { - ::rtl::OUString sContent = impl_convertToString(rCellData); - pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + } + else + { + ::rtl::OUString sContent = impl_convertToString(rCellData); + pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, sContent ); - } + } } - } } } //-------------------------------------------------------------------- @@ -2250,7 +2182,7 @@ namespace svt { namespace table //no region selected else { - if(m_pTableControl->m_nRowSelected.empty() + if(m_pTableControl->m_nRowSelected.empty()) m_pTableControl->m_nRowSelected.push_back(curRow); else { -- cgit From ee6e797e37f1657e47c530205d0162c6a886850d Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Thu, 25 Mar 2010 11:49:27 +0100 Subject: gridcontrol_03:scrollbar update after resizing bug fixed --- svtools/source/table/tablecontrol.cxx | 2 +- svtools/source/table/tablecontrol_impl.cxx | 6 ++---- svtools/source/table/tablecontrol_impl.hxx | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 4785248fbea6..3d8fedd2977e 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -177,7 +177,7 @@ namespace svt { namespace table { Rectangle _rRect; if(_bRemoved) - m_pImpl->invalidateRows(_nRowStart, _rRect); + m_pImpl->invalidateRows(); else { if(m_bSelectionChanged) diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index bd5f188e3889..d145e61b9274 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -899,7 +899,7 @@ namespace svt { namespace table { if(m_bResizingGrid) impl_ni_updateColumnWidths(); - impl_ni_updateScrollbars(); + invalidateRows(); m_bResizingGrid = true; } } @@ -1614,10 +1614,8 @@ namespace svt { namespace table m_nCurRow = _nRowPos-1; } //------------------------------------------------------------------------------ - void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect) + void TableControl_Impl::invalidateRows() { - (void)_nRowStart; - (void)_rCellRect; impl_ni_updateScrollbars(); TableSize nVisibleRows = impl_getVisibleRows(true); if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 8494e73d5ce9..bf22d8b3cd4e 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -200,7 +200,7 @@ namespace svt { namespace table std::vector& getSelectedRows(); /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); - void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); + void invalidateRows(); // IAbstractTableControl virtual void hideCursor(); -- cgit From f071b37411cf41a23d1364a37fc43135ca2dba85 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Mar 2010 12:29:31 +0100 Subject: reworked toolbar menu painting --- svtools/source/control/toolbarmenu.cxx | 417 ++++++++++++++++++++++-------- svtools/source/control/toolbarmenuimp.hxx | 10 +- 2 files changed, 309 insertions(+), 118 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 47c95ecb0038..bdd302f0839e 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -83,7 +83,6 @@ void ToolbarMenuEntry::init( int nEntryId, MenuItemBits nBits ) mbHasText = false; mbHasImage = false; - mbHasControl = false; mbChecked = false; mbEnabled = true; @@ -896,51 +895,84 @@ static void implDeselectControl( Control* pControl ) void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { - Size aSz = GetOutputSizePixel(); - long nY = BORDER_Y; - long nX = BORDER_X; + Size aSz( GetOutputSizePixel() ); + long nX = 0, nY = 0; const int nEntryCount = mpImpl->maEntryVector.size(); int nEntry; for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { - ToolbarMenuEntry* p = mpImpl->maEntryVector[nEntry]; - if( p ) + ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + if( pEntry && (nEntry == nHighlightEntry) ) { - if(nEntry == nHighlightEntry) + // no highlights for controls only items + if( pEntry->mpControl ) + break; + + bool bRestoreLineColor = false; + Color oldLineColor; + bool bDrawItemRect = true; + + Rectangle aItemRect( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ); + if ( pEntry->mnBits & MIB_POPUPSELECT ) { - if( p->mpControl == NULL ) - { - Rectangle aRect( Point( nX, nY ), Size( aSz.Width()-(BORDER_X<<1), p->maSize.Height() ) ); - SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - SetLineColor(); - DrawRect( aRect ); + long nFontHeight = GetTextHeight(); + aItemRect.Right() -= nFontHeight + nFontHeight/4; + } - if( bHighlight ) + if( IsNativeControlSupported( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL ) ) + { + Size aPxSize( GetOutputSizePixel() ); + Push( PUSH_CLIPREGION ); + IntersectClipRegion( Rectangle( Point( nX, nY ), Size( aSz.Width(), pEntry->maSize.Height() ) ) ); + Rectangle aCtrlRect( Point( nX, 0 ), Size( aPxSize.Width()-nX, aPxSize.Height() ) ); + DrawNativeControl( CTRL_MENU_POPUP, PART_ENTIRE_CONTROL, + Region( aCtrlRect ), + CTRL_STATE_ENABLED, + ImplControlValue(), + OUString() ); + if( bHighlight && IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM ) ) + { + bDrawItemRect = false; + if( FALSE == DrawNativeControl( CTRL_MENU_POPUP, PART_MENU_ITEM, + Region( aItemRect ), + CTRL_STATE_SELECTED | ( pEntry->mbEnabled? CTRL_STATE_ENABLED: 0 ), + ImplControlValue(), + OUString() ) ) { - aRect.nLeft += 1; - aRect.nTop += 1; - aRect.nBottom -= 1; - aRect.nRight -= 1; - DrawSelectionBackground( aRect, true, false, TRUE, TRUE ); + bDrawItemRect = bHighlight; } } else + bDrawItemRect = bHighlight; + Pop(); + } + if( bDrawItemRect ) + { + if ( bHighlight ) { - if( !bHighlight ) - implDeselectControl( p->mpControl ); + if( pEntry->mbEnabled ) + SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); + else + { + SetFillColor(); + oldLineColor = GetLineColor(); + SetLineColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() ); + bRestoreLineColor = true; + } } + else + SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); - implPaint( p, bHighlight ); - break; + DrawRect( aItemRect ); } - - nY += p->maSize.Height(); - } - else - { - nY += SEPARATOR_HEIGHT; + implPaint( pEntry, bHighlight ); + if( bRestoreLineColor ) + SetLineColor( oldLineColor ); + break; } + + nY += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT; } } @@ -1281,68 +1313,146 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) } // -------------------------------------------------------------------- +static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRect, bool i_bHighlight ) +{ + BOOL bNativeOk = FALSE; + if( i_pWindow->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + ImplControlValue aControlValue; + Region aCtrlRegion( i_rRect ); + ControlState nState = CTRL_STATE_PRESSED | CTRL_STATE_ENABLED; + + aControlValue.setTristateVal( BUTTONVALUE_ON ); + + bNativeOk = i_pWindow->DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, + aCtrlRegion, nState, aControlValue, + rtl::OUString() ); + } + + if( ! bNativeOk ) + { + const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings(); + Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() ); + i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, TRUE, FALSE, 2, NULL, &aColor ); + } +} + +static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) +{ + rMaxWidth = rCheckHeight = rRadioHeight = 0; + + ImplControlValue aVal; + Region aNativeBounds; + Region aNativeContent; + Point tmp( 0, 0 ); + Region aCtrlRegion( Rectangle( tmp, Size( 100, 15 ) ) ); + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_ITEM_CHECK_MARK), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + rCheckHeight = aNativeBounds.GetBoundRect().GetHeight(); + rMaxWidth = aNativeContent.GetBoundRect().GetWidth(); + } + } + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_ITEM_RADIO_MARK), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + rRadioHeight = aNativeBounds.GetBoundRect().GetHeight(); + rMaxWidth = Max (rMaxWidth, aNativeContent.GetBoundRect().GetWidth()); + } + } + return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; +} void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { - const long nFontHeight = GetTextHeight(); - const long nExtra = nFontHeight/4; + USHORT nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu + + long nFontHeight = GetTextHeight(); + long nExtra = nFontHeight/4; + + long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0; + ImplGetNativeCheckAndRadioSize( this, nCheckHeight, nRadioHeight, nMaxCheckWidth ); DecorationView aDecoView( this ); const StyleSettings& rSettings = GetSettings().GetStyleSettings(); - const Size aOutSz( GetOutputSizePixel() ); - - Point aTopLeft( BORDER_X, BORDER_Y ), aTmpPos; + int nOuterSpace = 0; // ImplGetSVData()->maNWFData.mnMenuFormatExtraBorder; + Point aTopLeft( nOuterSpace, nOuterSpace ), aTmpPos; + Size aOutSz( GetOutputSizePixel() ); const int nEntryCount = mpImpl->maEntryVector.size(); int nEntry; for( nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = mpImpl->maEntryVector[nEntry]; + Point aPos( aTopLeft ); + aPos.Y() += nBorder; + aPos.Y() += nStartY; - USHORT nTextStyle = 0; - USHORT nSymbolStyle = 0; - USHORT nImageStyle = 0; - if( pEntry && !pEntry->mbEnabled ) - { - nTextStyle |= TEXT_DRAW_DISABLE; - nSymbolStyle |= SYMBOL_DRAW_DISABLE; - nImageStyle |= IMAGE_DRAW_DISABLE; - } - // Separator - if( pEntry == NULL ) + if( (pEntry == 0) && !pThisOnly ) { - if( pThisOnly == NULL ) - { - aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); - - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - aTmpPos.Y()++; - SetLineColor( rSettings.GetLightColor() ); - DrawLine( aTmpPos, Point( aOutSz.Width() - 3, aTmpPos.Y() ) ); - SetLineColor(); - } - - aTopLeft.Y() += SEPARATOR_HEIGHT; + // Separator + aTmpPos.Y() = aPos.Y() + ((SEPARATOR_HEIGHT-2)/2); + aTmpPos.X() = aPos.X() + 2 + nOuterSpace; + SetLineColor( rSettings.GetShadowColor() ); + DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + aTmpPos.Y()++; + SetLineColor( rSettings.GetLightColor() ); + DrawLine( aTmpPos, Point( aOutSz.Width() - 3 - 2*nOuterSpace, aTmpPos.Y() ) ); + SetLineColor(); } - else + else if( !pThisOnly || ( pEntry == pThisOnly ) ) { - if( !pThisOnly || ( pEntry == pThisOnly ) ) + const bool bTitle = pEntry->mnEntryId == TITLE_ID; + + if ( pThisOnly && bHighlighted ) + SetTextColor( rSettings.GetMenuHighlightTextColor() ); + + if( aPos.Y() >= 0 ) { - const bool bTitle = pEntry->mnEntryId == TITLE_ID; + long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); - if( pThisOnly && bHighlighted ) - SetTextColor( rSettings.GetMenuHighlightTextColor() ); - else - SetTextColor( rSettings.GetMenuTextColor() ); + USHORT nTextStyle = 0; + USHORT nSymbolStyle = 0; + USHORT nImageStyle = 0; + + if( !pEntry->mbEnabled ) + { + nTextStyle |= TEXT_DRAW_DISABLE; + nSymbolStyle |= SYMBOL_DRAW_DISABLE; + nImageStyle |= IMAGE_DRAW_DISABLE; + } + + Rectangle aOuterCheckRect( Point( aPos.X()+mpImpl->mnCheckPos, aPos.Y() ), Size( pEntry->maSize.Height(), pEntry->maSize.Height() ) ); + aOuterCheckRect.Left() += 1; + aOuterCheckRect.Right() -= 1; + aOuterCheckRect.Top() += 1; + aOuterCheckRect.Bottom() -= 1; - Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); if( bTitle ) { // fill the background + Rectangle aRect( aTopLeft, Size( aOutSz.Width(), pEntry->maSize.Height() ) ); SetFillColor(rSettings.GetDialogColor()); SetLineColor(); DrawRect(aRect); @@ -1351,22 +1461,84 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) SetLineColor( rSettings.GetShadowColor() ); DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); } - else if( pEntry->mpControl ) + + // CheckMark + if ( pEntry->HasCheck() ) { - SetLineColor( rSettings.GetShadowColor() ); - DrawLine( aRect.BottomLeft(), aRect.BottomRight() ); - } + // draw selection transparent marker if checked + // onto that either a checkmark or the item image + // will be painted + // however do not do this if native checks will be painted since + // the selection color too often does not fit the theme's check and/or radio - long nTextOffsetY = ((pEntry->maSize.Height()-nFontHeight)/2); + if( !pEntry->mbHasImage ) + { + if( this->IsNativeControlSupported( CTRL_MENU_POPUP, + (pEntry->mnBits & MIB_RADIOCHECK) + ? PART_MENU_ITEM_CHECK_MARK + : PART_MENU_ITEM_RADIO_MARK ) ) + { + ControlPart nPart = ((pEntry->mnBits & MIB_RADIOCHECK) + ? PART_MENU_ITEM_RADIO_MARK + : PART_MENU_ITEM_CHECK_MARK); + + ControlState nState = 0; + + if ( pEntry->mbChecked ) + nState |= CTRL_STATE_PRESSED; - // Image + if ( pEntry->mbEnabled ) + nState |= CTRL_STATE_ENABLED; + + if ( bHighlighted ) + nState |= CTRL_STATE_SELECTED; + + long nCtrlHeight = (pEntry->mnBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight; + aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - nCtrlHeight)/2; + aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; + + Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); + DrawNativeControl( CTRL_MENU_POPUP, nPart, Region( aCheckRect ), nState, ImplControlValue(), OUString() ); + } + else if ( pEntry->mbChecked ) // by default do nothing for unchecked items + { + ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted ); + + SymbolType eSymbol; + Size aSymbolSize; + if ( pEntry->mnBits & MIB_RADIOCHECK ) + { + eSymbol = SYMBOL_RADIOCHECKMARK; + aSymbolSize = Size( nFontHeight/2, nFontHeight/2 ); + } + else + { + eSymbol = SYMBOL_CHECKMARK; + aSymbolSize = Size( (nFontHeight*25)/40, nFontHeight/2 ); + } + aTmpPos.X() = aOuterCheckRect.Left() + (aOuterCheckRect.GetWidth() - aSymbolSize.Width())/2; + aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2; + Rectangle aRect( aTmpPos, aSymbolSize ); + aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle ); + } + } + } + + // Image: if( pEntry->mbHasImage ) { - aTmpPos.X() = aPos.X() + mpImpl->mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); + // Don't render an image for a check thing + /* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/ + { + if( pEntry->mbChecked ) + ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted ); + aTmpPos = aOuterCheckRect.TopLeft(); + aTmpPos.X() += (aOuterCheckRect.GetWidth()-pEntry->maImage.GetSizePixel().Width())/2; + aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2; + DrawImage( aTmpPos, pEntry->maImage, nImageStyle ); + } } + // Text: if( pEntry->mbHasText ) { @@ -1375,53 +1547,66 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() += nTextOffsetY; USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC; - DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle ); + DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle, NULL, NULL ); // pVector, pDisplayText ); } - // CheckMark - if( pEntry->mbChecked ) +/* + // Accel + if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) { - if( pEntry->mbHasImage ) - { - aTmpPos.X() = aPos.X() + mpImpl->mnImagePos; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += (pEntry->maSize.Height()-pEntry->maImage.GetSizePixel().Height())/2; - - Rectangle aSelRect( aTmpPos, pEntry->maImage.GetSizePixel() ); - aSelRect.nLeft -= 1; - aSelRect.nTop -= 1; - aSelRect.nRight += 1; - aSelRect.nBottom += 1; - DrawSelectionBackground( aSelRect, false, true, TRUE, TRUE ); - } - else + XubString aAccText = pData->aAccelKey.GetName(); + aTmpPos.X() = aOutSz.Width() - this->GetTextWidth( aAccText ); + aTmpPos.X() -= 4*nExtra; + + aTmpPos.X() -= nOuterSpace; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nTextOffsetY; + this->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle ); + } +*/ + +/* + // SubMenu? + if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) + { + aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; + aTmpPos.Y() = aPos.Y(); + aTmpPos.Y() += nExtra/2; + aTmpPos.Y() += ( pEntry->maSize.Height() / 2 ) - ( nFontHeight/4 ); + if ( pEntry->mnBits & MIB_POPUPSELECT ) { - Rectangle aSelRect; - SymbolType eSymbol; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += pEntry->maSize.Height() / 2; - if ( pEntry->mnBits & MIB_RADIOCHECK ) - { - aTmpPos.X() = aPos.X() + mpImpl->mnCheckPos; - eSymbol = SYMBOL_RADIOCHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ); - } - else - { - aTmpPos.X() = aPos.X() + mpImpl->mnCheckPos; - eSymbol = SYMBOL_CHECKMARK; - aTmpPos.Y() -= nFontHeight/4; - aSelRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) ); - } - aDecoView.DrawSymbol( aSelRect, eSymbol, GetTextColor(), nSymbolStyle ); + this->SetTextColor( rSettings.GetMenuTextColor() ); + Point aTmpPos2( aPos ); + aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; + aDecoView.DrawFrame( + Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pEntry->maSize.Height() ) ), FRAME_DRAW_GROUP ); } + aDecoView.DrawSymbol( + Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), + SYMBOL_SPIN_RIGHT, this->GetTextColor(), nSymbolStyle ); +// if ( pEntry->mnBits & MIB_POPUPSELECT ) +// { +// aTmpPos.Y() += nFontHeight/2 ; +// this->SetLineColor( rSettings.GetShadowColor() ); +// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); +// this->SetLineColor( rSettings.GetLightColor() ); +// aTmpPos.Y()++; +// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); +// this->SetLineColor(); +// } } - } +*/ - aTopLeft.Y() += pEntry->maSize.Height(); + if ( pThisOnly && bHighlighted ) + { + // This restores the normal menu or menu bar text + // color for when it is no longer highlighted. + SetTextColor( rSettings.GetMenuTextColor() ); + } + } } + + aTopLeft.Y() += pEntry ? pEntry->maSize.Height() : SEPARATOR_HEIGHT; } } @@ -1429,6 +1614,8 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) void ToolbarMenu::Paint( const Rectangle& ) { + SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() ); + implPaint(); if( mpImpl->mnHighlightedEntry != -1 ) diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index 94215fc96681..1d9037b61dc5 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -61,8 +61,8 @@ typedef std::vector< ToolbarMenuEntry * > ToolbarMenuEntryVector; const int EXTRAITEMHEIGHT = 0; // 4; const int SEPARATOR_HEIGHT = 4; const int TITLE_ID = -1; -const int BORDER_X = 2; -const int BORDER_Y = 2; +const int BORDER_X = 0; +const int BORDER_Y = 0; // -------------------- // - ToolbarMenuEntry - @@ -79,7 +79,6 @@ public: bool mbHasText; bool mbHasImage; - bool mbHasControl; bool mbChecked; bool mbEnabled; @@ -104,6 +103,11 @@ public: sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + bool HasCheck() const + { + return mbChecked || ( mnBits & ( MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK ) ); + } }; // --------------- -- cgit From c08d3ab80afcf5e483ed3aa0b9255939e3013514 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Mar 2010 13:20:29 +0100 Subject: fixed unix compile warning --- svtools/source/control/toolbarmenu.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index bdd302f0839e..65bcaf63a912 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -1386,7 +1386,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) USHORT nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu long nFontHeight = GetTextHeight(); - long nExtra = nFontHeight/4; +// long nExtra = nFontHeight/4; long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0; ImplGetNativeCheckAndRadioSize( this, nCheckHeight, nRadioHeight, nMaxCheckWidth ); -- cgit From 2f528025b20854cf918d95f6781b5e2052ddf929 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 25 Mar 2010 17:19:23 +0100 Subject: cws l10ntooling18: #i109622# try to auto fix bad quote --- l10ntools/inc/export.hxx | 2 ++ l10ntools/source/export.cxx | 12 ++++++------ l10ntools/source/merge.cxx | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 13fad506b54d..d1474503882f 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -461,6 +461,8 @@ public: bTitleFirst[ nId ] = true; } BOOL GetText( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE ); + BOOL GetTransex3Text( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel = FALSE ); + }; // diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index a3df11c2920b..59f29525eda4 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -2096,7 +2096,7 @@ BOOL Export::PrepareTextToMerge( ByteString &rText, USHORT nTyp, } ByteString sContent; - pEntrys->GetText( sContent, nTyp, nLangIndex ); + pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex ); //if ( !sContent.Len() && ( ! nLangIndex.EqualsIgnoreCaseAscii("en-US") )) { if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) { rText = sOrigText; @@ -2158,7 +2158,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode ) sCur = aLanguages[ n ]; ByteString sText; - BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, sCur , TRUE ); + BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TEXT, sCur , TRUE ); if ( bText && sText.Len() && sText != "-" ) { ByteString sOutput; if ( bNextMustBeDefineEOL) { @@ -2211,7 +2211,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode ) sCur = aLanguages[ n ]; ByteString sText; - BOOL bText = pEntry->GetText( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE ); + BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_QUICKHELPTEXT, sCur, TRUE ); if ( bText && sText.Len() && sText != "-" ) { ByteString sOutput; if ( bNextMustBeDefineEOL) { @@ -2258,7 +2258,7 @@ void Export::MergeRest( ResData *pResData, USHORT nMode ) sCur = aLanguages[ n ]; ByteString sText; - BOOL bText = pEntry->GetText( sText, STRING_TYP_TITLE, sCur, TRUE ); + BOOL bText = pEntry->GetTransex3Text( sText, STRING_TYP_TITLE, sCur, TRUE ); if ( bText && sText.Len() && sText != "-" ) { ByteString sOutput; if ( bNextMustBeDefineEOL) { @@ -2343,9 +2343,9 @@ void Export::MergeRest( ResData *pResData, USHORT nMode ) //printf("Lang %s, List Index %d\n",sCur.GetBuffer(),(int)nLIndex); ByteString sText; BOOL bText; - bText = pEntrys->GetText( sText, STRING_TYP_TEXT, sCur, TRUE ); + bText = pEntrys->GetTransex3Text( sText, STRING_TYP_TEXT, sCur, TRUE ); if( !bText ) - bText = pEntrys->GetText( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE ); + bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , FALSE ); // Use fallback, if data is missing in sdf file //if( !bText && pResData->sResTyp.Equals( "pairedlist" ) ){ diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 3284b7026107..ace119da106c 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -50,6 +50,22 @@ ByteString PFormEntrys::Dump(){ return sRet; } +BOOL PFormEntrys::GetTransex3Text( ByteString &rReturn, + USHORT nTyp, const ByteString &nLangIndex, BOOL bDel ) +{ + BOOL rc = GetText( rReturn , nTyp , nLangIndex , bDel ); + ByteString test( rReturn ); + for( int idx = 0; idx < rReturn.Len(); idx++ ) + { + if( rReturn.GetChar( idx ) == '\"' && ( idx-1 > 0 ) && rReturn.GetChar( idx-1 ) == '\\' ) + { + rReturn.Erase( idx-1 , 1 ); + } + } + //if( !rReturn.Equals( test ) ) + // printf("*CHANGED******************\n%s\n%s\n",test.GetBuffer(),rReturn.GetBuffer()); + return rc; +} /*****************************************************************************/ BOOL PFormEntrys::GetText( ByteString &rReturn, USHORT nTyp, const ByteString &nLangIndex, BOOL bDel ) -- cgit From a687f59eac4ad98a4b60a4b3add78f33e4dd9166 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 25 Mar 2010 17:21:13 +0100 Subject: cws l10ntooling18: #i110394# Introduce the variable %OOOVENDOR --- unotools/inc/unotools/configmgr.hxx | 3 ++- unotools/source/config/configmgr.cxx | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx index 82af190aab4f..c26ff5245739 100644 --- a/unotools/inc/unotools/configmgr.hxx +++ b/unotools/inc/unotools/configmgr.hxx @@ -99,7 +99,8 @@ namespace utl PRODUCTXMLFILEFORMATVERSION, WRITERCOMPATIBILITYVERSIONOOO11, OPENSOURCECONTEXT, - ABOUTBOXPRODUCTVERSION + ABOUTBOXPRODUCTVERSION, + OOOVENDOR }; //direct readonly access to some special configuration elements static com::sun::star::uno::Any GetDirectConfigProperty(ConfigProperty eProp); diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index 5f16733b5249..0df6d49afe59 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -70,6 +70,8 @@ namespace : public rtl::Static< ::rtl::OUString, ProductVersion > {}; struct AboutBoxProductVersion : public rtl::Static< ::rtl::OUString, AboutBoxProductVersion > {}; + struct OOOVendor + : public rtl::Static< ::rtl::OUString, OOOVendor > {}; struct ProductExtension : public rtl::Static< ::rtl::OUString, ProductExtension > {}; struct XMLFileFormatName @@ -433,6 +435,14 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) return aRet; } + rtl::OUString &rOOOVendor = OOOVendor::get(); + if ( eProp == OOOVENDOR && rOOOVendor.getLength() ) + { + aRet <<= rOOOVendor; + return aRet; + } + + rtl::OUString &rProductExtension = ProductExtension::get(); if ( eProp == PRODUCTEXTENSION && rProductExtension.getLength() ) { @@ -493,6 +503,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) case PRODUCTXMLFILEFORMATNAME : case PRODUCTXMLFILEFORMATVERSION: case OPENSOURCECONTEXT: + case OOOVENDOR: case ABOUTBOXPRODUCTVERSION: sPath += C2U("Setup/Product"); break; case DEFAULTCURRENCY: sPath += C2U("Setup/L10N"); break; @@ -526,6 +537,7 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) case PRODUCTNAME: sProperty = C2U("ooName"); break; case PRODUCTVERSION: sProperty = C2U("ooSetupVersion"); break; case ABOUTBOXPRODUCTVERSION: sProperty = C2U("ooSetupVersionAboutBox"); break; + case OOOVENDOR: sProperty = C2U("ooVendor"); break; case PRODUCTEXTENSION: sProperty = C2U("ooSetupExtension"); break; case PRODUCTXMLFILEFORMATNAME: sProperty = C2U("ooXMLFileFormatName"); break; case PRODUCTXMLFILEFORMATVERSION: sProperty = C2U("ooXMLFileFormatVersion"); break; @@ -565,6 +577,9 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) if ( eProp == PRODUCTVERSION ) aRet >>= rProductVersion; + if( eProp == OOOVENDOR ) + aRet >>= rOOOVendor; + if ( eProp == ABOUTBOXPRODUCTVERSION ) { aRet >>= rAboutBoxProductVersion; -- cgit From aae2c038fad7eaeda79b1d77840cbbecb99f268b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 25 Mar 2010 18:16:13 +0100 Subject: vcl111: #i92094# use current event for GetPointerState --- vcl/aqua/source/window/salframe.cxx | 95 ++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 71c84ee0c2f1..413b5bcd5490 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1352,40 +1352,81 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect ) SalPointerState AquaSalFrame::GetPointerState() { SalPointerState state; + state.mnState = 0; // get position NSPoint aPt = [mpWindow mouseLocationOutsideOfEventStream]; CocoaToVCL( aPt, false ); state.maPos = Point(static_cast(aPt.x), static_cast(aPt.y)); - // FIXME: replace Carbon by Cocoa - // Cocoa does not have an equivalent for GetCurrentEventButtonState - // and GetCurrentEventKeyModifiers. - // we could try to get away with tracking all events for modifierKeys - // and all mouse events for button state in VCL_NSApllication::sendEvent, - // but it is unclear whether this will get us the same result. - // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now + NSEvent* pCur = [NSApp currentEvent]; + bool bMouseEvent = false; + if( pCur ) + { + bMouseEvent = true; + switch( [pCur type] ) + { + case NSLeftMouseDown: state.mnState |= MOUSE_LEFT; break; + case NSLeftMouseUp: break; + case NSRightMouseDown: state.mnState |= MOUSE_RIGHT; break; + case NSRightMouseUp: break; + case NSOtherMouseDown: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break; + case NSOtherMouseUp: break; + case NSMouseMoved: break; + case NSLeftMouseDragged: state.mnState |= MOUSE_LEFT; break; + case NSRightMouseDragged: state.mnState |= MOUSE_RIGHT; break; + case NSOtherMouseDragged: state.mnState |= ([pCur buttonNumber] == 2) ? MOUSE_MIDDLE : 0; break; + break; + default: + bMouseEvent = false; + break; + } + } + if( bMouseEvent ) + { + unsigned int nMask = (unsigned int)[pCur modifierFlags]; + if( (nMask & NSShiftKeyMask) != 0 ) + state.mnState |= KEY_SHIFT; + if( (nMask & NSControlKeyMask) != 0 ) + state.mnState |= KEY_MOD3; + if( (nMask & NSAlternateKeyMask) != 0 ) + state.mnState |= KEY_MOD2; + if( (nMask & NSCommandKeyMask) != 0 ) + state.mnState |= KEY_MOD1; + + } + else + { + // FIXME: replace Carbon by Cocoa + // Cocoa does not have an equivalent for GetCurrentEventButtonState + // and GetCurrentEventKeyModifiers. + // we could try to get away with tracking all events for modifierKeys + // and all mouse events for button state in VCL_NSApllication::sendEvent, + // but it is unclear whether this will get us the same result. + // leave in GetCurrentEventButtonState and GetCurrentEventKeyModifiers for now + + // fill in button state + UInt32 nState = GetCurrentEventButtonState(); + state.mnState = 0; + if( nState & 1 ) + state.mnState |= MOUSE_LEFT; // primary button + if( nState & 2 ) + state.mnState |= MOUSE_RIGHT; // secondary button + if( nState & 4 ) + state.mnState |= MOUSE_MIDDLE; // tertiary button + + // fill in modifier state + nState = GetCurrentEventKeyModifiers(); + if( nState & shiftKey ) + state.mnState |= KEY_SHIFT; + if( nState & controlKey ) + state.mnState |= KEY_MOD3; + if( nState & optionKey ) + state.mnState |= KEY_MOD2; + if( nState & cmdKey ) + state.mnState |= KEY_MOD1; + } - // fill in button state - UInt32 nState = GetCurrentEventButtonState(); - state.mnState = 0; - if( nState & 1 ) - state.mnState |= MOUSE_LEFT; // primary button - if( nState & 2 ) - state.mnState |= MOUSE_RIGHT; // secondary button - if( nState & 4 ) - state.mnState |= MOUSE_MIDDLE; // tertiary button - - // fill in modifier state - nState = GetCurrentEventKeyModifiers(); - if( nState & shiftKey ) - state.mnState |= KEY_SHIFT; - if( nState & controlKey ) - state.mnState |= KEY_MOD3; - if( nState & optionKey ) - state.mnState |= KEY_MOD2; - if( nState & cmdKey ) - state.mnState |= KEY_MOD1; return state; } -- cgit From 2b9102ab6fbbd9c681ff4db2b31076210d04ba55 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 26 Mar 2010 15:38:07 +0100 Subject: removed unused code --- svtools/source/control/toolbarmenu.cxx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 65bcaf63a912..5c93f730a02f 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -881,18 +881,6 @@ ToolbarMenuEntry* ToolbarMenu::implSearchEntry( int nEntryId ) const // -------------------------------------------------------------------- -static void implDeselectControl( Control* pControl ) -{ - ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); - if( pValueSet ) - { - pValueSet->SetNoSelection(); - pValueSet->Invalidate(); - } -} - -// -------------------------------------------------------------------- - void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { Size aSz( GetOutputSizePixel() ); -- cgit From de55cd16378a12c2360e3c600af84ffb9ffffe84 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 26 Mar 2010 17:45:16 +0100 Subject: gridcontrol_03:improvements --- svtools/inc/svtools/table/tablecontrol.hxx | 4 +- svtools/source/table/tablecontrol.cxx | 24 ++-------- svtools/source/table/tablecontrol_impl.cxx | 71 ++++++++++++++--------------- svtools/source/table/tablecontrol_impl.hxx | 42 +++++++++-------- svtools/source/uno/svtxgridcontrol.cxx | 11 +++-- svtools/source/uno/unocontroltablemodel.cxx | 12 ++--- 6 files changed, 75 insertions(+), 89 deletions(-) diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 3c91e31e1b00..839d4f73ebd6 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -71,8 +71,8 @@ namespace svt { namespace table DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); TableControl_Impl* m_pImpl; - ::com::sun::star::uno::Sequence< sal_Int32 >& m_nCols; - ::com::sun::star::uno::Sequence< ::rtl::OUString >& m_aText; + ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; Link m_aSelectHdl; bool m_bSelectionChanged; public: diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 3d8fedd2977e..01da79e2056e 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -68,8 +68,6 @@ namespace svt { namespace table TableControl::TableControl( Window* _pParent, WinBits _nStyle ) :Control( _pParent, _nStyle ) ,m_pImpl( new TableControl_Impl( *this ) ) - ,m_nCols(*( new ::com::sun::star::uno::Sequence< sal_Int32 >(0) )) - ,m_aText(*( new ::com::sun::star::uno::Sequence< ::rtl::OUString >(0) )) ,m_bSelectionChanged(false) { m_pImpl->getDataWindow()->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); @@ -339,11 +337,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any cellContent = ::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")); std::vector >& aTableContent = GetModel()->getCellContent(); if(&aTableContent) - { - std::vector< ::com::sun::star::uno::Any >& aRowContent = aTableContent[_nRowPos]; - if(&aRowContent) - cellContent = aRowContent[_nColPos]; - } + cellContent = aTableContent[_nRowPos][_nColPos]; return cellContent; } // ----------------------------------------------------------------------------- @@ -351,7 +345,7 @@ namespace svt { namespace table ::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) { ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); - return m_pImpl->impl_convertToString(cellContent); + return m_pImpl->convertToString(cellContent); } // ----------------------------------------------------------------------------- @@ -525,23 +519,13 @@ void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNew Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) { (void)_bOnScreen; - Rectangle aRectTable, aRectTableWithHeaders; - m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); - m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); - Size aSizeTable(aRectTable.GetSize()); - Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); - if(_bIsColumnBar) - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); - else - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); + return m_pImpl->calcHeaderRect(_bIsColumnBar); } // ----------------------------------------------------------------------------- Rectangle TableControl::calcTableRect(BOOL _bOnScreen) { (void)_bOnScreen; - Rectangle aRect; - m_pImpl->impl_getAllVisibleDataCellArea(aRect); - return aRect; + return m_pImpl->calcTableRect(); } //-------------------------------------------------------------------- ::com::sun::star::uno::Sequence< sal_Int32 >& TableControl::getColumnsForTooltip() diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index d145e61b9274..9ef171bf6c8c 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -234,7 +234,7 @@ namespace svt { namespace table } virtual std::vector >& getCellContent() { - return *( new std::vector >); + return m_aCellContent; } virtual void setRowHeaderName(const std::vector& ) { @@ -247,6 +247,7 @@ namespace svt { namespace table } private: std::vector aRowHeaderNames; + std::vector > m_aCellContent; }; @@ -1040,7 +1041,7 @@ namespace svt { namespace table } else { - ::rtl::OUString sContent = impl_convertToString(rCellData); + ::rtl::OUString sContent = convertToString(rCellData); pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, sContent ); } @@ -1806,28 +1807,19 @@ namespace svt { namespace table return m_pDataWindow; } //------------------------------------------------------------------------------- - BOOL TableControl_Impl::isRowSelected(::std::vector selectedRows, RowPos current) + BOOL TableControl_Impl::isRowSelected(const ::std::vector& selectedRows, RowPos current) { - for(::std::vector::iterator it=selectedRows.begin(); - it!=selectedRows.end();++it) - { - if(*it == current) - return TRUE; - } - return FALSE; + return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end(); } //------------------------------------------------------------------------------- - int TableControl_Impl::getRowSelectedNumber(::std::vector selectedRows, RowPos current) + int TableControl_Impl::getRowSelectedNumber(const ::std::vector& selectedRows, RowPos current) { - int pos = -1; - int i = 0; - for(std::vector::iterator it=selectedRows.begin();it!=selectedRows.end();++it) + std::vector::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current); + if ( it != selectedRows.end() ) { - if(*it == current) - return pos = i; - ++i; + return it - selectedRows.begin(); } - return pos; + return -1; } //------------------------------------------------------------------------------- void TableControl_Impl::setTooltip(const Point& rPoint ) @@ -1843,21 +1835,13 @@ namespace svt { namespace table if(i==0) { ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(content>>=xGraphic) - aTooltipText=::rtl::OUString::createFromAscii(""); - else - aTooltipText = impl_convertToString(content); + aTooltipText = convertToString(content); } else { aTooltipText+= ::rtl::OUString::createFromAscii("\n"); ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(content>>=xGraphic) - aTooltipText += ::rtl::OUString::createFromAscii(""); - else - aTooltipText += impl_convertToString(content); + aTooltipText += convertToString(content); } } } @@ -1887,11 +1871,7 @@ namespace svt { namespace table if(i==0) { ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(content>>=xGraphic) - aTooltipText = ::rtl::OUString::createFromAscii(""); - else - aTooltipText = text[i] + impl_convertToString(content); + aTooltipText = text[i] + convertToString(content); } else { @@ -1901,10 +1881,7 @@ namespace svt { namespace table { ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]]; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - if(content>>=xGraphic) - aTooltipText +=::rtl::OUString::createFromAscii(""); - else - aTooltipText += impl_convertToString(content); + aTooltipText += convertToString(content); } } } @@ -2073,7 +2050,7 @@ namespace svt { namespace table m_nLeftColumn--; } //-------------------------------------------------------------------- - rtl::OUString TableControl_Impl::impl_convertToString(::com::sun::star::uno::Any value) + rtl::OUString TableControl_Impl::convertToString(const ::com::sun::star::uno::Any& value) { sal_Int32 nInt = 0; sal_Bool bBool = false; @@ -2090,6 +2067,24 @@ namespace svt { namespace table sNewString = sConvertString.valueOf(fDouble); return sNewString; } + Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader) + { + Rectangle aRectTable, aRectTableWithHeaders; + impl_getAllVisibleDataCellArea(aRectTable); + impl_getAllVisibleCellsArea(aRectTableWithHeaders); + Size aSizeTable(aRectTable.GetSize()); + Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); + if(bColHeader) + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); + else + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); + } + Rectangle TableControl_Impl::calcTableRect() + { + Rectangle aRect; + impl_getAllVisibleDataCellArea(aRect); + return aRect; + } //-------------------------------------------------------------------- IMPL_LINK( TableControl_Impl, OnScroll, ScrollBar*, _pScrollbar ) { diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index bf22d8b3cd4e..61fcda7ceb71 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -189,9 +189,9 @@ namespace svt { namespace table void setCursorAtCurrentCell(const Point& rPoint); /** checks whether the vector with the selected rows contains the current row*/ - BOOL isRowSelected(::std::vector selectedRows, RowPos current); + BOOL isRowSelected(const ::std::vector& selectedRows, RowPos current); /** returns the position of the current row in the selection vector */ - int getRowSelectedNumber(::std::vector selectedRows, RowPos current); + int getRowSelectedNumber(const ::std::vector& selectedRows, RowPos current); /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect ); /** to be called when a new row is added to the control*/ @@ -213,25 +213,10 @@ namespace svt { namespace table virtual bool endResizeColumn(const Point& rPoint); TableDataWindow* getDataWindow(); - /** retrieves the area occupied by the totality of (at least partially) visible cells - The returned area includes row and column headers. Also, it takes into - account the the fact that there might be less columns than would normally - find room in the control. - - As a result of respecting the partial visibility of rows and columns, - the returned area might be larger than the data window's output size. - */ - void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const; - - /** retrieves the area occupied by all (at least partially) visible data cells. - - Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea, - minus the row and column header areas. - */ - void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; - - ::rtl::OUString impl_convertToString(::com::sun::star::uno::Any _value); + ::rtl::OUString convertToString(const ::com::sun::star::uno::Any& _value); + Rectangle calcHeaderRect(bool bColHeader); + Rectangle calcTableRect(); private: /** toggles the cursor visibility @@ -316,6 +301,23 @@ namespace svt { namespace table column range were reached. */ TableSize impl_ni_ScrollColumns( TableSize _nRowDelta ); + /** retrieves the area occupied by the totality of (at least partially) visible cells + + The returned area includes row and column headers. Also, it takes into + account the the fact that there might be less columns than would normally + find room in the control. + + As a result of respecting the partial visibility of rows and columns, + the returned area might be larger than the data window's output size. + */ + void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const; + + /** retrieves the area occupied by all (at least partially) visible data cells. + + Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea, + minus the row and column header areas. + */ + void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; void impl_ni_getAccVisibleColWidths(); void impl_updateLeftColumn(); diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index a9a61bbee1b1..5be2c71c9f52 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -372,7 +372,6 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru return Any ( m_xDataModel ); case BASEPROPERTY_GRID_COLUMNMODEL: return Any ( m_xColumnModel); - case BASEPROPERTY_TABSTOP: case BASEPROPERTY_HSCROLL: return Any ( m_bHScroll); case BASEPROPERTY_VSCROLL: @@ -463,6 +462,8 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri TableControl* pTable = (TableControl*)GetWindow(); if(Event.index == -1) { + if(!isSelectionEmpty()) + deselectAllRows(); if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().clear(); m_pTableModel->getCellContent().clear(); @@ -475,8 +476,12 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri } else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount()) { - pTable->RemoveSelectedRow(Event.index); - + if(isSelectedIndex(Event.index)) + { + Sequence selected(1); + selected[0]=Event.index; + deselectRows(selected); + } if(m_pTableModel->hasRowHeaders()) m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); std::vector >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index; diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 3dca0cbf4425..d239ee3c740d 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -169,7 +169,7 @@ using namespace ::com::sun::star::uno; //==================================================================== struct UnoControlTableModel_Impl { - ::std::vector< PColumnModel >& aColumns; + ::std::vector< PColumnModel > aColumns; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; @@ -180,8 +180,8 @@ using namespace ::com::sun::star::uno; TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; - std::vector& aRowHeadersTitle; - std::vector >& aCellContent; + std::vector aRowHeadersTitle; + std::vector > aCellContent; ::com::sun::star::util::Color m_xLineColor; ::com::sun::star::util::Color m_xHeaderColor; ::com::sun::star::util::Color m_xTextColor; @@ -190,7 +190,7 @@ using namespace ::com::sun::star::uno; ::com::sun::star::style::VerticalAlignment m_xVerticalAlign; UnoControlTableModel_Impl() - :aColumns ( *(new std::vector< PColumnModel> (0))) + :aColumns ( ) ,nRowCount ( 0 ) ,bHasColumnHeaders ( false ) ,bHasRowHeaders ( false ) @@ -201,8 +201,8 @@ using namespace ::com::sun::star::uno; ,nRowHeight ( 0 ) ,nColumnHeaderHeight( 0 ) ,nRowHeaderWidth ( 10 ) - ,aRowHeadersTitle ( *(new std::vector(0))) - ,aCellContent ( *(new std::vector >(0)) ) + ,aRowHeadersTitle ( ) + ,aCellContent ( ) ,m_xLineColor ( 0xFFFFFF ) ,m_xHeaderColor ( 0xFFFFFF ) ,m_xTextColor ( 0 )//black as default -- cgit From 878fb62d5ea81b56259d6cb6c51f7d08620425a4 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Sat, 27 Mar 2010 23:45:40 +0100 Subject: cloph14: #i110441# remove obsolete files no longer needed for Aqua version of OOo --- toolkit/src2xml/include.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst index a93449625585..2bf5fced6fd3 100644 --- a/toolkit/src2xml/include.lst +++ b/toolkit/src2xml/include.lst @@ -106,7 +106,6 @@ ../../basic/unxlngi6.pro/inc ../../boost/unxlngi6.pro/inc ../../XmlSearch/unxlngi6.pro/inc -../../fondu/unxlngi6.pro/inc ../../forms/inc ../../forms/source/inc ../../forms/source/solar/inc -- cgit From 919bcccd3267e1e6537d7ef93bf333d2fe934c4b Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 30 Mar 2010 10:07:55 +0200 Subject: fixed compile warnings --- svtools/inc/svtools/popupmenucontrollerbase.hxx | 2 +- svtools/source/control/toolbarmenu.cxx | 2 +- svtools/source/uno/popupmenucontrollerbase.cxx | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/svtools/inc/svtools/popupmenucontrollerbase.hxx b/svtools/inc/svtools/popupmenucontrollerbase.hxx index 706ce076be02..b062234a512e 100644 --- a/svtools/inc/svtools/popupmenucontrollerbase.hxx +++ b/svtools/inc/svtools/popupmenucontrollerbase.hxx @@ -58,7 +58,7 @@ namespace svt { struct PopupMenuControllerBaseDispatchInfo; - typedef public ::cppu::WeakComponentImplHelper7< + typedef ::cppu::WeakComponentImplHelper7< com::sun::star::lang::XServiceInfo , com::sun::star::frame::XPopupMenuController , com::sun::star::lang::XInitialization , diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 5c93f730a02f..bb332c77cc49 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -268,7 +268,7 @@ sal_Int32 ToolbarMenu_Impl::getAccessibleChildCount() throw (RuntimeException) for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) { ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; - if( pEntry ); + if( pEntry ) { if( pEntry->mpControl ) { diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 457207d317b4..ac75a1b9a24b 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -122,7 +122,6 @@ void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< co } void SAL_CALL PopupMenuControllerBase::disposing() -throw (::com::sun::star::uno::RuntimeException) { // Reset our members and set disposed flag osl::MutexGuard aLock( m_aMutex ); -- cgit From 75db234dfc435b25085dffe3cc2f398fd2660681 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 30 Mar 2010 13:46:11 +0200 Subject: slidecopy: A11Y for the ToolPanelDeck VCL control --- svtools/inc/svtools/accessiblefactory.hxx | 15 ++++ svtools/inc/svtools/toolpanel/decklayouter.hxx | 26 ++++++- svtools/inc/svtools/toolpanel/tablayouter.hxx | 7 ++ svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 19 +++++ svtools/source/misc/svtaccessiblefactory.cxx | 18 +++++ svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/paneldecklisteners.cxx | 15 +++- svtools/source/toolpanel/paneldecklisteners.hxx | 3 +- svtools/source/toolpanel/paneltabbar.cxx | 14 ++++ svtools/source/toolpanel/paneltabbar.hxx | 3 + svtools/source/toolpanel/tablayouter.cxx | 34 +++++++-- svtools/source/toolpanel/toolpaneldeck.cxx | 62 +++++++++++++++- svtools/source/toolpanel/toolpaneldeckpeer.cxx | 99 +++++++++++++++++++++++++ svtools/source/toolpanel/toolpaneldeckpeer.hxx | 69 +++++++++++++++++ svtools/workben/toolpanel/toolpaneltest.cxx | 7 ++ 15 files changed, 380 insertions(+), 12 deletions(-) mode change 100644 => 100755 svtools/inc/svtools/accessiblefactory.hxx mode change 100644 => 100755 svtools/inc/svtools/toolpanel/decklayouter.hxx mode change 100644 => 100755 svtools/inc/svtools/toolpanel/tablayouter.hxx mode change 100644 => 100755 svtools/inc/svtools/toolpanel/toolpaneldeck.hxx mode change 100644 => 100755 svtools/source/misc/svtaccessiblefactory.cxx mode change 100644 => 100755 svtools/source/toolpanel/makefile.mk mode change 100644 => 100755 svtools/source/toolpanel/paneldecklisteners.cxx mode change 100644 => 100755 svtools/source/toolpanel/paneldecklisteners.hxx mode change 100644 => 100755 svtools/source/toolpanel/paneltabbar.cxx mode change 100644 => 100755 svtools/source/toolpanel/paneltabbar.hxx mode change 100644 => 100755 svtools/source/toolpanel/tablayouter.cxx mode change 100644 => 100755 svtools/source/toolpanel/toolpaneldeck.cxx create mode 100755 svtools/source/toolpanel/toolpaneldeckpeer.cxx create mode 100755 svtools/source/toolpanel/toolpaneldeckpeer.hxx mode change 100644 => 100755 svtools/workben/toolpanel/toolpaneltest.cxx diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx old mode 100644 new mode 100755 index f4d8a03ef872..016d6a920fc6 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -64,6 +64,9 @@ namespace svt { //........................................................................ + class ToolPanelDeck; + class IToolPanelDeck; + /** a function which is able to create a factory for the standard Accessible/Context components needed for standard toolkit controls @@ -165,6 +168,18 @@ namespace svt sal_Int32 _nRowPos, sal_uInt16 _nColPos ) const = 0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ) = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + createAccessibleToolPanelDeckTabBarItem( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + const size_t i_nItemPos + ) = 0; }; //........................................................................ diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx old mode 100644 new mode 100755 index c284a34bcace..1542797a77b8 --- a/svtools/inc/svtools/toolpanel/decklayouter.hxx +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -27,9 +27,17 @@ #ifndef SVT_DECKLAYOUTER_HXX #define SVT_DECKLAYOUTER_HXX +#include + #include +#include + +namespace com { namespace sun { namespace star { namespace accessibility { + class XAccessible; +} } } } class Rectangle; +class Point; //........................................................................ namespace svt @@ -50,7 +58,7 @@ namespace svt @return the content area for a single tool panel */ - virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) = 0; + virtual ::Rectangle Layout( const ::Rectangle& i_rDeckPlayground ) = 0; /** destroys the instance @@ -66,6 +74,22 @@ namespace svt */ virtual void SetFocusToPanelSelector() = 0; + /** assuming that tools panels, no matter whether currently active or inactive, are visually represented + by some item, this method is to retrieve the position of an item for a given screen location. + */ + virtual ::boost::optional< size_t > + GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) = 0; + + /** assuming that tools panels, no matter whether currently active or inactive, are visually represented + by some item, this method is to retrieve the XAccessible implementation for such an item, given + by panel position. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetPanelItemAccessible( + const size_t i_nItemPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ) = 0; + virtual ~IDeckLayouter() { } diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx old mode 100644 new mode 100755 index 42e716dad53a..6df82bc713b4 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -83,6 +83,13 @@ namespace svt virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); virtual void SetFocusToPanelSelector(); + virtual ::boost::optional< size_t > + GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetPanelItemAccessible( + const size_t i_nItemPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); // IReference DECLARE_IREFERENCE() diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx old mode 100644 new mode 100755 index 97653eea0eb0..911857f46150 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -62,6 +62,13 @@ namespace svt */ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0; + /** called when a new layouter has been set at a tool panel deck. + + The method is called after the old layouter has been disposed (i.e. its Destroy method has been + invoked), and after the complete deck has been re-layouter. + */ + virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0; + /** called when the tool panel deck which the listener registered at is dying. The listener is required to release all references to the deck then. */ @@ -144,6 +151,13 @@ namespace svt */ Window& GetPanelWindowAnchor(); + /** sets the window which should act as parent in the A11Y object hierarchy. + + Calling this method has no effect if CreateAccessible had always been called. + */ + void SetAccessibleParentWindow( Window* i_pAccessibleParent ); + Window* GetAccessibleParentWindow() const; + // IToolPanelDeck virtual size_t GetPanelCount() const; virtual PToolPanel GetPanel( const size_t i_nPos ) const; @@ -161,8 +175,13 @@ namespace svt virtual long Notify( NotifyEvent& i_rNotifyEvent ); virtual void GetFocus(); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( BOOL i_bCreate ); + private: ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl; + + private: + using Window::GetAccessibleParentWindow; }; //........................................................................ diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx old mode 100644 new mode 100755 index a4b3cc1e8ecc..fc238348bd0b --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -212,6 +212,24 @@ namespace svt { return NULL; } + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/, + ::svt::ToolPanelDeck& /*i_rPanelDeck*/ + ) + { + return NULL; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + createAccessibleToolPanelDeckTabBarItem( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/, + ::svt::IToolPanelDeck& /*i_rPanelDeck*/, + const size_t /*i_nItemPos*/ + ) + { + return NULL; + } }; //---------------------------------------------------------------- diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk old mode 100644 new mode 100755 index 7e79ff4c00d7..5efaf6fe0af3 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -53,6 +53,7 @@ SLOFILES=\ $(SLO)$/toolpanel.obj \ $(SLO)$/toolpanelcollection.obj \ $(SLO)$/toolpaneldeck.obj \ + $(SLO)$/toolpaneldeckpeer.obj \ # --- Targets ------------------------------------------------------ diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx old mode 100644 new mode 100755 index 26a025f7181f..ddc6c9a7d29e --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -84,12 +84,25 @@ namespace svt } //-------------------------------------------------------------------- - void PanelDeckListeners::Dying() + void PanelDeckListeners::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) { for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); loop != m_aListeners.end(); ++loop ) + { + (*loop)->LayouterChanged( i_rNewLayouter ); + } + } + + //-------------------------------------------------------------------- + void PanelDeckListeners::Dying() + { + ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); + loop != aListeners.end(); + ++loop + ) { (*loop)->Dying(); } diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx old mode 100644 new mode 100755 index d3178d385e20..bc7e2ae7db88 --- a/svtools/source/toolpanel/paneldecklisteners.hxx +++ b/svtools/source/toolpanel/paneldecklisteners.hxx @@ -27,7 +27,7 @@ #ifndef PANELDECKLISTENERS_HXX #define PANELDECKLISTENERS_HXX -#include "svtools/toolpanel/toolpanel.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" #include #include @@ -54,6 +54,7 @@ namespace svt void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); void PanelRemoved( const size_t i_nPosition ); void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); void Dying(); // listener maintainance diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx old mode 100644 new mode 100755 index 11b53b0e0163..ceaa8ded4ce5 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -366,6 +366,7 @@ namespace svt } virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); virtual void Dying(); void UpdateScrollButtons() @@ -923,6 +924,13 @@ namespace svt InvalidateItem( *i_rNewActive ); } + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + //------------------------------------------------------------------------------------------------------------------ void PanelTabBar_Impl::Dying() { @@ -1244,6 +1252,12 @@ namespace svt } } + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > PanelTabBar::FindItemForPoint( const Point& i_rPoint ) const + { + return m_pImpl->FindItemForPoint( i_rPoint ); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx old mode 100644 new mode 100755 index ea2890e4cd36..90792bd1864f --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -58,6 +58,9 @@ namespace svt TabItemContent GetTabItemContent() const; void SetTabItemContent( const TabItemContent& i_eItemContent ); + // operations + ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; + // Window overridables virtual Size GetOptimalSize( WindowSizeType i_eType ) const; virtual void Paint( const Rectangle& i_rRect ); diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx old mode 100644 new mode 100755 index 523e2170eba2..186b64c001a7 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -29,6 +29,7 @@ #include "svtools/toolpanel/tablayouter.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "paneltabbar.hxx" +#include "svtaccessiblefactory.hxx" #include @@ -37,15 +38,18 @@ namespace svt { //........................................................................ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + //==================================================================== //= TabDeckLayouter_Data //==================================================================== struct TabDeckLayouter_Data { - TabAlignment eAlignment; - IToolPanelDeck& rPanels; - ::std::auto_ptr< PanelTabBar > - pTabBar; + TabAlignment eAlignment; + IToolPanelDeck& rPanels; + ::std::auto_ptr< PanelTabBar > pTabBar; + AccessibleFactoryAccess aAccessibleFactory; TabDeckLayouter_Data( Window& i_rParent, IToolPanelDeck& i_rPanels, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) @@ -187,14 +191,28 @@ namespace svt //-------------------------------------------------------------------- void TabDeckLayouter::SetFocusToPanelSelector() { - if ( !m_pData->pTabBar.get() ) - { - OSL_ENSURE( false, "TabDeckLayouter::SetFocusToPanelSelector: already disposed!" ); + if ( lcl_checkDisposed( * m_pData ) ) return; - } m_pData->pTabBar->GrabFocus(); } + //-------------------------------------------------------------------- + ::boost::optional< size_t > TabDeckLayouter::GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) + { + if ( lcl_checkDisposed( *m_pData ) ) + return ::boost::optional< size_t >(); + const Point aOutputPos( m_pData->pTabBar->ScreenToOutputPixel( i_rScreenPos ) ); + return m_pData->pTabBar->FindItemForPoint( aOutputPos ); + } + + //-------------------------------------------------------------------- + Reference< XAccessible > TabDeckLayouter::GetPanelItemAccessible( const size_t i_nItemPos, const Reference< XAccessible >& i_rParentAccessible ) + { + if ( lcl_checkDisposed( *m_pData ) ) + return NULL; + return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, m_pData->rPanels, i_nItemPos ); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx old mode 100644 new mode 100755 index 3b54a112c0da..c8d441ecdaf7 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -29,10 +29,15 @@ #include "dummypanel.hxx" #include "toolpanelcollection.hxx" #include "paneldecklisteners.hxx" - +#include "toolpaneldeckpeer.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + #include #include @@ -42,6 +47,14 @@ namespace svt { //........................................................................ + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::awt::XWindowPeer; + using ::com::sun::star::uno::UNO_SET_THROW; + /** === end UNO using === **/ + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + enum DeckAction { /// activates the first panel @@ -69,9 +82,11 @@ namespace svt ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() + ,m_pAccessibleParent( NULL ) { m_aPanels.AddListener( *this ); m_aPanelAnchor.Show(); + m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL ); } ~ToolPanelDeck_Impl() @@ -103,11 +118,15 @@ namespace svt void FocusActivePanel(); + void SetAccessibleParentWindow( Window* i_pAccessibleParent ); + Window* GetAccessibleParentWindow() const { return m_pAccessibleParent ? m_pAccessibleParent : m_rDeck.GetAccessibleParentWindow(); } + protected: // IToolPanelDeckListener virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); virtual void PanelRemoved( const size_t i_nPosition ); virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); virtual void Dying(); private: @@ -122,6 +141,8 @@ namespace svt PanelDeckListeners m_aListeners; PDeckLayouter m_pLayouter; + + Window* m_pAccessibleParent; }; //-------------------------------------------------------------------- @@ -144,6 +165,8 @@ namespace svt m_pLayouter = i_pNewLayouter; ImplDoLayout(); + + m_aListeners.LayouterChanged( m_pLayouter ); } //-------------------------------------------------------------------- @@ -301,6 +324,13 @@ namespace svt m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); } + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + //-------------------------------------------------------------------- void ToolPanelDeck_Impl::Dying() { @@ -308,6 +338,12 @@ namespace svt // are dying, and we already sent this notification in our dtor. } + //-------------------------------------------------------------------- + void ToolPanelDeck_Impl::SetAccessibleParentWindow( Window* i_pAccessibleParent ) + { + m_pAccessibleParent = i_pAccessibleParent; + } + //==================================================================== //= ToolPanelDeck //==================================================================== @@ -459,6 +495,30 @@ namespace svt m_pImpl->FocusActivePanel(); } + //-------------------------------------------------------------------- + void ToolPanelDeck::SetAccessibleParentWindow( Window* i_pAccessibleParent ) + { + m_pImpl->SetAccessibleParentWindow( i_pAccessibleParent ); + } + + //-------------------------------------------------------------------- + Window* ToolPanelDeck::GetAccessibleParentWindow() const + { + return m_pImpl->GetAccessibleParentWindow(); + } + + //-------------------------------------------------------------------- + Reference< XWindowPeer > ToolPanelDeck::GetComponentInterface( BOOL i_bCreate ) + { + Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) ); + if ( !xWindowPeer.is() && i_bCreate ) + { + xWindowPeer.set( new ToolPanelDeckPeer( *this ) ); + SetComponentInterface( xWindowPeer ); + } + return xWindowPeer; + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx new file mode 100755 index 000000000000..0a84a90b4fb3 --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx @@ -0,0 +1,99 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "toolpaneldeckpeer.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessibleContext; + using ::com::sun::star::lang::DisposedException; + /** === end UNO using === **/ + + //================================================================================================================== + //= ToolPanelDeckPeer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeckPeer::ToolPanelDeckPeer( ToolPanelDeck& i_rDeck ) + :VCLXWindow() + ,m_pDeck( &i_rDeck ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDeckPeer::~ToolPanelDeckPeer() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext() + { + ::vos::OGuard aSolarGuard( GetMutex() ); + if ( m_pDeck == NULL ) + throw DisposedException( ::rtl::OUString(), *this ); + + Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() ); + ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL ); + Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW ); + return m_aAccessibleFactory.getFactory().createAccessibleToolPanelDeck( xAccessibleParent, *m_pDeck ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException) + { + { + ::vos::OGuard aSolarGuard( GetMutex() ); + m_pDeck = NULL; + } + VCLXWindow::dispose(); + } + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx new file mode 100755 index 000000000000..4b6607ecbd05 --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_TOOLPANELDECKPEER_HXX +#define SVT_TOOLPANELDECKPEER_HXX + +#include "svtaccessiblefactory.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + class ToolPanelDeck; + //================================================================================================================== + //= ToolPanelDeckPeer + //================================================================================================================== + class ToolPanelDeckPeer : public VCLXWindow + { + public: + ToolPanelDeckPeer( ToolPanelDeck& i_rDeck ); + + protected: + ~ToolPanelDeckPeer(); + + // VCLXWindow overridables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); + + // XComponent + void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + + private: + AccessibleFactoryAccess m_aAccessibleFactory; + ToolPanelDeck* m_pDeck; + }; + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... + +#endif // SVT_TOOLPANELDECKPEER_HXX diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx old mode 100644 new mode 100755 index 8291d60a3b7b..b94ae616e233 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -280,6 +280,7 @@ public: virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); virtual void PanelRemoved( const size_t i_nPosition ); virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); virtual void Dying(); private: @@ -608,6 +609,12 @@ void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOl m_aPanelList.SelectEntryPos( USHORT( *i_rNewActive ) ); } +//----------------------------------------------------------------------------- +void OptionsWindow::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) +{ + // not interested in +} + //----------------------------------------------------------------------------- void OptionsWindow::Dying() { -- cgit From 0a4f1728933ff061497df6f0269d7128500cd816 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 30 Mar 2010 16:00:37 +0200 Subject: slidecopy: more A11Y implementations for the ToolPanelDeck --- svtools/inc/svtools/toolpanel/toolpanel.hxx | 13 +++++++++++++ svtools/source/toolpanel/dummypanel.cxx | 10 ++++++++++ svtools/source/toolpanel/dummypanel.hxx | 4 ++++ svtools/workben/toolpanel/toolpaneltest.cxx | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index 9d7202c31f98..d4d009b5c169 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -37,6 +37,9 @@ class Rectangle; class Window; +namespace com { namespace sun { namespace star { namespace accessibility { + class XAccessible; +} } } } //........................................................................ namespace svt @@ -95,6 +98,16 @@ namespace svt */ virtual void Dispose() = 0; + /** creates an XAccessible for the tool panel + + Implementations are allowed to create a new instance each time this method is called, the caller + is responsible for caching the XAccessible implementation, if this is desired. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ) = 0; + virtual ~IToolPanel() { } diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index d92444369c04..dae50723d4f1 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -33,6 +33,9 @@ namespace svt { //........................................................................ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + //==================================================================== //= DummyPanel //==================================================================== @@ -86,6 +89,13 @@ namespace svt { } + //-------------------------------------------------------------------- + Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + (void)i_rParentAccessible; + return NULL; + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index bcaf564cb021..b37e5cca19af 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -54,6 +54,10 @@ namespace svt virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); DECLARE_IREFERENCE() }; diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index b94ae616e233..f001cb4d08e3 100755 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -56,6 +56,7 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::uno::XComponentContext; +using ::com::sun::star::accessibility::XAccessible; //============================================================================= //= PanelDemo @@ -149,6 +150,7 @@ public: virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual Reference< XAccessible > CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ); // IReference virtual oslInterlockedCount SAL_CALL acquire(); @@ -248,6 +250,13 @@ void ColoredPanel::Dispose() m_pWindow.reset(); } +//----------------------------------------------------------------------------- +Reference< XAccessible > ColoredPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) +{ + ENSURE_OR_RETURN( m_pWindow.get(), "disposed!", NULL ); + return m_pWindow->GetAccessible(); +} + //----------------------------------------------------------------------------- ::rtl::OUString ColoredPanel::GetDisplayName() const { -- cgit From 07f5876bd07cc60e5c1bf153e5d8617c74306b29 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 30 Mar 2010 16:47:18 +0200 Subject: tl78: #i110383# support password to modify --- comphelper/inc/comphelper/docpasswordhelper.hxx | 42 +++++++++++++++ comphelper/inc/comphelper/docpasswordrequest.hxx | 13 +++-- comphelper/source/misc/docpasswordhelper.cxx | 39 ++++++++++++++ comphelper/source/misc/docpasswordrequest.cxx | 65 ++++++++++++++++-------- 4 files changed, 135 insertions(+), 24 deletions(-) diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx index 0a60c4b53ce9..fd04a82ec563 100644 --- a/comphelper/inc/comphelper/docpasswordhelper.hxx +++ b/comphelper/inc/comphelper/docpasswordhelper.hxx @@ -84,6 +84,48 @@ class COMPHELPER_DLLPUBLIC DocPasswordHelper public: // ------------------------------------------------------------------------ + /** This helper function generates the hash code based on the algorithm + specified by MS for "Password to modify" and passwords related to + table protection. + + @param aString + The string for which the hash should be calculated + + @param nEnc + The encoding that should be used to generate the 8-bit string + before the hash is generated + + @return + The hash represented by sal_uInt16 + */ + + static sal_uInt16 GetXLHashAsUINT16( + const ::rtl::OUString& aString, + rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 ); + + // ------------------------------------------------------------------------ + + /** This helper function generates the hash code based on the algorithm + specified by MS for "Password to modify" and passwords related to + table protection. + + @param aString + The string for which the hash should be calculated + + @param nEnc + The encoding that should be used to generate the 8-bit string + before the hash is generated + + @return + The hash represented by sequence of bytes in BigEndian form + */ + + static ::com::sun::star::uno::Sequence< sal_Int8 > GetXLHashAsSequence( + const ::rtl::OUString& aString, + rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 ); + + // ------------------------------------------------------------------------ + /** This helper function tries to request and verify a password to load a protected document. diff --git a/comphelper/inc/comphelper/docpasswordrequest.hxx b/comphelper/inc/comphelper/docpasswordrequest.hxx index 7b186b3a261a..6c369b41cf71 100644 --- a/comphelper/inc/comphelper/docpasswordrequest.hxx +++ b/comphelper/inc/comphelper/docpasswordrequest.hxx @@ -58,13 +58,18 @@ public: explicit DocPasswordRequest( DocPasswordRequestType eType, ::com::sun::star::task::PasswordRequestMode eMode, - const ::rtl::OUString& rDocumentName ); + const ::rtl::OUString& rDocumentName, + sal_Bool bPasswordToModify = sal_False ); virtual ~DocPasswordRequest(); - bool isAbort() const; - bool isPassword() const; + sal_Bool isAbort() const; + sal_Bool isPassword() const; + ::rtl::OUString getPassword() const; + ::rtl::OUString getPasswordToModify() const; + sal_Bool getRecommendReadOnly() const; + private: virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException ); @@ -78,6 +83,8 @@ private: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations; AbortContinuation* mpAbort; PasswordContinuation* mpPassword; + + sal_Bool mbPasswordToModify; }; // ============================================================================ diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index ea25cb795a53..5a5d2110deff 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -33,6 +33,7 @@ #include "comphelper/mediadescriptor.hxx" using ::rtl::OUString; +using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_SET_THROW; @@ -50,6 +51,44 @@ IDocPasswordVerifier::~IDocPasswordVerifier() { } +// ============================================================================ +sal_uInt16 DocPasswordHelper::GetXLHashAsUINT16( + const ::rtl::OUString& aUString, + rtl_TextEncoding nEnc ) +{ + sal_uInt16 nResult = 0; + + ::rtl::OString aString = ::rtl::OUStringToOString( aUString, nEnc ); + + if ( aString.getLength() && aString.getLength() <= SAL_MAX_UINT16 ) + { + for ( sal_Int32 nInd = aString.getLength() - 1; nInd >= 0; nInd-- ) + { + nResult = ( ( nResult >> 14 ) & 0x01 ) | ( ( nResult << 1 ) & 0x7FFF ); + nResult ^= aString.getStr()[nInd]; + } + + nResult = ( ( nResult >> 14 ) & 0x01 ) | ( ( nResult << 1 ) & 0x7FFF ); + nResult ^= ( 0x8000 | ( 'N' << 8 ) | 'K' ); + nResult ^= aString.getLength(); + } + + return nResult; +} + +// ============================================================================ +Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( + const ::rtl::OUString& aUString, + rtl_TextEncoding nEnc ) +{ + sal_uInt16 nHash = GetXLHashAsUINT16( aUString, nEnc ); + Sequence< sal_Int8 > aResult( 2 ); + aResult[0] = ( nHash >> 8 ); + aResult[1] = ( nHash & 0xFF ); + + return aResult; +} + // ============================================================================ /*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword( diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 9377d6c7c473..beed6d7342b3 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -29,10 +29,10 @@ #include "precompiled_comphelper.hxx" #include "comphelper/docpasswordrequest.hxx" -#include -#include +#include +#include #include -#include +#include using ::rtl::OUString; using ::com::sun::star::uno::Any; @@ -41,12 +41,12 @@ using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::XInterface; using ::com::sun::star::task::InteractionClassification_QUERY; -using ::com::sun::star::task::DocumentMSPasswordRequest; -using ::com::sun::star::task::DocumentPasswordRequest; +using ::com::sun::star::task::DocumentMSPasswordRequest2; +using ::com::sun::star::task::DocumentPasswordRequest2; using ::com::sun::star::task::PasswordRequestMode; using ::com::sun::star::task::XInteractionAbort; using ::com::sun::star::task::XInteractionContinuation; -using ::com::sun::star::task::XInteractionPassword; +using ::com::sun::star::task::XInteractionPassword2; namespace comphelper { @@ -57,52 +57,65 @@ class AbortContinuation : public ::cppu::WeakImplHelper1< XInteractionAbort > public: inline explicit AbortContinuation() : mbSelected( false ) {} - inline bool isSelected() const { return mbSelected; } + inline sal_Bool isSelected() const { return mbSelected; } inline void reset() { mbSelected = false; } virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; } private: - bool mbSelected; + sal_Bool mbSelected; }; // ============================================================================ -class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword > +class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword2 > { public: - inline explicit PasswordContinuation() : mbSelected( false ) {} + inline explicit PasswordContinuation() : mbSelected( sal_False ), mbReadOnly( sal_False ) {} - inline bool isSelected() const { return mbSelected; } - inline void reset() { mbSelected = false; } + inline sal_Bool isSelected() const { return mbSelected; } + inline void reset() { mbSelected = sal_False; } + + virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = sal_True; } - virtual void SAL_CALL select() throw( RuntimeException ) { mbSelected = true; } virtual void SAL_CALL setPassword( const OUString& rPass ) throw( RuntimeException ) { maPassword = rPass; } virtual OUString SAL_CALL getPassword() throw( RuntimeException ) { return maPassword; } + virtual void SAL_CALL setPasswordToModify( const OUString& rPass ) throw( RuntimeException ) { maModifyPassword = rPass; } + virtual OUString SAL_CALL getPasswordToModify() throw( RuntimeException ) { return maModifyPassword; } + + virtual void SAL_CALL setRecommendReadOnly( const sal_Bool bReadOnly ) throw( RuntimeException ) { mbReadOnly = bReadOnly; } + virtual sal_Bool SAL_CALL getRecommendReadOnly() throw( RuntimeException ) { return mbReadOnly; } + private: OUString maPassword; - bool mbSelected; + OUString maModifyPassword; + sal_Bool mbReadOnly; + + sal_Bool mbSelected; }; // ============================================================================ DocPasswordRequest::DocPasswordRequest( DocPasswordRequestType eType, - PasswordRequestMode eMode, const OUString& rDocumentName ) + PasswordRequestMode eMode, const OUString& rDocumentName, sal_Bool bPasswordToModify ) +: mpAbort( NULL ) +, mpPassword( NULL ) +, mbPasswordToModify( bPasswordToModify ) { switch( eType ) { case DocPasswordRequestType_STANDARD: { - DocumentPasswordRequest aRequest( OUString(), Reference< XInterface >(), - InteractionClassification_QUERY, eMode, rDocumentName ); + DocumentPasswordRequest2 aRequest( OUString(), Reference< XInterface >(), + InteractionClassification_QUERY, eMode, rDocumentName, bPasswordToModify ); maRequest <<= aRequest; } break; case DocPasswordRequestType_MS: { - DocumentMSPasswordRequest aRequest( OUString(), Reference< XInterface >(), - InteractionClassification_QUERY, eMode, rDocumentName ); + DocumentMSPasswordRequest2 aRequest( OUString(), Reference< XInterface >(), + InteractionClassification_QUERY, eMode, rDocumentName, bPasswordToModify ); maRequest <<= aRequest; } break; @@ -119,12 +132,12 @@ DocPasswordRequest::~DocPasswordRequest() { } -bool DocPasswordRequest::isAbort() const +sal_Bool DocPasswordRequest::isAbort() const { return mpAbort->isSelected(); } -bool DocPasswordRequest::isPassword() const +sal_Bool DocPasswordRequest::isPassword() const { return mpPassword->isSelected(); } @@ -134,6 +147,16 @@ OUString DocPasswordRequest::getPassword() const return mpPassword->getPassword(); } +OUString DocPasswordRequest::getPasswordToModify() const +{ + return mpPassword->getPasswordToModify(); +} + +sal_Bool DocPasswordRequest::getRecommendReadOnly() const +{ + return mpPassword->getRecommendReadOnly(); +} + Any SAL_CALL DocPasswordRequest::getRequest() throw( RuntimeException ) { return maRequest; -- cgit From f2e6d4df9dd4d269b1da1eff8277278d9360f1a7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 31 Mar 2010 08:37:22 +0200 Subject: slidecopy: #i10000# --- svtools/workben/toolpanel/toolpaneltest.cxx | 1 + ucbhelper/prj/build.lst | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index b94ae616e233..d142d71e8ad3 100755 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -612,6 +612,7 @@ void OptionsWindow::ActivePanelChanged( const ::boost::optional< size_t >& i_rOl //----------------------------------------------------------------------------- void OptionsWindow::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) { + (void)i_rNewLayouter; // not interested in } diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst index 8383eb4a8d5d..bbd01df9022a 100644 --- a/ucbhelper/prj/build.lst +++ b/ucbhelper/prj/build.lst @@ -4,4 +4,4 @@ uh ucbhelper\inc nmake - all uh_inc NULL uh ucbhelper\source\client nmake - all uh_client uh_inc NULL uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL -uh ucbhelper\workben\myucp nmake - all uh_wb_myucp NULL +uh ucbhelper\workben\myucp nmake - all uh_wb_myucp uh_util NULL -- cgit From 903bfc6a7230cf30262c52c6cf6b649dbac8f996 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 31 Mar 2010 14:10:23 +0200 Subject: vcl111: #102694# more hacking for metacity and tool windows --- vcl/unx/gtk/window/gtkframe.cxx | 31 +++++++++++++++++-------------- vcl/unx/inc/plugins/gtk/gtkframe.hxx | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index ba42cfc5ae82..bc4bc420a2eb 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon() m_nExtStyle = 0; m_pRegion = NULL; m_ePointerStyle = 0xffff; + m_bSetFocusOnMap = false; gtk_widget_set_app_paintable( m_pWindow, TRUE ); gtk_widget_set_double_buffered( m_pWindow, FALSE ); @@ -803,11 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); - /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME - at some point that may be fixed in metacity and we will have to revisit this - */ - bool bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && - (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); if( bDecoHandling ) { bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) ); @@ -823,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) { eType = GDK_WINDOW_TYPE_HINT_UTILITY; gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true ); - if( bMetaCityToolWindowHack ) - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); } else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) { @@ -874,7 +868,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -1357,9 +1351,9 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // // i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused. // awesome. + bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity"); if( nUserTime == 0 && - ( - getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") || + ( bMetaCity || ( getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") && (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) @@ -1371,9 +1365,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) nUserTime= getDisplay()->GetLastUserEventTime( true ); //nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window); } - lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime ); + if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) + m_bSetFocusOnMap = true; + gtk_widget_show( m_pWindow ); if( isFloatGrabWindow() ) @@ -2834,6 +2830,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); + bool bSetFocus = pThis->m_bSetFocusOnMap; + pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) { /* #i76541# testtool needs the focus to be in a new document @@ -2843,9 +2841,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) * so this is done when running in testtool only */ if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 ) - XSetInputFocus( pThis->getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), - RevertToParent, CurrentTime ); + bSetFocus = true; + } + + if( bSetFocus ) + { + XSetInputFocus( pThis->getDisplay()->GetDisplay(), + GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), + RevertToParent, CurrentTime ); } pThis->CallCallback( SALEVENT_RESIZE, NULL ); diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 0a91d99fd839..88a26b401eed 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -185,6 +185,7 @@ class GtkSalFrame : public SalFrame bool m_bDefaultSize; bool m_bSendModChangeOnRelease; bool m_bWindowIsGtkPlug; + bool m_bSetFocusOnMap; String m_aTitle; IMHandler* m_pIMHandler; -- cgit From 5caa5f2bed0f65401ae3a7e7f4ff7cf906b77db2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 31 Mar 2010 14:27:05 +0200 Subject: slidecopy: Dying: care for multiple listeners being removed during calling into one listener's Dying --- svtools/source/toolpanel/paneldecklisteners.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx index ddc6c9a7d29e..dd7abfc30f90 100755 --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -98,13 +98,11 @@ namespace svt //-------------------------------------------------------------------- void PanelDeckListeners::Dying() { - ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) + while ( !m_aListeners.empty() ) { - (*loop)->Dying(); + IToolPanelDeckListener* pListener( *m_aListeners.begin() ); + m_aListeners.erase( m_aListeners.begin() ); + pListener->Dying(); } } -- cgit From 4f7764d914a321127b8cadbda5b72ab700e62a46 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 12 Apr 2010 16:57:25 +0200 Subject: #i110387# avoid libc localization for strings in font subset --- vcl/source/fontsubset/cff.cxx | 56 ++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 9884e7016fee..a901a4744fda 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -2027,6 +2027,15 @@ void Type1Emitter::emitAllCrypted( void) // -------------------------------------------------------------------- +// #i110387# double->ascii conversion +// sprintf/ecvt/etc. cannot be used here because of LC_NUMERIC +// also strip off trailing zeros while we are at it +int dbl2str( char* pOut, double fVal, int /*nPrecision*/=6) +{ + int nLen = sprintf( pOut, "%g", fVal); + return nLen; +} + void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, const ValVector& rVector) { @@ -2042,10 +2051,11 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, aVal = *it; if( ++it == rVector.end() ) break; - mpPtr += sprintf( mpPtr, "%g ", aVal); + mpPtr += dbl2str( mpPtr, aVal); + *(mpPtr++) = ' '; } // emit the last value - mpPtr += sprintf( mpPtr, "%g", aVal); + mpPtr += dbl2str( mpPtr, aVal); // emit the line tail mpPtr += sprintf( mpPtr, pLineTail); } @@ -2202,18 +2212,33 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, rEmitter.emitValVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues); rEmitter.emitValVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues); - if( mpCffLocal->mfBlueScale) - pOut += sprintf( pOut, "/BlueScale %.6f def\n", mpCffLocal->mfBlueScale); - if( mpCffLocal->mfBlueShift) // default BlueShift==7 - pOut += sprintf( pOut, "/BlueShift %.1f def\n", mpCffLocal->mfBlueShift); - if( mpCffLocal->mfBlueFuzz) // default BlueFuzz==1 - pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz); + if( mpCffLocal->mfBlueScale) { + pOut += sprintf( pOut, "/BlueScale "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueScale, 6); + pOut += sprintf( pOut, " def\n"); + } + if( mpCffLocal->mfBlueShift) { // default BlueShift==7 + pOut += sprintf( pOut, "/BlueShift "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueShift); + pOut += sprintf( pOut, " def\n"); + } + if( mpCffLocal->mfBlueFuzz) { // default BlueFuzz==1 + pOut += sprintf( pOut, "/BlueFuzz "); + pOut += dbl2str( pOut, mpCffLocal->mfBlueFuzz); + pOut += sprintf( pOut, " def\n"); + } // emit stem hint related privdict entries - if( mpCffLocal->maStemStdHW) - pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW); - if( mpCffLocal->maStemStdVW) - pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW); + if( mpCffLocal->maStemStdHW) { + pOut += sprintf( pOut, "/StdHW ["); + pOut += dbl2str( pOut, mpCffLocal->maStemStdHW); + pOut += sprintf( pOut, "] def\n"); + } + if( mpCffLocal->maStemStdVW) { + pOut += sprintf( pOut, "/StdVW ["); + pOut += dbl2str( pOut, mpCffLocal->maStemStdVW); + pOut += sprintf( pOut, "] def\n"); + } rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); @@ -2224,8 +2249,11 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/LanguageGroup %d def\n", mpCffLocal->mnLangGroup); if( mpCffLocal->mnLangGroup == 1) // compatibility with ancient printers pOut += sprintf( pOut, "/RndStemUp false def\n"); - if( mpCffLocal->mfExpFactor) - pOut += sprintf( pOut, "/ExpansionFactor %.2f def\n", mpCffLocal->mfExpFactor); + if( mpCffLocal->mfExpFactor) { + pOut += sprintf( pOut, "/ExpansionFactor "); + pOut += dbl2str( pOut, mpCffLocal->mfExpFactor); + pOut += sprintf( pOut, " def\n"); + } #endif // IGNORE_HINTS // emit remaining privdict entries -- cgit From 38f4d323100037df1c2cb89087781a7677d44278 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 12 Apr 2010 17:02:34 +0200 Subject: #i110387# replace dummy implementation of cff dbl2str --- vcl/source/fontsubset/cff.cxx | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index a901a4744fda..9d329755baeb 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -2027,15 +2027,36 @@ void Type1Emitter::emitAllCrypted( void) // -------------------------------------------------------------------- -// #i110387# double->ascii conversion -// sprintf/ecvt/etc. cannot be used here because of LC_NUMERIC -// also strip off trailing zeros while we are at it -int dbl2str( char* pOut, double fVal, int /*nPrecision*/=6) +// #i110387# quick-and-dirty double->ascii conversion +// needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC) +// also strip off trailing zeros in fraction while we are at it +int dbl2str( char* pOut, double fVal, int nPrecision=6) { - int nLen = sprintf( pOut, "%g", fVal); + char* pBuf = pOut; + // TODO: avoid LC_NUMERIC based API + pOut += sprintf( pOut, "%.*g", nPrecision, fVal); + // ignore the number sign if any + char* p = pBuf; + if( (*p == '-') || (*p == '+')) + ++p; + for(; p < pOut; ++p) { + if( (*p >= '0') || (*p <= '9')) + continue; + // fixup fractional char + *(p++) = '.'; + break; + } + // ignore trailing zeros in fractional part + for( char* pEnd = pOut; p < pEnd; ++p) + if( *p != '0') + pOut = p; + // calculate the length of the number string + const int nLen = pOut - pBuf; return nLen; } +// -------------------------------------------------------------------- + void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail, const ValVector& rVector) { @@ -2276,6 +2297,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // emit used GlobalSubr charstrings // these are the just the default subrs + // TODO: do we need them as the flex hints are resolved differently? static const char aSubrs[] = "/Subrs 5 array\n" "dup 0 15 RD \x5F\x3D\x6B\xAC\x3C\xBD\x74\x3D\x3E\x17\xA0\x86\x58\x08\x85 NP\n" -- cgit From dbe5e2a03511da7dcd3399fe31c40d6ac5e96326 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 12 Apr 2010 17:16:41 +0200 Subject: #i110387# use strhelper\'s implementation for dbl2str --- vcl/source/fontsubset/cff.cxx | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 9d329755baeb..620ca64f44d9 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -33,6 +33,7 @@ #include #include +#include //#define IGNORE_HINTS @@ -2030,28 +2031,9 @@ void Type1Emitter::emitAllCrypted( void) // #i110387# quick-and-dirty double->ascii conversion // needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC) // also strip off trailing zeros in fraction while we are at it -int dbl2str( char* pOut, double fVal, int nPrecision=6) +inline int dbl2str( char* pOut, double fVal, int nPrecision=6) { - char* pBuf = pOut; - // TODO: avoid LC_NUMERIC based API - pOut += sprintf( pOut, "%.*g", nPrecision, fVal); - // ignore the number sign if any - char* p = pBuf; - if( (*p == '-') || (*p == '+')) - ++p; - for(; p < pOut; ++p) { - if( (*p >= '0') || (*p <= '9')) - continue; - // fixup fractional char - *(p++) = '.'; - break; - } - // ignore trailing zeros in fractional part - for( char* pEnd = pOut; p < pEnd; ++p) - if( *p != '0') - pOut = p; - // calculate the length of the number string - const int nLen = pOut - pBuf; + const int nLen = psp::getValueOfDouble( pOut, fVal, nPrecision); return nLen; } -- cgit From 84fc07bae918a72c15e3f39623c4564b790406bf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 12 Apr 2010 19:59:19 +0200 Subject: fwk140: #i110769# fix highlight issue with new flat buttons --- vcl/source/control/button.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 1f45b5902381..08a479c942b9 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1879,7 +1879,8 @@ long PushButton::PreNotify( NotifyEvent& rNEvt ) pBorder->Update(); } } - else if( IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) + else if( (GetStyle() & WB_FLATBUTTON) || + IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) ) { Invalidate(); } -- cgit From 5a09287c346a556f153b837beb93083d8808ec00 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Wed, 31 Mar 2010 15:08:00 +0200 Subject: OOO321l10n: #i110522# added qcv-ES for Catalan Valencian l10n --- i18npool/source/isolang/isolang.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 28c86d39673e..7c2d83c83a2b 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -287,7 +287,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_BELARUSIAN, "be", "BY" }, { LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default) { LANGUAGE_CATALAN, "ca", "AD" }, // Andorra - { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content! + { LANGUAGE_USER_CATALAN_VALENCIAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; for UI localization, use in document content on own risk! + { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; old workaround for UI localization only, do not use in document content! Kept just in case.. { LANGUAGE_FRENCH_CAMEROON, "fr", "CM" }, { LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" }, { LANGUAGE_FRENCH_HAITI, "fr", "HT" }, -- cgit From 076719b3429407d362f84d4939e67867cb502053 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 09:26:27 +0200 Subject: slidecopy: #i10000# (unxlngi6) --- svtools/workben/toolpanel/toolpaneltest.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 97a4e241575b..148df941a254 100755 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -254,6 +254,7 @@ void ColoredPanel::Dispose() Reference< XAccessible > ColoredPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) { ENSURE_OR_RETURN( m_pWindow.get(), "disposed!", NULL ); + (void)i_rParentAccessible; return m_pWindow->GetAccessible(); } -- cgit From a42067c4fd10629bd6b1f3a301b1e8eab5542584 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:50:14 +0200 Subject: slidecopy: initial version of the A11Y API for the tool panel deck's tab layouter. Effectively, the implementation showed that the current appraoch of the Deck having n+1 children (n panel selector items, plus one active panel) doesn't work. So, a next step will be a re-factoring so that the PanelDeck has 1+x children, where x children are provided by the layouter. --- svtools/inc/svtools/accessiblefactory.hxx | 4 +-- svtools/inc/svtools/toolpanel/tablayouter.hxx | 9 +++++ svtools/source/misc/svtaccessiblefactory.cxx | 2 +- svtools/source/toolpanel/paneltabbar.cxx | 45 ++++++++++++++++++++++++ svtools/source/toolpanel/paneltabbar.hxx | 3 ++ svtools/source/toolpanel/tablayouter.cxx | 50 ++++++++++++++++++++++++++- 6 files changed, 109 insertions(+), 4 deletions(-) diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index 016d6a920fc6..ab5eb595f76f 100755 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -65,7 +65,7 @@ namespace svt //........................................................................ class ToolPanelDeck; - class IToolPanelDeck; + class TabDeckLayouter; /** a function which is able to create a factory for the standard Accessible/Context components needed for standard toolkit controls @@ -177,7 +177,7 @@ namespace svt virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleToolPanelDeckTabBarItem( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, + const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, const size_t i_nItemPos ) = 0; }; diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 6df82bc713b4..9d4b56db649c 100755 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -79,6 +79,15 @@ namespace svt void SetTabItemContent( const TabItemContent& i_eItemContent ); TabAlignment GetTabAlignment() const; + // helpers for the A11Y implementation + IToolPanelDeck& GetPanelDeck() const; + ::boost::optional< size_t > + GetFocusedPanelItem() const; + void FocusPanelItem( const size_t i_nItemPos ); + bool IsPanelSelectorEnabled() const; + bool IsPanelSelectorVisible() const; + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; + // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index fc238348bd0b..8a45ee2e0b74 100755 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -224,7 +224,7 @@ namespace svt virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleToolPanelDeckTabBarItem( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/, - ::svt::IToolPanelDeck& /*i_rPanelDeck*/, + const ::rtl::Reference< ::svt::TabDeckLayouter >& /*i_pLayouter*/, const size_t /*i_nItemPos*/ ) { diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index ceaa8ded4ce5..f9a40004cb61 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -382,6 +383,7 @@ namespace svt void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const; void CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const; Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; inline bool IsVertical() const { @@ -870,6 +872,23 @@ namespace svt } return ::boost::optional< size_t >(); } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle PanelTabBar_Impl::GetItemScreenRect( const size_t i_nItemPos ) const + { + ENSURE_OR_RETURN( i_nItemPos < m_aItems.size(), "PanelTabBar_Impl::GetItemScreenRect: invalid item pos!", Rectangle() ); + const ItemDescriptor& rItem( m_aItems[ i_nItemPos ] ); + const Rectangle aItemRect( m_aNormalizer.getTransformed( + GetActualLogicalItemRect( rItem.GetCurrentRect() ), + m_eTabAlignment ) ); + + const Rectangle aTabBarRect( m_rTabBar.GetWindowExtentsRelative( NULL ) ); + return Rectangle( + Point( aTabBarRect.Left() + aItemRect.Left(), aTabBarRect.Top() + aItemRect.Top() ), + aItemRect.GetSize() + ); + } + //------------------------------------------------------------------------------------------------------------------ IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) { @@ -1258,6 +1277,32 @@ namespace svt return m_pImpl->FindItemForPoint( i_rPoint ); } + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const + { + return m_pImpl->m_aFocusedItem; + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::FocusPanelItem( const size_t i_nItemPos ) + { + ENSURE_OR_RETURN_VOID( i_nItemPos < m_pImpl->m_rPanelDeck.GetPanelCount(), "PanelTabBar::FocusPanelItem: illegal item pos!" ); + + if ( !HasChildPathFocus() ) + GrabFocus(); + + OSL_ENSURE( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but not focused item?" ); + if ( !!m_pImpl->m_aFocusedItem ) + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); + m_pImpl->m_aFocusedItem.reset( i_nItemPos ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle PanelTabBar::GetItemScreenRect( const size_t i_nItemPos ) const + { + return m_pImpl->GetItemScreenRect( i_nItemPos ); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index 90792bd1864f..9de726cc1e58 100755 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -60,6 +60,9 @@ namespace svt // operations ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; + ::boost::optional< size_t > GetFocusedPanelItem() const; + void FocusPanelItem( const size_t i_nItemPos ); + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; // Window overridables virtual Size GetOptimalSize( WindowSizeType i_eType ) const; diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 186b64c001a7..4f73558afecf 100755 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -32,6 +32,7 @@ #include "svtaccessiblefactory.hxx" #include +#include //........................................................................ namespace svt @@ -125,6 +126,53 @@ namespace svt return m_pData->eAlignment; } + //-------------------------------------------------------------------- + IToolPanelDeck& TabDeckLayouter::GetPanelDeck() const + { + lcl_checkDisposed( *m_pData ); + return m_pData->rPanels; + } + + //-------------------------------------------------------------------- + ::boost::optional< size_t > TabDeckLayouter::GetFocusedPanelItem() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return ::boost::optional< size_t >(); + return m_pData->pTabBar->GetFocusedPanelItem(); + } + + //-------------------------------------------------------------------- + void TabDeckLayouter::FocusPanelItem( const size_t i_nItemPos ) + { + if ( lcl_checkDisposed( *m_pData ) ) + return; + m_pData->pTabBar->FocusPanelItem( i_nItemPos ); + } + + //-------------------------------------------------------------------- + bool TabDeckLayouter::IsPanelSelectorEnabled() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return false; + return m_pData->pTabBar->IsEnabled(); + } + + //-------------------------------------------------------------------- + bool TabDeckLayouter::IsPanelSelectorVisible() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return false; + return m_pData->pTabBar->IsVisible(); + } + + //-------------------------------------------------------------------- + Rectangle TabDeckLayouter::GetItemScreenRect( const size_t i_nItemPos ) const + { + if ( lcl_checkDisposed( *m_pData ) ) + return Rectangle(); + return m_pData->pTabBar->GetItemScreenRect( i_nItemPos ); + } + //-------------------------------------------------------------------- Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) { @@ -210,7 +258,7 @@ namespace svt { if ( lcl_checkDisposed( *m_pData ) ) return NULL; - return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, m_pData->rPanels, i_nItemPos ); + return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, this, i_nItemPos ); } //........................................................................ -- cgit From 8187d63ccda9c2cb184ce055f6c42577546d6251 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:36 +0200 Subject: slidecopy: improved A11Y API implementations for the ToolPanelDeck items left: - A11Y representation of the scroll buttons of the PanelTabBar - AccessibleToolPanelTabBar event notifications - consolidate AccessibleToolPanelDeck/TabBar/Item? --- svtools/inc/svtools/accessiblefactory.hxx | 11 +-- svtools/inc/svtools/toolpanel/decklayouter.hxx | 18 ++--- svtools/inc/svtools/toolpanel/paneltabbar.hxx | 99 +++++++++++++++++++++++ svtools/inc/svtools/toolpanel/tablayouter.hxx | 8 +- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 3 +- svtools/source/misc/svtaccessiblefactory.cxx | 8 +- svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/paneltabbar.cxx | 70 ++++++++++++---- svtools/source/toolpanel/paneltabbar.hxx | 89 --------------------- svtools/source/toolpanel/paneltabbarpeer.cxx | 101 ++++++++++++++++++++++++ svtools/source/toolpanel/paneltabbarpeer.hxx | 69 ++++++++++++++++ svtools/source/toolpanel/tabbargeometry.cxx | 5 +- svtools/source/toolpanel/tablayouter.cxx | 24 +++--- 13 files changed, 358 insertions(+), 148 deletions(-) create mode 100644 svtools/inc/svtools/toolpanel/paneltabbar.hxx delete mode 100755 svtools/source/toolpanel/paneltabbar.hxx create mode 100644 svtools/source/toolpanel/paneltabbarpeer.cxx create mode 100644 svtools/source/toolpanel/paneltabbarpeer.hxx diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index ab5eb595f76f..f67232b2faad 100755 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -65,7 +65,8 @@ namespace svt //........................................................................ class ToolPanelDeck; - class TabDeckLayouter; + class IToolPanelDeck; + class PanelTabBar; /** a function which is able to create a factory for the standard Accessible/Context components needed for standard toolkit controls @@ -174,11 +175,11 @@ namespace svt const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck ) = 0; - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleToolPanelDeckTabBarItem( + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelTabBar( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, - const size_t i_nItemPos + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar ) = 0; }; diff --git a/svtools/inc/svtools/toolpanel/decklayouter.hxx b/svtools/inc/svtools/toolpanel/decklayouter.hxx index 1542797a77b8..da03d7c6c3aa 100755 --- a/svtools/inc/svtools/toolpanel/decklayouter.hxx +++ b/svtools/inc/svtools/toolpanel/decklayouter.hxx @@ -74,19 +74,19 @@ namespace svt */ virtual void SetFocusToPanelSelector() = 0; - /** assuming that tools panels, no matter whether currently active or inactive, are visually represented - by some item, this method is to retrieve the position of an item for a given screen location. + /** returns the number of components in the XAccessible hierarchy which are needed to represent all elements + the layouter is responsible form. + + Note that the implementation must guarantee that the count is fixed over the life time of the layouter. */ - virtual ::boost::optional< size_t > - GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) = 0; + virtual size_t GetAccessibleChildCount() const = 0; - /** assuming that tools panels, no matter whether currently active or inactive, are visually represented - by some item, this method is to retrieve the XAccessible implementation for such an item, given - by panel position. + /** retrieves the XAccessible implementation for the i_nChildIndex'th child in the XAccessible + hierarchy. */ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetPanelItemAccessible( - const size_t i_nItemPos, + GetAccessibleChild( + const size_t i_nChildIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ) = 0; diff --git a/svtools/inc/svtools/toolpanel/paneltabbar.hxx b/svtools/inc/svtools/toolpanel/paneltabbar.hxx new file mode 100644 index 000000000000..3eb9e7a5624d --- /dev/null +++ b/svtools/inc/svtools/toolpanel/paneltabbar.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SVT_PANELTABBAR_HXX +#define SVT_PANELTABBAR_HXX + +#include "svtools/svtdllapi.h" +#include "svtools/toolpanel/tabalignment.hxx" +#include "svtools/toolpanel/tabitemcontent.hxx" + +#include + +#include +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + class PanelTabBar_Impl; + class IToolPanelDeck; + + //==================================================================== + //= PanelTabBar + //==================================================================== + /** a tab bar for selecting panels + + At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal + layout in the future. + */ + class SVT_DLLPUBLIC PanelTabBar : public Control + { + public: + PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); + ~PanelTabBar(); + + // attribute access + TabItemContent GetTabItemContent() const; + void SetTabItemContent( const TabItemContent& i_eItemContent ); + + bool IsVertical() const; + + IToolPanelDeck& GetPanelDeck() const; + + // operations + ::boost::optional< size_t > GetFocusedPanelItem() const; + void FocusPanelItem( const size_t i_nItemPos ); + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; + + // Window overridables + virtual Size GetOptimalSize( WindowSizeType i_eType ) const; + virtual void Paint( const Rectangle& i_rRect ); + virtual void Resize(); + virtual void MouseMove( const MouseEvent& i_rMouseEvent ); + virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); + virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent ); + virtual void RequestHelp( const HelpEvent& i_rHelpEvent ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void KeyInput( const KeyEvent& i_rKeyEvent ); + virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + GetComponentInterface( BOOL i_bCreate ); + + private: + ::std::auto_ptr< PanelTabBar_Impl > m_pImpl; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // SVT_PANELTABBAR_HXX + diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 9d4b56db649c..92b36acf9114 100755 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -80,7 +80,6 @@ namespace svt TabAlignment GetTabAlignment() const; // helpers for the A11Y implementation - IToolPanelDeck& GetPanelDeck() const; ::boost::optional< size_t > GetFocusedPanelItem() const; void FocusPanelItem( const size_t i_nItemPos ); @@ -92,11 +91,10 @@ namespace svt virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); virtual void SetFocusToPanelSelector(); - virtual ::boost::optional< size_t > - GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ); + virtual size_t GetAccessibleChildCount() const; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - GetPanelItemAccessible( - const size_t i_nItemPos, + GetAccessibleChild( + const size_t i_nChildIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible ); diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 911857f46150..358464211255 100755 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -175,7 +175,8 @@ namespace svt virtual long Notify( NotifyEvent& i_rNotifyEvent ); virtual void GetFocus(); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( BOOL i_bCreate ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + GetComponentInterface( BOOL i_bCreate ); private: ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl; diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index 8a45ee2e0b74..b21e33a9c6e4 100755 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -221,11 +221,11 @@ namespace svt { return NULL; } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - createAccessibleToolPanelDeckTabBarItem( + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelTabBar( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*i_rAccessibleParent*/, - const ::rtl::Reference< ::svt::TabDeckLayouter >& /*i_pLayouter*/, - const size_t /*i_nItemPos*/ + ::svt::IToolPanelDeck& /*i_rPanelDeck*/, + ::svt::PanelTabBar& /*i_rTabBar*/ ) { return NULL; diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 5efaf6fe0af3..408d8eeb87b2 100755 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -47,6 +47,7 @@ SLOFILES=\ $(SLO)$/dummypanel.obj \ $(SLO)$/paneldecklisteners.obj \ $(SLO)$/paneltabbar.obj \ + $(SLO)$/paneltabbarpeer.obj \ $(SLO)$/refbase.obj \ $(SLO)$/tabbargeometry.obj \ $(SLO)$/tablayouter.obj \ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index f9a40004cb61..9fe193d9ac4f 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -26,9 +26,11 @@ #include "precompiled_svtools.hxx" +#include "svtools/toolpanel/paneltabbar.hxx" + #include "svtools/toolpanel/toolpaneldeck.hxx" #include "tabitemdescriptor.hxx" -#include "paneltabbar.hxx" +#include "paneltabbarpeer.hxx" #include "tabbargeometry.hxx" #include @@ -51,6 +53,9 @@ namespace svt { //........................................................................ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::awt::XWindowPeer; + typedef sal_uInt16 ItemFlags; #define ITEM_STATE_NORMAL 0x00 @@ -385,6 +390,8 @@ namespace svt Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; + void FocusItem( const ::boost::optional< size_t >& i_rItemPos ); + inline bool IsVertical() const { return ( ( m_eTabAlignment == TABS_LEFT ) @@ -546,9 +553,9 @@ namespace svt Rectangle aContentArea; - Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); - Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) ); - Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) ); + const Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); + const Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) ); + const Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) ); // TODO: have one method calculating all sizes? @@ -602,7 +609,7 @@ namespace svt { // have a minimal size - this is pure heuristics, but if it doesn't suit your needs, then give your panels // a name and or image! :) - aItemContentSize = Size( 14, 14 ); + aItemContentSize = Size( 16, 16 ); } aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; @@ -889,6 +896,22 @@ namespace svt ); } + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar_Impl::FocusItem( const ::boost::optional< size_t >& i_rItemPos ) + { + // reset old focus item + if ( !!m_aFocusedItem ) + InvalidateItem( *m_aFocusedItem ); + m_aFocusedItem.reset(); + + // mark the active icon as focused + if ( !!i_rItemPos ) + { + m_aFocusedItem = i_rItemPos; + InvalidateItem( *m_aFocusedItem ); + } + } + //------------------------------------------------------------------------------------------------------------------ IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) { @@ -986,6 +1009,13 @@ namespace svt Invalidate(); } + //------------------------------------------------------------------------------------------------------------------ + IToolPanelDeck& PanelTabBar::GetPanelDeck() const + { + DBG_CHECK( *m_pImpl ); + return m_pImpl->m_rPanelDeck; + } + //------------------------------------------------------------------------------------------------------------------ Size PanelTabBar::GetOptimalSize( WindowSizeType i_eType ) const { @@ -1145,15 +1175,8 @@ namespace svt void PanelTabBar::GetFocus() { Control::GetFocus(); - if ( m_pImpl->m_rPanelDeck.GetPanelCount() ) - { - ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() ); - if ( !!aActivePanel ) - { - m_pImpl->m_aFocusedItem = aActivePanel; - m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); - } - } + if ( !m_pImpl->m_aFocusedItem ) + m_pImpl->FocusItem( m_pImpl->m_rPanelDeck.GetActivePanel() ); } //------------------------------------------------------------------------------------------------------------------ @@ -1272,9 +1295,9 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - ::boost::optional< size_t > PanelTabBar::FindItemForPoint( const Point& i_rPoint ) const + bool PanelTabBar::IsVertical() const { - return m_pImpl->FindItemForPoint( i_rPoint ); + return m_pImpl->IsVertical(); } //------------------------------------------------------------------------------------------------------------------ @@ -1291,7 +1314,8 @@ namespace svt if ( !HasChildPathFocus() ) GrabFocus(); - OSL_ENSURE( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but not focused item?" ); + m_pImpl->FocusItem( i_nItemPos ); + OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but not focused item?" ); if ( !!m_pImpl->m_aFocusedItem ) m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); m_pImpl->m_aFocusedItem.reset( i_nItemPos ); @@ -1303,6 +1327,18 @@ namespace svt return m_pImpl->GetItemScreenRect( i_nItemPos ); } + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindowPeer > PanelTabBar::GetComponentInterface( BOOL i_bCreate ) + { + Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( FALSE ) ); + if ( !xWindowPeer.is() && i_bCreate ) + { + xWindowPeer.set( new PanelTabBarPeer( *this ) ); + SetComponentInterface( xWindowPeer ); + } + return xWindowPeer; + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx deleted file mode 100755 index 9de726cc1e58..000000000000 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ /dev/null @@ -1,89 +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 PANELTABBAR_HXX -#define PANELTABBAR_HXX - -#include "svtools/toolpanel/tabalignment.hxx" -#include "svtools/toolpanel/tabitemcontent.hxx" - -#include - -#include - -//........................................................................ -namespace svt -{ -//........................................................................ - - class PanelTabBar_Impl; - - //==================================================================== - //= PanelTabBar - //==================================================================== - /** a tab bar for selecting panels - - At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal - layout in the future. - */ - class PanelTabBar : public Control - { - public: - PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); - ~PanelTabBar(); - - // attribute access - TabItemContent GetTabItemContent() const; - void SetTabItemContent( const TabItemContent& i_eItemContent ); - - // operations - ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; - ::boost::optional< size_t > GetFocusedPanelItem() const; - void FocusPanelItem( const size_t i_nItemPos ); - Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; - - // Window overridables - virtual Size GetOptimalSize( WindowSizeType i_eType ) const; - virtual void Paint( const Rectangle& i_rRect ); - virtual void Resize(); - virtual void MouseMove( const MouseEvent& i_rMouseEvent ); - virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); - virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent ); - virtual void RequestHelp( const HelpEvent& i_rHelpEvent ); - virtual void GetFocus(); - virtual void LoseFocus(); - virtual void KeyInput( const KeyEvent& i_rKeyEvent ); - virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent ); - - private: - ::std::auto_ptr< PanelTabBar_Impl > m_pImpl; - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // PANELTABBAR_HXX - diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx new file mode 100644 index 000000000000..d8329109ffb4 --- /dev/null +++ b/svtools/source/toolpanel/paneltabbarpeer.cxx @@ -0,0 +1,101 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "paneltabbarpeer.hxx" +#include "svtools/toolpanel/paneltabbar.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//........................................................................ +namespace svt +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessibleContext; + using ::com::sun::star::lang::DisposedException; + /** === end UNO using === **/ + + //================================================================================================================== + //= PanelTabBarPeer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + PanelTabBarPeer::PanelTabBarPeer( PanelTabBar& i_rTabBar ) + :VCLXWindow() + ,m_pTabBar( &i_rTabBar ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + PanelTabBarPeer::~PanelTabBarPeer() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext() + { + ::vos::OGuard aSolarGuard( GetMutex() ); + if ( m_pTabBar == NULL ) + throw DisposedException( ::rtl::OUString(), *this ); + + + + Window* pAccessibleParent( m_pTabBar->GetAccessibleParentWindow() ); + ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL ); + Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW ); + return m_aAccessibleFactory.getFactory().createAccessibleToolPanelTabBar( xAccessibleParent, m_pTabBar->GetPanelDeck(), *m_pTabBar ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException) + { + { + ::vos::OGuard aSolarGuard( GetMutex() ); + m_pTabBar = NULL; + } + VCLXWindow::dispose(); + } + +//........................................................................ +} // namespace svt +//........................................................................ diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx new file mode 100644 index 000000000000..7c2e5188d994 --- /dev/null +++ b/svtools/source/toolpanel/paneltabbarpeer.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_PANELTABBARPEER_HXX +#define SVT_PANELTABBARPEER_HXX + +#include "svtaccessiblefactory.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + class PanelTabBar; + //==================================================================== + //= PanelTabBarPeer + //==================================================================== + class PanelTabBarPeer : public VCLXWindow + { + public: + PanelTabBarPeer( PanelTabBar& i_rTabBar ); + + protected: + ~PanelTabBarPeer(); + + // VCLXWindow overridables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); + + // XComponent + void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + + private: + AccessibleFactoryAccess m_aAccessibleFactory; + PanelTabBar* m_pTabBar; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // SVT_PANELTABBARPEER_HXX diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index 2e34ab6da636..f0f5c66d3af3 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -274,10 +274,9 @@ namespace svt // the rect of the last item const Rectangle& rLastItemRect( i_bMinimalSize ? io_rItems.rbegin()->aIconOnlyArea : io_rItems.rbegin()->aCompleteArea ); - const Point aBottomRight( rLastItemRect.BottomRight() ); return Size( - aBottomRight.X() + 1 + m_aItemsInset.Right(), - aBottomRight.Y() + 1 + m_aItemsInset.Bottom() + rLastItemRect.Left() + 1 + m_aItemsInset.Right(), + rLastItemRect.Top() + 1 + rLastItemRect.Bottom() + m_aItemsInset.Bottom() ); } diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 4f73558afecf..227640e6cad6 100755 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -28,7 +28,7 @@ #include "svtools/toolpanel/tablayouter.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" -#include "paneltabbar.hxx" +#include "svtools/toolpanel/paneltabbar.hxx" #include "svtaccessiblefactory.hxx" #include @@ -126,13 +126,6 @@ namespace svt return m_pData->eAlignment; } - //-------------------------------------------------------------------- - IToolPanelDeck& TabDeckLayouter::GetPanelDeck() const - { - lcl_checkDisposed( *m_pData ); - return m_pData->rPanels; - } - //-------------------------------------------------------------------- ::boost::optional< size_t > TabDeckLayouter::GetFocusedPanelItem() const { @@ -239,26 +232,27 @@ namespace svt //-------------------------------------------------------------------- void TabDeckLayouter::SetFocusToPanelSelector() { - if ( lcl_checkDisposed( * m_pData ) ) + if ( lcl_checkDisposed( *m_pData ) ) return; m_pData->pTabBar->GrabFocus(); } //-------------------------------------------------------------------- - ::boost::optional< size_t > TabDeckLayouter::GetPanelItemFromScreenPos( const ::Point& i_rScreenPos ) + size_t TabDeckLayouter::GetAccessibleChildCount() const { if ( lcl_checkDisposed( *m_pData ) ) - return ::boost::optional< size_t >(); - const Point aOutputPos( m_pData->pTabBar->ScreenToOutputPixel( i_rScreenPos ) ); - return m_pData->pTabBar->FindItemForPoint( aOutputPos ); + return 0; + + return 1; } //-------------------------------------------------------------------- - Reference< XAccessible > TabDeckLayouter::GetPanelItemAccessible( const size_t i_nItemPos, const Reference< XAccessible >& i_rParentAccessible ) + Reference< XAccessible > TabDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) { if ( lcl_checkDisposed( *m_pData ) ) return NULL; - return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, this, i_nItemPos ); + + return m_pData->pTabBar->GetAccessible( TRUE ); } //........................................................................ -- cgit From 46813b0e4ab83c7b5887b1f761f8b31e95cc7045 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:56 +0200 Subject: slidecopy: make Get(CLient)WindowExtentsRelative const --- svtools/inc/svtools/accessibletable.hxx | 2 +- svtools/inc/svtools/accessibletableprovider.hxx | 2 +- svtools/inc/svtools/brwbox.hxx | 2 +- svtools/inc/svtools/svtabbx.hxx | 2 +- svtools/inc/svtools/table/tablecontrol.hxx | 2 +- svtools/source/brwbox/brwbox3.cxx | 2 +- svtools/source/contnr/svtabbx.cxx | 2 +- svtools/source/table/tablecontrol.cxx | 68 ++++++++++++------------- vcl/inc/vcl/window.hxx | 6 +-- vcl/source/window/window.cxx | 8 +-- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index 0e3f08bfc568..b5bc53f33709 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -103,7 +103,7 @@ public: AccessibleTableControlObjType eObjType ) const= 0; // Window - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0; + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0; virtual void GrabFocus()= 0; virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0; virtual Window* GetAccessibleParentWindow() const= 0; diff --git a/svtools/inc/svtools/accessibletableprovider.hxx b/svtools/inc/svtools/accessibletableprovider.hxx index f77f34aeb463..e0e8a042d7aa 100644 --- a/svtools/inc/svtools/accessibletableprovider.hxx +++ b/svtools/inc/svtools/accessibletableprovider.hxx @@ -135,7 +135,7 @@ public: virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0; // Window - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0; + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0; virtual void GrabFocus() = 0; virtual XACC GetAccessible( BOOL bCreate = TRUE ) = 0; virtual Window* GetAccessibleParentWindow() const = 0; diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx index 8296c9f994f6..7c3ded029e11 100644 --- a/svtools/inc/svtools/brwbox.hxx +++ b/svtools/inc/svtools/brwbox.hxx @@ -851,7 +851,7 @@ public: virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const; virtual String GetAccessibleCellText(long _nRow, USHORT _nColPos) const; virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ); - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; virtual void GrabFocus(); virtual XACC GetAccessible( BOOL bCreate = TRUE ); virtual Window* GetAccessibleParentWindow() const; diff --git a/svtools/inc/svtools/svtabbx.hxx b/svtools/inc/svtools/svtabbx.hxx index 8018b8650dc5..5c16afa1232f 100644 --- a/svtools/inc/svtools/svtabbx.hxx +++ b/svtools/inc/svtools/svtabbx.hxx @@ -254,7 +254,7 @@ public: virtual BOOL GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ); // Window - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; virtual void GrabFocus(); virtual XACC GetAccessible( BOOL bCreate = TRUE ); virtual Window* GetAccessibleParentWindow() const; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index e3edd0b681ae..0c8d9d92b2b9 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -179,7 +179,7 @@ namespace svt { namespace table AccessibleTableControlObjType eObjType ) const; //// Window - virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; virtual void GrabFocus(); virtual XACC GetAccessible( BOOL bCreate = TRUE ); virtual Window* GetAccessibleParentWindow() const; diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index cc1816551237..8fb5d91ad27c 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -545,7 +545,7 @@ BOOL BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const String& rStr, in return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector ); } // ----------------------------------------------------------------------------- -Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle BrowseBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const { return Control::GetWindowExtentsRelative( pRelativeWindow ); } diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 3b4907e7a80d..122d0016d568 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -1235,7 +1235,7 @@ BOOL SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const String& return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, nBase, rVector ); } // ----------------------------------------------------------------------- -Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( Window *pRelativeWindow ) const { return Control::GetWindowExtentsRelative( pRelativeWindow ); } diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 1d7b046ae94b..d7fd48962b89 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -393,7 +393,7 @@ void TableControl::FillAccessibleStateSet( } } -Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) const { return Control::GetWindowExtentsRelative( pRelativeWindow ); } @@ -491,48 +491,48 @@ sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnP { (void)_nRow; (void)_nColumnPos; - return GetIndexForPoint(_rPoint); + return GetIndexForPoint(_rPoint); ; } - // ----------------------------------------------------------------------------- -sal_Bool TableControl::isAccessibleAlive( ) const -{ - return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive(); -} + // ----------------------------------------------------------------------------- +sal_Bool TableControl::isAccessibleAlive( ) const +{ + return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive(); +} // ----------------------------------------------------------------------------- ::svt::IAccessibleFactory& TableControl::getAccessibleFactory() { return m_pAccessTable->m_aFactoryAccess.getFactory(); } -// ----------------------------------------------------------------------------- -void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) -{ - if ( isAccessibleAlive() ) - m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); +// ----------------------------------------------------------------------------- +void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) +{ + if ( isAccessibleAlive() ) + m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) +{ + (void)_bOnScreen; + Rectangle aRectTable, aRectTableWithHeaders; + m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); + m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); + Size aSizeTable(aRectTable.GetSize()); + Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); + if(_bIsColumnBar) + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); + else + return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); +} +// ----------------------------------------------------------------------------- +Rectangle TableControl::calcTableRect(BOOL _bOnScreen) +{ + (void)_bOnScreen; + Rectangle aRect; + m_pImpl->impl_getAllVisibleDataCellArea(aRect); + return aRect; } -// ----------------------------------------------------------------------------- -Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen) -{ - (void)_bOnScreen; - Rectangle aRectTable, aRectTableWithHeaders; - m_pImpl->impl_getAllVisibleDataCellArea(aRectTable); - m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders); - Size aSizeTable(aRectTable.GetSize()); - Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize()); - if(_bIsColumnBar) - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height())); - else - return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height())); -} -// ----------------------------------------------------------------------------- -Rectangle TableControl::calcTableRect(BOOL _bOnScreen) -{ - (void)_bOnScreen; - Rectangle aRect; - m_pImpl->impl_getAllVisibleDataCellArea(aRect); - return aRect; -} //........................................................................ }} // namespace svt::table diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 044b560aac36..a11a6e610e16 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -551,7 +551,7 @@ public: SAL_DLLPRIVATE ::std::vector& ImplGetOwnerDrawList(); SAL_DLLPRIVATE Window* ImplGetTopmostFrameWindow(); - SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ); + SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const; SAL_DLLPRIVATE void ImplNotifyIconifiedState( BOOL bIconified ); SAL_DLLPRIVATE bool ImplStopDnd(); SAL_DLLPRIVATE void ImplStartDnd(); @@ -857,9 +857,9 @@ public: Point AbsoluteScreenToOutputPixel( const Point& rPos ) const; Rectangle GetDesktopRectPixel() const; // window extents including border and decoratrion - Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const; // window extents of the client window, coordinates to be used in SetPosPixel - Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ); + Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ) const; virtual BOOL IsScrollable() const; virtual void Scroll( long nHorzScroll, long nVertScroll, diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 39fa754404eb..3b3ad5ed6ab6 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -7449,13 +7449,13 @@ Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rR // ----------------------------------------------------------------------- -Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const { // with decoration return ImplGetWindowExtentsRelative( pRelativeWindow, FALSE ); } -Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) +Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const { // without decoration return ImplGetWindowExtentsRelative( pRelativeWindow, TRUE ); @@ -7463,12 +7463,12 @@ Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) // ----------------------------------------------------------------------- -Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) +Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, BOOL bClientOnly ) const { SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); // make sure we use the extent of our border window, // otherwise we miss a few pixels - Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; + const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this; Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) ); aPos.X() += g.nX; -- cgit From 19e77097df46500cac3752ceea465034d2c08463 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:56 +0200 Subject: slidecopy: typo, relayout did reset the wrong button rect --- svtools/source/toolpanel/tabbargeometry.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index f0f5c66d3af3..45c40cee6ef2 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -290,7 +290,7 @@ namespace svt Point aButtonForwardPos( i_rActualOutputSize.Width(), OUTER_SPACE_TOP ); m_aButtonForwardRect = Rectangle( aButtonForwardPos, Size( 1, 1 ) ); - m_aButtonBackRect.SetEmpty(); + m_aButtonForwardRect.SetEmpty(); Point aItemsPos( OUTER_SPACE_LEFT, 0 ); Size aItemsSize( i_rActualOutputSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, i_rActualOutputSize.Height() ); -- cgit From 5e1eeb99fdf3a5c303af4750df20ab4a0488daca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:56 +0200 Subject: slidecopy: removed unused resource file --- svtools/source/uno/makefile.mk | 3 -- svtools/source/uno/unoifac2.hrc | 55 -------------------- svtools/source/uno/unoifac2.src | 110 ---------------------------------------- svtools/util/makefile.mk | 1 - 4 files changed, 169 deletions(-) delete mode 100644 svtools/source/uno/unoifac2.hrc delete mode 100644 svtools/source/uno/unoifac2.src diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 82e509f1ce08..f21eb9d07f80 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -42,9 +42,6 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -SRS1NAME= uno -SRC1FILES= unoifac2.src - SLOFILES= \ $(SLO)$/addrtempuno.obj \ $(SLO)$/contextmenuhelper.obj \ diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc deleted file mode 100644 index 4f46edffdc51..000000000000 --- a/svtools/source/uno/unoifac2.hrc +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unoifac2.hrc,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _SVT_UNO_UNOIFAC_HRC_ -#define _SVT_UNO_UNOIFAC_HRC_ - - -#ifndef _SOLAR_HRC -#include -#endif - -//! Um den Überblick über alle benutzten HelpID's zu behalten sind diese -//! zentral in -#ifndef _SVT_HELPID_HRC -#include -#endif - -// RID's fuer das Kontextmenu der Textkomponente -#define RID_CONTEXTMENU (RID_APP_START + 1024) -#define RID_OPEN_LINK (RID_APP_START + 10) -#define RID_OPEN_LINK_NEW (RID_APP_START + 11) -#define RID_DOWNLOAD (RID_APP_START + 12) -#define RID_ADD_BOOKMARK (RID_APP_START + 13) -#define RID_COPY_LINK (RID_APP_START + 14) - - -#endif - diff --git a/svtools/source/uno/unoifac2.src b/svtools/source/uno/unoifac2.src deleted file mode 100644 index 661e3a68d248..000000000000 --- a/svtools/source/uno/unoifac2.src +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unoifac2.src,v $ - * $Revision: 1.23 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _SVT_UNO_UNOIFAC_HRC_ -#include -#endif - - -Menu RID_CONTEXTMENU -{ - ItemList = - { - MenuItem - { - Identifier = RID_OPEN_LINK ; - HelpId = HID_TEXTCPNT_OPEN_LINK ; - Text [ en-US ] = "~Open"; - }; - MenuItem - { - Identifier = RID_OPEN_LINK_NEW ; - HelpId = HID_TEXTCPNT_OPEN_LINK_NEW ; - Text [ en-US ] = "Open in New ~Window"; - }; - MenuItem - { - Identifier = RID_DOWNLOAD ; - HelpId = HID_TEXTCPNT_DOWNLOAD ; - Text [ en-US ] = "~Download..."; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = RID_ADD_BOOKMARK ; - HelpId = HID_TEXTCPNT_ADD_BOOKMARK ; - Text [ en-US ] = "Add ~Link"; - }; - MenuItem - { - Separator = TRUE; - }; - MenuItem - { - Identifier = RID_COPY_LINK ; - HelpId = HID_TEXTCPNT_COPY_LINK ; - Text [ en-US ] = "Cop~y Link" ; - }; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 1113c7ffd240..e632db6d4f33 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -88,7 +88,6 @@ RESLIB1SRSFILES= \ $(SRS)$/dialogs.srs \ $(SRS)$/plugapp.srs \ $(SRS)$/svcontnr.srs \ - $(SRS)$/uno.srs \ $(SRS)$/browse.srs \ $(SRS)$/javaerror.srs -- cgit From 9dac5ad99ce21f25f4199c71c86471999fd02ceb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:57 +0200 Subject: slidecopy: the A11Y API for the PanelTabBar now also includes the scroll buttons --- svtools/inc/svtools/toolpanel/paneltabbar.hxx | 13 +++++---- svtools/source/toolpanel/makefile.mk | 4 +++ svtools/source/toolpanel/paneltabbar.cxx | 16 +++++++++-- svtools/source/toolpanel/toolpanel.src | 39 +++++++++++++++++++++++++++ svtools/source/toolpanel/toolpaneldeck.cxx | 10 +++++-- svtools/util/makefile.mk | 1 + 6 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 svtools/source/toolpanel/toolpanel.src diff --git a/svtools/inc/svtools/toolpanel/paneltabbar.hxx b/svtools/inc/svtools/toolpanel/paneltabbar.hxx index 3eb9e7a5624d..668935d8a739 100644 --- a/svtools/inc/svtools/toolpanel/paneltabbar.hxx +++ b/svtools/inc/svtools/toolpanel/paneltabbar.hxx @@ -36,6 +36,8 @@ #include #include +class PushButton; + //........................................................................ namespace svt { @@ -62,17 +64,18 @@ namespace svt TabItemContent GetTabItemContent() const; void SetTabItemContent( const TabItemContent& i_eItemContent ); - bool IsVertical() const; - - IToolPanelDeck& GetPanelDeck() const; - - // operations ::boost::optional< size_t > GetFocusedPanelItem() const; void FocusPanelItem( const size_t i_nItemPos ); Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; + bool IsVertical() const; + IToolPanelDeck& GetPanelDeck() const; + PushButton& GetScrollButton( const bool i_bForward ); // Window overridables virtual Size GetOptimalSize( WindowSizeType i_eType ) const; + + protected: + // Window overridables virtual void Paint( const Rectangle& i_rRect ); virtual void Resize(); virtual void MouseMove( const MouseEvent& i_rMouseEvent ); diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 408d8eeb87b2..9d293b56d231 100755 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -43,6 +43,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- +SRS1NAME=$(TARGET) +SRC1FILES=\ + toolpanel.src + SLOFILES=\ $(SLO)$/dummypanel.obj \ $(SLO)$/paneldecklisteners.obj \ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 9fe193d9ac4f..95e6caa311e4 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -27,8 +27,9 @@ #include "precompiled_svtools.hxx" #include "svtools/toolpanel/paneltabbar.hxx" - #include "svtools/toolpanel/toolpaneldeck.hxx" +#include "svtools/svtdata.hxx" + #include "tabitemdescriptor.hxx" #include "paneltabbarpeer.hxx" #include "tabbargeometry.hxx" @@ -37,6 +38,7 @@ #include #include #include +#include #include #include @@ -526,10 +528,14 @@ namespace svt m_aScrollBack.SetSymbol( IsVertical() ? SYMBOL_ARROW_UP : SYMBOL_ARROW_LEFT ); m_aScrollBack.Show(); m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollBack.SetAccessibleDescription( String( SvtResId( STR_SVT_ACC_BEGIN + 0 ) ) ); + m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() ); m_aScrollForward.SetSymbol( IsVertical() ? SYMBOL_ARROW_DOWN : SYMBOL_ARROW_RIGHT ); m_aScrollForward.Show(); m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollForward.SetAccessibleDescription( String( SvtResId( STR_SVT_ACC_BEGIN + 1 ) ) ); + m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() ); } //------------------------------------------------------------------------------------------------------------------ @@ -1300,6 +1306,12 @@ namespace svt return m_pImpl->IsVertical(); } + //------------------------------------------------------------------------------------------------------------------ + PushButton& PanelTabBar::GetScrollButton( const bool i_bForward ) + { + return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack; + } + //------------------------------------------------------------------------------------------------------------------ ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const { @@ -1315,7 +1327,7 @@ namespace svt GrabFocus(); m_pImpl->FocusItem( i_nItemPos ); - OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but not focused item?" ); + OSL_POSTCOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" ); if ( !!m_pImpl->m_aFocusedItem ) m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); m_pImpl->m_aFocusedItem.reset( i_nItemPos ); diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src new file mode 100644 index 000000000000..4861fbfd14ac --- /dev/null +++ b/svtools/source/toolpanel/toolpanel.src @@ -0,0 +1,39 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + +// the following string ID is a hack, until MBA's promised patch appears, which splits svl/svtools.hrc +// into two files, one for svl, one or svtools +String STR_SVT_ACC_BEGIN + 0 +{ + Text [ en-US ] = "Tab Panel Scroll Button, backward"; +}; + +String STR_SVT_ACC_BEGIN + 1 +{ + Text [ en-US ] = "Tab Panel Scroll Button, forward"; +}; diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index c8d441ecdaf7..4b28699f1134 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -91,8 +91,6 @@ namespace svt ~ToolPanelDeck_Impl() { - m_aPanels.RemoveListener( *this ); - m_aListeners.Dying(); } PDeckLayouter GetLayouter() const { return m_pLayouter; } @@ -100,6 +98,13 @@ namespace svt Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor + void NotifyDying() + { + m_aPanels.RemoveListener( *this ); + m_aListeners.Dying(); + } + // IToolPanelDeck equivalents size_t GetPanelCount() const; PToolPanel GetPanel( const size_t i_nPos ) const; @@ -359,6 +364,7 @@ namespace svt //-------------------------------------------------------------------- ToolPanelDeck::~ToolPanelDeck() { + m_pImpl->NotifyDying(); GetLayouter()->Destroy(); Hide(); diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index e632db6d4f33..00ad1776e886 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -89,6 +89,7 @@ RESLIB1SRSFILES= \ $(SRS)$/plugapp.srs \ $(SRS)$/svcontnr.srs \ $(SRS)$/browse.srs \ + $(SRS)$/toolpanel.srs \ $(SRS)$/javaerror.srs RESLIB3NAME= $(RESTARGETPATCH) -- cgit From 78fa4f2c4127e35c4272e57dd0ad50dbcd192ced Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 1 Apr 2010 17:52:57 +0200 Subject: slidecopy: when notifying listeners, loop through a copy of m_aListeners, to show a little tolerance against listeners being removed during the notification --- svtools/source/toolpanel/paneldecklisteners.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx index dd7abfc30f90..32ba9b5c6a24 100755 --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -50,8 +50,9 @@ namespace svt //-------------------------------------------------------------------- void PanelDeckListeners::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) { - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); - loop != m_aListeners.end(); + ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); + loop != aListeners.end(); ++loop ) { @@ -62,8 +63,9 @@ namespace svt //-------------------------------------------------------------------- void PanelDeckListeners::PanelRemoved( const size_t i_nPosition ) { - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); - loop != m_aListeners.end(); + ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); + loop != aListeners.end(); ++loop ) { @@ -74,8 +76,9 @@ namespace svt //-------------------------------------------------------------------- void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) { - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); - loop != m_aListeners.end(); + ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); + loop != aListeners.end(); ++loop ) { @@ -86,8 +89,9 @@ namespace svt //-------------------------------------------------------------------- void PanelDeckListeners::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) { - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = m_aListeners.begin(); - loop != m_aListeners.end(); + ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); + for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); + loop != aListeners.end(); ++loop ) { -- cgit From b8b44a1bf5dafdd70c728abb4e0b9af6928128a3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 6 Apr 2010 12:16:19 +0200 Subject: slidecopy: silence warning 'bout unused parameters --- svtools/source/toolpanel/tablayouter.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 227640e6cad6..f68bbc1bbd0f 100755 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -249,6 +249,8 @@ namespace svt //-------------------------------------------------------------------- Reference< XAccessible > TabDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) { + (void)i_nChildIndex; + (void)i_rParentAccessible; if ( lcl_checkDisposed( *m_pData ) ) return NULL; -- cgit From 50a88d5340d73aa6cecec56d059887725de2e4e9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 6 Apr 2010 12:22:42 +0200 Subject: slidecopy: Load: when reporting a failure as assertion, also display the name of the image which could not be loaded --- vcl/source/gdi/image.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index a5a9886bd7a3..b43b6168ac8c 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -53,6 +53,10 @@ #include #include +#if OSL_DEBUG_LEVEL > 0 +#include +#endif + DBG_NAME( Image ) DBG_NAME( ImageList ) @@ -546,11 +550,19 @@ void ImageAryData::Load(const rtl::OUString &rPrefix) rtl::OUString aFileName = rPrefix; aFileName += maName; -#ifdef DBG_UTIL - bool bSuccess = aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); - DBG_ASSERT (bSuccess, "ImageAryData::Failed to load image"); -#else - aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + bool bSuccess = +#endif + aImageTree->loadImage( aFileName, aSymbolsStyle, maBitmapEx, true ); +#if OSL_DEBUG_LEVEL > 0 + if ( !bSuccess ) + { + ::rtl::OStringBuffer aMessage; + aMessage.append( "ImageAryData::Load: failed to load image '" ); + aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); + } #endif } -- cgit From af5c3ad88ab4f93e825d9b6931727d36d87df05e Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 6 Apr 2010 13:28:48 +0200 Subject: tl78: compiler warning --- comphelper/source/misc/docpasswordrequest.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index beed6d7342b3..585868822c18 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -84,14 +84,13 @@ public: virtual void SAL_CALL setPasswordToModify( const OUString& rPass ) throw( RuntimeException ) { maModifyPassword = rPass; } virtual OUString SAL_CALL getPasswordToModify() throw( RuntimeException ) { return maModifyPassword; } - virtual void SAL_CALL setRecommendReadOnly( const sal_Bool bReadOnly ) throw( RuntimeException ) { mbReadOnly = bReadOnly; } + virtual void SAL_CALL setRecommendReadOnly( sal_Bool bReadOnly ) throw( RuntimeException ) { mbReadOnly = bReadOnly; } virtual sal_Bool SAL_CALL getRecommendReadOnly() throw( RuntimeException ) { return mbReadOnly; } private: OUString maPassword; OUString maModifyPassword; sal_Bool mbReadOnly; - sal_Bool mbSelected; }; -- cgit From b26b5a2737848cdbeac3a42af78a86ac7a70300b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 6 Apr 2010 13:30:14 +0200 Subject: slidecopy: when activating a panel, also resize it. Cannot guarantee it has been done before ... --- svtools/source/toolpanel/toolpaneldeck.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 4b28699f1134..fe4fa63ad997 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -226,7 +226,7 @@ namespace svt // position the active panel const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); - pActive->SetSizePixel( m_aPanelAnchor.GetSizePixel() ); + pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); } //-------------------------------------------------------------------- @@ -325,6 +325,9 @@ namespace svt pNewActive->Activate( m_aPanelAnchor ); pNewActive->GrabFocus(); + // resize the panel (cannot guarantee it has ever been resized before + pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); + // multiplex to our own listeners m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); } -- cgit From 656c2a8f122c291e3f634e7eb508971e4a7e47de Mon Sep 17 00:00:00 2001 From: Martin Hollmichel Date: Tue, 6 Apr 2010 14:40:41 +0200 Subject: nativea: #i110249# chg copyright --- rsc/source/parser/erscerr.cxx | 2 +- sot/source/sdstor/sdintern.hdb | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 sot/source/sdstor/sdintern.hdb diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx index 11aaf9cce85f..158aea21b6e3 100644 --- a/rsc/source/parser/erscerr.cxx +++ b/rsc/source/parser/erscerr.cxx @@ -200,7 +200,7 @@ void RscError::WriteError( const ERRTYPE& rError, const char * pMessage ) case ERR_NOINPUT: StdLstErr( "Input file was not specified.\n"); case ERR_USAGE: - StdLstOut( "Copyright (C) 1990-92 STAR DIVISION GmbH\n" ); + StdLstOut( "Copyright (C) 2000, 2010 Oracle and/or its affiliates.\n" ); { char buf[40]; diff --git a/sot/source/sdstor/sdintern.hdb b/sot/source/sdstor/sdintern.hdb deleted file mode 100644 index 4dfbc69be013..000000000000 --- a/sot/source/sdstor/sdintern.hdb +++ /dev/null @@ -1,22 +0,0 @@ -write "/*************************************************************************" -write "* SDINTERN.HXX" -write "* __DATE__" -write "* (c) 1992-1995 STAR DIVISION" -write "*************************************************************************/" -write "#ifndef _SDINTERN_HXX" -write "#define _SDINTERN_HXX" -write "#ifndef _SOLAR_H" -write "#include " -write "#endif" -write "#ifndef _STREAM_HXX" -write "#include " -write "#endif" -file stg.hxx -file stgelem.hxx -file stgcache.hxx -file stgio.hxx -file stgstrms.hxx -file stgavl.hxx -file stgdir.hxx -write "#endif" - -- cgit From da5fbd8f9cfa7bb914f4db2cb326f71901289f58 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 6 Apr 2010 16:53:43 +0200 Subject: sb122: #i110548# extension native libraries linking against basis layer; new extension dependency deployment-repositories --- vcl/source/app/svapp.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 7cec6867e0a3..e503172eb2c6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1975,11 +1975,14 @@ BOOL Application::IsHeadlessModeEnabled() void Application::ShowNativeErrorBox(const String& sTitle , const String& sMessage) { - ImplGetSalSystem()->ShowNativeMessageBox ( + int btn = ImplGetSalSystem()->ShowNativeMessageBox ( sTitle, sMessage, SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK); + if (btn != SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK) { + OSL_TRACE("ShowNativeMessageBox returned %d\n", btn); + } } // ----------------------------------------------------------------------- -- cgit From 0358074a3ff86d284670c891c21db53105b292ae Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 6 Apr 2010 17:15:01 +0200 Subject: jl152 import 263445 from native0jl:#i77196# supporting extension help --- l10ntools/source/help/HelpLinker.cxx | 20 +++++++++++++++----- l10ntools/source/help/compilehelp.hxx | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index ae2b88bfc470..256ed850d49e 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -245,7 +245,11 @@ class HelpLinker { public: void main(std::vector &args, - std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) +// std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) + std::string* pExtensionPath = NULL, + std::string* pDestination = NULL, + const rtl::OUString* pOfficeHelpPath = NULL ) + throw( HelpProcessingException ); HelpLinker() @@ -269,6 +273,7 @@ private: std::string lang; std::string hid; std::string extensionPath; + std::string extensionDestination; bool bExtensionMode; fs::path indexDirName; Stringtable hidlistTranslation; @@ -752,8 +757,9 @@ void HelpLinker::link() throw( HelpProcessingException ) void HelpLinker::main( std::vector &args, - std::string* pExtensionPath, const rtl::OUString* pOfficeHelpPath ) - throw( HelpProcessingException ) + std::string* pExtensionPath, std::string* pDestination, + const rtl::OUString* pOfficeHelpPath ) + throw( HelpProcessingException ) { rtl::OUString aOfficeHelpPath; @@ -764,7 +770,7 @@ void HelpLinker::main( std::vector &args, bExtensionMode = true; extensionPath = *pExtensionPath; sourceRoot = fs::path(extensionPath); - + extensionDestination = *pDestination; aOfficeHelpPath = *pOfficeHelpPath; } if (args.size() > 0 && args[0][0] == '@') @@ -1069,6 +1075,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, + const rtl::OUString& aDestination, HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo ) { @@ -1102,13 +1109,16 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() ); const char* pExtensionPath = aOExtensionLanguageRoot.getStr(); std::string aStdStrExtensionPath = pExtensionPath; + rtl::OString aODestination = rtl::OUStringToOString(aDestination, fs::getThreadTextEncoding()); + const char* pDestination = aODestination.getStr(); + std::string aStdStrDestination = pDestination; // Set error handler xmlSetStructuredErrorFunc( NULL, (xmlStructuredErrorFunc)StructuredXMLErrorFunction ); try { HelpLinker* pHelpLinker = new HelpLinker(); - pHelpLinker->main( args, &aStdStrExtensionPath, &aOfficeHelpPath ); + pHelpLinker->main( args, &aStdStrExtensionPath, &aStdStrDestination, &aOfficeHelpPath ); delete pHelpLinker; } catch( const HelpProcessingException& e ) diff --git a/l10ntools/source/help/compilehelp.hxx b/l10ntools/source/help/compilehelp.hxx index 472b15231639..9c59083bf038 100644 --- a/l10ntools/source/help/compilehelp.hxx +++ b/l10ntools/source/help/compilehelp.hxx @@ -72,6 +72,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, + const rtl::OUString& aDestination, HelpProcessingErrorInfo& o_rHelpProcessingErrorInfo ); -- cgit From 095e84c6758bd2c0c0a77a94fc8022bd64eee3ed Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 7 Apr 2010 16:54:36 +0200 Subject: fwk127: #i105851# arguments to memset are the wrong way around --- svl/source/items/nranges.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx index 284bc251a3a4..813c1fec8ebd 100644 --- a/svl/source/items/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -480,7 +480,7 @@ SfxNumRanges& SfxNumRanges::operator -= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); + memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; @@ -690,7 +690,7 @@ SfxNumRanges& SfxNumRanges::operator /= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); + memset( pTarget, 0, sizeof(NUMTYPE)*nTargetSize ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; -- cgit From a912db019040b901bdd05a17b319316004c1a663 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:24 +0200 Subject: slidecopy: if there's no active panel, focus the panel selector, when getting the focus --- svtools/source/toolpanel/toolpaneldeck.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index fe4fa63ad997..8c17802e8a48 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -32,6 +32,7 @@ #include "toolpaneldeckpeer.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" +#include "svtools/toolpanel/drawerlayouter.hxx" /** === begin UNO includes === **/ #include @@ -121,7 +122,7 @@ namespace svt void DoAction( const DeckAction i_eAction ); - void FocusActivePanel(); + bool FocusActivePanel(); void SetAccessibleParentWindow( Window* i_pAccessibleParent ); Window* GetAccessibleParentWindow() const { return m_pAccessibleParent ? m_pAccessibleParent : m_rDeck.GetAccessibleParentWindow(); } @@ -290,10 +291,15 @@ namespace svt } //-------------------------------------------------------------------- - void ToolPanelDeck_Impl::FocusActivePanel() + bool ToolPanelDeck_Impl::FocusActivePanel() { - PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); + ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() ); + if ( !aActivePanel ) + return false; + + PToolPanel pActivePanel( m_aPanels.GetPanel( *aActivePanel ) ); pActivePanel->GrabFocus(); + return true; } //-------------------------------------------------------------------- @@ -361,7 +367,8 @@ namespace svt ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) { // use a default layouter - SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); +// SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); + SetLayouter( PDeckLayouter( new DrawerDeckLayouter( *this, *this ) ) ); } //-------------------------------------------------------------------- @@ -501,7 +508,12 @@ namespace svt void ToolPanelDeck::GetFocus() { Control::GetFocus(); - m_pImpl->FocusActivePanel(); + if ( !m_pImpl->FocusActivePanel() ) + { + PDeckLayouter pLayouter( GetLayouter() ); + ENSURE_OR_RETURN_VOID( pLayouter.get(), "ToolPanelDeck::GetFocus: no layouter?!" ); + pLayouter->SetFocusToPanelSelector(); + } } //-------------------------------------------------------------------- -- cgit From 6f5988cdd0eb19dc1c4316db9f3a38787fbad2e5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:24 +0200 Subject: slidecopy: outsourced the TaskPane/ToolPanel's drawer (TitleBar, type TBT_CONTROL_TITLE) from sd to svtools, to be used with generic tool panel decks, not only within sd diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down.png Binary file default_images/sd/res/triangle_down.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_down_hc.png Binary file default_images/sd/res/triangle_down_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right.png Binary file default_images/sd/res/triangle_right.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/sd/res/triangle_right_hc.png Binary file default_images/sd/res/triangle_right_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down.png Binary file default_images/svtools/res/triangle_down.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_down_hc.png Binary file default_images/svtools/res/triangle_down_hc.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right.png Binary file default_images/svtools/res/triangle_right.png has changed diff -r b53c58c139b0 -r 348318a2bab4 default_images/svtools/res/triangle_right_hc.png Binary file default_images/svtools/res/triangle_right_hc.png has changed --- svl/inc/svl/svtools.hrc | 5 + svtools/inc/svtools/toolpanel/drawerlayouter.hxx | 102 ++++++++ svtools/source/toolpanel/drawerlayouter.cxx | 286 ++++++++++++++++++++ svtools/source/toolpanel/makefile.mk | 2 + svtools/source/toolpanel/toolpanel.src | 20 ++ svtools/source/toolpanel/toolpaneldeck.cxx | 7 +- svtools/source/toolpanel/toolpaneldrawer.cxx | 319 +++++++++++++++++++++++ svtools/source/toolpanel/toolpaneldrawer.hxx | 74 ++++++ 8 files changed, 813 insertions(+), 2 deletions(-) create mode 100644 svtools/inc/svtools/toolpanel/drawerlayouter.hxx create mode 100644 svtools/source/toolpanel/drawerlayouter.cxx create mode 100644 svtools/source/toolpanel/toolpaneldrawer.cxx create mode 100644 svtools/source/toolpanel/toolpaneldrawer.hxx diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc index e4cc91cfcb49..cf782afdd71e 100644 --- a/svl/inc/svl/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -471,6 +471,11 @@ #define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16) #define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17) +#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18) +#define IMG_TRIANGLE_RIGHT_HC (RID_SVTOOLS_START + 19) +#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) +#define IMG_TRIANGLE_DOWN_HC (RID_SVTOOLS_START + 21) + #define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40) #define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) diff --git a/svtools/inc/svtools/toolpanel/drawerlayouter.hxx b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx new file mode 100644 index 000000000000..0ecf493d0e98 --- /dev/null +++ b/svtools/inc/svtools/toolpanel/drawerlayouter.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 SVT_DRAWERLAYOUTER_HXX +#define SVT_DRAWERLAYOUTER_HXX + +#include "svtools/svtdllapi.h" +#include "svtools/toolpanel/refbase.hxx" +#include "svtools/toolpanel/toolpaneldeck.hxx" +#include "svtools/toolpanel/decklayouter.hxx" + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + class ToolPanelViewShell; + class ToolPanelDrawer; + typedef ::boost::shared_ptr< ToolPanelDrawer > PToolPanelDrawer; + + //================================================================================================================== + //= ToolPanelDrawer + //================================================================================================================== + /** a class which implements a tool panel selector in the form of the classical drawers + */ + class SVT_DLLPUBLIC DrawerDeckLayouter :public RefBase + ,public IDeckLayouter + ,public IToolPanelDeckListener + { + public: + DrawerDeckLayouter( + ::Window& i_rParentWindow, + IToolPanelDeck& i_rPanels + ); + ~DrawerDeckLayouter(); + + // IReference + DECLARE_IREFERENCE() + + // IDeckLayouter + virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); + virtual void Destroy(); + virtual void SetFocusToPanelSelector(); + virtual size_t GetAccessibleChildCount() const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetAccessibleChild( + const size_t i_nChildIndex, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); + + // IToolPanelDeckListener + virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + private: + // triggers a re-arrance of the panel deck elements + void impl_triggerRearrange() const; + size_t impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const; + void impl_removeDrawer( const size_t i_nPosition ); + + DECL_LINK( OnWindowEvent, VclSimpleEvent* ); + +private: + Window& m_rParentWindow; + IToolPanelDeck& m_rPanelDeck; + ::std::vector< PToolPanelDrawer > m_aDrawers; + ::boost::optional< size_t > m_aLastKnownActivePanel; + }; + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... + +#endif // SVT_DRAWERLAYOUTER_HXX diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx new file mode 100644 index 000000000000..d9aa80369827 --- /dev/null +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -0,0 +1,286 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * +************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "svtools/toolpanel/drawerlayouter.hxx" +#include "toolpaneldrawer.hxx" + +#include + +#include +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::accessibility::XAccessible; + /** === end UNO using === **/ + + //================================================================================================================== + //= DrawerDeckLayouter + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + DrawerDeckLayouter::DrawerDeckLayouter( ::Window& i_rParentWindow, IToolPanelDeck& i_rPanels ) + :m_rParentWindow( i_rParentWindow ) + ,m_rPanelDeck( i_rPanels ) + ,m_aDrawers() + ,m_aLastKnownActivePanel() + { + m_rPanelDeck.AddListener( *this ); + + // simulate PanelInserted events for the panels which are already there + for ( size_t i=0; i aActivePanel( m_rPanelDeck.GetActivePanel() ); + if ( !aActivePanel ) + aActivePanel = m_aLastKnownActivePanel; + + // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus + // the title bar of the active panel itself + Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() ); + const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; + for ( size_t i=0; i<=nUpperBound; ++i ) + { + sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); + m_aDrawers[i]->SetPosSizePixel( + aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); + aUpperDrawerPos.Move( 0, nDrawerHeight ); + } + + // arrange title bars which are below the active panel (or *none* if there is no active panel) + Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); + for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) + { + sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); + m_aDrawers[j]->SetPosSizePixel( + Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), + Size( nWidth, nDrawerHeight ) + ); + aLowerDrawerPos.Move( 0, -nDrawerHeight ); + } + + // fincally calculate the rectangle for the active panel + return Rectangle( + aUpperDrawerPos, + Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 ) + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::Destroy() + { + while ( !m_aDrawers.empty() ) + impl_removeDrawer( 0 ); + m_rPanelDeck.RemoveListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::SetFocusToPanelSelector() + { + const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); + if ( !nPanelCount ) + // nothing to focus + return; + ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); + if ( !aActivePanel ) + aActivePanel = 0; + ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "DrawerDeckLayouter::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" ); + m_aDrawers[ *aActivePanel ]->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + size_t DrawerDeckLayouter::GetAccessibleChildCount() const + { + return m_aDrawers.size(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > DrawerDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", NULL ); + + const PToolPanelDrawer pDrawer( m_aDrawers[ i_nChildIndex ] ); + + Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( FALSE ); + if ( !xItemAccessible.is() ) + { + xItemAccessible = pDrawer->GetAccessible( TRUE ); + ENSURE_OR_RETURN( xItemAccessible.is(), "illegal accessible provided by the drawer implementation!", NULL ); + OSL_VERIFY( ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xItemAccessible->getAccessibleContext(), + i_rParentAccessible ) ); + } + + return xItemAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) + { + OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); + + PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow ) ); + pDrawer->SetText( i_pPanel->GetDisplayName() ); + pDrawer->Show(); + pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); + m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer ); + impl_triggerRearrange(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::PanelRemoved( const size_t i_nPosition ) + { + impl_removeDrawer( i_nPosition ); + impl_triggerRearrange(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::impl_triggerRearrange() const + { + // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its + // Resize implementation, rearrances all elements. + m_rParentWindow.Resize(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( !!i_rOldActive ) + { + OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal old index!" ); + m_aDrawers[ *i_rOldActive ]->SetExpanded( false ); + } + + if ( !!i_rNewActive ) + { + OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal new index!" ); + m_aDrawers[ *i_rNewActive ]->SetExpanded( true ); + } + + impl_triggerRearrange(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) + { + // not interested in + (void)i_rNewLayouter; + } + + //------------------------------------------------------------------------------------------------------------------ + size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const Window* i_pDrawerWindow ) const + { + for ( ::std::vector< PToolPanelDrawer >::const_iterator drawerPos = m_aDrawers.begin(); + drawerPos != m_aDrawers.end(); + ++drawerPos + ) + { + if ( drawerPos->get() == i_pDrawerWindow ) + return drawerPos - m_aDrawers.begin(); + } + return m_aDrawers.size(); + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::impl_removeDrawer( const size_t i_nPosition ) + { + OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" ); + m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); + OSL_ENSURE( m_aDrawers[ i_nPosition ].unique(), "DrawerDeckLayouter::impl_removeDrawer: somebody else is still holding a reference!" ); + m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( DrawerDeckLayouter, OnWindowEvent, VclSimpleEvent*, i_pEvent ) + { + const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent ); + ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L ); + + bool bActivatePanel = false; + switch ( pWindowEvent->GetId() ) + { + case VCLEVENT_WINDOW_MOUSEBUTTONUP: + { + const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() ); + ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L ); + if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) + { + bActivatePanel = true; + } + } + break; + case VCLEVENT_WINDOW_KEYINPUT: + { + const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() ); + ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L ); + const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); + if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) + { + bActivatePanel = true; + } + } + break; + } + if ( bActivatePanel ) + { + const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); + m_rPanelDeck.ActivatePanel( nPanelPos ); + return 1L; + } + return 0L; + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerDeckLayouter::Dying() + { + Destroy(); + } + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index 9d293b56d231..d36b377f3dfe 100755 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -48,6 +48,7 @@ SRC1FILES=\ toolpanel.src SLOFILES=\ + $(SLO)$/drawerlayouter.obj \ $(SLO)$/dummypanel.obj \ $(SLO)$/paneldecklisteners.obj \ $(SLO)$/paneltabbar.obj \ @@ -57,6 +58,7 @@ SLOFILES=\ $(SLO)$/tablayouter.obj \ $(SLO)$/toolpanel.obj \ $(SLO)$/toolpanelcollection.obj \ + $(SLO)$/toolpaneldrawer.obj \ $(SLO)$/toolpaneldeck.obj \ $(SLO)$/toolpaneldeckpeer.obj \ diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src index 4861fbfd14ac..0cbc3ea5896d 100644 --- a/svtools/source/toolpanel/toolpanel.src +++ b/svtools/source/toolpanel/toolpanel.src @@ -37,3 +37,23 @@ String STR_SVT_ACC_BEGIN + 1 { Text [ en-US ] = "Tab Panel Scroll Button, forward"; }; + +Image IMG_TRIANGLE_RIGHT +{ + ImageBitmap = Bitmap { File = "triangle_right.png"; }; +}; + +Image IMG_TRIANGLE_RIGHT_HC +{ + ImageBitmap = Bitmap { File = "triangle_right_hc.png"; }; +}; + +Image IMG_TRIANGLE_DOWN +{ + ImageBitmap = Bitmap { File = "triangle_down.png"; }; +}; + +Image IMG_TRIANGLE_DOWN_HC +{ + ImageBitmap = Bitmap { File = "plus.png"; } ; +}; diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 8c17802e8a48..349677a1e9ce 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -125,7 +125,7 @@ namespace svt bool FocusActivePanel(); void SetAccessibleParentWindow( Window* i_pAccessibleParent ); - Window* GetAccessibleParentWindow() const { return m_pAccessibleParent ? m_pAccessibleParent : m_rDeck.GetAccessibleParentWindow(); } + Window* GetAccessibleParentWindow() const { return m_pAccessibleParent; } protected: // IToolPanelDeckListener @@ -525,7 +525,10 @@ namespace svt //-------------------------------------------------------------------- Window* ToolPanelDeck::GetAccessibleParentWindow() const { - return m_pImpl->GetAccessibleParentWindow(); + Window* pAccessibleParent( m_pImpl->GetAccessibleParentWindow() ); + if ( !pAccessibleParent ) + pAccessibleParent = Window::GetAccessibleParentWindow(); + return pAccessibleParent; } //-------------------------------------------------------------------- diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx new file mode 100644 index 000000000000..3beb209672ec --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -0,0 +1,319 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "toolpaneldrawer.hxx" +#include "svtools/svtdata.hxx" + +#include + +#include +#include +#include +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + + static const int s_nIndentationWidth = 16; + + //================================================================================================================== + //= ToolPanelDrawer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent ) + :Window( &i_rParent, 0 ) + ,m_pPaintDevice( new VirtualDevice( *this ) ) + ,m_bFocused( false ) + ,m_bExpanded( false ) + { + EnableMapMode( FALSE ); + SetBackground( Wallpaper() ); + SetPointer( POINTER_REFHAND ); + + SetAccessibleRole( AccessibleRole::LABEL ); + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDrawer::~ToolPanelDrawer() + { + } + + //------------------------------------------------------------------------------------------------------------------ + long ToolPanelDrawer::GetPreferredHeightPixel() + { + Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) ); + return aTitleBarBox.GetHeight(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::Paint( const Rectangle& i_rBoundingBox ) + { + m_pPaintDevice->SetMapMode( GetMapMode() ); + m_pPaintDevice->SetOutputSize( GetOutputSizePixel() ); + m_pPaintDevice->SetSettings( GetSettings() ); + m_pPaintDevice->SetDrawMode( GetDrawMode() ); + + const int nWidth( GetOutputSizePixel().Width() ); + const Rectangle aTextBox( impl_calcTextBoundingBox() ); + impl_paintBackground( impl_calcTitleBarBox( aTextBox ) ); + + Rectangle aFocusBox( impl_paintExpansionIndicator( aTextBox ) ); + + m_pPaintDevice->DrawText( aTextBox, GetText(), impl_getTextStyle() ); + + aFocusBox.Union( aTextBox ); + aFocusBox.Left() += 2; + impl_paintFocusIndicator( aFocusBox ); + + DrawOutDev( + Point(), GetOutputSizePixel(), + Point(), GetOutputSizePixel(), + *m_pPaintDevice + ); + + ::Window::Paint( i_rBoundingBox ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle ToolPanelDrawer::impl_paintExpansionIndicator( const Rectangle& i_rTextBox ) + { + Rectangle aExpansionIndicatorArea; + + Image aImage( impl_getExpansionIndicator() ); + const int nHeight( aImage.GetSizePixel().Height() ); + if ( nHeight > 0 ) + { + Point aPosition( + 0, + i_rTextBox.Top() + ( GetTextHeight() - nHeight ) / 2 + ); + m_pPaintDevice->DrawImage( aPosition, aImage ); + + aExpansionIndicatorArea = Rectangle( aPosition, aImage.GetSizePixel() ); + } + + return aExpansionIndicatorArea; + } + + //------------------------------------------------------------------------------------------------------------------ + Image ToolPanelDrawer::impl_getExpansionIndicator() const + { + const bool bHighContrastMode( GetSettings().GetStyleSettings().GetHighContrastMode() != 0 ); + USHORT nResourceId = 0; + if ( m_bExpanded ) + if ( bHighContrastMode ) + nResourceId = IMG_TRIANGLE_DOWN_HC; + else + nResourceId = IMG_TRIANGLE_DOWN; + else + if ( bHighContrastMode ) + nResourceId = IMG_TRIANGLE_RIGHT_HC; + else + nResourceId = IMG_TRIANGLE_RIGHT; + return Image( SvtResId( nResourceId ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + USHORT ToolPanelDrawer::impl_getTextStyle() + { + const USHORT nBasicStyle = TEXT_DRAW_LEFT + | TEXT_DRAW_TOP + | TEXT_DRAW_WORDBREAK; + + if ( IsEnabled() ) + return nBasicStyle; + + return nBasicStyle | TEXT_DRAW_DISABLE; + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::impl_paintBackground( const Rectangle& i_rTitleBarBox ) + { + m_pPaintDevice->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); + m_pPaintDevice->DrawRect( i_rTitleBarBox ); + + m_pPaintDevice->SetFillColor(); + m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); + m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.TopRight() ); + m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.BottomLeft() ); + + m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); + m_pPaintDevice->DrawLine( i_rTitleBarBox.BottomLeft(), i_rTitleBarBox.BottomRight() ); + m_pPaintDevice->DrawLine( i_rTitleBarBox.TopRight(), i_rTitleBarBox.BottomRight() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::impl_paintFocusIndicator( const Rectangle& i_rTextBox ) + { + if ( m_bFocused ) + { + const Rectangle aTextPixelBox( m_pPaintDevice->LogicToPixel( i_rTextBox ) ); + + m_pPaintDevice->EnableMapMode( FALSE ); + m_pPaintDevice->SetFillColor(); + + Rectangle aBox( i_rTextBox ); + aBox.Top() -= 1; + aBox.Bottom() += 1; + + m_pPaintDevice->DrawRect( aTextPixelBox ); + + LineInfo aDottedStyle( LINE_DASH ); + aDottedStyle.SetDashCount( 0 ); + aDottedStyle.SetDotCount( 1 ); + aDottedStyle.SetDotLen( 1 ); + aDottedStyle.SetDistance( 1 ); + + m_pPaintDevice->SetLineColor( COL_BLACK ); + m_pPaintDevice->DrawPolyLine( Polygon( aTextPixelBox ), aDottedStyle ); + m_pPaintDevice->EnableMapMode( FALSE ); + } + else + HideFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::GetFocus() + { + m_bFocused = true; + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::LoseFocus() + { + m_bFocused = false; + Invalidate(); + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent ) + { + Window::DataChanged( i_rEvent ); + + switch ( i_rEvent.GetType() ) + { + case DATACHANGED_SETTINGS: + if ( ( i_rEvent.GetFlags() & SETTINGS_STYLE ) == 0 ) + break; + SetSettings( Application::GetSettings() ); + m_pPaintDevice.reset( new VirtualDevice( *this ) ); + + // fall through. + + case DATACHANGED_FONTS: + case DATACHANGED_FONTSUBSTITUTION: + { + const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + + // Font. + Font aFont = rStyleSettings.GetAppFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + // Color. + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = rStyleSettings.GetButtonTextColor(); + SetTextColor( aColor ); + SetTextFillColor(); + + Invalidate(); + } + break; + } + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::SetText( const String& i_rText ) + { + Window::SetText( i_rText ); + SetAccessibleName( i_rText ); + SetAccessibleDescription( i_rText ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() + { + Font aFont( GetFont() ); + if ( m_bExpanded ) + aFont.SetWeight( m_bExpanded ? WEIGHT_BOLD : WEIGHT_NORMAL ); + m_pPaintDevice->SetFont( aFont ); + + int nAvailableWidth = m_pPaintDevice->GetTextWidth( GetText() ); + + Rectangle aTextBox( + Point(), + Size( + nAvailableWidth, + GetSettings().GetStyleSettings().GetTitleHeight() + ) + ); + aTextBox.Top() += ( aTextBox.GetHeight() - GetTextHeight() ) / 2; + aTextBox.Left() += s_nIndentationWidth; + aTextBox.Right() -= 1; + + aTextBox = m_pPaintDevice->GetTextRect( aTextBox, GetText(), impl_getTextStyle() ); + return aTextBox; + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) + { + Rectangle aTitleBarBox( i_rTextBox ); + aTitleBarBox.Bottom() += aTitleBarBox.Top(); + aTitleBarBox.Top() = 0; + aTitleBarBox.Left() = 0; + + const long nWidth = GetOutputSizePixel().Width(); + if ( aTitleBarBox.GetWidth() < nWidth ) + aTitleBarBox.Right() = nWidth - 1; + + return aTitleBarBox; + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::SetExpanded( const bool i_bExpanded ) + { + if ( m_bExpanded != i_bExpanded ) + { + m_bExpanded = i_bExpanded; + Invalidate(); + } + } + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx new file mode 100644 index 000000000000..e4f00badb78f --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + //================================================================================================================== + //= ToolPanelDrawer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + class ToolPanelDrawer : public Window + { + public: + ToolPanelDrawer( Window& i_rParent ); + ~ToolPanelDrawer(); + + long GetPreferredHeightPixel(); + + void SetExpanded( const bool i_bExpanded ); + + virtual void Paint( const Rectangle& i_rBoundingBox ); + virtual void GetFocus(); + virtual void LoseFocus(); + virtual void DataChanged( const DataChangedEvent& i_rEvent ); + virtual void SetText( const String& i_rText ); + + private: + Rectangle impl_calcTextBoundingBox(); + Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ); + void impl_paintBackground( const Rectangle& i_rTitleBarBox ); + USHORT impl_getTextStyle(); + void impl_paintFocusIndicator( const Rectangle& i_rTextBox ); + Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox ); + Image impl_getExpansionIndicator() const; + + private: + ::std::auto_ptr< VirtualDevice > m_pPaintDevice; + bool m_bFocused; + bool m_bExpanded; + }; + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... -- cgit From e27f829f0371ad8484de9402fb1cd1d6a5610673 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:25 +0200 Subject: slidecopy: A11Y implementation for single ToolPanelDrawer instances --- svtools/source/toolpanel/drawerlayouter.cxx | 3 +- svtools/source/toolpanel/makefile.mk | 1 + svtools/source/toolpanel/toolpaneldrawer.cxx | 31 +++-- svtools/source/toolpanel/toolpaneldrawer.hxx | 21 ++-- svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 138 +++++++++++++++++++++++ svtools/source/toolpanel/toolpaneldrawerpeer.hxx | 56 +++++++++ 6 files changed, 232 insertions(+), 18 deletions(-) create mode 100644 svtools/source/toolpanel/toolpaneldrawerpeer.cxx create mode 100644 svtools/source/toolpanel/toolpaneldrawerpeer.hxx diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index d9aa80369827..2d73a5d1c0b9 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -164,8 +164,7 @@ namespace svt { OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); - PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow ) ); - pDrawer->SetText( i_pPanel->GetDisplayName() ); + PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) ); pDrawer->Show(); pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer ); diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk index d36b377f3dfe..58282056f529 100755 --- a/svtools/source/toolpanel/makefile.mk +++ b/svtools/source/toolpanel/makefile.mk @@ -59,6 +59,7 @@ SLOFILES=\ $(SLO)$/toolpanel.obj \ $(SLO)$/toolpanelcollection.obj \ $(SLO)$/toolpaneldrawer.obj \ + $(SLO)$/toolpaneldrawerpeer.obj \ $(SLO)$/toolpaneldeck.obj \ $(SLO)$/toolpaneldeckpeer.obj \ diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 3beb209672ec..1ee8273a95b4 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -27,6 +27,7 @@ #include "precompiled_svtools.hxx" #include "toolpaneldrawer.hxx" +#include "toolpaneldrawerpeer.hxx" #include "svtools/svtdata.hxx" #include @@ -35,12 +36,15 @@ #include #include #include +#include //...................................................................................................................... namespace svt { //...................................................................................................................... + using ::com::sun::star::uno::Reference; + using ::com::sun::star::awt::XWindowPeer; namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; static const int s_nIndentationWidth = 16; @@ -49,7 +53,7 @@ namespace svt //= ToolPanelDrawer //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent ) + ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ) :Window( &i_rParent, 0 ) ,m_pPaintDevice( new VirtualDevice( *this ) ) ,m_bFocused( false ) @@ -60,6 +64,10 @@ namespace svt SetPointer( POINTER_REFHAND ); SetAccessibleRole( AccessibleRole::LABEL ); + + SetText( i_rTitle ); + SetAccessibleName( i_rTitle ); + SetAccessibleDescription( i_rTitle ); } //------------------------------------------------------------------------------------------------------------------ @@ -68,7 +76,7 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - long ToolPanelDrawer::GetPreferredHeightPixel() + long ToolPanelDrawer::GetPreferredHeightPixel() const { Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) ); return aTitleBarBox.GetHeight(); @@ -143,7 +151,7 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - USHORT ToolPanelDrawer::impl_getTextStyle() + USHORT ToolPanelDrawer::impl_getTextStyle() const { const USHORT nBasicStyle = TEXT_DRAW_LEFT | TEXT_DRAW_TOP @@ -257,15 +265,19 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::SetText( const String& i_rText ) + Reference< XWindowPeer > ToolPanelDrawer::GetComponentInterface( BOOL i_bCreate ) { - Window::SetText( i_rText ); - SetAccessibleName( i_rText ); - SetAccessibleDescription( i_rText ); + Reference< XWindowPeer > xWindowPeer( Window::GetComponentInterface( FALSE ) ); + if ( !xWindowPeer.is() && i_bCreate ) + { + xWindowPeer.set( new ToolPanelDrawerPeer() ); + SetComponentInterface( xWindowPeer ); + } + return xWindowPeer; } //------------------------------------------------------------------------------------------------------------------ - Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() + Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() const { Font aFont( GetFont() ); if ( m_bExpanded ) @@ -290,7 +302,7 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) + Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const { Rectangle aTitleBarBox( i_rTextBox ); aTitleBarBox.Bottom() += aTitleBarBox.Top(); @@ -310,6 +322,7 @@ namespace svt if ( m_bExpanded != i_bExpanded ) { m_bExpanded = i_bExpanded; + CallEventListeners( m_bExpanded ? VCLEVENT_LISTBOX_ENTRY_EXPANDED : VCLEVENT_LISTBOX_ENTRY_COLLAPSED ); Invalidate(); } } diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index e4f00badb78f..992c15d67d6d 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -41,28 +41,35 @@ namespace svt class ToolPanelDrawer : public Window { public: - ToolPanelDrawer( Window& i_rParent ); + ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ); ~ToolPanelDrawer(); - long GetPreferredHeightPixel(); - + long GetPreferredHeightPixel() const; void SetExpanded( const bool i_bExpanded ); + bool IsExpanded() const { return m_bExpanded; } + protected: + // Window overridables virtual void Paint( const Rectangle& i_rBoundingBox ); virtual void GetFocus(); virtual void LoseFocus(); virtual void DataChanged( const DataChangedEvent& i_rEvent ); - virtual void SetText( const String& i_rText ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + GetComponentInterface( BOOL i_bCreate ); private: - Rectangle impl_calcTextBoundingBox(); - Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ); + Rectangle impl_calcTextBoundingBox() const; + Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const; void impl_paintBackground( const Rectangle& i_rTitleBarBox ); - USHORT impl_getTextStyle(); + USHORT impl_getTextStyle() const; void impl_paintFocusIndicator( const Rectangle& i_rTextBox ); Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox ); Image impl_getExpansionIndicator() const; + // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change. + using Window::SetText; + private: ::std::auto_ptr< VirtualDevice > m_pPaintDevice; bool m_bFocused; diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx new file mode 100644 index 000000000000..e535678af23e --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "toolpaneldrawerpeer.hxx" +#include "toolpaneldrawer.hxx" + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessibleContext; + /** === end UNO using === **/ + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + + //================================================================================================================== + //= ToolPanelDrawerContext + //================================================================================================================== + class ToolPanelDrawerContext : public VCLXAccessibleComponent + { + public: + ToolPanelDrawerContext( VCLXWindow& i_rWindow ) + :VCLXAccessibleComponent( &i_rWindow ) + { + } + + virtual void ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + protected: + ~ToolPanelDrawerContext() + { + } + }; + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ) + { + VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent ); + + switch ( i_rVclWindowEvent.GetId() ) + { + case VCLEVENT_LISTBOX_ENTRY_EXPANDED: + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) ); + break; + case VCLEVENT_LISTBOX_ENTRY_COLLAPSED: + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() ); + break; + } + } + + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) + { + VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet ); + if ( !GetWindow() ) + return; + + i_rStateSet.AddState( AccessibleStateType::EXPANDABLE ); + + const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) ); + ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" ); + if ( pDrawer->IsExpanded() ) + i_rStateSet.AddState( AccessibleStateType::EXPANDED ); + } + + //================================================================================================================== + //= ToolPanelDrawerPeer + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDrawerPeer::ToolPanelDrawerPeer() + :VCLXWindow() + { + } + + //------------------------------------------------------------------------------------------------------------------ + ToolPanelDrawerPeer::~ToolPanelDrawerPeer() + { + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext() + { + ::vos::OGuard aSolarGuard( GetMutex() ); + return new ToolPanelDrawerContext( *this ); + } + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx new file mode 100644 index 000000000000..5fcf0ac0ae7c --- /dev/null +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 SVT_TOOLPANELDRAWERPEER_HXX +#define SVT_TOOLPANELDRAWERPEER_HXX + +#include + +//...................................................................................................................... +namespace svt +{ +//...................................................................................................................... + + //================================================================================================================== + //= ToolPanelDrawerPeer + //================================================================================================================== + class ToolPanelDrawerPeer : public VCLXWindow + { + public: + ToolPanelDrawerPeer(); + + protected: + ~ToolPanelDrawerPeer(); + + // VCLXWindow overridables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); + }; + +//...................................................................................................................... +} // namespace svt +//...................................................................................................................... + +#endif // SVT_TOOLPANELDRAWERPEER_HXX -- cgit From 5545c8a373f0ae3265be01f3c0e4925f2502a8bc Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:25 +0200 Subject: slidecopy: VCLEVENT_LISTBOX_ENTRY_EXPANDED/COLLAPSED => VCLEVENT_ITEM_EXPANDED/COLLAPSED (to allow re-using it in the tool panel drawer items) --- svtools/source/contnr/svtreebx.cxx | 4 ++-- svtools/source/toolpanel/toolpaneldrawer.cxx | 2 +- svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 4 ++-- vcl/inc/vcl/vclevent.hxx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 503325ddf802..aac477dd71d2 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -1044,7 +1044,7 @@ BOOL SvTreeListBox::Expand( SvLBoxEntry* pParent ) // --> OD 2009-04-01 #i92103# if ( bExpanded ) { - pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_EXPANDED, pParent ); + pImp->CallEventListeners( VCLEVENT_ITEM_EXPANDED, pParent ); } // <-- @@ -1071,7 +1071,7 @@ BOOL SvTreeListBox::Collapse( SvLBoxEntry* pParent ) // --> OD 2009-04-01 #i92103# if ( bCollapsed ) { - pImp->CallEventListeners( VCLEVENT_LISTBOX_ENTRY_COLLAPSED, pParent ); + pImp->CallEventListeners( VCLEVENT_ITEM_COLLAPSED, pParent ); } // <-- diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 1ee8273a95b4..b0a78ba4e988 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -322,7 +322,7 @@ namespace svt if ( m_bExpanded != i_bExpanded ) { m_bExpanded = i_bExpanded; - CallEventListeners( m_bExpanded ? VCLEVENT_LISTBOX_ENTRY_EXPANDED : VCLEVENT_LISTBOX_ENTRY_COLLAPSED ); + CallEventListeners( m_bExpanded ? VCLEVENT_ITEM_EXPANDED : VCLEVENT_ITEM_COLLAPSED ); Invalidate(); } } diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx index e535678af23e..398445991cdd 100644 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx @@ -88,10 +88,10 @@ namespace svt switch ( i_rVclWindowEvent.GetId() ) { - case VCLEVENT_LISTBOX_ENTRY_EXPANDED: + case VCLEVENT_ITEM_EXPANDED: NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) ); break; - case VCLEVENT_LISTBOX_ENTRY_COLLAPSED: + case VCLEVENT_ITEM_COLLAPSED: NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() ); break; } diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index 570c8ad0a342..7f3fb70fd061 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -157,8 +157,8 @@ namespace com { namespace sun { namespace star { #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout #define VCLEVENT_COMBOBOX_SETTEXT 1173 // --> OD 2009-04-01 #i92103# -#define VCLEVENT_LISTBOX_ENTRY_EXPANDED 1174 -#define VCLEVENT_LISTBOX_ENTRY_COLLAPSED 1175 +#define VCLEVENT_ITEM_EXPANDED 1174 +#define VCLEVENT_ITEM_COLLAPSED 1175 // <-- #define VCLEVENT_DROPDOWN_PRE_OPEN 1176 -- cgit From a0bdb21dbb4de7cbd5e2991dbdafe97f85cd918e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:25 +0200 Subject: slidecopy: added non-ASCII version of the new convenience-ctor --- unotools/inc/unotools/confignode.hxx | 8 ++++++++ unotools/source/config/confignode.cxx | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index a1271b1eeed1..33ee99f17138 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -283,6 +283,14 @@ namespace utl const bool i_bUpdatable ); + /** creates a configuration tree for the given path in the given mode + */ + OConfigurationTreeRoot( + const ::comphelper::ComponentContext& i_rContext, + const ::rtl::OUString& i_rNodePath, + const bool i_bUpdatable + ); + /// copy ctor OConfigurationTreeRoot(const OConfigurationTreeRoot& _rSource) :OConfigurationNode(_rSource), m_xCommitter(_rSource.m_xCommitter) { } diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index fc4e20e6f600..4927f82023eb 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -570,6 +570,19 @@ namespace utl } } + //------------------------------------------------------------------------ + OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable ) + :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ), + i_rNodePath, i_bUpdatable, -1, false ).get() ) + ,m_xCommitter() + { + if ( i_bUpdatable ) + { + m_xCommitter.set( getUNONode(), UNO_QUERY ); + OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" ); + } + } + //------------------------------------------------------------------------ void OConfigurationTreeRoot::clear() throw() { -- cgit From d2910d38be6f4eda0841b15f2b0a77a327d12305 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 7 Apr 2010 22:36:25 +0200 Subject: slidecopy: WB_TABSTOP --- svtools/source/toolpanel/toolpaneldrawer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index b0a78ba4e988..66a0a1491d19 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -54,7 +54,7 @@ namespace svt //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ) - :Window( &i_rParent, 0 ) + :Window( &i_rParent, WB_TABSTOP ) ,m_pPaintDevice( new VirtualDevice( *this ) ) ,m_bFocused( false ) ,m_bExpanded( false ) -- cgit From 7a00b3600e888d1744ca8ca58924ad9bb59b023d Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 8 Apr 2010 10:20:00 +0200 Subject: fwk138: #161971# open the OpOfXML documents in repair mode always --- comphelper/inc/comphelper/storagehelper.hxx | 9 ++++++--- comphelper/source/misc/storagehelper.cxx | 27 ++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 796c0ad47142..b613ddd2c5f1 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -136,7 +136,8 @@ public: const ::rtl::OUString& aURL, sal_Int32 nStorageMode, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > @@ -144,7 +145,8 @@ public: const ::rtl::OUString& aFormat, const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > @@ -153,7 +155,8 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream, sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory - = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) + = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(), + sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed ); diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index eda42ec98abb..e2557523f674 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -328,12 +328,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( const ::rtl::OUString& aFormat, const ::rtl::OUString& aURL, sal_Int32 nStorageMode, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= aURL; @@ -352,12 +359,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL( uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStream( const ::rtl::OUString& aFormat, const uno::Reference < io::XInputStream >& xStream, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= xStream; @@ -377,12 +391,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( const ::rtl::OUString& aFormat, const uno::Reference < io::XStream >& xStream, sal_Int32 nStorageMode, - const uno::Reference< lang::XMultiServiceFactory >& xFactory ) + const uno::Reference< lang::XMultiServiceFactory >& xFactory, + sal_Bool bRepairStorage ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) ); aProps[0].Value <<= aFormat; + if ( bRepairStorage ) + { + aProps.realloc( 2 ); + aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) ); + aProps[1].Value <<= bRepairStorage; + } uno::Sequence< uno::Any > aArgs( 3 ); aArgs[0] <<= xStream; -- cgit From ae26801d4b351eee944156e3cb1d73879d011089 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 10:54:51 +0200 Subject: slidecopy: +getNodePath --- unotools/inc/unotools/confignode.hxx | 3 +++ unotools/source/config/confignode.cxx | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index 33ee99f17138..9be8b20d7a3e 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -100,6 +100,9 @@ namespace utl /// returns the local name of the node ::rtl::OUString getLocalName() const; + /// returns the fully qualified path of the node + ::rtl::OUString getNodePath() const; + /** open a sub node @param _rPath access path of the to-be-opened sub node. May be a hierarchical path. */ diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 4927f82023eb..c6ff13a6590a 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -154,6 +154,22 @@ namespace utl return sLocalName; } + //------------------------------------------------------------------------ + ::rtl::OUString OConfigurationNode::getNodePath() const + { + ::rtl::OUString sNodePath; + try + { + Reference< XHierarchicalName > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); + sNodePath = xNamed->getHierarchicalName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sNodePath; + } + //------------------------------------------------------------------------ ::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const { -- cgit From 3f41f560e4d5ddf018ce81abb7aaa7934dbc2dc1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 8 Apr 2010 11:32:16 +0200 Subject: slidecopy: default WinBits to WB_DIALOGCONTROL --- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 358464211255..92412212133b 100755 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -137,7 +137,7 @@ namespace svt ,public IToolPanelDeck { public: - ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle ); + ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL ); ~ToolPanelDeck(); // attributes -- cgit From 323f4068f6e23a23cfdc80b02142c32dc9fd0bb6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 8 Apr 2010 11:25:25 +0100 Subject: cmcfixes74: #i110050# make tools headers strict-aliasing safe --- tools/inc/tools/solar.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 1d248853f895..27ab33023f22 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -122,23 +122,13 @@ typedef BYTE SVBT64[8]; #ifdef __cplusplus inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; } -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1 -inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; } -#else inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0] + ((USHORT)p[1] << 8); } -#endif -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1 -inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return *(sal_uInt32*)p; } -#else inline sal_uInt32 SVBT32ToUInt32 ( const SVBT32 p ) { return (sal_uInt32)p[0] + ((sal_uInt32)p[1] << 8) + ((sal_uInt32)p[2] << 16) + ((sal_uInt32)p[3] << 24); } -#endif -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1 -inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; } -#elif defined OSL_LITENDIAN +#if defined OSL_LITENDIAN inline double SVBT64ToDouble( const SVBT64 p ) { double n; ((BYTE*)&n)[0] = p[0]; ((BYTE*)&n)[1] = p[1]; @@ -163,23 +153,13 @@ inline double SVBT64ToDouble( const SVBT64 p ) { double n; #endif inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; } -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT2 == 1 -inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; } -#else inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n; p[1] = (BYTE)(n >> 8); } -#endif -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT4 == 1 -inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { *(sal_uInt32*)p = n; } -#else inline void UInt32ToSVBT32 ( sal_uInt32 n, SVBT32 p ) { p[0] = (BYTE) n; p[1] = (BYTE)(n >> 8); p[2] = (BYTE)(n >> 16); p[3] = (BYTE)(n >> 24); } -#endif -#if defined OSL_LITENDIAN && SAL_TYPES_ALIGNMENT8 == 1 -inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; } -#elif defined OSL_LITENDIAN +#if defined OSL_LITENDIAN inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0]; p[1] = ((BYTE*)&n)[1]; p[2] = ((BYTE*)&n)[2]; -- cgit From 753b209ebcb42d313359fc4062201461b21213a1 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 8 Apr 2010 17:26:09 +0200 Subject: fwk139: #i100512# Eliminate flicker when toolbar buttons make themselves invisible --- svtools/inc/svtools/toolboxcontroller.hxx | 24 ++++++- svtools/source/uno/toolboxcontroller.cxx | 101 ++++++++++++++++++++++++++++-- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index 27ed315a3c04..e1ba26607922 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -42,7 +42,13 @@ #include #include #include - +//shizhoubo for ToolbarController Visiable +#include +#include +#include +#include +#include +//end #ifndef INCLUDED_HASH_MAP #include #define INCLUDED_HASH_MAP @@ -57,9 +63,13 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL public ::com::sun::star::lang::XInitialization, public ::com::sun::star::util::XUpdatable, public ::com::sun::star::lang::XComponent, - public ::comphelper::OBaseMutex, + public ::comphelper::OMutexAndBroadcastHelper,//shizhoubo + public ::comphelper::OPropertyContainer,//shizhoubo + public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,//shizhoubo public ::cppu::OWeakObject { + private: + sal_Bool m_bSupportVisiable; //shizhoubo public: ToolboxController( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rServiceManager, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, @@ -102,8 +112,18 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + // OPropertySetHelper //shizhoubo + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& rValue ) throw(com::sun::star::uno::Exception); + virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& rConvertedValue, com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const com::sun::star::uno::Any& rValue) throw(com::sun::star::lang::IllegalArgumentException); + // XPropertySet //shizhoubo + virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + // OPropertyArrayUsageHelper //shizhoubo + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + protected: + void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo struct Listener { Listener( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& rDispatch ) : diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 3f0b4e7c0ee6..4658da9bee3a 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -42,6 +42,12 @@ #include #endif #include +//shizhobo +#include +const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE = 1; +const int TOOLBARCONTROLLER_PROPCOUNT = 1; +const rtl::OUString TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE( RTL_CONSTASCII_USTRINGPARAM( "SupportsVisiable" )); +//end using namespace ::cppu; using namespace ::com::sun::star::awt; @@ -61,10 +67,12 @@ struct ToolboxController_Impl }; ToolboxController::ToolboxController( + const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& xFrame, const ::rtl::OUString& aCommandURL ) : OWeakObject() + ,OPropertyContainer(GetBroadcastHelper())//shizhoubo , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_xFrame(xFrame) @@ -72,6 +80,10 @@ ToolboxController::ToolboxController( , m_aCommandURL( aCommandURL ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; try @@ -87,10 +99,15 @@ ToolboxController::ToolboxController( ToolboxController::ToolboxController() : OWeakObject() + ,OPropertyContainer(GetBroadcastHelper())//shizhoubo , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_aListenerContainer( m_aMutex ) { + //registger Propertyh by shizhoubo + registerProperty(TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIABLE, TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE, com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY, + &m_bSupportVisiable, getCppuType(&m_bSupportVisiable)); + m_pImpl = new ToolboxController_Impl; } @@ -146,11 +163,16 @@ throw ( RuntimeException ) static_cast< XInitialization* >( this ), static_cast< XComponent* >( this ), static_cast< XUpdatable* >( this )); - - if ( a.hasValue() ) - return a; - - return OWeakObject::queryInterface( rType ); + if ( !a.hasValue()) + { + a = ::cppu::queryInterface(rType + ,static_cast(this) + ,static_cast(this) + ,static_cast(this)); + if (!a.hasValue()) + return OWeakObject::queryInterface( rType ); + } + return a; } void SAL_CALL ToolboxController::acquire() throw () @@ -186,7 +208,8 @@ throw ( Exception, RuntimeException ) { vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); m_bInitialized = sal_True; - + //shizhoubo add + m_bSupportVisiable = sal_False; PropertyValue aPropValue; for ( int i = 0; i < aArguments.getLength(); i++ ) { @@ -704,4 +727,70 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const { return m_pImpl->m_xParentWindow; } +// +//------------------------------------------------------------------------- +// XPropertySet by shizhoubo +com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL ToolboxController::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) +{ + Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& ToolboxController::getInfoHelper() +{ + return *const_cast(this)->getArrayHelper(); +} +//OPropertyArrayUsageHelper by shizhoubo +//------------------------------------------------------------------------------ +::cppu::IPropertyArrayHelper* ToolboxController::createArrayHelper( ) const +{ + com::sun::star::uno::Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} +//shizhoubo for supportsvisiable +void ToolboxController::setSupportVisiableProperty(sal_Bool bValue) +{ + m_bSupportVisiable = bValue; +} +//OPropertySetHelper by shizhoubo +sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue , + com::sun::star::uno::Any& aOldValue , + sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) +{ + + switch (nHandle) + { + case TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE: + { + sal_Bool aNewValue; + aValue >>= aNewValue; + if (aNewValue != m_bSupportVisiable) + { + aConvertedValue <<= aNewValue; + aOldValue <<= m_bSupportVisiable; + return sal_True; + } + return sal_False; + } + } + return OPropertyContainer::convertFastPropertyValue(aConvertedValue, aOldValue, nHandle, aValue); + + +} +void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception) +{ + OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue); + if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle) + { sal_Bool rValue; + aValue >>= rValue; + if (m_bInitialized) + this->setSupportVisiableProperty(rValue); + } + +} +//end + } // svt -- cgit From b74f6441cc4cb098053269988082d9736fab2661 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 08:31:28 +0200 Subject: slidecopy: why is the SvBorder class duplicated in sfx2/viewfrm.hxx, when it is (nearly) exactly the same way declared in tools/svborder.hxx? removed the duplicate --- tools/inc/tools/svborder.hxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/inc/tools/svborder.hxx b/tools/inc/tools/svborder.hxx index 59dc96c21480..ba949950a2b2 100644 --- a/tools/inc/tools/svborder.hxx +++ b/tools/inc/tools/svborder.hxx @@ -52,6 +52,14 @@ public: } BOOL operator != ( const SvBorder & rObj ) const { return !(*this == rObj); } + SvBorder & operator = ( const SvBorder & rBorder ) + { + Left() = rBorder.Left(); + Top() = rBorder.Top(); + Right() = rBorder.Right(); + Bottom() = rBorder.Bottom(); + return *this; + } SvBorder & operator += ( const SvBorder & rBorder ) { Left() += rBorder.Left(); -- cgit From fb1d597546d2a7a974f008c962d81b49a87115a0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 08:48:30 +0200 Subject: slidecopy: do nothing in GetFocus if we're just dying --- svtools/source/toolpanel/toolpaneldeck.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index 349677a1e9ce..af12a39f75ab 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -83,6 +83,7 @@ namespace svt ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() + ,m_bInDtor( false ) ,m_pAccessibleParent( NULL ) { m_aPanels.AddListener( *this ); @@ -92,6 +93,7 @@ namespace svt ~ToolPanelDeck_Impl() { + m_bInDtor = true; } PDeckLayouter GetLayouter() const { return m_pLayouter; } @@ -99,6 +101,8 @@ namespace svt Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + bool IsDead() const { return m_bInDtor; } + /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor void NotifyDying() { @@ -145,9 +149,8 @@ namespace svt ToolPanelCollection m_aPanels; PToolPanel m_pDummyPanel; PanelDeckListeners m_aListeners; - PDeckLayouter m_pLayouter; - + bool m_bInDtor; Window* m_pAccessibleParent; }; @@ -508,6 +511,8 @@ namespace svt void ToolPanelDeck::GetFocus() { Control::GetFocus(); + if ( m_pImpl->IsDead() ) + return; if ( !m_pImpl->FocusActivePanel() ) { PDeckLayouter pLayouter( GetLayouter() ); -- cgit From a62b79fc1e4c3858a0aa76cf8762fc833ac0ea11 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 9 Apr 2010 11:05:09 +0200 Subject: slidecopy: separate resource ID number circles for svl and svtools (thanks to MBA for the patch) --- svl/inc/svl/solar.hrc | 4 +- svl/inc/svl/svl.hrc | 160 +++++++ svl/inc/svl/svtools.hrc | 521 --------------------- svl/source/items/cstitem.src | 2 +- svl/source/items/dateitem.cxx | 3 +- svl/source/misc/inettype.cxx | 4 +- svl/source/misc/mediatyp.src | 2 +- svtools/inc/svtools/svtools.hrc | 400 ++++++++++++++++ svtools/source/brwbox/editbrowsebox.cxx | 2 +- svtools/source/brwbox/editbrowsebox.src | 2 +- svtools/source/contnr/fileview.cxx | 2 +- svtools/source/contnr/fileview.src | 2 +- svtools/source/contnr/svcontnr.src | 2 +- svtools/source/contnr/svimpbox.cxx | 2 +- svtools/source/contnr/svtabbx.cxx | 2 +- svtools/source/contnr/templwin.cxx | 2 +- svtools/source/contnr/templwin.src | 2 +- svtools/source/control/calendar.cxx | 2 +- svtools/source/control/calendar.src | 2 +- svtools/source/control/collatorres.cxx | 2 +- svtools/source/control/ctrlbox.cxx | 2 +- svtools/source/control/ctrlbox.src | 2 +- svtools/source/control/ctrltool.cxx | 2 +- svtools/source/control/ctrltool.src | 2 +- svtools/source/control/indexentryres.cxx | 2 +- svtools/source/dialogs/addresstemplate.cxx | 2 +- svtools/source/dialogs/addresstemplate.src | 2 +- svtools/source/dialogs/logindlg.cxx | 2 +- svtools/source/dialogs/logindlg.src | 2 +- svtools/source/dialogs/printdlg.hrc | 2 +- svtools/source/dialogs/prnsetup.hrc | 2 +- svtools/source/dialogs/roadmapwizard.cxx | 2 +- svtools/source/dialogs/wizardmachine.cxx | 2 +- svtools/source/dialogs/wizardmachine.src | 2 +- svtools/source/filter.vcl/filter/dlgejpg.hrc | 2 +- svtools/source/filter.vcl/filter/dlgepng.hrc | 2 +- svtools/source/filter.vcl/filter/dlgexpor.hrc | 2 +- svtools/source/filter.vcl/filter/strings.hrc | 2 +- svtools/source/inc/iodlg.hrc | 2 +- svtools/source/java/javaerror.src | 2 +- svtools/source/java/javainteractionhandler.cxx | 2 +- svtools/source/java/patchjavaerror.src | 2 +- svtools/source/misc/ehdl.cxx | 2 +- svtools/source/misc/ehdl.src | 2 +- svtools/source/misc/embedhlp.cxx | 2 +- svtools/source/misc/errtxt.src | 2 +- svtools/source/misc/helpagent.src | 2 +- svtools/source/misc/helpagentwindow.cxx | 2 +- svtools/source/misc/imagemgr.cxx | 2 +- svtools/source/misc/imagemgr.src | 2 +- svtools/source/misc/langtab.cxx | 2 +- svtools/source/misc/langtab.src | 2 +- .../productregistration/productregistration.cxx | 2 +- .../source/productregistration/registrationdlg.cxx | 2 +- .../source/productregistration/registrationdlg.src | 2 +- svtools/source/toolpanel/paneltabbar.cxx | 6 +- svtools/source/toolpanel/toolpanel.src | 8 +- svtools/source/toolpanel/toolpaneldrawer.cxx | 2 +- 58 files changed, 620 insertions(+), 586 deletions(-) create mode 100644 svl/inc/svl/svl.hrc delete mode 100644 svl/inc/svl/svtools.hrc create mode 100644 svtools/inc/svtools/svtools.hrc diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc index 26ab8a959c5e..935c53db2790 100644 --- a/svl/inc/svl/solar.hrc +++ b/svl/inc/svl/solar.hrc @@ -105,8 +105,8 @@ #define RID_OFA_START (RID_LIB_START+6500) #define RID_OFA_END (RID_LIB_START+6999) -#define RID_CHANNEL_START (RID_LIB_START+7000) -#define RID_CHANNEL_END (RID_LIB_START+7499) +#define RID_SVL_START (RID_LIB_START+7000) +#define RID_SVL_END (RID_LIB_START+7499) #define RID_CHAOS_START (RID_LIB_START+7500) #define RID_CHAOS_END (RID_LIB_START+7999) diff --git a/svl/inc/svl/svl.hrc b/svl/inc/svl/svl.hrc new file mode 100644 index 000000000000..d63e84f2b91f --- /dev/null +++ b/svl/inc/svl/svl.hrc @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svtools.hrc,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _SVL_HRC +#define _SVL_HRC + +#include + +#define STR_SVT_MIMETYPE_START (RID_SVL_START) +#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0) +#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1) +#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2) +#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3) +#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4) +#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5) +#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6) +#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7) +#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8) +#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9) +#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10) +#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11) +#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12) +#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13) +#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14) +#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15) +#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16) +#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17) +#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18) +#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19) +#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20) +#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21) +#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22) +#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23) +#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24) +#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25) +#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26) +#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27) +#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28) +#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29) +#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30) +#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31) +#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32) + +#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33) +#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34) +#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35) +#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36) +#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37) +#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38) +#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39) +#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40) +#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41) +#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42) +#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43) +#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44) +#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45) +#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46) +#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47) +#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48) +#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49) +#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50) +#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51) +#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52) +#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53) +#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54) +#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55) +#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56) +#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57) +#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58) +#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59) +#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60) +#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61) +#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62) +#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63) +#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64) +#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65) +#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66) +#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67) +#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68) +#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69) +#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70) +#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71) +#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72) +#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73) +#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74) +#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75) +#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76) +#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77) +#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78) +#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79) +#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80) +#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81) +#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82) +#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83) +#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84) +#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85) +#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86) +#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87) +#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88) +#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89) +#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90) +#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91) +#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92) +#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93) +#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94) +#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95) +#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96) +#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97) +#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98) +#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99) +#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100) +#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101) +#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102) +#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103) +#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104) +#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105) +#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106) + +#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107) +#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108) +#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109) +#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110) +#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111) +#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112) +#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113) +#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114) +#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED) + +#define STR_COLUM_DT_AUTO (STR_SVT_MIMETYPE_END+1) + +#endif // #ifndef _SVTOOLS_HRC + +// ******************************************************************* EOF + diff --git a/svl/inc/svl/svtools.hrc b/svl/inc/svl/svtools.hrc deleted file mode 100644 index cf782afdd71e..000000000000 --- a/svl/inc/svl/svtools.hrc +++ /dev/null @@ -1,521 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: svtools.hrc,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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 _SVTOOLS_HRC -#define _SVTOOLS_HRC "$Revision: 1.0" - -#include - -#define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) -#define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) - -//............................................................................. -// various unsorted stuff - -#define DLG_EXPORT_PIX (RID_SVTOOLS_START+1) -#define DLG_EXPORT_VEC (RID_SVTOOLS_START+2) -#define DLG_TWAIN_SOURCE (RID_SVTOOLS_START+3) - -#define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) -#define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) -#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) - -#define EXPORT_DIALOG_TITLE (RID_SVTOOLS_START+4) -#define KEY_MODE (RID_SVTOOLS_START+5) -#define KEY_RES (RID_SVTOOLS_START+6) -#define KEY_SIZE (RID_SVTOOLS_START+7) - -#define KEY_COLORS (RID_SVTOOLS_START+9) -#define KEY_RLE_CODING (RID_SVTOOLS_START+10) - -#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) - -#define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) -#define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) -#define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) -#define STR_SVT_FOLDER (RID_SVTOOLS_START + 23) -#define STR_SVT_FILEVIEW_ERR_MAKEFOLDER (RID_SVTOOLS_START + 24) -#define STR_SVT_BYTES (RID_SVTOOLS_START + 25) -#define STR_SVT_KB (RID_SVTOOLS_START + 26) -#define STR_SVT_MB (RID_SVTOOLS_START + 27) -#define STR_SVT_GB (RID_SVTOOLS_START + 28) -#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 29) -#define STR_SVT_NEW_FOLDER (RID_SVTOOLS_START + 30) -#define STR_SVT_ALREADYEXISTOVERWRITE (RID_SVTOOLS_START + 31) -#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 32) -#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 33) -#define RID_FILEOPEN_INVALIDFOLDER (RID_SVTOOLS_START + 34) -#define RID_FILEOPEN_NOTEXISTENTFILE (RID_SVTOOLS_START + 35) -#define STR_SVT_NOREMOVABLEDEVICE (RID_SVTOOLS_START + 36) - -// doc template dialog -#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50) -#define CTRL_FILEVIEW (RID_SVTOOLS_START+51) -#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52) -#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53) -#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54) -#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55) -#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56) -#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57) -#define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) -#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63) -#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64) -#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65) -#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) - -#define STR_WARNING_ITEM (RID_SVTOOLS_START+90) -#define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) - -#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) -#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) -#define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104) -#define STR_BASICKEY_FORMAT_YES (RID_SVTOOLS_START+105) -#define STR_BASICKEY_FORMAT_NO (RID_SVTOOLS_START+106) -#define STR_BASICKEY_FORMAT_TRUE (RID_SVTOOLS_START+107) -#define STR_BASICKEY_FORMAT_FALSE (RID_SVTOOLS_START+108) -#define CONFIG_BASIC_FORMAT_END (RID_SVTOOLS_START+109) - -#define STR_INVALIDTRYBUY (RID_SVTOOLS_START+120) -#define STR_OLDTRYBUY (RID_SVTOOLS_START+121) -#define STR_TRYBUY (RID_SVTOOLS_START+122) -#define STR_PVER_LANGUAGECODE (RID_SVTOOLS_START+124) -#define STR_PVER_LONG_LANGUAGECODE (RID_SVTOOLS_START+125) -#define STR_INVALIDPUFF (RID_SVTOOLS_START+126) -#define STR_LIMITEDPUFF (RID_SVTOOLS_START+127) -#define STR_OLDLIMITEDPUFF (RID_SVTOOLS_START+128) -#define RID_REGISTER_DIALOG (RID_SVTOOLS_START+129) -#define STR_BASICKEY_FORMAT_CURRENCY (RID_SVTOOLS_START+130) -#define STR_KEYERR_GENERAL_HELP (RID_SVTOOLS_START+131) -#define STR_KEYERR_INVALID_KEY (RID_SVTOOLS_START+132) -#define STR_KEYERR_INVALID_USERDATA (RID_SVTOOLS_START+133) -#define STR_KEYERR_INVALID_ADDRESSDATA (RID_SVTOOLS_START+134) -#define STR_KEYERR_INVALID_LICENSE (RID_SVTOOLS_START+135) -#define STR_KEYERR_INVALID_LANGUAGE (RID_SVTOOLS_START+136) -#define STR_KEYERR_INVALID_OS (RID_SVTOOLS_START+137) -#define STR_KEYERR_INVALID_NO_CNR (RID_SVTOOLS_START+138) -#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139) -#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140) - -#define STR_SVT_MIMETYPE_START (RID_SVTOOLS_START+141) -#define STR_SVT_MIMETYPE_APP_OCTSTREAM (STR_SVT_MIMETYPE_START+0) -#define STR_SVT_MIMETYPE_APP_PDF (STR_SVT_MIMETYPE_START+1) -#define STR_SVT_MIMETYPE_APP_RTF (STR_SVT_MIMETYPE_START+2) -#define STR_SVT_MIMETYPE_APP_MSWORD (STR_SVT_MIMETYPE_START+3) -#define STR_SVT_MIMETYPE_APP_STARCALC (STR_SVT_MIMETYPE_START+4) -#define STR_SVT_MIMETYPE_APP_STARCHART (STR_SVT_MIMETYPE_START+5) -#define STR_SVT_MIMETYPE_APP_STARDRAW (STR_SVT_MIMETYPE_START+6) -#define STR_SVT_MIMETYPE_APP_STARIMAGE (STR_SVT_MIMETYPE_START+7) -#define STR_SVT_MIMETYPE_APP_STARMATH (STR_SVT_MIMETYPE_START+8) -#define STR_SVT_MIMETYPE_APP_STARWRITER (STR_SVT_MIMETYPE_START+9) -#define STR_SVT_MIMETYPE_APP_ZIP (STR_SVT_MIMETYPE_START+10) -#define STR_SVT_MIMETYPE_AUDIO_AIFF (STR_SVT_MIMETYPE_START+11) -#define STR_SVT_MIMETYPE_AUDIO_BASIC (STR_SVT_MIMETYPE_START+12) -#define STR_SVT_MIMETYPE_AUDIO_MIDI (STR_SVT_MIMETYPE_START+13) -#define STR_SVT_MIMETYPE_AUDIO_WAV (STR_SVT_MIMETYPE_START+14) -#define STR_SVT_MIMETYPE_IMAGE_GIF (STR_SVT_MIMETYPE_START+15) -#define STR_SVT_MIMETYPE_IMAGE_JPEG (STR_SVT_MIMETYPE_START+16) -#define STR_SVT_MIMETYPE_IMAGE_PCX (STR_SVT_MIMETYPE_START+17) -#define STR_SVT_MIMETYPE_IMAGE_BMP (STR_SVT_MIMETYPE_START+18) -#define STR_SVT_MIMETYPE_TEXT_HTML (STR_SVT_MIMETYPE_START+19) -#define STR_SVT_MIMETYPE_TEXT_PLAIN (STR_SVT_MIMETYPE_START+20) -#define STR_SVT_MIMETYPE_TEXT_URL (STR_SVT_MIMETYPE_START+21) -#define STR_SVT_MIMETYPE_TEXT_VCARD (STR_SVT_MIMETYPE_START+22) -#define STR_SVT_MIMETYPE_VIDEO_VDO (STR_SVT_MIMETYPE_START+23) -#define STR_SVT_MIMETYPE_VIDEO_MSVIDEO (STR_SVT_MIMETYPE_START+24) -#define STR_SVT_MIMETYPE_X_STARMAIL (STR_SVT_MIMETYPE_START+25) -#define STR_SVT_MIMETYPE_X_VRML (STR_SVT_MIMETYPE_START+26) -#define STR_SVT_MIMETYPE_APP_STARHELP (STR_SVT_MIMETYPE_START+27) -#define STR_SVT_MIMETYPE_APP_STARIMPRESS (STR_SVT_MIMETYPE_START+28) -#define STR_SVT_MIMETYPE_APP_SCHED_CMB (STR_SVT_MIMETYPE_START+29) -#define STR_SVT_MIMETYPE_APP_SCHED_EVT (STR_SVT_MIMETYPE_START+30) -#define STR_SVT_MIMETYPE_APP_SCHED_TASK (STR_SVT_MIMETYPE_START+31) -#define STR_SVT_MIMETYPE_APP_SCHED_TVIEW (STR_SVT_MIMETYPE_START+32) - -#define STR_SVT_MIMETYPE_CNT_MSG (STR_SVT_MIMETYPE_START+33) -#define STR_SVT_MIMETYPE_CNT_DOCUMENT (STR_SVT_MIMETYPE_START+34) -#define STR_SVT_MIMETYPE_CNT_POP3BOX (STR_SVT_MIMETYPE_START+35) -#define STR_SVT_MIMETYPE_CNT_IMAPBOX (STR_SVT_MIMETYPE_START+36) -#define STR_SVT_MIMETYPE_CNT_IMAPFLD (STR_SVT_MIMETYPE_START+37) -#define STR_SVT_MIMETYPE_CNT_VIMBOX (STR_SVT_MIMETYPE_START+38) -#define STR_SVT_MIMETYPE_CNT_VIMINBOX (STR_SVT_MIMETYPE_START+39) -#define STR_SVT_MIMETYPE_CNT_BBBOX (STR_SVT_MIMETYPE_START+40) -#define STR_SVT_MIMETYPE_CNT_VIM_BB (STR_SVT_MIMETYPE_START+41) -#define STR_SVT_MIMETYPE_CNT_NEWSBOX (STR_SVT_MIMETYPE_START+42) -#define STR_SVT_MIMETYPE_CNT_NEWSGRP (STR_SVT_MIMETYPE_START+43) -#define STR_SVT_MIMETYPE_CNT_OUTBOX (STR_SVT_MIMETYPE_START+44) -#define STR_SVT_MIMETYPE_CNT_FTPBOX (STR_SVT_MIMETYPE_START+45) -#define STR_SVT_MIMETYPE_CNT_FTPFLD (STR_SVT_MIMETYPE_START+46) -#define STR_SVT_MIMETYPE_CNT_FTPFILE (STR_SVT_MIMETYPE_START+47) -#define STR_SVT_MIMETYPE_CNT_FTPLINK (STR_SVT_MIMETYPE_START+48) -#define STR_SVT_MIMETYPE_CNT_HTTPBOX (STR_SVT_MIMETYPE_START+49) -#define STR_SVT_MIMETYPE_CNT_FSYSBOX (STR_SVT_MIMETYPE_START+50) -#define STR_SVT_MIMETYPE_CNT_FSYSFLD (STR_SVT_MIMETYPE_START+51) -#define STR_SVT_MIMETYPE_CNT_FSYSFILE (STR_SVT_MIMETYPE_START+52) -#define STR_SVT_MIMETYPE_CNT_FSYSURLFILE (STR_SVT_MIMETYPE_START+53) -#define STR_SVT_MIMETYPE_CNT_PUBLBOX (STR_SVT_MIMETYPE_START+54) -#define STR_SVT_MIMETYPE_CNT_SRCHBOX (STR_SVT_MIMETYPE_START+55) -#define STR_SVT_MIMETYPE_CNT_SUBSCRBOX (STR_SVT_MIMETYPE_START+56) -#define STR_SVT_MIMETYPE_CNT_BOOKMARK (STR_SVT_MIMETYPE_START+57) -#define STR_SVT_MIMETYPE_CNT_CDF (STR_SVT_MIMETYPE_START+58) -#define STR_SVT_MIMETYPE_CNT_CDFSUB (STR_SVT_MIMETYPE_START+59) -#define STR_SVT_MIMETYPE_CNT_CDFITEM (STR_SVT_MIMETYPE_START+60) -#define STR_SVT_MIMETYPE_CNT_STARCHANNEL (STR_SVT_MIMETYPE_START+61) -#define STR_SVT_MIMETYPE_CNT_TRASHBOX (STR_SVT_MIMETYPE_START+62) -#define STR_SVT_MIMETYPE_CNT_TRASH (STR_SVT_MIMETYPE_START+63) -#define STR_SVT_MIMETYPE_CNT_REMOV_VOL (STR_SVT_MIMETYPE_START+64) -#define STR_SVT_MIMETYPE_CNT_FIX_VOL (STR_SVT_MIMETYPE_START+65) -#define STR_SVT_MIMETYPE_CNT_REM_VOL (STR_SVT_MIMETYPE_START+66) -#define STR_SVT_MIMETYPE_CNT_RAM_VOL (STR_SVT_MIMETYPE_START+67) -#define STR_SVT_MIMETYPE_CNT_CDROM (STR_SVT_MIMETYPE_START+68) -#define STR_SVT_MIMETYPE_CNT_DISK_35 (STR_SVT_MIMETYPE_START+69) -#define STR_SVT_MIMETYPE_CNT_DISK_525 (STR_SVT_MIMETYPE_START+70) -#define STR_SVT_MIMETYPE_CNT_TAPEDRIVE (STR_SVT_MIMETYPE_START+71) -#define STR_SVT_MIMETYPE_APP_GAL (STR_SVT_MIMETYPE_START+72) -#define STR_SVT_MIMETYPE_APP_GAL_THEME (STR_SVT_MIMETYPE_START+73) -#define STR_SVT_MIMETYPE_CNT_SEPARATOR (STR_SVT_MIMETYPE_START+74) -#define STR_SVT_MIMETYPE_APP_STARW_GLOB (STR_SVT_MIMETYPE_START+75) -#define STR_SVT_MIMETYPE_APP_SDM (STR_SVT_MIMETYPE_START+76) -#define STR_SVT_MIMETYPE_APP_SMD (STR_SVT_MIMETYPE_START+77) -#define STR_SVT_MIMETYPE_APP_STARW_WEB (STR_SVT_MIMETYPE_START+78) -#define STR_SVT_MIMETYPE_SCHEDULE (STR_SVT_MIMETYPE_START+79) -#define STR_SVT_MIMETYPE_SCHEDULE_EVT (STR_SVT_MIMETYPE_START+80) -#define STR_SVT_MIMETYPE_SCHEDULE_TASK (STR_SVT_MIMETYPE_START+81) -#define STR_SVT_MIMETYPE_SCHEDULE_FEVT (STR_SVT_MIMETYPE_START+82) -#define STR_SVT_MIMETYPE_SCHEDULE_FTASK (STR_SVT_MIMETYPE_START+83) -#define STR_SVT_MIMETYPE_FRAMESET (STR_SVT_MIMETYPE_START+84) -#define STR_SVT_MIMETYPE_MACRO (STR_SVT_MIMETYPE_START+85) -#define STR_SVT_MIMETYPE_CNT_SFSYSFOLDER (STR_SVT_MIMETYPE_START+86) -#define STR_SVT_MIMETYPE_CNT_SFSYSFILE (STR_SVT_MIMETYPE_START+87) -#define STR_SVT_MIMETYPE_APP_TEMPLATE (STR_SVT_MIMETYPE_START+88) -#define STR_SVT_MIMETYPE_IMAGE_GENERIC (STR_SVT_MIMETYPE_START+89) -#define STR_SVT_MIMETYPE_APP_MSEXCEL (STR_SVT_MIMETYPE_START+90) -#define STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL (STR_SVT_MIMETYPE_START+91) -#define STR_SVT_MIMETYPE_APP_MSPPOINT (STR_SVT_MIMETYPE_START+92) -#define STR_SVT_MIMETYPE_TEXT_VCALENDAR (STR_SVT_MIMETYPE_START+93) -#define STR_SVT_MIMETYPE_TEXT_ICALENDAR (STR_SVT_MIMETYPE_START+94) -#define STR_SVT_MIMETYPE_TEXT_XMLICALENDAR (STR_SVT_MIMETYPE_START+95) -#define STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP (STR_SVT_MIMETYPE_START+96) -#define STR_SVT_MIMETYPE_INET_MSG_RFC822 (STR_SVT_MIMETYPE_START+97) -#define STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE (STR_SVT_MIMETYPE_START+98) -#define STR_SVT_MIMETYPE_INET_MULTI_DIGEST (STR_SVT_MIMETYPE_START+99) -#define STR_SVT_MIMETYPE_INET_MULTI_PARALLEL (STR_SVT_MIMETYPE_START+100) -#define STR_SVT_MIMETYPE_INET_MULTI_RELATED (STR_SVT_MIMETYPE_START+101) -#define STR_SVT_MIMETYPE_INET_MULTI_MIXED (STR_SVT_MIMETYPE_START+102) -#define STR_SVT_MIMETYPE_APP_IMPRESSPACKED (STR_SVT_MIMETYPE_START+103) -#define STR_SVT_MIMETYPE_APP_JAR (STR_SVT_MIMETYPE_START+104) -#define STR_SVT_MIMETYPE_IMAGE_PNG (STR_SVT_MIMETYPE_START+105) -#define STR_SVT_MIMETYPE_IMAGE_TIFF (STR_SVT_MIMETYPE_START+106) - -#define STR_SVT_MIMETYPE_APP_SXCALC (STR_SVT_MIMETYPE_START+107) -#define STR_SVT_MIMETYPE_APP_SXCHART (STR_SVT_MIMETYPE_START+108) -#define STR_SVT_MIMETYPE_APP_SXDRAW (STR_SVT_MIMETYPE_START+109) -#define STR_SVT_MIMETYPE_APP_SXMATH (STR_SVT_MIMETYPE_START+110) -#define STR_SVT_MIMETYPE_APP_SXWRITER (STR_SVT_MIMETYPE_START+111) -#define STR_SVT_MIMETYPE_APP_SXIMPRESS (STR_SVT_MIMETYPE_START+112) -#define STR_SVT_MIMETYPE_APP_SXGLOBAL (STR_SVT_MIMETYPE_START+113) -#define STR_SVT_MIMETYPE_APP_SXIPACKED (STR_SVT_MIMETYPE_START+114) -#define STR_SVT_MIMETYPE_END (STR_SVT_MIMETYPE_APP_SXIPACKED) - -#define STR_SVT_PRNDLG_START (STR_SVT_MIMETYPE_END+1) -#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0) -#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1) -#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2) -#define STR_SVT_PRNDLG_PAUSED (STR_SVT_PRNDLG_START+3) -#define STR_SVT_PRNDLG_PENDING (STR_SVT_PRNDLG_START+4) -#define STR_SVT_PRNDLG_BUSY (STR_SVT_PRNDLG_START+5) -#define STR_SVT_PRNDLG_INITIALIZING (STR_SVT_PRNDLG_START+6) -#define STR_SVT_PRNDLG_WAITING (STR_SVT_PRNDLG_START+7) -#define STR_SVT_PRNDLG_WARMING_UP (STR_SVT_PRNDLG_START+8) -#define STR_SVT_PRNDLG_PROCESSING (STR_SVT_PRNDLG_START+9) -#define STR_SVT_PRNDLG_PRINTING (STR_SVT_PRNDLG_START+10) -#define STR_SVT_PRNDLG_OFFLINE (STR_SVT_PRNDLG_START+11) -#define STR_SVT_PRNDLG_ERROR (STR_SVT_PRNDLG_START+12) -#define STR_SVT_PRNDLG_SERVER_UNKNOWN (STR_SVT_PRNDLG_START+13) -#define STR_SVT_PRNDLG_PAPER_JAM (STR_SVT_PRNDLG_START+14) -#define STR_SVT_PRNDLG_PAPER_OUT (STR_SVT_PRNDLG_START+15) -#define STR_SVT_PRNDLG_MANUAL_FEED (STR_SVT_PRNDLG_START+16) -#define STR_SVT_PRNDLG_PAPER_PROBLEM (STR_SVT_PRNDLG_START+17) -#define STR_SVT_PRNDLG_IO_ACTIVE (STR_SVT_PRNDLG_START+18) -#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL (STR_SVT_PRNDLG_START+19) -#define STR_SVT_PRNDLG_TONER_LOW (STR_SVT_PRNDLG_START+20) -#define STR_SVT_PRNDLG_NO_TONER (STR_SVT_PRNDLG_START+21) -#define STR_SVT_PRNDLG_PAGE_PUNT (STR_SVT_PRNDLG_START+22) -#define STR_SVT_PRNDLG_USER_INTERVENTION (STR_SVT_PRNDLG_START+23) -#define STR_SVT_PRNDLG_OUT_OF_MEMORY (STR_SVT_PRNDLG_START+24) -#define STR_SVT_PRNDLG_DOOR_OPEN (STR_SVT_PRNDLG_START+25) -#define STR_SVT_PRNDLG_POWER_SAVE (STR_SVT_PRNDLG_START+26) -#define STR_SVT_PRNDLG_DEFPRINTER (STR_SVT_PRNDLG_START+27) -#define STR_SVT_PRNDLG_JOBCOUNT (STR_SVT_PRNDLG_START+28) -#define STR_SVT_PRNDLG_END (RID_IMG_PRNDLG_NOCOLLATE_HC) - -#define STR_SVT_CALENDAR_START (STR_SVT_PRNDLG_END+1) -#define STR_SVT_CALENDAR_DAY (STR_SVT_CALENDAR_START+0) -#define STR_SVT_CALENDAR_WEEK (STR_SVT_CALENDAR_START+1) -#define STR_SVT_CALENDAR_TODAY (STR_SVT_CALENDAR_START+2) -#define STR_SVT_CALENDAR_NONE (STR_SVT_CALENDAR_START+3) -#define STR_SVT_CALENDAR_END (STR_SVT_CALENDAR_NONE) - -#define STR_SVT_PVER_START (STR_SVT_CALENDAR_END+1) -#define STR_SVT_PVER_INTERNAL (STR_SVT_PVER_START+0) -#define STR_SVT_PVER_PERSONAL_DELUXE (STR_SVT_PVER_START+1) -#define STR_SVT_PVER_PERSONAL (STR_SVT_PVER_START+2) -#define STR_SVT_PVER_PROFESSIONAL (STR_SVT_PVER_START+3) -#define STR_SVT_PVER_BUSINESS (STR_SVT_PVER_START+4) -#define STR_SVT_PVER_ENTERPRICE (STR_SVT_PVER_START+5) -#define STR_SVT_PVER_EDUCATION (STR_SVT_PVER_START+6) -#define STR_SVT_PVER_DEMO (STR_SVT_PVER_START+7) -#define STR_SVT_PVER_BETA (STR_SVT_PVER_START+8) -#define STR_SVT_PVER_OEM (STR_SVT_PVER_START+9) -#define STR_SVT_PVER_NOT_REGISTERED (STR_SVT_PVER_START+10) -#define STR_SVT_PVER_PILOT (STR_SVT_PVER_START+11) -#define STR_SVT_PVER_CAMPUS (STR_SVT_PVER_START+12) -#define STR_SVT_PVER_EVALUATION (STR_SVT_PVER_START+13) -#define STR_SVT_PVER_PARTNER (STR_SVT_PVER_START+14) -#define STR_SVT_PVER_SMALLBUSINESS (STR_SVT_PVER_START+15) -#define STR_SVT_PVER_OEM_PROFESSIONAL (STR_SVT_PVER_START+16) -#define STR_SVT_PVER_END (STR_SVT_PVER_OEM_PROFESSIONAL) - -#define STR_SVT_STYLE_START (STR_SVT_PVER_END+1) -#define STR_SVT_STYLE_LIGHT (STR_SVT_STYLE_START+0) -#define STR_SVT_STYLE_LIGHT_ITALIC (STR_SVT_STYLE_START+1) -#define STR_SVT_STYLE_NORMAL (STR_SVT_STYLE_START+2) -#define STR_SVT_STYLE_NORMAL_ITALIC (STR_SVT_STYLE_START+3) -#define STR_SVT_STYLE_BOLD (STR_SVT_STYLE_START+4) -#define STR_SVT_STYLE_BOLD_ITALIC (STR_SVT_STYLE_START+5) -#define STR_SVT_STYLE_BLACK (STR_SVT_STYLE_START+6) -#define STR_SVT_STYLE_BLACK_ITALIC (STR_SVT_STYLE_START+7) -#define STR_SVT_STYLE_END (STR_SVT_STYLE_BLACK_ITALIC) - -#define STR_SVT_FONTMAP_START (STR_SVT_STYLE_END+1) -#define STR_SVT_FONTMAP_BOTH (STR_SVT_FONTMAP_START+0) -#define STR_SVT_FONTMAP_PRINTERONLY (STR_SVT_FONTMAP_START+1) -#define STR_SVT_FONTMAP_SCREENONLY (STR_SVT_FONTMAP_START+2) -#define STR_SVT_FONTMAP_SIZENOTAVAILABLE (STR_SVT_FONTMAP_START+3) -#define STR_SVT_FONTMAP_STYLENOTAVAILABLE (STR_SVT_FONTMAP_START+4) -#define STR_SVT_FONTMAP_NOTAVAILABLE (STR_SVT_FONTMAP_START+5) -#define STR_SVT_FONTMAP_END (STR_SVT_FONTMAP_NOTAVAILABLE) - -#define STR_SVT_ERRORCONTEXT_START (STR_SVT_FONTMAP_END+1) -#define STR_ERR_HDLMESS (STR_SVT_ERRORCONTEXT_START+0) -#define RID_ERRHDL_CLASS (STR_SVT_ERRORCONTEXT_START+1) -#define RID_ERRCTX (STR_SVT_ERRORCONTEXT_START+2) -#define RID_ERRHDL (STR_SVT_ERRORCONTEXT_START+3) -#define STR_SVT_ERRORCONTEXT_END (RID_ERRHDL) - -#define STR_WIZARDDIALOG_START (STR_SVT_ERRORCONTEXT_END + 1) -#define STR_WIZDLG_FINISH (STR_WIZARDDIALOG_START + 0) -#define STR_WIZDLG_NEXT (STR_WIZARDDIALOG_START + 1) -#define STR_WIZDLG_PREVIOUS (STR_WIZARDDIALOG_START + 2) -#define STR_WIZDLG_ROADMAP_TITLE (STR_WIZARDDIALOG_START + 3) -#define STR_WIZARDDIALOG_END (STR_WIZDLG_ROADMAP_TITLE) - -#define STR_SVT_COLLATE_START (STR_WIZARDDIALOG_END+1) -#define STR_SVT_COLLATE_NORMAL (STR_SVT_COLLATE_START+0) -#define STR_SVT_COLLATE_DICTIONARY (STR_SVT_COLLATE_START+1) -#define STR_SVT_COLLATE_PINYIN (STR_SVT_COLLATE_START+2) -#define STR_SVT_COLLATE_STROKE (STR_SVT_COLLATE_START+3) -#define STR_SVT_COLLATE_RADICAL (STR_SVT_COLLATE_START+4) -#define STR_SVT_COLLATE_CHARSET (STR_SVT_COLLATE_START+5) -#define STR_SVT_COLLATE_ZHUYIN (STR_SVT_COLLATE_START+6) -#define STR_SVT_COLLATE_ALPHANUMERIC (STR_SVT_COLLATE_START+7) -#define STR_SVT_COLLATE_UNICODE (STR_SVT_COLLATE_START+8) -#define STR_SVT_COLLATE_PHONEBOOK (STR_SVT_COLLATE_START+9) -#define STR_SVT_COLLATE_PHONETIC_F (STR_SVT_COLLATE_START+10) -#define STR_SVT_COLLATE_PHONETIC_L (STR_SVT_COLLATE_START+11) -#define STR_SVT_COLLATE_END (STR_SVT_COLLATE_PHONETIC_L) - -#define STR_SVT_FILEPICKER_START (STR_SVT_COLLATE_END+1) -#define STR_SVT_FILEPICKER_AUTO_EXTENSION (STR_SVT_FILEPICKER_START+ 0) -#define STR_SVT_FILEPICKER_PASSWORD (STR_SVT_FILEPICKER_START+ 1) -#define STR_SVT_FILEPICKER_FILTER_OPTIONS (STR_SVT_FILEPICKER_START+ 2) -#define STR_SVT_FILEPICKER_READONLY (STR_SVT_FILEPICKER_START+ 3) -#define STR_SVT_FILEPICKER_INSERT_AS_LINK (STR_SVT_FILEPICKER_START+ 4) -#define STR_SVT_FILEPICKER_SHOW_PREVIEW (STR_SVT_FILEPICKER_START+ 5) -#define STR_SVT_FILEPICKER_PLAY (STR_SVT_FILEPICKER_START+ 6) -#define STR_SVT_FILEPICKER_VERSION (STR_SVT_FILEPICKER_START+ 7) -#define STR_SVT_FILEPICKER_TEMPLATES (STR_SVT_FILEPICKER_START+ 8) -#define STR_SVT_FILEPICKER_IMAGE_TEMPLATE (STR_SVT_FILEPICKER_START+ 9) -#define STR_SVT_FILEPICKER_SELECTION (STR_SVT_FILEPICKER_START+10) -#define STR_SVT_FILEPICKER_FILTER_TITLE (STR_SVT_FILEPICKER_START+11) -#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE (STR_SVT_FILEPICKER_START+12) -#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION (STR_SVT_FILEPICKER_START+13) -#define STR_SVT_FILEPICKER_END (STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION) - -// String-Ids for accessibility -#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1) - // FREE - // FREE -#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2) -#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3) -#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) -#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5) -#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6) -#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD) - -#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1) -#define STR_SVT_INDEXENTRY_ALPHANUMERIC (STR_SVT_INDEXENTRY_START+0) -#define STR_SVT_INDEXENTRY_DICTIONARY (STR_SVT_INDEXENTRY_START+1) -#define STR_SVT_INDEXENTRY_PINYIN (STR_SVT_INDEXENTRY_START+2) -#define STR_SVT_INDEXENTRY_RADICAL (STR_SVT_INDEXENTRY_START+3) -#define STR_SVT_INDEXENTRY_STROKE (STR_SVT_INDEXENTRY_START+4) -#define STR_SVT_INDEXENTRY_ZHUYIN (STR_SVT_INDEXENTRY_START+5) -#define STR_SVT_INDEXENTRY_PHONETIC_FS (STR_SVT_INDEXENTRY_START+6) -#define STR_SVT_INDEXENTRY_PHONETIC_FC (STR_SVT_INDEXENTRY_START+7) -#define STR_SVT_INDEXENTRY_PHONETIC_LS (STR_SVT_INDEXENTRY_START+8) -#define STR_SVT_INDEXENTRY_PHONETIC_LC (STR_SVT_INDEXENTRY_START+9) -#define STR_SVT_INDEXENTRY_END (STR_SVT_INDEXENTRY_PHONETIC_LC) - -//String - Ids for Java errors, messages -//These strings come from project desktop -//There was no time for translation, therefore the defines needed to -//remain the same. -#define STR_SVT_JAVAERROR_START (STR_SVT_INDEXENTRY_END + 1) -#define STR_QUESTION_JAVADISABLED (STR_SVT_JAVAERROR_START+0) -#define STR_ERROR_JVMCREATIONFAILED (STR_SVT_JAVAERROR_START+1) -#define STR_WARNING_JAVANOTFOUND (STR_SVT_JAVAERROR_START+2) -#define STR_WARNING_INVALIDJAVASETTINGS (STR_SVT_JAVAERROR_START+3) -#define STR_ERROR_RESTARTREQUIRED (STR_SVT_JAVAERROR_START+4) -#define STR_SVT_JAVAERROR_END (STR_ERROR_RESTARTREQUIRED) - -// String array to match UI language names to LanguageType values and vice versa -#define STR_ARR_SVT_LANGUAGE_TABLE_START (STR_SVT_JAVAERROR_END + 1) -#define STR_ARR_SVT_LANGUAGE_TABLE (STR_ARR_SVT_LANGUAGE_TABLE_START + 0) -#define STR_ARR_SVT_LANGUAGE_TABLE_END (STR_ARR_SVT_LANGUAGE_TABLE) - -//............................................................................. -// dialogs - -#define DLG_EXPORT_JPG_START (RID_SVTOOLS_START+110) -#define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) -#define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) - -#define DLG_LOGIN (RID_SVTOOLS_START+113) -#define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) - -#define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) - -#define DLG_EXPORT_EPNG (RID_SVTOOLS_START+116) -//............................................................................. -// bitmaps - -#define BMP_DEMO_FINGER (RID_SVTOOLS_BITMAP_START + 0) -#define BMP_HELP_AGENT_IMAGE (RID_SVTOOLS_BITMAP_START + 1) -#define BMP_HELP_AGENT_CLOSER (RID_SVTOOLS_BITMAP_START + 2) -#define BMP_PLUGIN (RID_SVTOOLS_BITMAP_START + 3) - -//............................................................................. -// image lists - -#define RID_IMG_EXPANDER (RID_SVTOOLS_IMAGELIST_START + 0) -#define RID_SVTOOLS_IMAGELIST_BIG (RID_SVTOOLS_IMAGELIST_START + 1) -#define RID_SVTOOLS_IMAGELIST_SMALL (RID_SVTOOLS_IMAGELIST_START + 2) -#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX (RID_SVTOOLS_IMAGELIST_START + 3) -#define RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 4) -#define RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 5) -#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H (RID_SVTOOLS_IMAGELIST_START + 6) -#define RID_FILEPICKER_IMAGES (RID_SVTOOLS_IMAGELIST_START + 7) -#define RID_FILEPICKER_IMAGES_HC (RID_SVTOOLS_IMAGELIST_START + 8) - -//............................................................................. -// error boxes -#define ERRBOX_REG_NOSYSBROWSER ( RID_SVTOOLS_START + 0 ) -#define ERRBOX_CHECK_PLZ ( RID_SVTOOLS_START + 11 ) - -// Java message boxes -//These strings come from project desktop -//There was no time for translation, therefore the defines needed to -//remain the same. -#define QBX_JAVADISABLED (RID_SVTOOLS_START+20) -#define ERRORBOX_JVMCREATIONFAILED (RID_SVTOOLS_START+21) -#define WARNINGBOX_JAVANOTFOUND (RID_SVTOOLS_START+22) -#define WARNINGBOX_INVALIDJAVASETTINGS (RID_SVTOOLS_START+23) -#define ERRORBOX_RESTARTREQUIRED (RID_SVTOOLS_START+24) - -//............................................................................. -// images -#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) -#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) -#define RID_IMG_TREENODE_COLLAPSED_HC (RID_SVTOOLS_START + 2) -#define RID_IMG_TREENODE_EXPANDED_HC (RID_SVTOOLS_START + 3) - -#define RID_IMG_PRINTERFONT (RID_SVTOOLS_START + 12) -#define RID_IMG_BITMAPFONT (RID_SVTOOLS_START + 13) -#define RID_IMG_SCALABLEFONT (RID_SVTOOLS_START + 14) -#define RID_IMG_PRINTERFONT_HC (RID_SVTOOLS_START + 15) -#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16) -#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17) - -#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18) -#define IMG_TRIANGLE_RIGHT_HC (RID_SVTOOLS_START + 19) -#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) -#define IMG_TRIANGLE_DOWN_HC (RID_SVTOOLS_START + 21) - -#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40) - -#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) -#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53) -#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54) -#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55) - -#define IMG_SVT_NEWDOC_HC (RID_SVTOOLS_START + 59) -#define IMG_SVT_MYDOCS_HC (RID_SVTOOLS_START + 60) -#define IMG_SVT_TEMPLATES_HC (RID_SVTOOLS_START + 61) -#define IMG_SVT_SAMPLES_HC (RID_SVTOOLS_START + 62) - -#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70) -#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71) -#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72) -#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73) -#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74) -#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79) - -#define IMG_SVT_DOCTEMPL_HC_BACK_SMALL (RID_SVTOOLS_START + 80) -#define IMG_SVT_DOCTEMPL_HC_BACK_LARGE (RID_SVTOOLS_START + 81) -#define IMG_SVT_DOCTEMPL_HC_PREV_SMALL (RID_SVTOOLS_START + 82) -#define IMG_SVT_DOCTEMPL_HC_PREV_LARGE (RID_SVTOOLS_START + 83) -#define IMG_SVT_DOCTEMPL_HC_PRINT_SMALL (RID_SVTOOLS_START + 84) -#define IMG_SVT_DOCTEMPL_HC_PRINT_LARGE (RID_SVTOOLS_START + 85) -#define IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL (RID_SVTOOLS_START + 86) -#define IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE (RID_SVTOOLS_START + 87) -#define IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL (RID_SVTOOLS_START + 88) -#define IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE (RID_SVTOOLS_START + 89) - -#define RID_IMG_PRNDLG_COLLATE (STR_SVT_PRNDLG_START + 29) -#define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) -#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31) -#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32) - -#endif // #ifndef _SVTOOLS_HRC - -// ******************************************************************* EOF - diff --git a/svl/source/items/cstitem.src b/svl/source/items/cstitem.src index 54951dd3761e..de910011b063 100644 --- a/svl/source/items/cstitem.src +++ b/svl/source/items/cstitem.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include String STR_COLUM_DT_AUTO { Text [ en-US ] = "automatic" ; diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx index d6ef8fdc7c9e..d7ad53aab8ef 100644 --- a/svl/source/items/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -36,7 +36,7 @@ #define _DATETIMEITEM_CXX #include #include -#include +#include #include #include @@ -48,7 +48,6 @@ #include #include - // STATIC DATA ----------------------------------------------------------- DBG_NAME(SfxDateTimeItem) diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index 47183be1d7b2..fe9ec16de6b4 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -34,9 +34,7 @@ #include #include #include -#ifndef _SVTOOLS_HRC -#include -#endif +#include #ifndef _SVSTDARR_STRINGSSORT_DECL #define _SVSTDARR_STRINGSSORT diff --git a/svl/source/misc/mediatyp.src b/svl/source/misc/mediatyp.src index 63033af29d03..de7fa1d7af84 100644 --- a/svl/source/misc/mediatyp.src +++ b/svl/source/misc/mediatyp.src @@ -35,7 +35,7 @@ //============================================================================ #ifndef _SVTOOLS_HRC -#include +#include #endif String STR_SVT_MIMETYPE_APP_OCTSTREAM diff --git a/svtools/inc/svtools/svtools.hrc b/svtools/inc/svtools/svtools.hrc new file mode 100644 index 000000000000..a57a0f5bb0fe --- /dev/null +++ b/svtools/inc/svtools/svtools.hrc @@ -0,0 +1,400 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svtools.hrc,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _SVTOOLS_HRC +#define _SVTOOLS_HRC "$Revision: 1.0" + +#include + +#define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) +#define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) + +//............................................................................. +// various unsorted stuff + +#define DLG_EXPORT_PIX (RID_SVTOOLS_START+1) +#define DLG_EXPORT_VEC (RID_SVTOOLS_START+2) +#define DLG_TWAIN_SOURCE (RID_SVTOOLS_START+3) + +#define DLG_SVT_EXPLORERFILE (RID_SVTOOLS_START+4) +#define DLG_SVT_QUERYFOLDERNAME (RID_SVTOOLS_START+5) +#define DLG_SVT_QUERYDELETE (RID_SVTOOLS_START+6) + +#define EXPORT_DIALOG_TITLE (RID_SVTOOLS_START+4) +#define KEY_MODE (RID_SVTOOLS_START+5) +#define KEY_RES (RID_SVTOOLS_START+6) +#define KEY_SIZE (RID_SVTOOLS_START+7) + +#define KEY_COLORS (RID_SVTOOLS_START+9) +#define KEY_RLE_CODING (RID_SVTOOLS_START+10) + +#define STR_SVT_AUTOMATIC_COLOR (RID_SVTOOLS_START+16) + +#define STR_SVT_FILEVIEW_COLUMN_TITLE (RID_SVTOOLS_START + 20) +#define STR_SVT_FILEVIEW_COLUMN_SIZE (RID_SVTOOLS_START + 21) +#define STR_SVT_FILEVIEW_COLUMN_DATE (RID_SVTOOLS_START + 22) +#define STR_SVT_FOLDER (RID_SVTOOLS_START + 23) +#define STR_SVT_FILEVIEW_ERR_MAKEFOLDER (RID_SVTOOLS_START + 24) +#define STR_SVT_BYTES (RID_SVTOOLS_START + 25) +#define STR_SVT_KB (RID_SVTOOLS_START + 26) +#define STR_SVT_MB (RID_SVTOOLS_START + 27) +#define STR_SVT_GB (RID_SVTOOLS_START + 28) +#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 29) +#define STR_SVT_NEW_FOLDER (RID_SVTOOLS_START + 30) +#define STR_SVT_ALREADYEXISTOVERWRITE (RID_SVTOOLS_START + 31) +#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 32) +#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 33) +#define RID_FILEOPEN_INVALIDFOLDER (RID_SVTOOLS_START + 34) +#define RID_FILEOPEN_NOTEXISTENTFILE (RID_SVTOOLS_START + 35) +#define STR_SVT_NOREMOVABLEDEVICE (RID_SVTOOLS_START + 36) + +// doc template dialog +#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50) +#define CTRL_FILEVIEW (RID_SVTOOLS_START+51) +#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52) +#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53) +#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54) +#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55) +#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56) +#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57) +#define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) +#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63) +#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64) +#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65) +#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) + +#define STR_WARNING_ITEM (RID_SVTOOLS_START+90) + +#define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) +#define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) +#define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104) +#define STR_BASICKEY_FORMAT_YES (RID_SVTOOLS_START+105) +#define STR_BASICKEY_FORMAT_NO (RID_SVTOOLS_START+106) +#define STR_BASICKEY_FORMAT_TRUE (RID_SVTOOLS_START+107) +#define STR_BASICKEY_FORMAT_FALSE (RID_SVTOOLS_START+108) +#define CONFIG_BASIC_FORMAT_END (RID_SVTOOLS_START+109) + +#define STR_INVALIDTRYBUY (RID_SVTOOLS_START+120) +#define STR_OLDTRYBUY (RID_SVTOOLS_START+121) +#define STR_TRYBUY (RID_SVTOOLS_START+122) +#define STR_PVER_LANGUAGECODE (RID_SVTOOLS_START+124) +#define STR_PVER_LONG_LANGUAGECODE (RID_SVTOOLS_START+125) +#define STR_INVALIDPUFF (RID_SVTOOLS_START+126) +#define STR_LIMITEDPUFF (RID_SVTOOLS_START+127) +#define STR_OLDLIMITEDPUFF (RID_SVTOOLS_START+128) +#define RID_REGISTER_DIALOG (RID_SVTOOLS_START+129) +#define STR_BASICKEY_FORMAT_CURRENCY (RID_SVTOOLS_START+130) +#define STR_KEYERR_GENERAL_HELP (RID_SVTOOLS_START+131) +#define STR_KEYERR_INVALID_KEY (RID_SVTOOLS_START+132) +#define STR_KEYERR_INVALID_USERDATA (RID_SVTOOLS_START+133) +#define STR_KEYERR_INVALID_ADDRESSDATA (RID_SVTOOLS_START+134) +#define STR_KEYERR_INVALID_LICENSE (RID_SVTOOLS_START+135) +#define STR_KEYERR_INVALID_LANGUAGE (RID_SVTOOLS_START+136) +#define STR_KEYERR_INVALID_OS (RID_SVTOOLS_START+137) +#define STR_KEYERR_INVALID_NO_CNR (RID_SVTOOLS_START+138) +#define STR_KEYERR_INVALID_CNR (RID_SVTOOLS_START+139) +#define RID_LIMITED_DIALOG (RID_SVTOOLS_START+140) + +#define STR_SVT_PRNDLG_START (RID_SVTOOLS_START+141) +#define DLG_SVT_PRNDLG_PRNSETUPDLG (STR_SVT_PRNDLG_START+0) +#define DLG_SVT_PRNDLG_PRINTDLG (STR_SVT_PRNDLG_START+1) +#define STR_SVT_PRNDLG_READY (STR_SVT_PRNDLG_START+2) +#define STR_SVT_PRNDLG_PAUSED (STR_SVT_PRNDLG_START+3) +#define STR_SVT_PRNDLG_PENDING (STR_SVT_PRNDLG_START+4) +#define STR_SVT_PRNDLG_BUSY (STR_SVT_PRNDLG_START+5) +#define STR_SVT_PRNDLG_INITIALIZING (STR_SVT_PRNDLG_START+6) +#define STR_SVT_PRNDLG_WAITING (STR_SVT_PRNDLG_START+7) +#define STR_SVT_PRNDLG_WARMING_UP (STR_SVT_PRNDLG_START+8) +#define STR_SVT_PRNDLG_PROCESSING (STR_SVT_PRNDLG_START+9) +#define STR_SVT_PRNDLG_PRINTING (STR_SVT_PRNDLG_START+10) +#define STR_SVT_PRNDLG_OFFLINE (STR_SVT_PRNDLG_START+11) +#define STR_SVT_PRNDLG_ERROR (STR_SVT_PRNDLG_START+12) +#define STR_SVT_PRNDLG_SERVER_UNKNOWN (STR_SVT_PRNDLG_START+13) +#define STR_SVT_PRNDLG_PAPER_JAM (STR_SVT_PRNDLG_START+14) +#define STR_SVT_PRNDLG_PAPER_OUT (STR_SVT_PRNDLG_START+15) +#define STR_SVT_PRNDLG_MANUAL_FEED (STR_SVT_PRNDLG_START+16) +#define STR_SVT_PRNDLG_PAPER_PROBLEM (STR_SVT_PRNDLG_START+17) +#define STR_SVT_PRNDLG_IO_ACTIVE (STR_SVT_PRNDLG_START+18) +#define STR_SVT_PRNDLG_OUTPUT_BIN_FULL (STR_SVT_PRNDLG_START+19) +#define STR_SVT_PRNDLG_TONER_LOW (STR_SVT_PRNDLG_START+20) +#define STR_SVT_PRNDLG_NO_TONER (STR_SVT_PRNDLG_START+21) +#define STR_SVT_PRNDLG_PAGE_PUNT (STR_SVT_PRNDLG_START+22) +#define STR_SVT_PRNDLG_USER_INTERVENTION (STR_SVT_PRNDLG_START+23) +#define STR_SVT_PRNDLG_OUT_OF_MEMORY (STR_SVT_PRNDLG_START+24) +#define STR_SVT_PRNDLG_DOOR_OPEN (STR_SVT_PRNDLG_START+25) +#define STR_SVT_PRNDLG_POWER_SAVE (STR_SVT_PRNDLG_START+26) +#define STR_SVT_PRNDLG_DEFPRINTER (STR_SVT_PRNDLG_START+27) +#define STR_SVT_PRNDLG_JOBCOUNT (STR_SVT_PRNDLG_START+28) +#define STR_SVT_PRNDLG_END (RID_IMG_PRNDLG_NOCOLLATE_HC) + +#define STR_SVT_CALENDAR_START (STR_SVT_PRNDLG_END+1) +#define STR_SVT_CALENDAR_DAY (STR_SVT_CALENDAR_START+0) +#define STR_SVT_CALENDAR_WEEK (STR_SVT_CALENDAR_START+1) +#define STR_SVT_CALENDAR_TODAY (STR_SVT_CALENDAR_START+2) +#define STR_SVT_CALENDAR_NONE (STR_SVT_CALENDAR_START+3) +#define STR_SVT_CALENDAR_END (STR_SVT_CALENDAR_NONE) + +#define STR_SVT_PVER_START (STR_SVT_CALENDAR_END+1) +#define STR_SVT_PVER_INTERNAL (STR_SVT_PVER_START+0) +#define STR_SVT_PVER_PERSONAL_DELUXE (STR_SVT_PVER_START+1) +#define STR_SVT_PVER_PERSONAL (STR_SVT_PVER_START+2) +#define STR_SVT_PVER_PROFESSIONAL (STR_SVT_PVER_START+3) +#define STR_SVT_PVER_BUSINESS (STR_SVT_PVER_START+4) +#define STR_SVT_PVER_ENTERPRICE (STR_SVT_PVER_START+5) +#define STR_SVT_PVER_EDUCATION (STR_SVT_PVER_START+6) +#define STR_SVT_PVER_DEMO (STR_SVT_PVER_START+7) +#define STR_SVT_PVER_BETA (STR_SVT_PVER_START+8) +#define STR_SVT_PVER_OEM (STR_SVT_PVER_START+9) +#define STR_SVT_PVER_NOT_REGISTERED (STR_SVT_PVER_START+10) +#define STR_SVT_PVER_PILOT (STR_SVT_PVER_START+11) +#define STR_SVT_PVER_CAMPUS (STR_SVT_PVER_START+12) +#define STR_SVT_PVER_EVALUATION (STR_SVT_PVER_START+13) +#define STR_SVT_PVER_PARTNER (STR_SVT_PVER_START+14) +#define STR_SVT_PVER_SMALLBUSINESS (STR_SVT_PVER_START+15) +#define STR_SVT_PVER_OEM_PROFESSIONAL (STR_SVT_PVER_START+16) +#define STR_SVT_PVER_END (STR_SVT_PVER_OEM_PROFESSIONAL) + +#define STR_SVT_STYLE_START (STR_SVT_PVER_END+1) +#define STR_SVT_STYLE_LIGHT (STR_SVT_STYLE_START+0) +#define STR_SVT_STYLE_LIGHT_ITALIC (STR_SVT_STYLE_START+1) +#define STR_SVT_STYLE_NORMAL (STR_SVT_STYLE_START+2) +#define STR_SVT_STYLE_NORMAL_ITALIC (STR_SVT_STYLE_START+3) +#define STR_SVT_STYLE_BOLD (STR_SVT_STYLE_START+4) +#define STR_SVT_STYLE_BOLD_ITALIC (STR_SVT_STYLE_START+5) +#define STR_SVT_STYLE_BLACK (STR_SVT_STYLE_START+6) +#define STR_SVT_STYLE_BLACK_ITALIC (STR_SVT_STYLE_START+7) +#define STR_SVT_STYLE_END (STR_SVT_STYLE_BLACK_ITALIC) + +#define STR_SVT_FONTMAP_START (STR_SVT_STYLE_END+1) +#define STR_SVT_FONTMAP_BOTH (STR_SVT_FONTMAP_START+0) +#define STR_SVT_FONTMAP_PRINTERONLY (STR_SVT_FONTMAP_START+1) +#define STR_SVT_FONTMAP_SCREENONLY (STR_SVT_FONTMAP_START+2) +#define STR_SVT_FONTMAP_SIZENOTAVAILABLE (STR_SVT_FONTMAP_START+3) +#define STR_SVT_FONTMAP_STYLENOTAVAILABLE (STR_SVT_FONTMAP_START+4) +#define STR_SVT_FONTMAP_NOTAVAILABLE (STR_SVT_FONTMAP_START+5) +#define STR_SVT_FONTMAP_END (STR_SVT_FONTMAP_NOTAVAILABLE) + +#define STR_SVT_ERRORCONTEXT_START (STR_SVT_FONTMAP_END+1) +#define STR_ERR_HDLMESS (STR_SVT_ERRORCONTEXT_START+0) +#define RID_ERRHDL_CLASS (STR_SVT_ERRORCONTEXT_START+1) +#define RID_ERRCTX (STR_SVT_ERRORCONTEXT_START+2) +#define RID_ERRHDL (STR_SVT_ERRORCONTEXT_START+3) +#define STR_SVT_ERRORCONTEXT_END (RID_ERRHDL) + +#define STR_WIZARDDIALOG_START (STR_SVT_ERRORCONTEXT_END + 1) +#define STR_WIZDLG_FINISH (STR_WIZARDDIALOG_START + 0) +#define STR_WIZDLG_NEXT (STR_WIZARDDIALOG_START + 1) +#define STR_WIZDLG_PREVIOUS (STR_WIZARDDIALOG_START + 2) +#define STR_WIZDLG_ROADMAP_TITLE (STR_WIZARDDIALOG_START + 3) +#define STR_WIZARDDIALOG_END (STR_WIZDLG_ROADMAP_TITLE) + +#define STR_SVT_COLLATE_START (STR_WIZARDDIALOG_END+1) +#define STR_SVT_COLLATE_NORMAL (STR_SVT_COLLATE_START+0) +#define STR_SVT_COLLATE_DICTIONARY (STR_SVT_COLLATE_START+1) +#define STR_SVT_COLLATE_PINYIN (STR_SVT_COLLATE_START+2) +#define STR_SVT_COLLATE_STROKE (STR_SVT_COLLATE_START+3) +#define STR_SVT_COLLATE_RADICAL (STR_SVT_COLLATE_START+4) +#define STR_SVT_COLLATE_CHARSET (STR_SVT_COLLATE_START+5) +#define STR_SVT_COLLATE_ZHUYIN (STR_SVT_COLLATE_START+6) +#define STR_SVT_COLLATE_ALPHANUMERIC (STR_SVT_COLLATE_START+7) +#define STR_SVT_COLLATE_UNICODE (STR_SVT_COLLATE_START+8) +#define STR_SVT_COLLATE_PHONEBOOK (STR_SVT_COLLATE_START+9) +#define STR_SVT_COLLATE_PHONETIC_F (STR_SVT_COLLATE_START+10) +#define STR_SVT_COLLATE_PHONETIC_L (STR_SVT_COLLATE_START+11) +#define STR_SVT_COLLATE_END (STR_SVT_COLLATE_PHONETIC_L) + +#define STR_SVT_FILEPICKER_START (STR_SVT_COLLATE_END+1) +#define STR_SVT_FILEPICKER_AUTO_EXTENSION (STR_SVT_FILEPICKER_START+ 0) +#define STR_SVT_FILEPICKER_PASSWORD (STR_SVT_FILEPICKER_START+ 1) +#define STR_SVT_FILEPICKER_FILTER_OPTIONS (STR_SVT_FILEPICKER_START+ 2) +#define STR_SVT_FILEPICKER_READONLY (STR_SVT_FILEPICKER_START+ 3) +#define STR_SVT_FILEPICKER_INSERT_AS_LINK (STR_SVT_FILEPICKER_START+ 4) +#define STR_SVT_FILEPICKER_SHOW_PREVIEW (STR_SVT_FILEPICKER_START+ 5) +#define STR_SVT_FILEPICKER_PLAY (STR_SVT_FILEPICKER_START+ 6) +#define STR_SVT_FILEPICKER_VERSION (STR_SVT_FILEPICKER_START+ 7) +#define STR_SVT_FILEPICKER_TEMPLATES (STR_SVT_FILEPICKER_START+ 8) +#define STR_SVT_FILEPICKER_IMAGE_TEMPLATE (STR_SVT_FILEPICKER_START+ 9) +#define STR_SVT_FILEPICKER_SELECTION (STR_SVT_FILEPICKER_START+10) +#define STR_SVT_FILEPICKER_FILTER_TITLE (STR_SVT_FILEPICKER_START+11) +#define STR_SVT_FOLDERPICKER_DEFAULT_TITLE (STR_SVT_FILEPICKER_START+12) +#define STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION (STR_SVT_FILEPICKER_START+13) +#define STR_SVT_FILEPICKER_END (STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION) + +// String-Ids for accessibility +#define STR_SVT_ACC_BEGIN (STR_SVT_FILEPICKER_END+1) +#define STR_SVT_TOOL_PANEL_BUTTON_FWD (STR_SVT_ACC_BEGIN+0) +#define STR_SVT_TOOL_PANEL_BUTTON_BACK (STR_SVT_ACC_BEGIN+1) +#define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2) +#define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3) +#define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) +#define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5) +#define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6) +#define STR_SVT_ACC_END (STR_SVT_ACC_EMPTY_FIELD) + +#define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1) +#define STR_SVT_INDEXENTRY_ALPHANUMERIC (STR_SVT_INDEXENTRY_START+0) +#define STR_SVT_INDEXENTRY_DICTIONARY (STR_SVT_INDEXENTRY_START+1) +#define STR_SVT_INDEXENTRY_PINYIN (STR_SVT_INDEXENTRY_START+2) +#define STR_SVT_INDEXENTRY_RADICAL (STR_SVT_INDEXENTRY_START+3) +#define STR_SVT_INDEXENTRY_STROKE (STR_SVT_INDEXENTRY_START+4) +#define STR_SVT_INDEXENTRY_ZHUYIN (STR_SVT_INDEXENTRY_START+5) +#define STR_SVT_INDEXENTRY_PHONETIC_FS (STR_SVT_INDEXENTRY_START+6) +#define STR_SVT_INDEXENTRY_PHONETIC_FC (STR_SVT_INDEXENTRY_START+7) +#define STR_SVT_INDEXENTRY_PHONETIC_LS (STR_SVT_INDEXENTRY_START+8) +#define STR_SVT_INDEXENTRY_PHONETIC_LC (STR_SVT_INDEXENTRY_START+9) +#define STR_SVT_INDEXENTRY_END (STR_SVT_INDEXENTRY_PHONETIC_LC) + +//String - Ids for Java errors, messages +//These strings come from project desktop +//There was no time for translation, therefore the defines needed to +//remain the same. +#define STR_SVT_JAVAERROR_START (STR_SVT_INDEXENTRY_END + 1) +#define STR_QUESTION_JAVADISABLED (STR_SVT_JAVAERROR_START+0) +#define STR_ERROR_JVMCREATIONFAILED (STR_SVT_JAVAERROR_START+1) +#define STR_WARNING_JAVANOTFOUND (STR_SVT_JAVAERROR_START+2) +#define STR_WARNING_INVALIDJAVASETTINGS (STR_SVT_JAVAERROR_START+3) +#define STR_ERROR_RESTARTREQUIRED (STR_SVT_JAVAERROR_START+4) +#define STR_SVT_JAVAERROR_END (STR_ERROR_RESTARTREQUIRED) + +// String array to match UI language names to LanguageType values and vice versa +#define STR_ARR_SVT_LANGUAGE_TABLE_START (STR_SVT_JAVAERROR_END + 1) +#define STR_ARR_SVT_LANGUAGE_TABLE (STR_ARR_SVT_LANGUAGE_TABLE_START + 0) +#define STR_ARR_SVT_LANGUAGE_TABLE_END (STR_ARR_SVT_LANGUAGE_TABLE) + +//............................................................................. +// dialogs + +#define DLG_EXPORT_JPG_START (RID_SVTOOLS_START+110) +#define DLG_EXPORT_JPG (RID_SVTOOLS_START+111) +#define DLG_EXPORT_JPG_END (RID_SVTOOLS_START+112) + +#define DLG_LOGIN (RID_SVTOOLS_START+113) +#define DLG_ADDRESSBOOKSOURCE (RID_SVTOOLS_START+114) + +#define DLG_REGISTRATION_REQUEST (RID_SVTOOLS_START+115) + +#define DLG_EXPORT_EPNG (RID_SVTOOLS_START+116) +//............................................................................. +// bitmaps + +#define BMP_DEMO_FINGER (RID_SVTOOLS_BITMAP_START + 0) +#define BMP_HELP_AGENT_IMAGE (RID_SVTOOLS_BITMAP_START + 1) +#define BMP_HELP_AGENT_CLOSER (RID_SVTOOLS_BITMAP_START + 2) +#define BMP_PLUGIN (RID_SVTOOLS_BITMAP_START + 3) + +//............................................................................. +// image lists + +#define RID_IMG_EXPANDER (RID_SVTOOLS_IMAGELIST_START + 0) +#define RID_SVTOOLS_IMAGELIST_BIG (RID_SVTOOLS_IMAGELIST_START + 1) +#define RID_SVTOOLS_IMAGELIST_SMALL (RID_SVTOOLS_IMAGELIST_START + 2) +#define RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX (RID_SVTOOLS_IMAGELIST_START + 3) +#define RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 4) +#define RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST (RID_SVTOOLS_IMAGELIST_START + 5) +#define RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H (RID_SVTOOLS_IMAGELIST_START + 6) +#define RID_FILEPICKER_IMAGES (RID_SVTOOLS_IMAGELIST_START + 7) +#define RID_FILEPICKER_IMAGES_HC (RID_SVTOOLS_IMAGELIST_START + 8) + +//............................................................................. +// error boxes +#define ERRBOX_REG_NOSYSBROWSER ( RID_SVTOOLS_START + 0 ) +#define ERRBOX_CHECK_PLZ ( RID_SVTOOLS_START + 11 ) + +// Java message boxes +//These strings come from project desktop +//There was no time for translation, therefore the defines needed to +//remain the same. +#define QBX_JAVADISABLED (RID_SVTOOLS_START+20) +#define ERRORBOX_JVMCREATIONFAILED (RID_SVTOOLS_START+21) +#define WARNINGBOX_JAVANOTFOUND (RID_SVTOOLS_START+22) +#define WARNINGBOX_INVALIDJAVASETTINGS (RID_SVTOOLS_START+23) +#define ERRORBOX_RESTARTREQUIRED (RID_SVTOOLS_START+24) + +//............................................................................. +// images +#define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) +#define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) +#define RID_IMG_TREENODE_COLLAPSED_HC (RID_SVTOOLS_START + 2) +#define RID_IMG_TREENODE_EXPANDED_HC (RID_SVTOOLS_START + 3) + +#define RID_IMG_PRINTERFONT (RID_SVTOOLS_START + 12) +#define RID_IMG_BITMAPFONT (RID_SVTOOLS_START + 13) +#define RID_IMG_SCALABLEFONT (RID_SVTOOLS_START + 14) +#define RID_IMG_PRINTERFONT_HC (RID_SVTOOLS_START + 15) +#define RID_IMG_BITMAPFONT_HC (RID_SVTOOLS_START + 16) +#define RID_IMG_SCALABLEFONT_HC (RID_SVTOOLS_START + 17) + +#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18) +#define IMG_TRIANGLE_RIGHT_HC (RID_SVTOOLS_START + 19) +#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) +#define IMG_TRIANGLE_DOWN_HC (RID_SVTOOLS_START + 21) + +#define IMG_SVT_FOLDER (RID_SVTOOLS_START + 40) + +#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) +#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53) +#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54) +#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55) + +#define IMG_SVT_NEWDOC_HC (RID_SVTOOLS_START + 59) +#define IMG_SVT_MYDOCS_HC (RID_SVTOOLS_START + 60) +#define IMG_SVT_TEMPLATES_HC (RID_SVTOOLS_START + 61) +#define IMG_SVT_SAMPLES_HC (RID_SVTOOLS_START + 62) + +#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70) +#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71) +#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72) +#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73) +#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74) +#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75) +#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76) +#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77) +#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78) +#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79) + +#define IMG_SVT_DOCTEMPL_HC_BACK_SMALL (RID_SVTOOLS_START + 80) +#define IMG_SVT_DOCTEMPL_HC_BACK_LARGE (RID_SVTOOLS_START + 81) +#define IMG_SVT_DOCTEMPL_HC_PREV_SMALL (RID_SVTOOLS_START + 82) +#define IMG_SVT_DOCTEMPL_HC_PREV_LARGE (RID_SVTOOLS_START + 83) +#define IMG_SVT_DOCTEMPL_HC_PRINT_SMALL (RID_SVTOOLS_START + 84) +#define IMG_SVT_DOCTEMPL_HC_PRINT_LARGE (RID_SVTOOLS_START + 85) +#define IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL (RID_SVTOOLS_START + 86) +#define IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE (RID_SVTOOLS_START + 87) +#define IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL (RID_SVTOOLS_START + 88) +#define IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE (RID_SVTOOLS_START + 89) + +#define RID_IMG_PRNDLG_COLLATE (STR_SVT_PRNDLG_START + 29) +#define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) +#define RID_IMG_PRNDLG_COLLATE_HC (STR_SVT_PRNDLG_START + 31) +#define RID_IMG_PRNDLG_NOCOLLATE_HC (STR_SVT_PRNDLG_START + 32) + +#endif // #ifndef _SVTOOLS_HRC + +// ******************************************************************* EOF + diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 09d1f5c869b9..36a798d666cd 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -50,7 +50,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #include diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src index c04e1294c0af..39991363c906 100644 --- a/svtools/source/brwbox/editbrowsebox.src +++ b/svtools/source/brwbox/editbrowsebox.src @@ -33,7 +33,7 @@ #endif #ifndef _SVTOOLS_HRC -#include +#include #endif ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 7fddf18ee266..4938cb3b02ed 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -37,7 +37,7 @@ #include #include -#include +#include #include "fileview.hrc" #include "contentenumeration.hxx" #include diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index 9d1cdb618cda..c86db1ce418a 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -30,7 +30,7 @@ // includes ------------------------------------------------------------------ -#include +#include #include "fileview.hrc" #include diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src index f81bc3fdfa9b..c26c906eb3f6 100644 --- a/svtools/source/contnr/svcontnr.src +++ b/svtools/source/contnr/svcontnr.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include Image RID_IMG_TREENODE_COLLAPSED { diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index f2674279f4df..e17b81e548a9 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -50,7 +50,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif // #102891# -------------------- diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 122d0016d568..a03d61f12c9c 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -34,7 +34,7 @@ #include #include #ifndef _SVTOOLS_HRC -#include +#include #endif #include #include diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 06de35ba19aa..d9db6c9ecdd5 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -44,7 +44,7 @@ #include "imgdef.hxx" #include "txtattr.hxx" #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVTOOLS_TEMPLWIN_HRC #include "templwin.hrc" diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index f7f42b7e176b..30149de4da14 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -33,7 +33,7 @@ #include "templwin.hrc" #include "controldims.hrc" #include -#include +#include // Magenta and Grey as mask colors #define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 481f6f2ceeae..8ff008eaf7e4 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -62,7 +62,7 @@ #include #define _SV_CALENDAR_CXX -#include +#include #include #include diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src index 043dd9808663..44bffd361847 100644 --- a/svtools/source/control/calendar.src +++ b/svtools/source/control/calendar.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include String STR_SVT_CALENDAR_DAY { Text [ en-US ] = "Day" ; diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx index c976d7442bc0..692d470b8f5b 100644 --- a/svtools/source/control/collatorres.cxx +++ b/svtools/source/control/collatorres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include -#include +#include #include diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 1a6465bd5c5d..b4d8d0506917 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 05c75577cdbf..5cfee79e5f11 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #ifndef IMAGE_STDBTN_COLOR #define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 1573ed531662..77bb996584bd 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src index ab8005cd9698..267a65e98517 100644 --- a/svtools/source/control/ctrltool.src +++ b/svtools/source/control/ctrltool.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include String STR_SVT_STYLE_LIGHT { diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx index f69e9b34e5ea..49096144b215 100644 --- a/svtools/source/control/indexentryres.cxx +++ b/svtools/source/control/indexentryres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include -#include +#include #include diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index aa18a3683916..caa3dd1c1971 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -39,7 +39,7 @@ #include "addresstemplate.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src index 63c0e6475597..9c4997cae9d2 100644 --- a/svtools/source/dialogs/addresstemplate.src +++ b/svtools/source/dialogs/addresstemplate.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_ADDRESSTEMPLATE_HRC_ #include "addresstemplate.hrc" diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx index 791e373086af..7ac65a77947d 100644 --- a/svtools/source/dialogs/logindlg.cxx +++ b/svtools/source/dialogs/logindlg.cxx @@ -38,7 +38,7 @@ #include "logindlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #include diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src index b3ef357bbae4..897597f383bf 100644 --- a/svtools/source/dialogs/logindlg.src +++ b/svtools/source/dialogs/logindlg.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVTOOLS_LOGINDLG_HRC_ diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc index 2f2f43e3ba10..cae57cefdb0e 100644 --- a/svtools/source/dialogs/printdlg.hrc +++ b/svtools/source/dialogs/printdlg.hrc @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc index 00623d97084c..33f98f7ed5e0 100644 --- a/svtools/source/dialogs/prnsetup.hrc +++ b/svtools/source/dialogs/prnsetup.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index c7473e446986..b0fff49e5e8d 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include -#include +#include #include #include "roadmap.hxx" #include diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 602c2e3e6f8a..c436256a31c4 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -36,7 +36,7 @@ #include #include #ifndef _SVTOOLS_HRC -#include +#include #endif //......................................................................... diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src index 2fa50ef20bf6..d83fdd98824b 100644 --- a/svtools/source/dialogs/wizardmachine.src +++ b/svtools/source/dialogs/wizardmachine.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif String STR_WIZDLG_FINISH diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc index 67ac915df367..4342a89d1d24 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc index d687141abf56..79d4b189aa5a 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ b/svtools/source/filter.vcl/filter/dlgepng.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc index cae15d7276d2..28921b5f178c 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include #define BTN_OK_PIX 1 #define BTN_CANCEL_PIX 1 diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc index a3356982609a..0cfa4e6bf7c4 100644 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ b/svtools/source/filter.vcl/filter/strings.hrc @@ -27,4 +27,4 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include +#include diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc index 9c41e06a2b6c..36e3092064cd 100644 --- a/svtools/source/inc/iodlg.hrc +++ b/svtools/source/inc/iodlg.hrc @@ -32,7 +32,7 @@ #define _SVTOOLS_IODLGIMPL_HRC #ifndef _SVTOOLS_HRC -#include +#include #endif // ModalDialog DLG_SVT_EXPLORERFILE diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index 3460df859c2b..3063bcd994d5 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index a7808c80992b..30f8775a6d5f 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -33,7 +33,7 @@ -#include +#include #include #include #include diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src index 2d2ad06a9592..bfdfd5a8bcba 100644 --- a/svtools/source/java/patchjavaerror.src +++ b/svtools/source/java/patchjavaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include +#include WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 3a31c1b812a6..9031c8c7fdd1 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include "sfxecode.hxx" //========================================================================= diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src index 5267d13765c3..ed32172a92e2 100644 --- a/svtools/source/misc/ehdl.src +++ b/svtools/source/misc/ehdl.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include +#include #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 3554f6955171..91342058aba1 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 3ab58ef92dbf..ebd922bfedf7 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include +#include #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- Resource RID_ERRCTX diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src index 181583bc8f6d..3b9e2a450ec1 100644 --- a/svtools/source/misc/helpagent.src +++ b/svtools/source/misc/helpagent.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include +#include #endif Bitmap BMP_HELP_AGENT_IMAGE diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx index 51cd7ebfb740..368c55a94ade 100644 --- a/svtools/source/misc/helpagentwindow.cxx +++ b/svtools/source/misc/helpagentwindow.cxx @@ -39,7 +39,7 @@ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 76752b27354e..ddf6a7350772 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -55,7 +55,7 @@ #include #include -#include +#include #include "imagemgr.hrc" #include #include diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src index e082398beaa1..0aada34305da 100644 --- a/svtools/source/misc/imagemgr.src +++ b/svtools/source/misc/imagemgr.src @@ -29,7 +29,7 @@ ************************************************************************/ // includes ****************************************************************** -#include +#include #include "imagemgr.hrc" // images ******************************************************************** diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index ef2cedcc50c2..7fb24b01ecef 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 0aa90f8e96b9..4458d4b0f132 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -29,7 +29,7 @@ ************************************************************************/ // include --------------------------------------------------------------- -#include +#include #define RSC_RESOURCE_USAGE 1 #include diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index f5fc03337cd6..4f9d1bb476ef 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -35,7 +35,7 @@ #include "unotools/regoptions.hxx" #include "registrationdlg.hxx" #ifndef _SVTOOLS_HRC -#include +#include #endif #include "cppuhelper/factory.hxx" #include diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx index d3969828cb1f..83018cfa804b 100644 --- a/svtools/source/productregistration/registrationdlg.cxx +++ b/svtools/source/productregistration/registrationdlg.cxx @@ -35,7 +35,7 @@ #if 0 /* @@@ */ #include #ifndef _SVTOOLS_HRC -#include +#include #endif #endif /* @@@ */ diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src index f9462a420061..86024ef765cd 100644 --- a/svtools/source/productregistration/registrationdlg.src +++ b/svtools/source/productregistration/registrationdlg.src @@ -32,7 +32,7 @@ #include "registrationdlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include +#include #endif #ifndef _SVT_HELPID_HRC #include diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 95e6caa311e4..38aee00c8f55 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -29,6 +29,7 @@ #include "svtools/toolpanel/paneltabbar.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/svtdata.hxx" +#include "svtools/svtools.hrc" #include "tabitemdescriptor.hxx" #include "paneltabbarpeer.hxx" @@ -38,7 +39,6 @@ #include #include #include -#include #include #include @@ -528,13 +528,13 @@ namespace svt m_aScrollBack.SetSymbol( IsVertical() ? SYMBOL_ARROW_UP : SYMBOL_ARROW_LEFT ); m_aScrollBack.Show(); m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollBack.SetAccessibleDescription( String( SvtResId( STR_SVT_ACC_BEGIN + 0 ) ) ); + m_aScrollBack.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ) ) ); m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() ); m_aScrollForward.SetSymbol( IsVertical() ? SYMBOL_ARROW_DOWN : SYMBOL_ARROW_RIGHT ); m_aScrollForward.Show(); m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollForward.SetAccessibleDescription( String( SvtResId( STR_SVT_ACC_BEGIN + 1 ) ) ); + m_aScrollForward.SetAccessibleDescription( String( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ) ) ); m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() ); } diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src index 0cbc3ea5896d..5908a8fbcf98 100644 --- a/svtools/source/toolpanel/toolpanel.src +++ b/svtools/source/toolpanel/toolpanel.src @@ -24,16 +24,14 @@ * ************************************************************************/ -#include +#include "svtools/svtools.hrc" -// the following string ID is a hack, until MBA's promised patch appears, which splits svl/svtools.hrc -// into two files, one for svl, one or svtools -String STR_SVT_ACC_BEGIN + 0 +String STR_SVT_TOOL_PANEL_BUTTON_FWD { Text [ en-US ] = "Tab Panel Scroll Button, backward"; }; -String STR_SVT_ACC_BEGIN + 1 +String STR_SVT_TOOL_PANEL_BUTTON_BACK { Text [ en-US ] = "Tab Panel Scroll Button, forward"; }; diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 66a0a1491d19..e9a12de762b1 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -29,10 +29,10 @@ #include "toolpaneldrawer.hxx" #include "toolpaneldrawerpeer.hxx" #include "svtools/svtdata.hxx" +#include "svtools/svtools.hrc" #include -#include #include #include #include -- cgit From 2b9a5547b87c46bae38fe69f68e859eb8b4f8afa Mon Sep 17 00:00:00 2001 From: Gregor Hartmann Date: Fri, 9 Apr 2010 14:15:44 +0200 Subject: export TableControl for usage in VCLTestTool --- svtools/inc/svtools/table/tablecontrol.hxx | 54 ++++++++------------------ svtools/inc/svtools/table/tablemodel.hxx | 51 ++++++++++++------------ svtools/prj/d.lst | 2 + svtools/source/inc/accessibletableimp.hxx | 62 ++++++++++++++++++++++++++++++ svtools/source/table/tablecontrol.cxx | 1 + svtools/source/uno/svtxgridcontrol.cxx | 1 + 6 files changed, 109 insertions(+), 62 deletions(-) create mode 100644 svtools/source/inc/accessibletableimp.hxx diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 839d4f73ebd6..cfb4357eb5ac 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -27,13 +27,14 @@ #ifndef SVTOOLS_INC_TABLE_TABLECONTROL_HXX #define SVTOOLS_INC_TABLE_TABLECONTROL_HXX +#include "svtools/svtdllapi.h" #include #include #include #include #include -#include "svtaccessiblefactory.hxx" #include +#include //........................................................................ namespace svt { namespace table @@ -65,24 +66,24 @@ namespace svt { namespace table // TODO: scrolling? */ - class TableControl : public Control, public IAccessibleTable + class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { private: - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); TableControl_Impl* m_pImpl; - ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols; - ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; - Link m_aSelectHdl; - bool m_bSelectionChanged; + ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; + Link m_aSelectHdl; + bool m_bSelectionChanged; public: - ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; + ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; TableControl( Window* _pParent, WinBits _nStyle ); ~TableControl(); /// sets a new table model - void SetModel( PTableModel _pModel ); + SVT_DLLPRIVATE void SetModel( PTableModel _pModel ); /// retrieves the current table model PTableModel GetModel() const; @@ -152,9 +153,9 @@ namespace svt { namespace table { return GoTo( GetCurrentColumn(), _nRow ); } - virtual void Resize(); + SVT_DLLPRIVATE virtual void Resize(); virtual void Select(); - void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } + SVT_DLLPRIVATE void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } const Link& GetSelectHdl() const { return m_aSelectHdl; } /**invalidates the table if table has been changed e.g. new row added @@ -176,11 +177,11 @@ namespace svt { namespace table //virtual long Notify(NotifyEvent& rNEvt); /** Creates and returns the accessible object of the whole GridControl. */ - virtual XACC CreateAccessible(); - virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); - virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; - virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); - virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; + SVT_DLLPRIVATE virtual XACC CreateAccessible(); + SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); + SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; + SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); + SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const; @@ -230,27 +231,6 @@ namespace svt { namespace table TableControl& operator=( const TableControl& ); // never implemented }; - class AccessibleTableControl_Impl - { - public: - AccessibleFactoryAccess m_aFactoryAccess; - IAccessibleTableControl* m_pAccessible; - - public: - AccessibleTableControl_Impl() : m_pAccessible(NULL) - { - } - - - /// @see AccessibleTableControl::getTableRowHeader - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ); - /// @see AccessibleTableControl::getTable - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > - getAccessibleTable( ); - - }; - //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index 1492468871a3..fbc60fb7bc0e 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -27,6 +27,7 @@ #ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX #define SVTOOLS_INC_TABLE_TABLEMODEL_HXX +#include "svtools/svtdllapi.h" #include #include #include @@ -310,7 +311,7 @@ namespace svt { namespace table //==================================================================== /** declares the interface to implement by an abtract table model */ - class SAL_NO_VTABLE ITableModel + class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel { public: /** returns the number of columns in the table @@ -321,8 +322,8 @@ namespace svt { namespace table */ virtual TableSize getRowCount() const = 0; - virtual void setColumnCount(TableSize _nColCount) = 0; - virtual void setRowCount(TableSize _nRowCount) = 0; + SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0; + SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0; /** determines whether the table has column headers @@ -335,12 +336,12 @@ namespace svt { namespace table /** sets whether the table should have row headers @see IColumnRenderer */ - virtual void setRowHeaders( bool rowHeaders) = 0; + SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0; /** sets whether the table should have column headers @see IColumnRenderer */ - virtual void setColumnHeaders( bool columnHeaders) = 0; + SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0; /** determines whether the table has row headers @@ -360,11 +361,11 @@ namespace svt { namespace table /** adds the given listener to the list of ->ITableModelListener's */ - virtual void addTableModelListener( const PTableModelListener& listener ) = 0; + SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0; /** revokes the given listener from the list of ->ITableModelListener's */ - virtual void removeTableModelListener( const PTableModelListener& listener ) = 0; + SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0; /** returns a model for a certain column @@ -394,7 +395,7 @@ namespace svt { namespace table @return the renderer to use. Must not be */ - virtual PTableRenderer getRenderer() const = 0; + SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0; /** returns the component handling input in a view associated with the model */ @@ -406,9 +407,9 @@ namespace svt { namespace table the logical height of rows in the table, in 1/100 millimeters. The height must be greater 0. */ - virtual TableMetrics getRowHeight() const = 0; + SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0; - virtual void setRowHeight(TableMetrics _nRowHeight) = 0; + SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0; /** determines the height of the column header row @@ -419,7 +420,7 @@ namespace svt { namespace table the logical height of the column header row, in 1/100 millimeters. Must be greater than 0. */ - virtual TableMetrics getColumnHeaderHeight() const = 0; + SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0; /** determines the width of the row header column @@ -430,7 +431,7 @@ namespace svt { namespace table the logical width of the row header column, in 1/100 millimeters. Must be greater than 0. */ - virtual TableMetrics getRowHeaderWidth() const = 0; + SVT_DLLPRIVATE virtual TableMetrics getRowHeaderWidth() const = 0; /** determines the visibility of the vertical scrollbar of the table control @param overAllHeight the height of the table with all rows @@ -454,22 +455,22 @@ namespace svt { namespace table virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0; /**sets title of header rows */ - virtual void setRowHeaderName(const std::vector& cellColumnContent)=0; + SVT_DLLPRIVATE virtual void setRowHeaderName(const std::vector& cellColumnContent)=0; /** gets title of header rows */ virtual std::vector& getRowHeaderName() = 0; - virtual ::com::sun::star::util::Color getLineColor() = 0; - virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0; - virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; - virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - virtual ::com::sun::star::util::Color getTextColor() = 0; - virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0; - virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; - virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; - virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; - virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; - virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0; + SVT_DLLPRIVATE virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0; + SVT_DLLPRIVATE virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0; + SVT_DLLPRIVATE virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0; + SVT_DLLPRIVATE virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0; + SVT_DLLPRIVATE virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0; + SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0; + SVT_DLLPRIVATE virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0; /// destroys the table model instance virtual ~ITableModel() { } diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 0a3ccd8a9819..4a9e8314e0d8 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -1,6 +1,7 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid mkdir: %COMMON_DEST%\res%_EXT% mkdir: %_DEST%\inc%_EXT%\svtools +mkdir: %_DEST%\inc%_EXT%\svtools\table ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs @@ -25,6 +26,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx ..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc +..\inc\svtools\table\*.hxx %_DEST%\inc%_EXT%\svtools\table\*.hxx ..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx ..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h ..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc diff --git a/svtools/source/inc/accessibletableimp.hxx b/svtools/source/inc/accessibletableimp.hxx new file mode 100644 index 000000000000..3a01c01567d3 --- /dev/null +++ b/svtools/source/inc/accessibletableimp.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX +#define SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX + +#include "svtaccessiblefactory.hxx" + +namespace svt { namespace table +{ +//........................................................................ + + + class AccessibleTableControl_Impl + { + public: + AccessibleFactoryAccess m_aFactoryAccess; + IAccessibleTableControl* m_pAccessible; + + public: + AccessibleTableControl_Impl() : m_pAccessible(NULL) + { + } + + + /// @see AccessibleTableControl::getTableRowHeader + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ); + /// @see AccessibleTableControl::getTable + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTable( ); + + }; + +//........................................................................ +} } // namespace svt::table +//........................................................................ + +#endif // SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 01da79e2056e..7452bda6d02a 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -30,6 +30,7 @@ #include "svtools/table/tablecontrol.hxx" #include "tablegeometry.hxx" #include "tablecontrol_impl.hxx" +#include "accessibletableimp.hxx" #include "svtools/table/tabledatawindow.hxx" #include #include diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 5be2c71c9f52..404caadd9fb7 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -28,6 +28,7 @@ #include "precompiled_svtools.hxx" #include "svtxgridcontrol.hxx" +#include "accessibletableimp.hxx" #include #include "svtools/table/gridtablerenderer.hxx" #include "svtools/table/defaultinputhandler.hxx" -- cgit From a14e90df9620b4e4259d20197660f2dac67628d7 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 9 Apr 2010 18:04:50 +0200 Subject: impress190: #110673# applied patch (removed some Boundchecker warnings) --- vcl/source/gdi/pngread.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index b7eb8e5f50bf..11971db34378 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -703,7 +703,7 @@ void PNGReaderImpl::ImplGetGrayPalette( sal_uInt16 nBitDepth ) nBitDepth = 8; sal_uInt16 nPaletteEntryCount = 1 << nBitDepth; - sal_uInt32 nAdd = 256 / (nPaletteEntryCount - 1); + sal_uInt32 nAdd = nBitDepth ? 256 / (nPaletteEntryCount - 1) : 0; // no bitdepth==2 available // but bitdepth==4 with two unused bits is close enough -- cgit From 61e685d3e8e68b37294c6b853342a39c54cd85d9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 12 Apr 2010 13:15:12 +0200 Subject: slidecopy: proper deletion of 'argv[iXhp + 3]', will cause assertions otherwise, which break the build in instsetoo_native --- l10ntools/source/help/HelpLinker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index ae2b88bfc470..9eed9132a5ec 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -1096,7 +1096,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp args.push_back(std::string( argv[i]) ); for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - delete argv[iXhp + 3]; + delete[] argv[iXhp + 3]; delete[] argv; rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() ); -- cgit From 20231f17aebf160bb96b81ed31d4c2ed5c83785c Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 12 Apr 2010 14:55:57 +0200 Subject: #i110806# fix stlport debug assertion (thanks dtardon) --- vcl/source/gdi/sallayout.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 344867ebb0b0..cacaa1849b65 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -1800,8 +1800,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) int nRunStart, nRunEnd; while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl)) { - if (bRtl) std::fill(vRtl.begin() + nRunStart - rArgs.mnMinCharPos, - vRtl.begin() + nRunEnd - rArgs.mnMinCharPos, true); + if (bRtl) std::fill(vRtl.begin() + (nRunStart - rArgs.mnMinCharPos), + vRtl.begin() + (nRunEnd - rArgs.mnMinCharPos), true); } rArgs.ResetPos(); -- cgit From f0b4543e5d07906c9f2a3c0afcae736740d7c0ac Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 12 Apr 2010 16:02:27 +0200 Subject: #i110810# rename output files --- l10ntools/source/localize.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index b869098faed7..9379590d089c 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -959,8 +959,16 @@ int _cdecl main( int argc, char *argv[] ) aIter.SetLanguageRestriction( sLanguages ); if ( bExport ){ if( bQuiet2 ){ /*printf("");*/fflush( stdout );} - aIter.Extract( sFileName ); - if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + if( *iter == "ooo" ) + aIter.Extract( sFileName ); + else + { + ByteString sFileNameWithExt( sFileName ); + sFileNameWithExt += ByteString( "." ); + sFileNameWithExt += ByteString( (*iter).c_str() , (*iter).length() ); + aIter.Extract( sFileNameWithExt ); + } + if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());} } } if( hasPwd ) @@ -973,7 +981,7 @@ int _cdecl main( int argc, char *argv[] ) if ( bExport ){ if( bQuiet2 ){ /*printf("");*/fflush( stdout );} aIter.Extract( sFileName ); - if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());} } } -- cgit From d1137b8a472b3cc30262c20267c63086e58424a5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 10:06:23 +0200 Subject: slidecopy: make compile with GCC --- svtools/source/toolpanel/toolpaneldrawer.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index e9a12de762b1..b45c88106a03 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -90,7 +90,6 @@ namespace svt m_pPaintDevice->SetSettings( GetSettings() ); m_pPaintDevice->SetDrawMode( GetDrawMode() ); - const int nWidth( GetOutputSizePixel().Width() ); const Rectangle aTextBox( impl_calcTextBoundingBox() ); impl_paintBackground( impl_calcTitleBarBox( aTextBox ) ); -- cgit From 7aaf18c9983734125c595c294a3f50fc95de38f0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 13 Apr 2010 12:17:53 +0200 Subject: slidecopy: moved SD's task pane implementation to the new base implementation from SFX. Still not all previous functionality restored. --- svtools/inc/svtools/toolpanel/toolpaneldeck.hxx | 7 ++++--- svtools/source/toolpanel/toolpaneldeck.cxx | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx index 92412212133b..a1009591ffba 100755 --- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx +++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx @@ -149,14 +149,15 @@ namespace svt This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method whenever a panel is activated, to act as parent window for the panel's VCL-Window. */ - Window& GetPanelWindowAnchor(); + ::Window& GetPanelWindowAnchor(); + const ::Window& GetPanelWindowAnchor() const; /** sets the window which should act as parent in the A11Y object hierarchy. Calling this method has no effect if CreateAccessible had always been called. */ - void SetAccessibleParentWindow( Window* i_pAccessibleParent ); - Window* GetAccessibleParentWindow() const; + void SetAccessibleParentWindow( ::Window* i_pAccessibleParent ); + ::Window* GetAccessibleParentWindow() const; // IToolPanelDeck virtual size_t GetPanelCount() const; diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index af12a39f75ab..e939eb027141 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -99,7 +99,8 @@ namespace svt PDeckLayouter GetLayouter() const { return m_pLayouter; } void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + const Window& GetPanelWindowAnchor() const { return m_aPanelAnchor; } bool IsDead() const { return m_bInDtor; } @@ -454,6 +455,12 @@ namespace svt return m_pImpl->GetPanelWindowAnchor(); } + //-------------------------------------------------------------------- + const Window& ToolPanelDeck::GetPanelWindowAnchor() const + { + return m_pImpl->GetPanelWindowAnchor(); + } + //-------------------------------------------------------------------- void ToolPanelDeck::Resize() { -- cgit From 0f641fbfd20f06811ec4bdd886ff7ab16d058375 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Tue, 13 Apr 2010 18:26:22 +0200 Subject: l10ntooling18: #i109378# set path to gsicheck in localize.pl --- l10ntools/scripts/localize.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index 8b6a8231ebce..a6a370385f21 100755 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -392,11 +392,9 @@ sub merge_gsicheck{ my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile(); close ( $TMPHANDLE ); - if( $ENV{WRAPCMD} ){ - $command = "$ENV{WRAPCMD} gsicheck"; - }else{ - $command = "gsicheck"; - } + $command = "$ENV{WRAPCMD} " if( $ENV{WRAPCMD} ); + $command .= fix_cygwin_path("$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck"); + my $errfile = $sdffile.".err"; $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $sdffile"; #my $rc = system( $command ); -- cgit From 8b570a04e1bd1f5e2f49f13c4c377dbeb2ca6928 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 14 Apr 2010 09:28:17 +0200 Subject: #i107915# fix vertical writing for non-BMP CJK chars --- vcl/source/gdi/sallayout.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 008a64f615f2..3e4ca9fc3df6 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -133,18 +133,19 @@ int GetVerticalFlags( sal_UCS4 nChar ) /* #i52932# remember: nChar == 0x2010 || nChar == 0x2015 nChar == 0x2016 || nChar == 0x2026 - are GF_NONE also, but already handled in the first if + are GF_NONE also, but already handled in the outer if condition */ if((nChar >= 0x3008 && nChar <= 0x301C && nChar != 0x3012) || (nChar == 0xFF3B || nChar == 0xFF3D) || (nChar >= 0xFF5B && nChar <= 0xFF9F) // halfwidth forms - || (nChar == 0xFFE3) - || (nChar >= 0x02F800 && nChar <= 0x02FFFF) ) + || (nChar == 0xFFE3) ) return GF_NONE; // not rotated else if( nChar == 0x30fc ) return GF_ROTR; // right return GF_ROTL; // left } + else if( (nChar >= 0x02F800 && nChar <= 0x02FFFF) ) // non-BMP CJK ideographs + return GF_NONE; // not rotated return GF_NONE; } -- cgit From 4862537f5858d956503113a5cd44933e02281a70 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 10:37:41 +0200 Subject: slidecopy: re-implemented the TaskPane's "View" menu in SFX, using the code formerly found in SD --- svtools/source/toolpanel/toolpaneldrawer.cxx | 7 +++++++ svtools/source/toolpanel/toolpaneldrawer.hxx | 1 + 2 files changed, 8 insertions(+) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index e9a12de762b1..c33a33843d2b 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -223,6 +223,13 @@ namespace svt Invalidate(); } + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent ) + { + // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when + // we live in a DockingWindow, would start undocking + } + //------------------------------------------------------------------------------------------------------------------ void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent ) { diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index 992c15d67d6d..e088365176f4 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -54,6 +54,7 @@ namespace svt virtual void GetFocus(); virtual void LoseFocus(); virtual void DataChanged( const DataChangedEvent& i_rEvent ); + virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( BOOL i_bCreate ); -- cgit From 2f030c991f7de0b09dc4dd6210f2b99511b69509 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 14 Apr 2010 14:45:43 +0200 Subject: #i110240# fix emulation of hflex/hflex1 type2ops for type1 subset --- vcl/source/fontsubset/cff.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 9884e7016fee..d3cbd7e7bfbf 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -468,7 +468,7 @@ public: // TODO: is public really needed? private: // typeop exceution context int mnStackIdx; - ValType mnValStack[ NMAXSTACK]; + ValType mnValStack[ NMAXSTACK+4]; ValType mnTransVals[ NMAXTRANS]; int mnHintSize; @@ -1241,16 +1241,33 @@ void CffSubsetterContext::convertOneTypeEsc( void) break; } case TYPE2OP::HFLEX1: { - assert( mnStackIdx == 9 ); - writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, -6 ); - writeCurveTo( mnStackIdx, -4, -6, -3, -2, -1, -8 ); + assert( mnStackIdx == 9); +#if 0 // emulate hflex1 as straight line + const ValType* pX = &mnValStack[ mnStackIdx]; + const ValType fDX = pX[-9] + pX[-7] + pX[-5] + pX[-4] + pX[-3] + pX[-1]; + writeType1Val( fDX); + writeTypeOp( TYPE1OP::HLINETO); +#else // emulate hflex1 as two curves + writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0); + writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0); + // TODO: emulate hflex1 using othersubr call +#endif mnStackIdx -= 9; } break; case TYPE2OP::HFLEX: { - assert( mnStackIdx == 7 ); - writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, -5 ); - writeCurveTo( mnStackIdx, -3, -5, -2, 0, -1, 0 ); + assert( mnStackIdx == 7); + ValType* pX = &mnValStack[ mnStackIdx]; +#if 0 // emulate hflex as straight line + const ValType fDX = pX[-7] + pX[-6] + pX[-4] + pX[-3] + pX[-2] + pX[-1]; + writeType1Val( fDX); + writeTypeOp( TYPE1OP::HLINETO); +#else // emulate hflex as two curves + pX[+1] = -pX[-5]; // temp: +dy5==-dy2 + writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0); + writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0); + // TODO: emulate hflex using othersubr call +#endif mnStackIdx -= 7; } break; -- cgit From b798812d02e55e78ca20f6c55fefdd062f5cd164 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 14 Apr 2010 17:31:33 +0200 Subject: npower13_objectmodules: make vba import available in oox filters --- sot/source/unoolestorage/xolesimplestorage.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index 68686ff8c8f5..1780e45c5ed6 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -199,9 +199,9 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, :: uno::Reference< container::XNameAccess > xSubNameAccess; uno::Any aAny = xNameAccess->getByName( aElements[nInd] ); if ( aAny >>= xInputStream ) - InsertInputStreamToStorage_Impl( pNewStorage, aName, xInputStream ); + InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream ); else if ( aAny >>= xSubNameAccess ) - InsertNameAccessToStorage_Impl( pNewStorage, aName, xSubNameAccess ); + InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess ); } } catch( uno::Exception& ) -- cgit From 0335bd7d3883fa2fd7127ad70a2820c269efb9e3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 14 Apr 2010 21:22:47 +0200 Subject: slidecopy: #i10000# (unxlngi6) --- svtools/source/toolpanel/toolpaneldrawer.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 61ec839ca100..029afab0ad55 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -227,6 +227,7 @@ namespace svt { // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when // we live in a DockingWindow, would start undocking + (void)i_rMouseEvent; } //------------------------------------------------------------------------------------------------------------------ -- cgit From d19446a8cae2eb3435032d54be2563c9946889d0 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 6 May 2010 11:11:19 +0200 Subject: ooo321l10n: added support for hi qcv-ES sq, removed hi-IN --- i18npool/source/isolang/isolang.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 7c2d83c83a2b..9d80bf7050e6 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -287,8 +287,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_BELARUSIAN, "be", "BY" }, { LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default) { LANGUAGE_CATALAN, "ca", "AD" }, // Andorra - { LANGUAGE_USER_CATALAN_VALENCIAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; for UI localization, use in document content on own risk! { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; old workaround for UI localization only, do not use in document content! Kept just in case.. + { LANGUAGE_USER_CATALAN_VALENCIAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; for UI localization, use in document content on own risk! { LANGUAGE_FRENCH_CAMEROON, "fr", "CM" }, { LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" }, { LANGUAGE_FRENCH_HAITI, "fr", "HT" }, -- cgit From db2cdcabc3d800dab0c7e8ef48e08c1198d8cefe Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 20 Apr 2010 17:31:39 +0200 Subject: ooo321gsl05: #i107249# update fullscreen handling --- vcl/unx/gtk/window/gtkframe.cxx | 49 ++++++++++++++++++++++++++++++------- vcl/unx/inc/wmadaptor.hxx | 10 ++++++++ vcl/unx/source/app/wmadaptor.cxx | 35 ++++++++++++++++++++++++++ vcl/unx/source/window/salframe.cxx | 50 ++++++++++++++++++-------------------- 4 files changed, 109 insertions(+), 35 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index ef356eb57aa9..16e478c22f6e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -690,7 +690,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe XFree( pHints ); if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz")) - return; + return; /* remove WM_TAKE_FOCUS protocol; this would usually be the * right thing, but gtk handles it internally whereas we @@ -844,7 +844,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) eType = GDK_WINDOW_TYPE_HINT_UTILITY; } - if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) + && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true ); @@ -1304,7 +1305,8 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) { if( m_pWindow ) { - if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) ) + if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) + && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible ); if( bVisible ) { @@ -1465,6 +1467,12 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } + if( m_bFullscreen ) + { + aGeo.max_width = m_aMaxSize.Width(); + aGeo.max_height = m_aMaxSize.Height(); + aHints |= GDK_HINT_MAX_SIZE; + } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1816,8 +1824,6 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ), Size( maGeometry.nWidth, maGeometry.nHeight ) ); - // workaround different window managers have different opinions about - // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); if( bVisible ) Show( FALSE ); @@ -1834,12 +1840,22 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) gtk_window_move( GTK_WINDOW(m_pWindow), maGeometry.nX = aNewPosSize.Left(), maGeometry.nY = aNewPosSize.Top() ); + // #i110881# for the benefit of compiz set a max size here + // else setting to fullscreen fails for unknown reasons + m_aMaxSize.Width() = aNewPosSize.GetWidth()+100; + m_aMaxSize.Height() = aNewPosSize.GetHeight()+100; + // workaround different legacy version window managers have different opinions about + // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) + if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); if( bVisible ) Show( TRUE ); } else { bool bVisible = GTK_WIDGET_MAPPED(m_pWindow); + if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); if( bVisible ) Show( FALSE ); m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN; @@ -1862,8 +1878,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { if( bFullScreen ) { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); + } gtk_window_fullscreen( GTK_WINDOW(m_pWindow) ); moveToScreen( nScreen ); Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); @@ -1875,8 +1894,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else { gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); + if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); + } moveToScreen( nScreen ); } } @@ -3184,6 +3206,15 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame } pThis->m_nState = pEvent->window_state.new_window_state; + #if OSL_DEBUG_LEVEL > 1 + if( (pEvent->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) ) + { + fprintf( stderr, "window %p %s full screen state\n", + pThis, + (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? "enters" : "leaves"); + } + #endif + return FALSE; } diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx index c628cfe091ef..d8aecc905c27 100644 --- a/vcl/unx/inc/wmadaptor.hxx +++ b/vcl/unx/inc/wmadaptor.hxx @@ -160,6 +160,7 @@ protected: m_aWMWorkAreas; bool m_bTransientBehaviour; bool m_bEnableAlwaysOnTopWorks; + bool m_bLegacyPartialFullscreen; int m_nWinGravity; int m_nInitWinGravity; @@ -230,6 +231,15 @@ public: * start/stop fullscreen mode on a frame */ virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const; + /* + * tell whether legacy partial full screen handling is necessary + * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto + * modern WM's interpret it the "right" way, namely they make "full screen" + * taking twin view or Xinerama into accound and honor the positioning hints + * to see which screen actually was meant to use for fullscreen. + */ + bool isLegacyPartialFullscreen() const + { return m_bLegacyPartialFullscreen; } /* * set window struts */ diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index 89c8bb56291c..997bf6f1504f 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -233,6 +233,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : m_pSalDisplay( pDisplay ), m_bTransientBehaviour( true ), m_bEnableAlwaysOnTopWorks( false ), + m_bLegacyPartialFullscreen( false ), m_nWinGravity( StaticGravity ), m_nInitWinGravity( StaticGravity ) { @@ -909,6 +910,40 @@ bool WMAdaptor::getNetWmName() XFree( pProperty ); pProperty = NULL; } + // if this is metacity, check for version to enable a legacy workaround + if( m_aWMName.EqualsAscii( "Metacity" ) ) + { + int nVersionMajor = 0, nVersionMinor = 0; + Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True ); + if( nVersionAtom ) + { + if( XGetWindowProperty( m_pDisplay, + aWMChild, + nVersionAtom, + 0, 256, + False, + m_aWMAtoms[ UTF8_STRING ], + &aRealType, + &nFormat, + &nItems, + &nBytesLeft, + &pProperty ) == 0 + && nItems != 0 + ) + { + String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 ); + nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32(); + nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32(); + } + if( pProperty ) + { + XFree( pProperty ); + pProperty = NULL; + } + } + if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) ) + m_bLegacyPartialFullscreen = true; + } } } else if( pProperty ) diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 5b538626a634..c6e699ea55a5 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -549,6 +549,14 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa pHints->win_gravity = GetDisplay()->getWMAdaptor()->getPositionWinGravity(); pHints->x = 0; pHints->y = 0; + if( mbFullScreen ) + { + pHints->flags |= PMaxSize | PMinSize; + pHints->max_width = w+100; + pHints->max_height = h+100; + pHints->min_width = w; + pHints->min_height = h; + } XSetWMNormalHints( GetXDisplay(), GetShellWindow(), pHints ); @@ -605,7 +613,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa eType = WMAdaptor::windowType_Utility; if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) eType = WMAdaptor::windowType_Toolbar; - if( nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) + if( (nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) + && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) eType = WMAdaptor::windowType_Dock; GetDisplay()->getWMAdaptor()-> @@ -1130,7 +1139,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // even though transient frames should be kept above their parent // this does not necessarily hold true for DOCK type windows // so artificially set ABOVE and remove it again on hide - if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) + if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) && pDisplay_->getWMAdaptor()->isLegacyPartialFullscreen()) pDisplay_->getWMAdaptor()->enableAlwaysOnTop( this, bVisible ); bMapped_ = bVisible; @@ -1322,11 +1331,6 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } else { -#if OSL_DEBUG_LEVEL > 1 - if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) - fprintf( stderr, "hide on ownerdraw\n" ); -#endif - if( getInputContext() ) getInputContext()->Unmap( this ); @@ -1616,6 +1620,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR } else SetPosSize( aPosSize ); + bDefaultPosition_ = False; } @@ -2042,6 +2047,12 @@ void X11SalFrame::SetPosSize( const Rectangle &rPosSize ) pHints->y = values.y; pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity(); } + if( mbFullScreen ) + { + pHints->max_width = 10000; + pHints->max_height = 10000; + pHints->flags |= PMaxSize; + } XSetWMNormalHints( GetXDisplay(), GetShellWindow(), pHints ); @@ -2199,28 +2210,15 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) maGeometry.nWidth = aRect.GetWidth(); maGeometry.nHeight = aRect.GetHeight(); mbMaximizedHorz = mbMaximizedVert = false; + mbFullScreen = true; createNewWindow( None, m_nScreen ); - GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); - #if 0 - // this would give additional intent to the window - // manager to force the positioning of the window; - // alas all other windows will be expunged from that - // region, leaving us in a pity state afterwards - Size aScreenSize = pDisplay_->GetScreenSize( m_nScreen ); - pDisplay_->getWMAdaptor()->setFrameStruts( this, - aRect.Left(), aRect.Top(), - aScreenSize.Width() - aRect.Right(), - aScreenSize.Height() - aRect.Bottom(), - aRect.Left(), aRect.Right(), - aRect.Top(), aRect.Bottom(), - aRect.Left(), aRect.Right(), - aRect.Top(), aRect.Bottom() - ); - #endif - + if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true ); + else + GetDisplay()->getWMAdaptor()->showFullScreen( this, true ); if( bVisible ) Show(TRUE); - mbFullScreen = true; + } else { -- cgit From 9ee8a12b8bd63f7a24d8f29dd4cd2b91b567f1b1 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 6 May 2010 11:57:18 +0200 Subject: ooo321gsl05: fix wrong order of initializers --- svtools/source/filter.vcl/wmf/winmtf.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx index beb1f62e22d6..d2f5d0f39aee 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.hxx +++ b/svtools/source/filter.vcl/wmf/winmtf.hxx @@ -321,7 +321,7 @@ class WinMtfClipPath sal_Bool bNeedsUpdate; - WinMtfClipPath(): eType(EMPTY), bNeedsUpdate( sal_False ){}; + WinMtfClipPath(): eType(EMPTY), nDepth( 0 ), bNeedsUpdate( sal_False ){}; void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ); void IntersectClipRect( const Rectangle& rRect ); -- cgit From ece3ce2a708049c68932f1c2b470a85add548ac4 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 6 May 2010 17:42:57 +0200 Subject: ooo321gsl05: #i110980# prevent wmf import filter to resolve too many clip actions --- svtools/source/filter.vcl/wmf/winmtf.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx index 21f6e69c8d9e..bf176015fd77 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.cxx +++ b/svtools/source/filter.vcl/wmf/winmtf.cxx @@ -36,7 +36,7 @@ // ------------------------------------------------------------------------ -#define WIN_MTF_MAX_POLYPOLYCOUNT 16 +#define WIN_MTF_MAX_CLIP_DEPTH 16 void WinMtfClipPath::ImpUpdateType() { @@ -54,26 +54,28 @@ void WinMtfClipPath::IntersectClipRect( const Rectangle& rRect ) { if ( !aPolyPoly.Count() ) aPolyPoly = Polygon( rRect ); - else if ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) + else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) { Polygon aPolygon( rRect ); PolyPolygon aIntersection; PolyPolygon aPolyPolyRect( aPolygon ); aPolyPoly.GetIntersection( aPolyPolyRect, aIntersection ); aPolyPoly = aIntersection; + nDepth++; } ImpUpdateType(); } void WinMtfClipPath::ExcludeClipRect( const Rectangle& rRect ) { - if ( aPolyPoly.Count() && ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) ) + if ( aPolyPoly.Count() && ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) ) { Polygon aPolygon( rRect ); PolyPolygon aPolyPolyRect( aPolygon ); PolyPolygon aDifference; aPolyPoly.GetDifference( aPolyPolyRect, aDifference ); aPolyPoly = aDifference; + nDepth++; } ImpUpdateType(); } @@ -82,8 +84,10 @@ void WinMtfClipPath::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nCl { if ( !rPolyPolygon.Count() ) aPolyPoly = rPolyPolygon; - else if ( rPolyPolygon.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) + else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) { + nDepth++; + PolyPolygon aNewClipPath; // #115345# Watch out for empty aPolyPoly here - conceptually, -- cgit From 2d5a8894b9250792202ed7cd4447949573d9dfbf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 15 Apr 2010 16:37:39 +0200 Subject: nativeb: #i110915# make flat buttons even more flat --- vcl/source/control/button.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 08a479c942b9..486cfe258449 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -880,7 +880,9 @@ void PushButton::ImplInitSettings( BOOL bFont, EnableChildTransparentMode( TRUE ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); SetPaintTransparent( TRUE ); - mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects; + mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON) + ? false + : ImplGetSVData()->maNWFData.mbNoFocusRects; } else { @@ -1363,7 +1365,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); - if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) ) + if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) ) { bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); @@ -1388,7 +1390,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( (GetStyle() & WB_FLATBUTTON) ) { Rectangle aTempRect( aInRect ); - if( ! bLayout && (bRollOver || HasFocus()) ) + if( ! bLayout && bRollOver ) ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle ); aInRect.Left() += 2; aInRect.Top() += 2; -- cgit From d1ff4b4f3430d60eea947d48d9af14c90ca2d13b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 15 Apr 2010 20:50:30 +0200 Subject: nativeb: #i110915# adjust image/text alignment for flat buttons --- vcl/inc/vcl/button.hxx | 2 +- vcl/source/control/button.cxx | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 317a98026f45..8f4b94bf7b18 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -60,7 +60,7 @@ public: SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags ); SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect=NULL ); + USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false ); SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect ); SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const; SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign ); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 486cfe258449..08759f37d7a6 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -367,7 +367,8 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle, void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize, BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags, - USHORT nTextStyle, Rectangle *pSymbolRect ) + USHORT nTextStyle, Rectangle *pSymbolRect, + bool bAddImageSep ) { XubString aText( GetText() ); BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE ); @@ -502,6 +503,13 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, if ( aTSSize.Height() < aTextSize.Height() ) aTSSize.Height() = aTextSize.Height(); + + if( bAddImageSep && bDrawImage ) + { + long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3; + if( nDiff > 0 ) + nImageSep += nDiff; + } } aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width(); @@ -1196,8 +1204,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; if( nImageSep < 1 ) nImageSep = 1; + // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary + // in the next major this should be replaced by "true" ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, - nTextStyle, IsSymbol() ? &aSymbolRect : NULL ); + nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); if ( IsSymbol() && ! bLayout ) { -- cgit From dcf66a0c608601ce92cc1df62038eb8a8d507a87 Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Fri, 16 Apr 2010 11:53:57 +0200 Subject: kfreebsdport01: add kFreeBSD port patches from http://bugs.debian.org/578023 --- tools/source/stream/strmunx.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 8a3504a417c0..e4c280d12383 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -209,7 +209,7 @@ static sal_uInt32 GetSvError( int nErrno ) { 0, SVSTREAM_OK }, { EACCES, SVSTREAM_ACCESS_DENIED }, { EBADF, SVSTREAM_INVALID_HANDLE }, -#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) +#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined(FREEBSD) || defined(MACOSX) || defined(__FreeBSD_kernel__) { EDEADLK, SVSTREAM_LOCKING_VIOLATION }, #else { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION }, @@ -223,7 +223,7 @@ static sal_uInt32 GetSvError( int nErrno ) { EAGAIN, SVSTREAM_LOCKING_VIOLATION }, { EISDIR, SVSTREAM_PATH_NOT_FOUND }, { ELOOP, SVSTREAM_PATH_NOT_FOUND }, -#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) +#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX) && ! defined(__FreeBSD_kernel__) { EMULTIHOP, SVSTREAM_PATH_NOT_FOUND }, { ENOLINK, SVSTREAM_PATH_NOT_FOUND }, #endif -- cgit From a075cefbec52ef6b02cd631e8a5b1319aadd3e03 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 16 Apr 2010 14:11:19 +0200 Subject: #i108743# fix psp\'s getGlyphWidths() for non-type1 fonts --- vcl/unx/source/fontmanager/fontmanager.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 93e3eef53ab3..606a57071d64 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -40,6 +40,7 @@ #include "vcl/fontcache.hxx" #include "vcl/fontcache.hxx" #include "vcl/fontsubset.hxx" +#include "vcl/impfont.hxx" #include "vcl/strhelper.hxx" #include "vcl/ppdparser.hxx" #include "vcl/svdata.hxx" @@ -3795,6 +3796,35 @@ void PrintFontManager::getGlyphWidths( fontID nFont, free( pMetrics ); rUnicodeEnc.clear(); } + + // fill the unicode map + // TODO: isn't this map already available elsewhere in the fontmanager? + const sal_uInt8* pCmapData = NULL; + int nCmapSize = 0; + if( GetSfntTable( pTTFont, O_cmap, &pCmapData, &nCmapSize ) ) + { + CmapResult aCmapResult; + if( ParseCMAP( pCmapData, nCmapSize, aCmapResult ) ) + { + const ImplFontCharMap aCharMap( aCmapResult ); + for( sal_uInt32 cOld = 0;;) + { + // get next unicode covered by font + const sal_uInt32 c = aCharMap.GetNextChar( cOld ); + if( c == cOld ) + break; + cOld = c; +#if (sizeof(sal_Unicode) <= 2) // TODO: remove when sal_Unicode covers all of unicode + if( c > 0xFFFF ) + break; +#endif + // get the matching glyph index + const sal_uInt32 nGlyphId = aCharMap.GetGlyphIndex( c ); + // update the requested map + rUnicodeEnc[ (sal_Unicode)c ] = nGlyphId; + } + } + } } CloseTTFont( pTTFont ); } -- cgit From 63c03e7f1bb7349cd4168ed30a0535f7c928207f Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 16 Apr 2010 14:47:11 +0200 Subject: npower13_objectmodules: use document frame from media descriptor --- comphelper/inc/comphelper/mediadescriptor.hxx | 1 + comphelper/source/misc/mediadescriptor.cxx | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index ac9661c76ebc..e20440a3d30d 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -83,6 +83,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap static const ::rtl::OUString& PROP_FILTERNAME(); static const ::rtl::OUString& PROP_FILTEROPTIONS(); static const ::rtl::OUString& PROP_FORMAT(); + static const ::rtl::OUString& PROP_FRAME(); static const ::rtl::OUString& PROP_FRAMENAME(); static const ::rtl::OUString& PROP_HIDDEN(); static const ::rtl::OUString& PROP_INPUTSTREAM(); diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 7e3be338992b..1710a43027cf 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -183,6 +183,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_FORMAT() return sProp; } +const ::rtl::OUString& MediaDescriptor::PROP_FRAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame")); + return sProp; +} + const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName")); -- cgit From 0d26b21b603b07aa6dba089c12e8a6c66eade60a Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Fri, 16 Apr 2010 16:10:11 +0200 Subject: #i108132# dispose stylesheets to avoid dangling references --- svl/source/items/style.cxx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index b8bed49b603b..60c622208d53 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -28,7 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svl.hxx" -#ifndef GCC +#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ +#include #endif #define _SVSTDARR_STRINGS @@ -808,6 +809,16 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) { // Alle Styles umsetzen, deren Parent dieser hier ist ChangeParent( p->GetName(), p->GetParent() ); + + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY ); + if( xComp.is() ) try + { + xComp->dispose(); + } + catch( com::sun::star::uno::Exception& ) + { + } + aStyles.erase(aIter); Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) ); } @@ -838,6 +849,15 @@ void SfxStyleSheetBasePool::Clear() SfxStyles::iterator aIter( aClearStyles.begin() ); while( aIter != aClearStyles.end() ) { + com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY ); + if( xComp.is() ) try + { + xComp->dispose(); + } + catch( com::sun::star::uno::Exception& ) + { + } + Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) ); } } -- cgit From 219103d56e4c84589ab2eec75cc77f420a1dfa0d Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 16 Apr 2010 16:55:27 +0200 Subject: gridcontrol_03:fixes for #i110947#, #i110521# --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 1 + svtools/inc/svtools/table/tablecontrol.hxx | 7 +- svtools/inc/svtools/table/tabledatawindow.hxx | 7 + svtools/inc/svtools/table/tablemodel.hxx | 1 - svtools/source/table/defaultinputhandler.cxx | 18 +- svtools/source/table/gridtablerenderer.cxx | 186 +++++------- svtools/source/table/tablecontrol.cxx | 14 +- svtools/source/table/tablecontrol_impl.cxx | 325 ++++++++++++--------- svtools/source/table/tablecontrol_impl.hxx | 3 +- svtools/source/table/tabledatawindow.cxx | 20 +- svtools/source/uno/svtxgridcontrol.cxx | 15 +- 11 files changed, 316 insertions(+), 281 deletions(-) diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 95ac7b6bdd94..849c2cd23905 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -121,6 +121,7 @@ namespace svt { namespace table virtual void resizeColumn(const Point& rPoint ) = 0; virtual bool startResizeColumn(const Point& rPoint) = 0; virtual bool endResizeColumn(const Point& rPoint) = 0; + virtual bool isRowSelected(RowPos _nRow); virtual ~IAbstractTableControl() {}; }; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index cfb4357eb5ac..313b2b7b7735 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -69,7 +69,10 @@ namespace svt { namespace table class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable { private: - DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* ); + DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* ); + + DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* ); TableControl_Impl* m_pImpl; ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols; @@ -185,7 +188,6 @@ namespace svt { namespace table virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const; - //// Window virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); virtual void GrabFocus(); @@ -221,6 +223,7 @@ namespace svt { namespace table void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); void selectionChanged(bool _bChanged); + protected: /// retrieves the XAccessible implementation associated with the GridControl instance ::svt::IAccessibleFactory& getAccessibleFactory(); diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index 00630be35ae4..0e65f9847816 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -52,9 +52,16 @@ namespace svt { namespace table friend class TableFunctionSet; private: TableControl_Impl& m_rTableControl; + Link m_aMouseButtonDownHdl; + Link m_aMouseButtonUpHdl; Link m_aSelectHdl; + RowPos m_nRowAlreadySelected; public: TableDataWindow( TableControl_Impl& _rTableControl ); + inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; } + inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; } + inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; } + inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; } inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } inline const Link& GetSelectHdl() const { return m_aSelectHdl; } diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index fbc60fb7bc0e..3da396d9d86c 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -444,7 +444,6 @@ namespace svt { namespace table @param actWidth the given width of the table */ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0; - virtual bool hasVerticalScrollbar() =0; virtual bool hasHorizontalScrollbar() = 0; /** fills cells with content diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index 6a33b96b2742..ad8f7a7562d3 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -77,21 +77,26 @@ namespace svt { namespace table { bool bHandled = false; Point aPoint = _rMEvt.GetPosPixel(); - if(_rControl.getCurrentRow(aPoint) == -1) + RowPos nRow = _rControl.getCurrentRow(aPoint); + if(nRow == -1) { m_bResize = _rControl.startResizeColumn(aPoint); bHandled = true; } - else if(_rControl.getCurrentRow(aPoint) >= 0) + else if(nRow >= 0) { if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION) { - LoseFocus(_rControl); _rControl.setCursorAtCurrentCell(aPoint); bHandled = true; } else - bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt); + { + if(!_rControl.isRowSelected(nRow)) + bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt); + else + bHandled = true; + } } return bHandled; } @@ -109,12 +114,12 @@ namespace svt { namespace table } else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION) { - GetFocus(_rControl); - _rControl.setCursorAtCurrentCell(aPoint); bHandled = true; } else + { bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt); + } } else { @@ -224,7 +229,6 @@ namespace svt { namespace table // TODO return false; } - //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 5c7a8dbd6832..77db8fc30904 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -79,34 +79,21 @@ namespace svt { namespace table OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea, "GridTableRenderer::PaintHeaderArea: invalid area flags!" ); - // fill the rows with alternating background colors _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - if( background != 0xFFFFFF && line == 0xFFFFFF) - { - _rDevice.SetLineColor(background); - _rDevice.SetFillColor(background); - } - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - _rDevice.SetFillColor(background); - } + Color background = m_pImpl->rModel.getHeaderBackgroundColor(); + if( background != 0xFFFFFF) + _rDevice.SetFillColor(background); + else + _rDevice.SetFillColor(_rStyle.GetDialogColor()); + _rDevice.SetLineColor(_rStyle.GetSeparatorColor()); _rDevice.DrawRect( _rArea ); // delimiter lines at bottom/right _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); _rDevice.Pop(); - (void)_rStyle; - (void)_bIsColHeaderArea; - (void)_bIsRowHeaderArea; + (void)_bIsColHeaderArea; + (void)_bIsRowHeaderArea; } //-------------------------------------------------------------------- @@ -114,41 +101,30 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle ) { _rDevice.Push( PUSH_LINECOLOR); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetShadowColor()); - else - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + _rDevice.SetLineColor(_rStyle.GetSeparatorColor()); _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight()); String sHeaderText; - PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol ); DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); if ( !!pColumn ) sHeaderText = pColumn->getName(); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); - ULONG nHorFlag = TEXT_DRAW_LEFT; - ULONG nVerFlag = TEXT_DRAW_TOP; - if(m_pImpl->rModel.getVerticalAlign() == 1) - nVerFlag = TEXT_DRAW_VCENTER; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - nVerFlag = TEXT_DRAW_BOTTOM; - if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1) - nHorFlag = TEXT_DRAW_CENTER; - else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) - nHorFlag = TEXT_DRAW_RIGHT; - Rectangle aRect(_rArea); - aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=4; aRect.Bottom()-=4; - _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); - _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=2; aRect.Bottom()-=2; + _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.Pop(); (void)_bActive; @@ -168,95 +144,75 @@ namespace svt { namespace table _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - //if row is selected background color becomes blue, and lines should be also blue - //if they aren't user defined - if(_bSelected) - { - Color aSelected(_rStyle.GetHighlightColor()); - aRowBackground = aSelected; - if(line == 0xFFFFFF) - _rDevice.SetLineColor(aRowBackground); - else - _rDevice.SetLineColor(line); - } - //if row not selected, check the cases whether user defined backgrounds are set - //and set line color to be the same - else - { - if(aRowBackground2 != 0xFFFFFF && _nRow%2) + Color line = m_pImpl->rModel.getLineColor(); + Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + //if row is selected background color becomes blue, and lines should be also blue + //if they aren't user defined + if(_bSelected) { - aRowBackground = aRowBackground2; + Color aSelected(_rStyle.GetHighlightColor()); + aRowBackground = aSelected; if(line == 0xFFFFFF) _rDevice.SetLineColor(aRowBackground); else _rDevice.SetLineColor(line); } - //fill the rows with alternating background colors if second background color is specified - else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(aRowBackground); + //if row not selected, check the cases whether user defined backgrounds are set + //and set line color to be the same else { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + if(aRowBackground2 != 0xFFFFFF && _nRow%2) + { + aRowBackground = aRowBackground2; + if(line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + _rDevice.SetLineColor(line); + } + //fill the rows with alternating background colors if second background color is specified + else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(aRowBackground); + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } - } - Rectangle aRect(_rRowArea); - if(m_pImpl->rModel.hasColumnHeaders() || _nRow != 0) - --aRect.Top(); - if(m_pImpl->rModel.hasRowHeaders()) - --aRect.Left(); _rDevice.SetFillColor( aRowBackground ); - _rDevice.DrawRect( aRect ); + _rDevice.DrawRect( _rRowArea ); // TODO: active? _rDevice.Pop(); - (void)_bActive; + (void)_bActive; } //-------------------------------------------------------------------- void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) { - _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR); - //default background and line color is white - //background and lines should have same color, that's means lines aren't visible - //in case line color isn't set and background color is set, this should be changed - Color background = m_pImpl->rModel.getHeaderBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - if(background != 0xFFFFFF && line == 0xFFFFFF) - { - _rDevice.SetLineColor(background); - } - else - { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); - } + _rDevice.Push( PUSH_LINECOLOR); + _rDevice.SetLineColor(_rStyle.GetSeparatorColor()); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); - ULONG nHorFlag = TEXT_DRAW_LEFT; - ULONG nVerFlag = TEXT_DRAW_TOP; - if(m_pImpl->rModel.getVerticalAlign() == 1) - nVerFlag = TEXT_DRAW_VCENTER; - else if(m_pImpl->rModel.getVerticalAlign() == 2) - nVerFlag = TEXT_DRAW_BOTTOM; - if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1) - nHorFlag = TEXT_DRAW_CENTER; - else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) - nHorFlag = TEXT_DRAW_RIGHT; - Rectangle aRect(_rArea); - aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=4; aRect.Bottom()-=4; + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + ULONG nHorFlag = TEXT_DRAW_LEFT; + ULONG nVerFlag = TEXT_DRAW_TOP; + if(m_pImpl->rModel.getVerticalAlign() == 1) + nVerFlag = TEXT_DRAW_VCENTER; + else if(m_pImpl->rModel.getVerticalAlign() == 2) + nVerFlag = TEXT_DRAW_BOTTOM; + if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1) + nHorFlag = TEXT_DRAW_CENTER; + else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2) + nHorFlag = TEXT_DRAW_RIGHT; + Rectangle aRect(_rArea); + aRect.Left()+=4; aRect.Right()-=4; + aRect.Top()+=2; aRect.Bottom()-=2; _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); // TODO: active? selected? (void)_bActive; (void)_bSelected; - (void)_rStyle; //at the moment no special paint for selected row header _rDevice.Pop(); } @@ -330,7 +286,6 @@ namespace svt { namespace table (void)_bActive; // no special painting for the active cell at the moment - (void)_rStyle; } //-------------------------------------------------------------------- @@ -392,13 +347,12 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_RIGHT; Rectangle textRect(_rArea); textRect.Left()+=4; textRect.Right()-=4; - textRect.Top()+=4; textRect.Bottom()-=4; + textRect.Top()+=2; textRect.Bottom()-=2; _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); } _rDevice.Pop(); (void)_bActive; // no special painting for the active cell at the moment - (void)_rStyle; } //-------------------------------------------------------------------- diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 7452bda6d02a..12def82d3ecf 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -71,6 +71,8 @@ namespace svt { namespace table ,m_pImpl( new TableControl_Impl( *this ) ) ,m_bSelectionChanged(false) { + m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); + m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); m_pImpl->getDataWindow()->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); } @@ -335,7 +337,7 @@ namespace svt { namespace table ::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const { - ::com::sun::star::uno::Any cellContent = ::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")); + ::com::sun::star::uno::Any cellContent(::com::sun::star::uno::Any(::rtl::OUString::createFromAscii(""))); std::vector >& aTableContent = GetModel()->getCellContent(); if(&aTableContent) cellContent = aTableContent[_nRowPos][_nColPos]; @@ -555,6 +557,16 @@ IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) Select(); return 1; } +IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData ) +{ + CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData ); + return 1; +} +IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData ) +{ + CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData ); + return 1; +} // ----------------------------------------------------------------------- void TableControl::Select() { diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 9ef171bf6c8c..4057be745097 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -580,88 +580,89 @@ namespace svt { namespace table m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); long accumulatedPixelWidth = 0; - double gridWidth = m_rAntiImpl.GetSizePixel().Width()-4; - if(m_pModel->hasRowHeaders()) - { - TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); - gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); - } - if(m_pModel->hasVerticalScrollbar()) - { - sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); - gridWidth-=scrollbarWidth; - } - double colWidthsSum = 0.0; - double colWithoutFixedWidthsSum = 0.0; - double minColWithoutFixedSum = 0.0; - for ( ColPos col = 0; col < colCount; ++col ) + double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width(); + if(m_pModel->hasRowHeaders()) { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = 0; - TableMetrics colPrefWidth = pColumn->getPreferredWidth(); - bool bResizable = pColumn->isResizable(); - if(pColumn->getMinWidth() == 0 && bResizable) + TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); + gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); + } + if(m_pModel->hasVerticalScrollbar()) { - pColumn->setMinWidth(1); - minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + gridWidth-=scrollbarWidth; } - if(pColumn->getMaxWidth() == 0 && bResizable) - pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); - if( colPrefWidth != 0) + double colWidthsSum = 0.0; + double colWithoutFixedWidthsSum = 0.0; + double minColWithoutFixedSum = 0.0; + for ( ColPos col = 0; col < colCount; ++col ) { - if(m_bResizingGrid) + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = 0; + TableMetrics colPrefWidth = pColumn->getPreferredWidth(); + bool bResizable = pColumn->isResizable(); + if(pColumn->getMinWidth() == 0 && bResizable) { - colWidth = pColumn->getWidth(); - pColumn->setPreferredWidth(0); + pColumn->setMinWidth(1); + minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); } - else + if(pColumn->getMaxWidth() == 0 && bResizable) + pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); + if( colPrefWidth != 0) { - colWidth = colPrefWidth; - pColumn->setWidth(colPrefWidth); + if(m_bResizingGrid) + { + colWidth = pColumn->getWidth(); + pColumn->setPreferredWidth(0); + } + else + { + colWidth = colPrefWidth; + pColumn->setWidth(colPrefWidth); + } } + else + colWidth = pColumn->getWidth(); + long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + if(bResizable && colPrefWidth == 0) + colWithoutFixedWidthsSum+=pixelWidth; + colWidthsSum+=pixelWidth; } - else - colWidth = pColumn->getWidth(); - long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - if(bResizable && colPrefWidth == 0) - colWithoutFixedWidthsSum+=pixelWidth; - colWidthsSum+=pixelWidth; - } - gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; - double scalingFactor = 1.0; - if(m_bResizingGrid) - { - if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) - scalingFactor = gridWidth/colWithoutFixedWidthsSum; - } - else - { - if(colWidthsSum < gridWidth) + gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double scalingFactor = 1.0; + if(m_bResizingGrid) { - if(colWithoutFixedWidthsSum>0) + if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) scalingFactor = gridWidth/colWithoutFixedWidthsSum; } - } - long pixelWidth = 0; - for ( ColPos col = 0; col < colCount; ++col ) - { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = pColumn->getWidth(); - if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + else { - colWidth*=scalingFactor; - pColumn->setWidth(colWidth); + if(colWidthsSum < gridWidth) + { + if(colWithoutFixedWidthsSum>0) + scalingFactor = gridWidth/colWithoutFixedWidthsSum; + } + } + long pixelWidth = 0; + for ( ColPos i = 0; i < colCount; ++i ) + { + PColumnModel pColumn = m_pModel->getColumnModel( i ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = pColumn->getWidth(); + if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + { + colWidth*=scalingFactor; + //colWidth+=1; + pColumn->setWidth(colWidth); + } + pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + m_aColumnWidthsPixel.push_back( pixelWidth ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); } - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - m_aColumnWidthsPixel.push_back( pixelWidth ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); - } } //-------------------------------------------------------------------- @@ -882,6 +883,11 @@ namespace svt { namespace table m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) ); m_pScrollCorner->Show(); } + else if(bHaveScrollCorner && bNeedScrollCorner) + { + m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) ); + m_pScrollCorner->Show(); + } // resize the data window m_pDataWindow->SetSizePixel( Size( @@ -894,16 +900,22 @@ namespace svt { namespace table void TableControl_Impl::onResize() { DBG_CHECK_ME(); - if(m_nRowCount != 0) - { - if(m_nColumnCount != 0) + if(m_nRowCount != 0) { - if(m_bResizingGrid) - impl_ni_updateColumnWidths(); - invalidateRows(); - m_bResizingGrid = true; + if(m_nColumnCount != 0) + { + if(m_bResizingGrid) + impl_ni_updateColumnWidths(); + invalidateRows(); + m_bResizingGrid = true; + } } - } + else + //In the case that column headers are defined but data hasn't yet been set, + //only column headers will be shown + if(m_pModel->hasColumnHeaders()) + if(m_nColHeaderHeightPixel>1) + m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel()); } //-------------------------------------------------------------------- @@ -920,23 +932,28 @@ namespace svt { namespace table // our current style settings, to be passed to the renderer const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings(); - m_nRowCount = m_pModel->getRowCount(); - TableSize nVisibleRows = impl_getVisibleRows(true); - TableSize nActualRows = m_nRowCount; - if(m_nRowCount>nVisibleRows) - nActualRows = nVisibleRows; + m_nRowCount = m_pModel->getRowCount(); + TableSize nVisibleRows = impl_getVisibleRows(true); + TableSize nActualRows = m_nRowCount; + if(m_nRowCount>nVisibleRows) + nActualRows = nVisibleRows; // the area occupied by all (at least partially) visible cells, including // headers Rectangle aAllCellsWithHeaders; impl_getAllVisibleCellsArea( aAllCellsWithHeaders ); + // ............................ // draw the header column area - if ( getModel()->hasColumnHeaders() ) + if ( m_pModel->hasColumnHeaders() ) { TableRowGeometry aHeaderRow( *this, Rectangle( Point( 0, 0 ), aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS ); + Rectangle aColRect(aHeaderRow.getRect()); + //to avoid double lines when scrolling horizontally + if(m_nLeftColumn != 0) + --aColRect.Left(); pRenderer->PaintHeaderArea( - *m_pDataWindow, aHeaderRow.getRect(), true, false, rStyle + *m_pDataWindow, aColRect, true, false, rStyle ); // Note that strictly, aHeaderRow.getRect() also contains the intersection between column // and row header area. However, below we go to paint this intersection, again, @@ -963,11 +980,14 @@ namespace svt { namespace table { aRowHeaderArea = aAllCellsWithHeaders; aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1; - if(m_nTopRow+nActualRows>m_nRowCount) - aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1; - else - aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1; - pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle); + if(m_nTopRow+nActualRows>m_nRowCount) + aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1; + else + aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1; + //to avoid double lines when scrolling vertically + if(m_nTopRow != 0) + --aRowHeaderArea.Top(); + pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle); // Note that strictly, aRowHeaderArea also contains the intersection between column // and row header area. However, below we go to paint this intersection, again, // so this hopefully doesn't hurt if we already paint it here. @@ -976,8 +996,15 @@ namespace svt { namespace table { TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ), aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS ); + Rectangle aInters(aIntersection.getRect()); + //to avoid double line when scrolling vertically + if( m_nTopRow != 0 ) + { + --aInters.Top(); + --aInters.Bottom(); + } pRenderer->PaintHeaderArea( - *m_pDataWindow, aIntersection.getRect(), true, true, rStyle + *m_pDataWindow, aInters, true, true, rStyle ); } } @@ -990,34 +1017,46 @@ namespace svt { namespace table // paint all rows Rectangle aAllDataCellsArea; impl_getAllVisibleDataCellArea( aAllDataCellsArea ); - ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent(); + ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent(); for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() ); aRowIterator.isValid(); aRowIterator.moveDown() ) { if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() ) - continue; + continue; bool isActiveRow = ( aRowIterator.getRow() == getCurRow() ); - bool isSelectedRow = false; - if(!m_nRowSelected.empty()) - { - for(std::vector::iterator itSel=m_nRowSelected.begin(); - itSel!=m_nRowSelected.end();++itSel) + bool isSelectedRow = false; + if(!m_nRowSelected.empty()) { - if(*itSel == aRowIterator.getRow()) - isSelectedRow = true; + for(std::vector::iterator itSel=m_nRowSelected.begin(); + itSel!=m_nRowSelected.end();++itSel) + { + if(*itSel == aRowIterator.getRow()) + isSelectedRow = true; + } } - } + Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea ); + //to avoid double lines + if( aRowIterator.getRow() != 0 ) + --aRect.Top(); + else + if(m_nColHeaderHeightPixel>1) + --aRect.Top(); + if(m_nLeftColumn != 0) + --aRect.Left(); + else + if(m_pModel->hasRowHeaders()) + --aRect.Left(); // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, - *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle ); + *m_pDataWindow, aRect, rStyle ); // paint the row header if ( m_pModel->hasRowHeaders() ) { - Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); - rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()]; - pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, + Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) ); + rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()]; + pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader, rStyle, rowHeaderName ); } if ( !colCount ) @@ -1028,25 +1067,25 @@ namespace svt { namespace table aCell.moveRight() ) { - bool isSelectedColumn = false; - Size siz = m_rAntiImpl.GetSizePixel(); - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; - ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()]; - if(rCellData>>=xGraphic) - { - Image* pImage = new Image(xGraphic); - if(pImage!=NULL) - pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + bool isSelectedColumn = false; + // Size siz = m_rAntiImpl.GetSizePixel(); + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; + ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()]; + if(rCellData>>=xGraphic) + { + Image* pImage = new Image(xGraphic); + if(pImage!=NULL) + pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, pImage ); - } - else - { - ::rtl::OUString sContent = convertToString(rCellData); - pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, + } + else + { + ::rtl::OUString sContent = convertToString(rCellData); + pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow, *m_pDataWindow, aCell.getRect(), rStyle, sContent ); + } } } - } } //-------------------------------------------------------------------- void TableControl_Impl::hideCursor() @@ -1454,10 +1493,12 @@ namespace svt { namespace table { Rectangle aCellRect; impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect ); - if ( _bShow ) - pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect); - else - pRenderer->HideCellCursor( *m_pDataWindow, aCellRect); + if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0) + aCellRect.Left()++; + if ( _bShow ) + pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect); + else + pRenderer->HideCellCursor( *m_pDataWindow, aCellRect); } } @@ -1480,6 +1521,7 @@ namespace svt { namespace table TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow ); _rCellRect = aCell.getRect(); + _rCellRect.Top()--;_rCellRect.Left()--; } //------------------------------------------------------------------------------- RowPos TableControl_Impl::getCurrentRow(const Point& rPoint) @@ -1497,9 +1539,7 @@ namespace svt { namespace table { newRowPos = i; newColPos = j; - if(newColPos == -1) - m_nCurColumn = 0; - else + if(newColPos != -1) m_nCurColumn = newColPos; return newRowPos; } @@ -1617,13 +1657,18 @@ namespace svt { namespace table //------------------------------------------------------------------------------ void TableControl_Impl::invalidateRows() { - impl_ni_updateScrollbars(); - TableSize nVisibleRows = impl_getVisibleRows(true); - if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) - m_nTopRow--; - else - m_nTopRow = 0; - m_pDataWindow->Invalidate(); + impl_ni_updateScrollbars(); + TableSize nVisibleRows = impl_getVisibleRows(true); + TableSize nVisibleCols = impl_getVisibleColumns(true); + if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows) + m_nTopRow--; + else + m_nTopRow = 0; + if(m_nLeftColumn+nVisibleCols>m_nColumnCount && m_nColumnCount>=nVisibleCols) + m_nLeftColumn--; + else + m_nLeftColumn = 0; + m_pDataWindow->Invalidate(); } //-------------------------------------------------------------------- @@ -1799,17 +1844,22 @@ namespace svt { namespace table //------------------------------------------------------------------------------- SelectionEngine* TableControl_Impl::getSelEngine() { - return m_pSelEngine; + return m_pSelEngine; } //------------------------------------------------------------------------------- TableDataWindow* TableControl_Impl::getDataWindow() { - return m_pDataWindow; + return m_pDataWindow; } //------------------------------------------------------------------------------- BOOL TableControl_Impl::isRowSelected(const ::std::vector& selectedRows, RowPos current) { return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end(); + } + //------------------------------------------------------------------------------- + bool TableControl_Impl::isRowSelected(RowPos current) + { + return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end(); } //------------------------------------------------------------------------------- int TableControl_Impl::getRowSelectedNumber(const ::std::vector& selectedRows, RowPos current) @@ -1906,7 +1956,7 @@ namespace svt { namespace table //MouseButton was pressed but not yet released, mouse is moving if(m_bResizing) { - if(rPoint.X() > m_pDataWindow->GetSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth) + if(rPoint.X() > m_pDataWindow->GetOutputSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth) aNewPointer = Pointer( POINTER_NOTALLOWED); else aNewPointer = Pointer( POINTER_HSPLIT ); @@ -1915,7 +1965,7 @@ namespace svt { namespace table if(m_pModel->hasColumnHeaders()) lineHeight+= m_nColHeaderHeightPixel; lineHeight+=m_nRowHeightPixel*m_nRowCount; - int gridHeight = m_pDataWindow->GetSizePixel().Height(); + int gridHeight = m_pDataWindow->GetOutputSizePixel().Height(); if(lineHeight >= gridHeight) lineHeight = gridHeight; m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )), @@ -2046,7 +2096,7 @@ namespace svt { namespace table } //when the sum of all visible columns and the next to the left column is smaller than //window width, then update m_nLeftColumn - if(widthsPixelGetSizePixel().Width()) + if(widthsPixelGetOutputSizePixel().Width()) m_nLeftColumn--; } //-------------------------------------------------------------------- @@ -2085,6 +2135,7 @@ namespace svt { namespace table impl_getAllVisibleDataCellArea(aRect); return aRect; } + //-------------------------------------------------------------------- IMPL_LINK( TableControl_Impl, OnScroll, ScrollBar*, _pScrollbar ) { diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 61fcda7ceb71..da4108e3af09 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -190,6 +190,8 @@ namespace svt { namespace table void setCursorAtCurrentCell(const Point& rPoint); /** checks whether the vector with the selected rows contains the current row*/ BOOL isRowSelected(const ::std::vector& selectedRows, RowPos current); + + bool isRowSelected(RowPos current); /** returns the position of the current row in the selection vector */ int getRowSelectedNumber(const ::std::vector& selectedRows, RowPos current); /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/ @@ -201,7 +203,6 @@ namespace svt { namespace table /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(); - // IAbstractTableControl virtual void hideCursor(); virtual void showCursor(); diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 1a1696a6ea58..e602f0418cfe 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -44,6 +44,7 @@ namespace svt { namespace table TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl ) :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) + ,m_nRowAlreadySelected( -1 ) { } @@ -75,13 +76,24 @@ namespace svt { namespace table //-------------------------------------------------------------------- void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt ) { + Point aPoint = rMEvt.GetPosPixel(); + RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint); if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) Window::MouseButtonDown( rMEvt ); else { - Point aPoint = rMEvt.GetPosPixel(); - if(m_rTableControl.getCurrentRow(aPoint) >= 0) - m_aSelectHdl.Call( NULL ); + if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION) + { + if( m_nRowAlreadySelected != nCurRow ) + { + m_nRowAlreadySelected = nCurRow; + m_aSelectHdl.Call( NULL ); + } + else + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); + } + else + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } m_rTableControl.getAntiImpl().LoseFocus(); } @@ -90,6 +102,8 @@ namespace svt { namespace table { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); + else + m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } //-------------------------------------------------------------------- diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 404caadd9fb7..8d3edad11be5 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -127,9 +127,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = (TableControl*)GetWindow(); - const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings(); - const com::sun::star::awt::FontDescriptor& aFont = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() ); - + sal_Int32 fontHeight = GetWindow()->GetTextHeight(); switch( GetPropertyId( PropertyName ) ) { case BASEPROPERTY_GRID_SELECTIONMODE: @@ -293,7 +291,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } else throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel); - sal_Int32 fontHeight = aFont.Height+8; if(m_xDataModel->getRowHeight() == 0) m_pTableModel->setRowHeight(fontHeight); else @@ -312,7 +309,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An Sequence > columns = m_xColumnModel->getColumns(); std::vector > aNewColumns( comphelper::sequenceToContainer > >(columns)); - sal_Int32 fontHeight = aFont.Height+8; if(m_xColumnModel->getColumnHeaderHeight() == 0) m_pTableModel->setColumnHeaderHeight(fontHeight); else @@ -671,14 +667,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R { TableControl* pTable = (TableControl*)GetWindow(); std::vector& selectedRows = pTable->GetSelectedRows(); - ::std::vector::iterator iter = selectedRows.begin(); - sal_Bool bSelected = sal_False; - for(;iter!=selectedRows.end();iter++) - { - if(*iter == index) - bSelected = sal_True; - } - return bSelected; + return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end(); } void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) -- cgit From 90c923e58d2285a7fc147930df7d43d201fe820a Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 17 Apr 2010 01:33:12 +0200 Subject: locales33a: #i110235# correction to Latvian locale data; patch from --- i18npool/source/localedata/data/ltg_LV.xml | 22 +++++++++++----------- i18npool/source/localedata/data/lv_LV.xml | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/i18npool/source/localedata/data/ltg_LV.xml b/i18npool/source/localedata/data/ltg_LV.xml index c41c38c86b9c..7d4445d26426 100644 --- a/i18npool/source/localedata/data/ltg_LV.xml +++ b/i18npool/source/localedata/data/ltg_LV.xml @@ -65,23 +65,23 @@ 0,00% - - # ##0[$Ls-64B];-# ##0[$Ls-64B] + + [$Ls-64B] # ##0;[$Ls-64B] -# ##0 - - # ##0,00[$Ls-64B];-# ##0,00[$Ls-64B] + + [$Ls-64B] # ##0,00;[$Ls-64B] -# ##0,00 - - # ##0[$Ls-64B];[RED]-# ##0[$Ls-64B] + + [$Ls-64B] # ##0;[RED][$Ls-64B] -# ##0 - - # ##0,00[$Ls-64B];[RED]-# ##0,00[$Ls-64B] + + [$Ls-64B] # ##0,00;[RED][$Ls-64B] -# ##0,00 - + # ##0,00 CCC - - # ##0,--[$Ls-64B];[RED]-# ##0,--[$Ls-64B] + + [$Ls-64B] # ##0,--;[RED][$Ls-64B] -# ##0,-- D.MM.YY diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index 27bb0f13e409..5e9c649cdf8b 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -66,28 +66,28 @@ 0,00% - # ##0[$Ls-426];-# ##0[$Ls-426] + [$Ls-426] # ##0;[$Ls-426] -# ##0 - # ##0,00[$Ls-426];-# ##0,00[$Ls-426] + [$Ls-426] # ##0,00;[$Ls-426] -# ##0,00 - # ##0[$Ls-426];[RED]-# ##0[$Ls-426] + [$Ls-426] # ##0;[RED][$Ls-426] -# ##0 - # ##0,00[$Ls-426];[RED]-# ##0,00[$Ls-426] + [$Ls-426] # ##0,00;[RED][$Ls-426] -# ##0,00 # ##0,00 CCC - # ##0,--[$Ls-426];[RED]-# ##0,--[$Ls-426] + [$Ls-426] # ##0,--;[RED][$Ls-426] -# ##0,-- D.M.YY - DD. NNNNMMMM, YYYY + YYYY. "gada" DD. MMMM, NNNN DD.MM.YY @@ -120,7 +120,7 @@ NN, D. MMMM, YYYY - NNNNMMMM D, YYYY + NNNN, YYYY. "gada" DD. MMMM DD-MM -- cgit From f8908f7cb3b4613d5f190c7f0692f13c854f783d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 14:00:27 +0200 Subject: slidecopy: proper Z-Order for the single drawers, so TABbing works as expected --- svtools/source/toolpanel/drawerlayouter.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index 2d73a5d1c0b9..dd7298bf61e0 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -165,6 +165,17 @@ namespace svt OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) ); + // proper Z-Order + if ( i_nPosition == 0 ) + { + pDrawer->SetZOrder( NULL, WINDOW_ZORDER_FIRST ); + } + else + { + const PToolPanelDrawer pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] ); + pDrawer->SetZOrder( pFirstDrawer.get(), WINDOW_ZORDER_BEHIND ); + } + pDrawer->Show(); pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer ); -- cgit From 0582a263074e71bd849548f88a796f05d067cc00 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 19 Apr 2010 14:39:41 +0200 Subject: slidecopy: when pressing RETURN on the drawer of the active panel, focus this panel --- svtools/source/toolpanel/drawerlayouter.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index dd7298bf61e0..f10e9439ef0b 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -279,7 +279,15 @@ namespace svt if ( bActivatePanel ) { const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() ); - m_rPanelDeck.ActivatePanel( nPanelPos ); + if ( nPanelPos != m_rPanelDeck.GetActivePanel() ) + { + m_rPanelDeck.ActivatePanel( nPanelPos ); + } + else + { + PToolPanel pPanel( m_rPanelDeck.GetPanel( nPanelPos ) ); + pPanel->GrabFocus(); + } return 1L; } return 0L; -- cgit From c5934ada09feec288519cbdfbe1c0c988a2fceec Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Mon, 19 Apr 2010 15:13:32 +0200 Subject: DEV300 masterfix: #i10000#: adapt to cppunit changes by CWS sb118, fix license headers --- basegfx/test/basegfxtools.cxx | 19 +++++-------------- basegfx/test/boxclipper.cxx | 19 +++++-------------- basegfx/test/clipstate.cxx | 19 +++++-------------- basegfx/test/genericclipper.cxx | 19 +++++-------------- o3tl/qa/test-vector_pool.cxx | 12 ++++-------- 5 files changed, 24 insertions(+), 64 deletions(-) diff --git a/basegfx/test/basegfxtools.cxx b/basegfx/test/basegfxtools.cxx index 4daf0a351d77..1a8b97a559b2 100644 --- a/basegfx/test/basegfxtools.cxx +++ b/basegfx/test/basegfxtools.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basegfx2d.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -107,13 +106,5 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfxtools::KeyStopLerpTest, "basegfxtools"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfxtools::KeyStopLerpTest); } // namespace basegfxtools - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -// NOADDITIONAL; - diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index c88f0e14c1ce..d52218a51ee0 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basegfx2d.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -416,13 +415,5 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::boxclipper, "boxclipper"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::boxclipper); } // namespace basegfx2d - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -// NOADDITIONAL; - diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index 45d542d91b46..3d9f59979aa7 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basegfx2d.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -175,13 +174,5 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::clipstate, "clipstate"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::clipstate); } // namespace basegfx2d - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -// NOADDITIONAL; - diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx index ed77ca1f693f..84230a084493 100644 --- a/basegfx/test/genericclipper.cxx +++ b/basegfx/test/genericclipper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basegfx2d.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,9 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include #include @@ -156,13 +155,5 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::genericclipper, "genericclipper"); +CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::genericclipper); } // namespace basegfx2d - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -// NOADDITIONAL; - diff --git a/o3tl/qa/test-vector_pool.cxx b/o3tl/qa/test-vector_pool.cxx index 749859f4b995..4efaebdd3414 100644 --- a/o3tl/qa/test-vector_pool.cxx +++ b/o3tl/qa/test-vector_pool.cxx @@ -1,6 +1,8 @@ // autogenerated file with codegen.pl -#include +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" #include @@ -64,10 +66,4 @@ public: }; // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(vector_pool_test, "vector pool test"); - - -// ----------------------------------------------------------------------------- - -// NOADDITIONAL; - +CPPUNIT_TEST_SUITE_REGISTRATION(vector_pool_test); -- cgit From d3d4b6789d52d2decf7d4432f8df30fef22085d7 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 19 Apr 2010 17:00:47 +0200 Subject: sb120: #i110988# disable failing tests for now --- svtools/qa/unoapi/svtools.sce | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/svtools/qa/unoapi/svtools.sce b/svtools/qa/unoapi/svtools.sce index 53d53e0e6824..90fb50358f99 100644 --- a/svtools/qa/unoapi/svtools.sce +++ b/svtools/qa/unoapi/svtools.sce @@ -1,12 +1,12 @@ #i88276 -o svtools.AccessibleIconChoiceCtrlEntry #i88647 -o svtools.AccessibleTabBarPage --o svtools.AccessibleBrowseBox --o svtools.AccessibleBrowseBoxHeaderBar --o svtools.AccessibleBrowseBoxHeaderCell --o svtools.AccessibleBrowseBoxTable +#i110988 -o svtools.AccessibleBrowseBox +#i110988 -o svtools.AccessibleBrowseBoxHeaderBar +#i110988 -o svtools.AccessibleBrowseBoxHeaderCell +#i110988 -o svtools.AccessibleBrowseBoxTable #i85245 -o svtools.AccessibleBrowseBoxTableCell #i88276 -o svtools.AccessibleIconChoiceCtrl -o svtools.AccessibleTabBar #i85246 -o svtools.AccessibleTabBarPageList --o svtools.AccessibleTreeListBox --o svtools.AccessibleTreeListBoxEntry \ No newline at end of file +#i110988 -o svtools.AccessibleTreeListBox +#i110988 -o svtools.AccessibleTreeListBoxEntry -- cgit From 61604da6e03327792dded05f18afd8cae35cf8c1 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 19 Apr 2010 17:46:40 +0200 Subject: do not show icons in menu if this is disabled --- svtools/source/control/asynclink.cxx | 0 svtools/source/control/calendar.cxx | 0 svtools/source/control/calendar.src | 0 svtools/source/control/collatorres.cxx | 0 svtools/source/control/ctrlbox.cxx | 0 svtools/source/control/ctrlbox.src | 0 svtools/source/control/ctrldll.cxx | 0 svtools/source/control/ctrltool.cxx | 0 svtools/source/control/ctrltool.src | 0 svtools/source/control/filectrl.cxx | 0 svtools/source/control/filectrl.src | 0 svtools/source/control/filectrl2.cxx | 0 svtools/source/control/fileurlbox.cxx | 0 svtools/source/control/fixedhyper.cxx | 0 svtools/source/control/fmtfield.cxx | 0 svtools/source/control/headbar.cxx | 0 svtools/source/control/hyperlabel.cxx | 0 svtools/source/control/indexentryres.cxx | 0 svtools/source/control/inettbc.cxx | 0 svtools/source/control/makefile.mk | 0 svtools/source/control/prgsbar.cxx | 0 svtools/source/control/roadmap.cxx | 0 svtools/source/control/ruler.cxx | 0 svtools/source/control/scriptedtext.cxx | 0 svtools/source/control/scrwin.cxx | 0 svtools/source/control/stdctrl.cxx | 0 svtools/source/control/stdmenu.cxx | 0 svtools/source/control/svxbox.cxx | 0 svtools/source/control/tabbar.cxx | 0 svtools/source/control/taskbar.cxx | 0 svtools/source/control/taskbox.cxx | 0 svtools/source/control/taskmisc.cxx | 0 svtools/source/control/taskstat.cxx | 0 svtools/source/control/toolbarmenu.cxx | 3 ++- svtools/source/control/toolbarmenuacc.cxx | 0 svtools/source/control/toolbarmenuimp.hxx | 0 svtools/source/control/urlcontrol.cxx | 0 svtools/source/control/valueacc.cxx | 0 svtools/source/control/valueimp.hxx | 0 svtools/source/control/valueset.cxx | 0 40 files changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 svtools/source/control/asynclink.cxx mode change 100644 => 100755 svtools/source/control/calendar.cxx mode change 100644 => 100755 svtools/source/control/calendar.src mode change 100644 => 100755 svtools/source/control/collatorres.cxx mode change 100644 => 100755 svtools/source/control/ctrlbox.cxx mode change 100644 => 100755 svtools/source/control/ctrlbox.src mode change 100644 => 100755 svtools/source/control/ctrldll.cxx mode change 100644 => 100755 svtools/source/control/ctrltool.cxx mode change 100644 => 100755 svtools/source/control/ctrltool.src mode change 100644 => 100755 svtools/source/control/filectrl.cxx mode change 100644 => 100755 svtools/source/control/filectrl.src mode change 100644 => 100755 svtools/source/control/filectrl2.cxx mode change 100644 => 100755 svtools/source/control/fileurlbox.cxx mode change 100644 => 100755 svtools/source/control/fixedhyper.cxx mode change 100644 => 100755 svtools/source/control/fmtfield.cxx mode change 100644 => 100755 svtools/source/control/headbar.cxx mode change 100644 => 100755 svtools/source/control/hyperlabel.cxx mode change 100644 => 100755 svtools/source/control/indexentryres.cxx mode change 100644 => 100755 svtools/source/control/inettbc.cxx mode change 100644 => 100755 svtools/source/control/makefile.mk mode change 100644 => 100755 svtools/source/control/prgsbar.cxx mode change 100644 => 100755 svtools/source/control/roadmap.cxx mode change 100644 => 100755 svtools/source/control/ruler.cxx mode change 100644 => 100755 svtools/source/control/scriptedtext.cxx mode change 100644 => 100755 svtools/source/control/scrwin.cxx mode change 100644 => 100755 svtools/source/control/stdctrl.cxx mode change 100644 => 100755 svtools/source/control/stdmenu.cxx mode change 100644 => 100755 svtools/source/control/svxbox.cxx mode change 100644 => 100755 svtools/source/control/tabbar.cxx mode change 100644 => 100755 svtools/source/control/taskbar.cxx mode change 100644 => 100755 svtools/source/control/taskbox.cxx mode change 100644 => 100755 svtools/source/control/taskmisc.cxx mode change 100644 => 100755 svtools/source/control/taskstat.cxx mode change 100644 => 100755 svtools/source/control/toolbarmenuacc.cxx mode change 100644 => 100755 svtools/source/control/toolbarmenuimp.hxx mode change 100644 => 100755 svtools/source/control/urlcontrol.cxx mode change 100644 => 100755 svtools/source/control/valueacc.cxx mode change 100644 => 100755 svtools/source/control/valueimp.hxx mode change 100644 => 100755 svtools/source/control/valueset.cxx diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src old mode 100644 new mode 100755 diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src old mode 100644 new mode 100755 diff --git a/svtools/source/control/ctrldll.cxx b/svtools/source/control/ctrldll.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src old mode 100644 new mode 100755 diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/filectrl.src b/svtools/source/control/filectrl.src old mode 100644 new mode 100755 diff --git a/svtools/source/control/filectrl2.cxx b/svtools/source/control/filectrl2.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/fixedhyper.cxx b/svtools/source/control/fixedhyper.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk old mode 100644 new mode 100755 diff --git a/svtools/source/control/prgsbar.cxx b/svtools/source/control/prgsbar.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/stdctrl.cxx b/svtools/source/control/stdctrl.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/svxbox.cxx b/svtools/source/control/svxbox.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/taskbox.cxx b/svtools/source/control/taskbox.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index bb332c77cc49..6a6edcc41f57 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -1381,6 +1381,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) DecorationView aDecoView( this ); const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + const bool bUseImages = rSettings.GetUseImagesInMenus(); int nOuterSpace = 0; // ImplGetSVData()->maNWFData.mnMenuFormatExtraBorder; Point aTopLeft( nOuterSpace, nOuterSpace ), aTmpPos; @@ -1513,7 +1514,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) } // Image: - if( pEntry->mbHasImage ) + if( pEntry->mbHasImage && bUseImages ) { // Don't render an image for a check thing /* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/ diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx old mode 100644 new mode 100755 diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx old mode 100644 new mode 100755 -- cgit From fac60d2f0b6938e768a0c662f34a5f67028eaa93 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 20 Apr 2010 15:42:54 +0200 Subject: #i107360# moved trapezoid tesselation into basegfx --- vcl/unx/inc/salgdi.h | 13 +- vcl/unx/source/gdi/salgdi.cxx | 778 +++++------------------------------------- 2 files changed, 88 insertions(+), 703 deletions(-) diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index da69f04b6f8f..6ccea2c4a00c 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -57,6 +57,10 @@ class ImplLayoutArgs; class X11FontLayout; class ServerFontLayout; +namespace basegfx { + class B2DTrapezoid; +} + // -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= class CairoFontsCache @@ -289,8 +293,11 @@ public: virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); - virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin); + virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); + +#if 1 // TODO: remove these obselete methods virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); @@ -301,6 +308,8 @@ public: const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); +#endif + virtual void copyArea( long nDestX, long nDestY, long nSrcX, diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 7637d3b2bd02..32aeed2dbc95 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -50,8 +50,9 @@ #include "basegfx/polygon/b2dpolygonclipper.hxx" #include "basegfx/polygon/b2dlinegeometry.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" -#include +#include "basegfx/matrix/b2dhommatrixtools.hxx" #include "basegfx/polygon/b2dpolypolygoncutter.hxx" +#include "basegfx/polygon/b2dtrapezoid.hxx" #include #include @@ -1087,115 +1088,6 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -// B2DPolygon support methods - -namespace { // anonymous namespace to prevent export -// the methods and structures here are used by the -// B2DPolyPolygon->RenderTrapezoid conversion algorithm - -// compare two line segments -// assumption: both segments point downward -// assumption: they must have at least some y-overlap -// assumption: rA.p1.y <= rB.p1.y -bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) -{ - bool bAbove = (rA.p1.y <= rB.p1.y); - const XLineFixed& rU = bAbove ? rA : rB; - const XLineFixed& rL = bAbove ? rB : rA; - - const XFixed aXDiff = rU.p2.x - rU.p1.x; - const XFixed aYDiff = rU.p2.y - rU.p1.y; - - // compare upper point of lower segment with line through upper segment - if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) ) - { - const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y); - const sal_Int64 n2 = (sal_Int64)aYDiff * (rL.p1.x - rU.p1.x); - if( n1 != n2 ) - return ((n1 < n2) == bAbove); - } - - // compare lower point of lower segment with line through upper segment - if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) ) - { - const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y); - const sal_Int64 n4 = (sal_Int64)aYDiff * (rL.p2.x - rU.p1.x); - if( n3 != n4 ) - return ((n3 < n4) == bAbove); - } - - // both segments overlap - return false; -} - -struct HalfTrapezoid -{ - // assumptions: - // maLine.p1.y <= mnY < maLine.p2.y - XLineFixed maLine; - XFixed mnY; - - XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); } - XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); } -}; - -class HalfTrapCompare -{ -public: - bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const - { - bool bIsTopLeft = false; - if( rA.mnY != rB.mnY ) // sort top-first if possible - bIsTopLeft = (rA.mnY < rB.mnY); - else // else sort left-first - bIsTopLeft = IsLeftOf( rA.maLine, rB.maLine ); - // adjust to priority_queue sorting convention - return !bIsTopLeft; - } -}; - -typedef std::vector< HalfTrapezoid > HTVector; -typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase; -// we need a priority queue with a reserve() to prevent countless reallocations -class HTQueue -: public HTQueueBase -{ -public: - void reserve( size_t n ) { c.reserve( n ); } - void swapvec( HTVector& v ) { c.swap( v ); } -}; - -typedef std::vector TrapezoidVector; - -class TrapezoidXCompare -{ - const TrapezoidVector& mrVector; -public: - TrapezoidXCompare( const TrapezoidVector& rVector ) - : mrVector( rVector ) {} - bool operator()( int nA, int nB ) const - { return IsLeftOf( mrVector[nA].left, mrVector[nB].left ); } -}; - -typedef std::multiset< int, TrapezoidXCompare > ActiveTrapSet; - -class TrapezoidYCompare -{ - const TrapezoidVector& mrVector; -public: - TrapezoidYCompare( const TrapezoidVector& rVector ) - : mrVector( rVector ) {} - bool operator()( int nA, int nB ) const - { return (mrVector[nA].bottom < mrVector[nB].bottom); } -}; - -typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; - -#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND -void splitIntersectingSegments( HTVector&); -#endif // DISABLE_SOLVECROSSOVER_WORKAROUND -} // end of anonymous namespace - // draw a poly-polygon bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency) { @@ -1219,329 +1111,66 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly if( pRenderEnv ) return FALSE; - // check xrender support for trapezoids - XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); - if( !rRenderPeer.AreTrapezoidsSupported() ) - return FALSE; - Picture aDstPic = GetXRenderPicture(); - // check xrender support for this drawable - if( !aDstPic ) - return FALSE; + // snap to raster if requested + basegfx::B2DPolyPolygon aPolyPoly = rOrigPolyPoly; + const bool bSnapToRaster = !getAntiAliasB2DDraw(); + if( bSnapToRaster ) + aPolyPoly = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges( aPolyPoly ); // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); - const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); - const bool bNeedViewClip = aPolyRange.isInside( aViewRange ); - if( !aPolyRange.overlaps( aViewRange ) ) + aPolyPoly = basegfx::tools::clipPolyPolygonOnRange( aPolyPoly, aViewRange, true, false ); + if( !aPolyPoly.count() ) return true; - // convert the polypolygon to trapezoids - - // prepare the polypolygon for the algorithm below: - // - clip it against the view range - // - make sure it contains no self-intersections - // while we are at it guess the number of involved polygon points - int nHTQueueReserve = 0; - basegfx::B2DPolyPolygon aGoodPolyPoly; - for( int nOrigPolyIdx = 0; nOrigPolyIdx < nOrigPolyCount; ++nOrigPolyIdx ) - { - const ::basegfx::B2DPolygon aOuterPolygon = rOrigPolyPoly.getB2DPolygon( nOrigPolyIdx ); - - // render-trapezoids should be inside the view => clip polygon against view range - basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon ); - if( bNeedViewClip ) - { - aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false ); - DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" ); - } - const int nClippedPolyCount = aClippedPolygon.count(); - if( !nClippedPolyCount ) - continue; - -#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND - for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) - { - const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); - const int nPointCount = aSolvedPolygon.count(); - aGoodPolyPoly.append( aSolvedPolygon ); - nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; - } -#else // DISABLE_SOLVECROSSOVER_WORKAROUND - // #i103259# polypoly.solveCrossover() fails to remove self-intersections - // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon - // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections - for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) - { - ::basegfx::B2DPolygon aUnsolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); - basegfx::B2DPolyPolygon aSolvedPolyPoly( basegfx::tools::solveCrossovers( aUnsolvedPolygon) ); - const int nSolvedPolyCount = aSolvedPolyPoly.count(); - for( int nSolvedPolyIdx = 0; nSolvedPolyIdx < nSolvedPolyCount; ++nSolvedPolyIdx ) - { - // build the intersection-free polypolygon one by one - const ::basegfx::B2DPolygon aSolvedPolygon = aSolvedPolyPoly.getB2DPolygon( nSolvedPolyIdx ); - aGoodPolyPoly.append( aSolvedPolygon ); - // and while we are at it use the conviently available point count to guess the number of needed half-traps - const int nPointCount = aSolvedPolygon.count(); - nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; - } - } -#endif // DISABLE_SOLVECROSSOVER_WORKAROUND - } - // #i100922# try to prevent priority-queue reallocations by reservering enough - nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTVector aHTVector; - aHTVector.reserve( nHTQueueReserve ); - - // first convert the B2DPolyPolygon to HalfTrapezoids - const int nGoodPolyCount = aGoodPolyPoly.count(); - for( int nGoodPolyIdx = 0; nGoodPolyIdx < nGoodPolyCount; ++nGoodPolyIdx ) - { - ::basegfx::B2DPolygon aInnerPolygon = aGoodPolyPoly.getB2DPolygon( nGoodPolyIdx ); - - // render-trapezoids have linear edges => get rid of bezier segments - if( aInnerPolygon.areControlPointsUsed() ) - aInnerPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aInnerPolygon, 0.125 ); - - const int nPointCount = aInnerPolygon.count(); - if( nPointCount >= 3 ) - { - // convert polygon point pairs to HalfTrapezoids - // connect the polygon point with the first one if needed - XPointFixed aOldXPF = { 0, 0 }; - XPointFixed aNewXPF; - for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF ) - { - // auto-close the polygon if needed - const int k = (nPointIdx < nPointCount) ? nPointIdx : 0; - const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k ); - - // convert the B2DPoint into XRENDER units - if(getAntiAliasB2DDraw()) - { - aNewXPF.x = XDoubleToFixed( aPoint.getX() ); - aNewXPF.y = XDoubleToFixed( aPoint.getY() ); - } - else - { - aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) ); - aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) ); - } - - // check if enough data is available for a new HalfTrapezoid - if( nPointIdx == 0 ) - continue; - - // construct HalfTrapezoid as topdown segment - HalfTrapezoid aHT; - if( aNewXPF.y < aOldXPF.y ) - { - aHT.maLine.p1 = aNewXPF; - aHT.maLine.p2 = aOldXPF; - } - else - { - aHT.maLine.p2 = aNewXPF; - aHT.maLine.p1 = aOldXPF; - } - - aHT.mnY = aHT.maLine.p1.y; + // tesselate the polypolygon into trapezoids + basegfx::B2DTrapezoidVector aB2DTrapVector; + basegfx::tools::trapezoidSubdivide( aB2DTrapVector, aPolyPoly ); + const int nTrapCount = aB2DTrapVector.size(); + const bool bDrawn = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency ); + return bDrawn; +} -#if 0 // ignore clipped HalfTrapezoids - if( aHT.mnY < 0 ) - aHT.mnY = 0; - else if( aHT.mnY > 10000 ) - continue; -#endif +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - // queue up the HalfTrapezoid - aHTVector.push_back( aHT ); - } - } - } +bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTraps, int nTrapCount, double fTransparency ) +{ + if( nTrapCount <= 0 ) + return true; - if( aHTVector.empty() ) - return TRUE; + Picture aDstPic = GetXRenderPicture(); + // check xrender support for this drawable + if( !aDstPic ) + return false; -#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND - // find intersecting halftraps and split them up - // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above - // FAQ: why should segment intersection be handled before adaptiveSubdivide()? - // Answer: because it is conceptually much faster - // Example: consider two intersecting circles with a diameter of 1000 pixels - // before subdivision: eight bezier segments - // after subdivision: more than a thousand line segments - // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) - // it shows that testing while the segment count is still low is a much better approach. - splitIntersectingSegments( aHTVector); -#endif // DISABLE_SOLVECROSSOVER_WORKAROUND - - // build queue from vector of intersection-free segments - // TODO: is replacing the priority-queue by a sorted vector worth it? - std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare()); - HTQueue aHTQueue; - aHTQueue.swapvec( aHTVector); - - // then convert the HalfTrapezoids into full Trapezoids - TrapezoidVector aTrapVector; - aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess - - TrapezoidXCompare aTrapXCompare( aTrapVector ); - ActiveTrapSet aActiveTraps( aTrapXCompare ); - - TrapezoidYCompare aTrapYCompare( aTrapVector ); - VerticalTrapSet aVerticalTraps( aTrapYCompare ); - - while( !aHTQueue.empty() ) + // convert the B2DTrapezoids into XRender-Trapezoids + typedef std::vector TrapezoidVector; + TrapezoidVector aTrapVector( nTrapCount ); + const basegfx::B2DTrapezoid* pB2DTrap = pB2DTraps; + for( int i = 0; i < nTrapCount; ++pB2DTrap, ++i ) { - XTrapezoid aTrapezoid; - - // convert a HalfTrapezoid pair - // get the left side of the trapezoid - const HalfTrapezoid& rLeft = aHTQueue.top(); - aTrapezoid.top = rLeft.mnY; - aTrapezoid.left = rLeft.maLine; - aHTQueue.pop(); - - // ignore left segment that would result in an empty trapezoid - if( aTrapezoid.left.p2.y <= aTrapezoid.top ) - continue; - - // get the right side of the trapezoid - aTrapezoid.right.p2.y = aTrapezoid.bottom; - while( !aHTQueue.empty() ) { - const HalfTrapezoid& rRight = aHTQueue.top(); - aTrapezoid.right = rRight.maLine; - aHTQueue.pop(); - // ignore right segment that would result in an empty trapezoid - if( aTrapezoid.right.p2.y > aTrapezoid.top ) - break; - } - - // the topmost endpoint determines the trapezoid bottom - aTrapezoid.bottom = aTrapezoid.left.p2.y; - if( aTrapezoid.bottom > aTrapezoid.right.p2.y ) - aTrapezoid.bottom = aTrapezoid.right.p2.y; - - // keep the full Trapezoid candidate - aTrapVector.push_back( aTrapezoid ); - - // unless it splits another trapezoid that is still active - bool bSplit = false; - ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin(); - while(aActiveTrapsIt != aActiveTraps.end()) - { - XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ]; - - // skip until first overlap candidate - // TODO: use stl::*er_bound() instead - if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) ) - { - ++aActiveTrapsIt; - continue; - } - - // in the ActiveTrapSet there are still trapezoids where - // a vertical overlap with new trapezoids is no longer possible - // they could have been removed in the verticaltraps loop below - // but this would be expensive and is not needed as we can - // simply ignore them until we stumble upon them here. - if( rLeftTrap.bottom <= aTrapezoid.top ) - { - ActiveTrapSet::iterator it = aActiveTrapsIt; - if( aActiveTrapsIt != aActiveTraps.begin() ) - { - --aActiveTrapsIt; - aActiveTraps.erase( it ); - ++aActiveTrapsIt; - } - else - { - aActiveTraps.erase( it ); - aActiveTrapsIt = aActiveTraps.begin(); - } - continue; - } - - // check if there is horizontal overlap - // aTrapezoid.left==rLeftTrap.right is allowed though - if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) ) - { - ++aActiveTrapsIt; - continue; - } - - // prepare to split the old trapezoid and keep its upper part - // find the old trapezoids entry in the VerticalTrapSet and remove it - typedef std::pair VTSPair; - VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt ); - VerticalTrapSet::iterator aVTSit = aVTSPair.first; - for(; aVTSit != aVTSPair.second; ++aVTSit ) - { - if( *aVTSit != *aActiveTrapsIt ) - continue; - aVerticalTraps.erase( aVTSit ); - break; - } - // then update the old trapezoid's bottom - rLeftTrap.bottom = aTrapezoid.top; - // enter the updated old trapzoid in VerticalTrapSet - aVerticalTraps.insert( aVerticalTraps.begin(), *aActiveTrapsIt ); - // the old trapezoid is no longer active - aActiveTraps.erase( aActiveTrapsIt ); - - // the trapezoid causing the split has become obsolete - // so its both sides have to be re-queued - HalfTrapezoid aHT; - aHT.mnY = aTrapezoid.top; - aHT.maLine = aTrapezoid.left; - aHTQueue.push( aHT ); - aHT.maLine = aTrapezoid.right; - aHTQueue.push( aHT ); - - bSplit = true; - break; - } - - // keep or forget the resulting full Trapezoid - if( bSplit ) - aTrapVector.pop_back(); - else - { - aActiveTraps.insert( aTrapVector.size()-1 ); - aVerticalTraps.insert( aTrapVector.size()-1 ); - } - - // mark trapezoids that can no longer be split as inactive - // and recycle their sides which were not fully resolved - static const XFixed nMaxTop = +0x7FFFFFFF; - const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; - while( !aVerticalTraps.empty() ) - { - // check the next trapezoid to be retired - const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ]; - if( nNewTop < rOldTrap.bottom ) - break; - // this trapezoid can no longer be split - aVerticalTraps.erase( aVerticalTraps.begin() ); - - // recycle its sides that were not fully resolved - HalfTrapezoid aHT; - aHT.mnY = rOldTrap.bottom; - - if( rOldTrap.left.p2.y > aHT.mnY ) - { - aHT.maLine = rOldTrap.left; - aHTQueue.push( aHT ); - } - if( rOldTrap.right.p2.y > aHT.mnY ) - { - aHT.maLine = rOldTrap.right; - aHTQueue.push( aHT ); - } - } + XTrapezoid& rTrap = aTrapVector[ i ] ; + + // set y-coordinates + const double fY1 = pB2DTrap->getTopY(); + rTrap.left.p1.y = rTrap.right.p1.y = rTrap.top = XDoubleToFixed( fY1 ); + const double fY2 = pB2DTrap->getBottomY(); + rTrap.left.p2.y = rTrap.right.p2.y = rTrap.bottom = XDoubleToFixed( fY2 ); + + // set x-coordinates + const double fXL1 = pB2DTrap->getTopXLeft(); + rTrap.left.p1.x = XDoubleToFixed( fXL1 ); + const double fXR1 = pB2DTrap->getTopXRight(); + rTrap.right.p1.x = XDoubleToFixed( fXR1 ); + const double fXL2 = pB2DTrap->getBottomXLeft(); + rTrap.left.p2.x = XDoubleToFixed( fXL2 ); + const double fXR2 = pB2DTrap->getBottomXRight(); + rTrap.right.p2.x = XDoubleToFixed( fXR2 ); } - // create xrender Picture for polygon foreground + // get xrender Picture for polygon foreground + // TODO: cache it like the target picture which uses GetXRenderPicture() + XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ]; if( !rEntry.m_aPicture ) { @@ -1569,15 +1198,17 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly rRenderPeer.CompositeTrapezoids( PictOpOver, rEntry.m_aPicture, aDstPic, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() ); - return TRUE; + return true; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin) { + const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX() <= 1.2); + // #i101491# - if(rPolygon.count() > 1000) + if( !bIsHairline && (rPolygon.count() > 1000) ) { // the used basegfx::tools::createAreaGeometry is simply too // expensive with very big polygons; fallback to caller (who @@ -1587,9 +1218,28 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // the same way. return false; } - const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); - if( !rRenderPeer.AreTrapezoidsSupported() ) - return false; + + // temporarily adjust brush color to pen color + // since the line is drawn as an area-polygon + const SalColor aKeepBrushColor = nBrushColor_; + nBrushColor_ = nPenColor_; + + // shortcut for hairline drawing to improve performance + if( bIsHairline ) + { + // hairlines can benefit from a simplified tesselation + // e.g. for hairlines the linejoin style can be ignored + basegfx::B2DTrapezoidVector aB2DTrapVector; + basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, rPolygon, rLineWidth.getX() ); + + // draw tesselation result + const int nTrapCount = aB2DTrapVector.size(); + const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, 0.0 ); + + // restore the original brush GC + nBrushColor_ = aKeepBrushColor; + return bDrawOk; + } // get the area polygon for the line polygon basegfx::B2DPolygon aPolygon = rPolygon; @@ -1600,18 +1250,6 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); } - // special handling for hairlines to improve the drawing performance - // TODO: revisit after basegfx performance related changes - const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2); - if( bIsHairline ) - { - // for hairlines the linejoin style becomes irrelevant - eLineJoin = basegfx::B2DLINEJOIN_NONE; - // createAreaGeometry is still too expensive when beziers are involved - if( aPolygon.areControlPointsUsed() ) - aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 ); - } - // create the area-polygon for the line const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) ); @@ -1622,11 +1260,6 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX())); } - // temporarily adjust brush color to pen color - // since the line is drawn as an area-polygon - const SalColor aKeepBrushColor = nBrushColor_; - nBrushColor_ = nPenColor_; - // draw each area polypolygon component individually // to emulate the polypolygon winding rule "non-zero" bool bDrawOk = true; @@ -1634,7 +1267,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) ); - bDrawOk = drawPolyPolygon( aOnePoly, 0.0); + bDrawOk = drawPolyPolygon( aOnePoly, 0.0 ); if( !bDrawOk ) break; } @@ -1645,260 +1278,3 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND -// TODO: move the intersection solver into basegfx -// and then support bezier-intersection finding too - -namespace { // anonymous namespace to prevent export - -typedef HalfTrapezoid LineSeg; -typedef HTVector LSVector; - -inline bool operator==( const LineSeg& r1, const LineSeg& r2) -{ - if( r1.maLine.p2.y != r2.maLine.p2.y) return false; - if( r1.maLine.p2.x != r2.maLine.p2.x) return false; - if( r1.maLine.p1.y != r2.maLine.p1.y) return false; - if( r1.maLine.p1.x != r2.maLine.p1.x) return false; - return true; -} - -struct LSYMinCmp -{ - bool operator()( const LineSeg& r1, const LineSeg& r2) const - { return r2.maLine.p1.y < r1.maLine.p1.y; } -}; - -struct LSYMaxCmp -{ - bool operator()( const LineSeg& r1, const LineSeg& r2) const - { return r2.maLine.p2.y < r1.maLine.p2.y; } -}; - -struct LSXMinCmp -{ - bool operator()( const LineSeg& r1, const LineSeg& r2) const - { return( r1.getXMin() < r2.getXMin()); } -}; - -struct CutPoint -{ - XFixed mnSegmentId; - float mfCutParam; - XPointFixed maPoint; -}; - -struct CutPointCmp -{ - bool operator()( const CutPoint& r1, const CutPoint& r2) const - { - if( r1.mnSegmentId != r2.mnSegmentId) - return (r1.mnSegmentId < r2.mnSegmentId); - return (r1.mfCutParam < r2.mfCutParam); - } -}; - -bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2]) -{ - // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1) - // when both segment-parameters are ((0 - // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x) - // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y) - // check if lines are identical or parallel => not intersecting - const XLineFixed& r1 = rLS1.maLine; - const XLineFixed& r2 = rLS2.maLine; - const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y) - - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y); - static const double fEps = 1e-8; - if( fabs(fDet) < fEps) - return false; - // check if intersecting with first segment - const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x); - const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y); - const double fS = (fS1 + fS2) / fDet; - if( (fS <= +fEps) || (fS >= 1-fEps)) - return false; - // check if intersecting with second segment - const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x); - const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y); - const double fT = (fT1 + fT2) / fDet; - if( (fT <= +fEps) || (fT >= 1-fEps)) - return false; - // force the intersection point to be exactly identical on both segments - aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x)); - aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y)); - aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x; - aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y; - aCutPoints[0].mnSegmentId = rLS1.mnY; - aCutPoints[0].mfCutParam = (float)fS; - aCutPoints[1].mnSegmentId = rLS2.mnY; - aCutPoints[1].mfCutParam = (float)fT; - return true; -} - -typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; -typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; -typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; -typedef std::set< CutPoint, CutPointCmp> CutPointSet; - -class LSYMinQueue : public LSYMinQueueBase -{ -public: - void reserve( size_t n) { c.reserve(n);} - void swapvec( LSVector& v) { c.swap(v);} -}; - -class LSYMaxQueue : public LSYMaxQueueBase -{ -public: - void reserve( size_t n) { c.reserve(n);} -}; - -void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet) -{ - // short circuit when no segment was cut - if( rCutPointSet.empty()) { - rLSVector.push_back( rLS); - return; - } - - // find the first cut point for this segment - LineSeg aCS = rLS; - CutPoint aMinCutPoint; - aMinCutPoint.mnSegmentId = rLS.mnY; - aMinCutPoint.mfCutParam = 0.0; - CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint); - CutPointSet::iterator it = itFirst; - // iterate through all cut points of this segment - for(; it != rCutPointSet.end(); ++it) { - const CutPoint rCutPoint = (*it); - if( rCutPoint.mnSegmentId != rLS.mnY) - break; - // cut segment at the cutpoint - aCS.maLine.p2 = rCutPoint.maPoint; - rLSVector.push_back( aCS); - // prepare for next segment cut - aCS.maLine.p1 = aCS.maLine.p2; - } - // remove cutparams that will no longer be needed - // TODO: is it worth it or should we just keep the cutparams? - rCutPointSet.erase( itFirst, it); - - // add segment part remaining after last cut - aCS.maLine.p2 = rLS.maLine.p2; - rLSVector.push_back( aCS); -} - -void splitIntersectingSegments( LSVector& rLSVector) -{ - // get a unique id for each lineseg, temporarily abuse the mnY member - LSVector::iterator aLSit = rLSVector.begin(); - for( int i = 0; aLSit != rLSVector.end(); ++aLSit) { - LineSeg& rLS = *aLSit; - rLS.mnY = i++; - } - // get an y-sorted queue from the input vector - LSYMinQueue aYMinQueue; - std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp()); - aYMinQueue.swapvec( rLSVector); - - // prepare the result vector - // try to avoid reallocations by guessing a reasonable result size - rLSVector.reserve( aYMinQueue.size() * 3/2 ); - - // find all intersections - CutPointSet aCutPointSet; - LSXMinSet aXMinSet; - LSYMaxQueue aYMaxQueue; - aYMaxQueue.reserve( aYMinQueue.size()); - // sweep-down and check all segment-pairs that overlap - while( !aYMinQueue.empty()) { - // get next input-segment - const LineSeg& rLS = aYMinQueue.top(); - // retire obsoleted segments - const XFixed fYCur = rLS.maLine.p1.y; - while( !aYMaxQueue.empty()) { - // check next segment to be retired - const LineSeg& rOS = aYMaxQueue.top(); - if( fYCur < rOS.maLine.p2.y) - break; - // emit resolved segment into result - addAndCutSegment( rLSVector, rOS, aCutPointSet); - // find segment to be retired in xmin-compare-set - LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS); - while( !(*itR == rOS)) ++itR; - // retire segment from xmin-compare-set - aXMinSet.erase( itR); - // this segment is pining for the fjords - aYMaxQueue.pop(); - } - - // iterate over all segments that might overlap - // skip over the leftmost segments that cannot overlap - const XFixed fXMax = rLS.getXMax(); - LSXMinSet::const_iterator itC = aXMinSet.begin(); - for(; itC != aXMinSet.end(); ++itC) - if( (*itC).getXMin() <= fXMax) - break; - // TODO: if the linear search becomes too expensive - // then use an XMaxQueue based approach to replace it - const XFixed fXMin = rLS.getXMin(); - for(; itC != aXMinSet.end(); ++itC) { - const LineSeg& rOS = *itC; - if( fXMin >= rOS.getXMax()) - continue; - if( fXMax < rOS.getXMin()) - break; - CutPoint aCutPoints[2]; - if( !findIntersection( rLS, rOS, aCutPoints)) - continue; - // remember cut parameters - // TODO: std::set seems to use individual allocations - // which results in perf-problems for many entries - // => pre-allocate nodes by using a non-default allocator - aCutPointSet.insert( aCutPoints[0]); - aCutPointSet.insert( aCutPoints[1]); - } - // add segment to xmin-compare-set - // TODO: do we have a good insertion hint? - aXMinSet.insert( /*itC,*/ rLS); - // register segment for retirement - aYMaxQueue.push( rLS); - aYMinQueue.pop(); - } - - // retire the remaining segments - aXMinSet.clear(); - while( !aYMaxQueue.empty()) { - // emit segments and cut them up if needed - const LineSeg& rLS = aYMaxQueue.top(); - addAndCutSegment( rLSVector, rLS, aCutPointSet); - aYMaxQueue.pop(); - } - - // get the segments ready to be consumed by the drawPolygon() caller - aLSit = rLSVector.begin(); - LSVector::iterator aLSit2 = aLSit; - for(; aLSit != rLSVector.end(); ++aLSit) { - LineSeg& rLS = *aLSit; - // restore the segment top member - rLS.mnY = rLS.maLine.p1.y; - // remove horizontal segments for now - // TODO: until the trapezoid converter is adjusted to handle them - if( rLS.maLine.p1.y == rLS.maLine.p2.y ) - continue; - *(aLSit2++) = rLS; - } - if(aLSit2 != aLSit) - rLSVector.resize( aLSit2 - rLSVector.begin() ); -} - -} // end anonymous namespace - -#endif // DISABLE_SOLVECROSSOVER_WORKAROUND - -// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -- cgit From 17c8132ca3e52eada54e861e59f0a805c50fff6e Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 20 Apr 2010 15:53:33 +0200 Subject: #i108743# destructor of ImplFontCharMap becomes public --- vcl/inc/vcl/impfont.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx index 6ce9f21500b5..a1104bbf4a86 100644 --- a/vcl/inc/vcl/impfont.hxx +++ b/vcl/inc/vcl/impfont.hxx @@ -177,7 +177,8 @@ class CmapResult; class VCL_DLLPUBLIC ImplFontCharMap { public: - explicit ImplFontCharMap( const CmapResult& ); + explicit ImplFontCharMap( const CmapResult& ); + virtual ~ImplFontCharMap(); static ImplFontCharMap* GetDefaultMap( bool bSymbols=false); @@ -201,7 +202,6 @@ public: int GetGlyphIndex( sal_uInt32 ) const; private: - /*virtual*/ ~ImplFontCharMap(); int ImplFindRangeIndex( sal_uInt32 ) const; // prevent assignment and copy construction -- cgit From 7d1514688c7baafb3b998cde97eabf83ea3ab908 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 20 Apr 2010 16:01:40 +0200 Subject: remove compile warning --- vcl/unx/source/fontmanager/fontmanager.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 606a57071d64..21183dc567ec 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -3814,8 +3814,8 @@ void PrintFontManager::getGlyphWidths( fontID nFont, if( c == cOld ) break; cOld = c; -#if (sizeof(sal_Unicode) <= 2) // TODO: remove when sal_Unicode covers all of unicode - if( c > 0xFFFF ) +#if 1 // TODO: remove when sal_Unicode covers all of unicode + if( c > (sal_Unicode)~0 ) break; #endif // get the matching glyph index -- cgit From eea019398f2c849b702c49d9e55bdbd059a34c7b Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Wed, 21 Apr 2010 11:08:13 +0200 Subject: gridcontrol_03:fix for #i110947# --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 2 +- svtools/source/uno/svtxgridcontrol.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 849c2cd23905..ba9bec8e0e2e 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -121,7 +121,7 @@ namespace svt { namespace table virtual void resizeColumn(const Point& rPoint ) = 0; virtual bool startResizeColumn(const Point& rPoint) = 0; virtual bool endResizeColumn(const Point& rPoint) = 0; - virtual bool isRowSelected(RowPos _nRow); + virtual bool isRowSelected(RowPos _nRow) = 0; virtual ~IAbstractTableControl() {}; }; diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 8d3edad11be5..f29273b1ec65 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -127,7 +127,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = (TableControl*)GetWindow(); - sal_Int32 fontHeight = GetWindow()->GetTextHeight(); switch( GetPropertyId( PropertyName ) ) { case BASEPROPERTY_GRID_SELECTIONMODE: @@ -291,6 +290,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } else throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel); + sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() ), MAP_APPFONT ).Height(); if(m_xDataModel->getRowHeight() == 0) m_pTableModel->setRowHeight(fontHeight); else @@ -309,6 +309,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An Sequence > columns = m_xColumnModel->getColumns(); std::vector > aNewColumns( comphelper::sequenceToContainer > >(columns)); + sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() ), MAP_APPFONT ).Height(); if(m_xColumnModel->getColumnHeaderHeight() == 0) m_pTableModel->setColumnHeaderHeight(fontHeight); else -- cgit From 2ae59042967fd82531924c66c0184d391c7c7415 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 21 Apr 2010 11:39:59 +0200 Subject: #i100845# let -o switch write several files into one directory --- transex3/java/jpropex/java/JPropEx.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/transex3/java/jpropex/java/JPropEx.java b/transex3/java/jpropex/java/JPropEx.java index 2ba1e913f5d4..20175febe5d5 100644 --- a/transex3/java/jpropex/java/JPropEx.java +++ b/transex3/java/jpropex/java/JPropEx.java @@ -223,7 +223,13 @@ public class JPropEx .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); } else if( outputFileArg != null && outputFileArg.length()>0 ) + { name = outputFileArg; + name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); + + //name = outputFileArg; + } else { System.err.println("ERROR: No outputfile specified .. either -o or -x -y !"); @@ -249,6 +255,7 @@ public class JPropEx } path += name; // Write the properties file + System.out.println("DBG: Writing to "+path); try{ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) ); if( prop == null ) -- cgit From 8d3cd06bdf2a14e3275edc0987b91347b1ff9dd9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 21 Apr 2010 13:43:11 +0200 Subject: sllidecopy: inject an artifical A11Y component into the A11Y object hierarchy, for ZoomText to actually read the tool panel deck drawers --- svtools/source/toolpanel/toolpaneldrawer.cxx | 43 +++++++++++++++++++++--- svtools/source/toolpanel/toolpaneldrawer.hxx | 32 +++++++++++++++++- svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 4 +++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 029afab0ad55..96bba7a221fe 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -49,6 +49,30 @@ namespace svt static const int s_nIndentationWidth = 16; + //================================================================================================================== + //= DrawerVisualization + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent ) + :Window( &i_rParent ) + ,m_rDrawer( i_rParent ) + { + Show(); + SetAccessibleRole( AccessibleRole::LABEL ); + } + + //------------------------------------------------------------------------------------------------------------------ + DrawerVisualization::~DrawerVisualization() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox ) + { + Window::Paint( i_rBoundingBox ); + m_rDrawer.Paint(); + } + //================================================================================================================== //= ToolPanelDrawer //================================================================================================================== @@ -56,6 +80,7 @@ namespace svt ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ) :Window( &i_rParent, WB_TABSTOP ) ,m_pPaintDevice( new VirtualDevice( *this ) ) + ,m_aVisualization( *this ) ,m_bFocused( false ) ,m_bExpanded( false ) { @@ -63,11 +88,14 @@ namespace svt SetBackground( Wallpaper() ); SetPointer( POINTER_REFHAND ); - SetAccessibleRole( AccessibleRole::LABEL ); + SetAccessibleRole( AccessibleRole::LIST_ITEM ); SetText( i_rTitle ); SetAccessibleName( i_rTitle ); SetAccessibleDescription( i_rTitle ); + + m_aVisualization.SetAccessibleName( i_rTitle ); + m_aVisualization.SetAccessibleDescription( i_rTitle ); } //------------------------------------------------------------------------------------------------------------------ @@ -83,7 +111,7 @@ namespace svt } //------------------------------------------------------------------------------------------------------------------ - void ToolPanelDrawer::Paint( const Rectangle& i_rBoundingBox ) + void ToolPanelDrawer::Paint() { m_pPaintDevice->SetMapMode( GetMapMode() ); m_pPaintDevice->SetOutputSize( GetOutputSizePixel() ); @@ -101,13 +129,11 @@ namespace svt aFocusBox.Left() += 2; impl_paintFocusIndicator( aFocusBox ); - DrawOutDev( + m_aVisualization.DrawOutDev( Point(), GetOutputSizePixel(), Point(), GetOutputSizePixel(), *m_pPaintDevice ); - - ::Window::Paint( i_rBoundingBox ); } //------------------------------------------------------------------------------------------------------------------ @@ -222,6 +248,13 @@ namespace svt Invalidate(); } + //------------------------------------------------------------------------------------------------------------------ + void ToolPanelDrawer::Resize() + { + Window::Resize(); + m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() ); + } + //------------------------------------------------------------------------------------------------------------------ void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent ) { diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index e088365176f4..f58726c2d247 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -34,6 +34,33 @@ namespace svt { //...................................................................................................................... + class ToolPanelDrawer; + //================================================================================================================== + //= DrawerVisualization + //================================================================================================================== + /** serves a single purpose - let ZoomText read the drawers ... + + Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations + of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject" + such a child into the A11Y hierarchy, we use this window here. + + (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With + this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.) + */ + class DrawerVisualization : public Window + { + public: + DrawerVisualization( ToolPanelDrawer& i_rParent ); + ~DrawerVisualization(); + + protected: + // Window overridables + virtual void Paint( const Rectangle& i_rBoundingBox ); + + private: + ToolPanelDrawer& m_rDrawer; + }; + //================================================================================================================== //= ToolPanelDrawer //================================================================================================================== @@ -48,11 +75,13 @@ namespace svt void SetExpanded( const bool i_bExpanded ); bool IsExpanded() const { return m_bExpanded; } + void Paint(); + protected: // Window overridables - virtual void Paint( const Rectangle& i_rBoundingBox ); virtual void GetFocus(); virtual void LoseFocus(); + virtual void Resize(); virtual void DataChanged( const DataChangedEvent& i_rEvent ); virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); @@ -73,6 +102,7 @@ namespace svt private: ::std::auto_ptr< VirtualDevice > m_pPaintDevice; + DrawerVisualization m_aVisualization; bool m_bFocused; bool m_bExpanded; }; diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx index 398445991cdd..959527330897 100644 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx @@ -105,11 +105,15 @@ namespace svt return; i_rStateSet.AddState( AccessibleStateType::EXPANDABLE ); + i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) ); ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" ); if ( pDrawer->IsExpanded() ) i_rStateSet.AddState( AccessibleStateType::EXPANDED ); + + if ( pDrawer->HasChildPathFocus() ) + i_rStateSet.AddState( AccessibleStateType::FOCUSED ); } //================================================================================================================== -- cgit From a3a66f45d1ad48b5e2fc91827f0aebfe4a341d6c Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 21 Apr 2010 16:26:28 +0200 Subject: sb120: #i111047# disabled failing tests for now --- toolkit/qa/unoapi/toolkit.sce | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce index 1c8ad0c95181..003c263fb37c 100644 --- a/toolkit/qa/unoapi/toolkit.sce +++ b/toolkit/qa/unoapi/toolkit.sce @@ -8,10 +8,10 @@ #i86110 -o toolkit.AccessibleList #i86110 -o toolkit.AccessibleListBox #i86110 -o toolkit.AccessibleListItem --o toolkit.AccessibleMenu --o toolkit.AccessibleMenuBar +#i111047# -o toolkit.AccessibleMenu +#i111047# -o toolkit.AccessibleMenuBar #i86009 -o toolkit.AccessibleMenuItem --o toolkit.AccessibleMenuSeparator +#i111047# -o toolkit.AccessibleMenuSeparator #i52607 -o toolkit.AccessiblePopupMenu #i86107,i86110 -o toolkit.AccessibleRadioButton -o toolkit.AccessibleScrollBar -- cgit From ae0cba91142ccb13dae82c3e33483e419b82b555 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 22 Apr 2010 10:13:58 +0200 Subject: slidecopy: make the visualization window mouse-transparent --- svtools/source/toolpanel/toolpaneldrawer.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 96bba7a221fe..851556bc7874 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -57,6 +57,7 @@ namespace svt :Window( &i_rParent ) ,m_rDrawer( i_rParent ) { + SetMouseTransparent( TRUE ); Show(); SetAccessibleRole( AccessibleRole::LABEL ); } -- cgit From e21cf359294afc7d569b0b5eb99b504f3ea65e2c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 22 Apr 2010 10:19:37 +0100 Subject: cmcfixes74: #i110989# make sure preextstl.h will work even if the namespace std hasn't been opened yet --- tools/inc/tools/preextstl.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/inc/tools/preextstl.h b/tools/inc/tools/preextstl.h index 4d0418d01c57..27aed38686f0 100644 --- a/tools/inc/tools/preextstl.h +++ b/tools/inc/tools/preextstl.h @@ -24,8 +24,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - +//1. Force inclusion of a std:: using header to ensure the stlport define +//of std as "stlport" +#include #if defined(ADAPT_EXT_STL) +//2. Force inclusion of stlport headers to get their stlport:: definitions # include # include # include @@ -33,12 +36,14 @@ # include # include # include -# include +//3. Now force inclusion of native headers to get their std:: definitions # if defined(std) # define std_was_redefined_as_stlport std # undef std # define _STLP_OUTERMOST_HEADER_ID 0xdeadbeaf -# pragma GCC visibility push(default) +# if defined(_GNUC__) +# pragma GCC visibility push(default) +# endif # include _STLP_NATIVE_HEADER(exception_defines.h) # include _STLP_NATIVE_HEADER(limits) # include _STLP_NATIVE_HEADER(memory) @@ -56,7 +61,9 @@ # include _STLP_NATIVE_HEADER(vector) # include _STLP_NATIVE_HEADER(list) # include _STLP_NATIVE_HEADER(map) -# pragma GCC visibility pop +# if defined(_GNUC__) +# pragma GCC visibility pop +# endif # endif #endif //ext_std resolves to the std that external c++ libs, e.g. Graphite were built -- cgit From ac46c88be4e0f9223a00236afeb91e0c7d265a24 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 22 Apr 2010 13:19:35 +0200 Subject: slidecopy: proper include (the undelivered version of ctrlbox.hxx is not below 'svtools') --- svtools/workben/toolpanel/toolpaneltest.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 148df941a254..812d6479b887 100755 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -26,7 +26,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include "svtools/ctrlbox.hxx" +#include "ctrlbox.hxx" #include "svtools/toolpanel/toolpaneldeck.hxx" #include "svtools/toolpanel/tablayouter.hxx" -- cgit From a01ff5eee51b2c5b06916576b6fbf3fb0192452b Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 22 Apr 2010 14:38:59 +0200 Subject: sb120: #i111076# disabled failing test for now --- toolkit/qa/unoapi/knownissues.xcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 6f57f37536a2..255b9819ab45 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -240,3 +240,6 @@ toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection + +### i111076 ### +toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess -- cgit From 33b27bb6627da60efcd78919c287a521f06c7e2b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 22 Apr 2010 17:01:19 +0200 Subject: vcl111: #i108490# condition for error message was to broad --- vcl/source/gdi/pdfwriter_impl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6a24775219d9..add53cdfaabf 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9749,7 +9749,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) aLine.append( " ]\n" ); } } - else if( m_bIsPDF_A1 ) + else if( m_bIsPDF_A1 && (bWriteMask || aTransparentColor != Color( COL_TRANSPARENT )) ) m_aErrors.insert( PDFWriter::Warning_Transparency_Omitted_PDFA ); aLine.append( ">>\n" -- cgit From fbce9358c049499cf0fc142e259493034fc6355c Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 22 Apr 2010 19:41:52 +0200 Subject: vcl111: #i59974# improve single key commit hack --- vcl/unx/gtk/window/gtkframe.cxx | 17 +++++++++++++---- vcl/unx/inc/plugins/gtk/gtkframe.hxx | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index ad694cf5bbc1..8029fb3cd05c 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -3209,7 +3209,8 @@ GtkSalFrame::IMHandler::IMHandler( GtkSalFrame* pFrame ) : m_pFrame(pFrame), m_nPrevKeyPresses( 0 ), m_pIMContext( NULL ), - m_bFocused( true ) + m_bFocused( true ), + m_bPreeditJustChanged( false ) { m_aInputEvent.mpTextAttr = NULL; createIMContext(); @@ -3384,6 +3385,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent ) if( aDel.isDeleted() ) return true; + m_bPreeditJustChanged = false; + if( bResult ) return true; else @@ -3413,6 +3416,8 @@ bool GtkSalFrame::IMHandler::handleKeyEvent( GdkEventKey* pEvent ) if( aDel.isDeleted() ) return true; + m_bPreeditJustChanged = false; + std::list::iterator iter = m_aPrevKeyPresses.begin(); std::list::iterator iter_end = m_aPrevKeyPresses.end(); while (iter != iter_end) @@ -3476,8 +3481,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p { GTK_YIELD_GRAB(); - bool bWasPreedit = (pThis->m_aInputEvent.mpTextAttr != 0); - pThis->m_aInputEvent.mnTime = 0; pThis->m_aInputEvent.mpTextAttr = 0; pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 ); @@ -3501,6 +3504,9 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p * or because there never was a preedit. */ bool bSingleCommit = false; + bool bWasPreedit = + (pThis->m_aInputEvent.mpTextAttr != 0) || + pThis->m_bPreeditJustChanged; if( ! bWasPreedit && pThis->m_aInputEvent.maText.Len() == 1 && ! pThis->m_aPrevKeyPresses.empty() @@ -3515,7 +3521,6 @@ void GtkSalFrame::IMHandler::signalIMCommit( GtkIMContext* CONTEXT_ARG, gchar* p bSingleCommit = true; } } - if( ! bSingleCommit ) { pThis->m_pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&pThis->m_aInputEvent); @@ -3563,6 +3568,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_ } } + pThis->m_bPreeditJustChanged = true; + bool bEndPreedit = (!pText || !*pText) && pThis->m_aInputEvent.mpTextAttr != NULL; pThis->m_aInputEvent.mnTime = 0; pThis->m_aInputEvent.maText = String( pText, RTL_TEXTENCODING_UTF8 ); @@ -3646,6 +3653,8 @@ void GtkSalFrame::IMHandler::signalIMPreeditEnd( GtkIMContext*, gpointer im_hand GtkSalFrame::IMHandler* pThis = (GtkSalFrame::IMHandler*)im_handler; GTK_YIELD_GRAB(); + pThis->m_bPreeditJustChanged = true; + vcl::DeletionListener aDel( pThis->m_pFrame ); pThis->doCallEndExtTextInput(); if( ! aDel.isDeleted() ) diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 88a26b401eed..18dd476fc2c4 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -130,6 +130,7 @@ class GtkSalFrame : public SalFrame int m_nPrevKeyPresses; // avoid using size() GtkIMContext* m_pIMContext; bool m_bFocused; + bool m_bPreeditJustChanged; SalExtTextInputEvent m_aInputEvent; std::vector< USHORT > m_aInputFlags; -- cgit From cc93f06f93eeaaee5811588d90929ebc72bf9724 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 23 Apr 2010 12:28:26 +0200 Subject: #i111108# do not prefer fontconfig familyname because of i79878 --- vcl/unx/source/fontmanager/fontconfig.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index bc6de4fbc94a..2f92154605f0 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -767,10 +767,14 @@ int PrintFontManager::countFontconfigFonts( std::hash_mapm_nFamilyName != nFamilyName ) { +#if 0 // fontconfig prefers nameid=16 for the family name which is all fine + // but Writer suffers from #i79878# + // the only reasonable workaround for now is to use the classic nameid=1 pUpdate->m_aAliases.remove( pUpdate->m_nFamilyName ); pUpdate->m_aAliases.push_back( pUpdate->m_nFamilyName ); pUpdate->m_aAliases.remove( nFamilyName ); pUpdate->m_nFamilyName = nFamilyName; +#endif } if( eWeightRes == FcResultMatch ) pUpdate->m_eWeight = convertWeight(weight); -- cgit From 8ac46a7ad1beddfb2eb254a1ad4dd7ca11a56b87 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 23 Apr 2010 16:46:44 +0200 Subject: sb120: #i111113# disabled failing tests for now --- toolkit/qa/unoapi/knownissues.xcl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 255b9819ab45..89528e04b0ae 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -243,3 +243,7 @@ toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection ### i111076 ### toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess + +### i111113 ### +toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent +toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext -- cgit From 5c737d12c11c1ef5b758e2045098e7037c3b56cc Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 23 Apr 2010 17:41:32 +0200 Subject: gridcontrol_03:bug fix for #i111107#, added update methods to xgriddatamodel --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 2 +- svtools/inc/svtools/table/tabledatawindow.hxx | 2 +- svtools/source/table/gridtablerenderer.cxx | 6 +- svtools/source/table/tablecontrol.cxx | 7 +- svtools/source/table/tablecontrol_impl.cxx | 84 ++++++--- svtools/source/table/tablecontrol_impl.hxx | 4 +- svtools/source/table/tabledatawindow.cxx | 32 +++- svtools/source/uno/svtxgridcontrol.cxx | 195 ++++++++++++++++----- .../source/controls/grid/defaultgriddatamodel.cxx | 41 ++++- .../source/controls/grid/defaultgriddatamodel.hxx | 4 +- toolkit/source/controls/grid/gridcontrol.hxx | 2 - 11 files changed, 288 insertions(+), 91 deletions(-) diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index ba9bec8e0e2e..2b3951f6aaf3 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -116,7 +116,7 @@ namespace svt { namespace table /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; virtual void setCursorAtCurrentCell(const Point& rPoint) = 0; - virtual void setTooltip(const Point& rPoint ) = 0; + virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; virtual RowPos getCurrentRow(const Point& rPoint ) = 0; virtual void resizeColumn(const Point& rPoint ) = 0; virtual bool startResizeColumn(const Point& rPoint) = 0; diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index 0e65f9847816..c9f96483d943 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -73,7 +73,7 @@ namespace svt { namespace table virtual void SetPointer( const Pointer& rPointer ); virtual void CaptureMouse(); virtual void ReleaseMouse(); - + virtual long Notify(NotifyEvent& rNEvt); }; //........................................................................ } } // namespace svt::table diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 77db8fc30904..a3f954e0bef5 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -122,7 +122,7 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_RIGHT; Rectangle aRect(_rArea); aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=2; aRect.Bottom()-=2; + aRect.Bottom()-=2; _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); _rDevice.Pop(); @@ -208,7 +208,7 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_RIGHT; Rectangle aRect(_rArea); aRect.Left()+=4; aRect.Right()-=4; - aRect.Top()+=2; aRect.Bottom()-=2; + aRect.Bottom()-=2; _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); // TODO: active? selected? (void)_bActive; @@ -347,7 +347,7 @@ namespace svt { namespace table nHorFlag = TEXT_DRAW_RIGHT; Rectangle textRect(_rArea); textRect.Left()+=4; textRect.Right()-=4; - textRect.Top()+=2; textRect.Bottom()-=2; + textRect.Bottom()-=2; _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); } _rDevice.Pop(); diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 12def82d3ecf..418348c81b7d 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -71,9 +71,10 @@ namespace svt { namespace table ,m_pImpl( new TableControl_Impl( *this ) ) ,m_bSelectionChanged(false) { - m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); - m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); - m_pImpl->getDataWindow()->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); + TableDataWindow* aTableData = m_pImpl->getDataWindow(); + aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); + aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); + aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); } diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 4057be745097..37717c5c1833 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -456,8 +455,8 @@ namespace svt { namespace table DELETEZ( m_pVScroll ); DELETEZ( m_pHScroll ); DELETEZ( m_pScrollCorner ); - DELETEZ( m_pTableFunctionSet ); - DELETEZ( m_pSelEngine ); + DELETEZ( m_pTableFunctionSet ); + DELETEZ( m_pSelEngine ); DELETEZ( m_pDataWindow ); } @@ -579,7 +578,9 @@ namespace svt { namespace table m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); + std::vector aPrePixelWidths(0); long accumulatedPixelWidth = 0; + int lastResizableCol = -1; double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width(); if(m_pModel->hasRowHeaders()) { @@ -627,22 +628,26 @@ namespace svt { namespace table colWidth = pColumn->getWidth(); long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); if(bResizable && colPrefWidth == 0) + { colWithoutFixedWidthsSum+=pixelWidth; + lastResizableCol = col; + } colWidthsSum+=pixelWidth; + aPrePixelWidths.push_back(pixelWidth); } - gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; double scalingFactor = 1.0; if(m_bResizingGrid) { - if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) - scalingFactor = gridWidth/colWithoutFixedWidthsSum; + if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) + scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; } else { - if(colWidthsSum < gridWidth) + if(colWidthsSum < gridWidthWithoutFixed) { if(colWithoutFixedWidthsSum>0) - scalingFactor = gridWidth/colWithoutFixedWidthsSum; + scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; } } long pixelWidth = 0; @@ -652,16 +657,32 @@ namespace svt { namespace table DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); if ( !pColumn ) continue; - TableMetrics colWidth = pColumn->getWidth(); if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) { - colWidth*=scalingFactor; - //colWidth+=1; - pColumn->setWidth(colWidth); + aPrePixelWidths[i]*=scalingFactor; + TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width(); + pColumn->setWidth(logicColWidth); + } + m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] ); + } + if(gridWidth > m_aAccColumnWidthsPixel[colCount-1]) + { + if(lastResizableCol >= 0) + { + PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol); + m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1]; + TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width(); + pColumn->setWidth(logicColWidth1); + while(lastResizableCol < colCount) + { + if(lastResizableCol == 0) + m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol]; + else + m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol]; + ++lastResizableCol; + } } - pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - m_aColumnWidthsPixel.push_back( pixelWidth ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth ); } } @@ -1068,7 +1089,6 @@ namespace svt { namespace table ) { bool isSelectedColumn = false; - // Size siz = m_rAntiImpl.GetSizePixel(); ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic; ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()]; if(rCellData>>=xGraphic) @@ -1852,6 +1872,16 @@ namespace svt { namespace table return m_pDataWindow; } //------------------------------------------------------------------------------- + ScrollBar* TableControl_Impl::getHorzScrollbar() + { + return m_pHScroll; + } + //------------------------------------------------------------------------------- + ScrollBar* TableControl_Impl::getVertScrollbar() + { + return m_pVScroll; + } + //------------------------------------------------------------------------------- BOOL TableControl_Impl::isRowSelected(const ::std::vector& selectedRows, RowPos current) { return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end(); @@ -1872,13 +1902,18 @@ namespace svt { namespace table return -1; } //------------------------------------------------------------------------------- - void TableControl_Impl::setTooltip(const Point& rPoint ) + ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint ) { - ::rtl::OUString aTooltipText; + ::rtl::OUString& aTooltipText(::rtl::OUString::createFromAscii("")); RowPos current = getCurrentRow(rPoint); com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip(); com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip(); - if(text.getLength() == 0) + if(text.getLength()==0 && cols.getLength()==0) + { + ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][m_nCurColumn]; + aTooltipText = convertToString(content); + } + else if(text.getLength() == 0) { for(int i=0; igetRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); int resizingColumn=m_nCurColumn-m_nLeftColumn; PColumnModel pColumn = m_pModel->getColumnModel(m_nCurColumn); - sal_Int32 colWidth = pColumn->getWidth(); impl_ni_getAccVisibleColWidths(); - int newColWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + int newColWidth = m_aColumnWidthsPixel[m_nCurColumn]; //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && pColumn->isResizable()) aNewPointer = Pointer( POINTER_HSPLIT ); @@ -2059,9 +2093,9 @@ namespace svt { namespace table int col = m_nLeftColumn; while(nVisCols) { - PColumnModel pColumn = m_pModel->getColumnModel(col); - pixelWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getWidth(), 0 ), MAP_APPFONT ).Width(); - m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=pixelWidth); + // PColumnModel pColumn = m_pModel->getColumnModel(col); + // pixelWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getWidth(), 0 ), MAP_APPFONT ).Width(); + m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=m_aColumnWidthsPixel[col]); col++; nVisCols--; } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index da4108e3af09..6e009ffd6fd9 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -208,12 +208,14 @@ namespace svt { namespace table virtual void showCursor(); virtual bool dispatchAction( TableControlAction _eAction ); virtual SelectionEngine* getSelEngine(); - virtual void setTooltip(const Point& rPoint ); + virtual rtl::OUString& setTooltip(const Point& rPoint ); virtual void resizeColumn(const Point& rPoint); virtual bool startResizeColumn(const Point& rPoint); virtual bool endResizeColumn(const Point& rPoint); TableDataWindow* getDataWindow(); + ScrollBar* getHorzScrollbar(); + ScrollBar* getVertScrollbar(); ::rtl::OUString convertToString(const ::com::sun::star::uno::Any& _value); Rectangle calcHeaderRect(bool bColHeader); diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e602f0418cfe..e307071e2699 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -30,6 +30,7 @@ #include "svtools/table/tablecontrol.hxx" #include "svtools/table/tabledatawindow.hxx" #include "tablecontrol_impl.hxx" +#include //........................................................................ namespace svt { namespace table @@ -59,18 +60,25 @@ namespace svt { namespace table Point aPoint = rMEvt.GetPosPixel(); if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) ) { - if(m_rTableControl.getCurrentRow(aPoint)>=0 && - (!m_rTableControl.getAntiImpl().getColumnsForTooltip().getLength()==0 || !m_rTableControl.getAntiImpl().getTextForTooltip().getLength()==0)) + if(m_rTableControl.getCurrentRow(aPoint)>=0 ) { - m_rTableControl.setTooltip(aPoint); SetPointer(POINTER_ARROW); + rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint); + Help::EnableBalloonHelp(); + Window::SetHelpText( rHelpText.getStr()); } else if(m_rTableControl.getCurrentRow(aPoint) == -1) { + if(Help::IsBalloonHelpEnabled()) + Help::DisableBalloonHelp(); m_rTableControl.resizeColumn(aPoint); } else + { + if(Help::IsBalloonHelpEnabled()) + Help::DisableBalloonHelp(); Window::MouseMove( rMEvt ); + } } } //-------------------------------------------------------------------- @@ -121,6 +129,24 @@ namespace svt { namespace table { Window::ReleaseMouse(); } + // ----------------------------------------------------------------------- + long TableDataWindow::Notify(NotifyEvent& rNEvt ) + { + long nDone = 0; + if ( rNEvt.GetType() == EVENT_COMMAND ) + { + const CommandEvent& rCEvt = *rNEvt.GetCommandEvent(); + if ( rCEvt.GetCommand() == COMMAND_WHEEL ) + { + const CommandWheelData* pData = rCEvt.GetWheelData(); + if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) ) + { + nDone = HandleScrollCommand( rCEvt, m_rTableControl.getHorzScrollbar(), m_rTableControl.getVertScrollbar() ); + } + } + } + return nDone ? nDone : Window::Notify( rNEvt ); + } //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index f29273b1ec65..b411181c2aab 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -271,8 +271,9 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } m_xColumnModel->setDefaultColumns(rawRowData.getLength()); } - if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount()) - throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel); + else + if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount()) + throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel); for ( int k = 0; k < rawRowData.getLength(); k++) { @@ -290,9 +291,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } else throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel); - sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() ), MAP_APPFONT ).Height(); + sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height(); if(m_xDataModel->getRowHeight() == 0) + { m_pTableModel->setRowHeight(fontHeight); + m_xDataModel->setRowHeight(fontHeight); + } else m_pTableModel->setRowHeight(m_xDataModel->getRowHeight()); m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth()); @@ -309,18 +313,28 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An Sequence > columns = m_xColumnModel->getColumns(); std::vector > aNewColumns( comphelper::sequenceToContainer > >(columns)); - sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight() ), MAP_APPFONT ).Height(); + sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height(); if(m_xColumnModel->getColumnHeaderHeight() == 0) + { m_pTableModel->setColumnHeaderHeight(fontHeight); + m_xColumnModel->setColumnHeaderHeight(fontHeight); + } else m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight()); for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) { UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); + Reference< XGridColumn > xGridColumn = m_xColumnModel->getColumn(col); m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); - m_pTableModel->getColumnModel()[col]->setHorizontalAlign(m_xColumnModel->getColumn(col)->getHorizontalAlign()); - m_pTableModel->getColumnModel()[col]->setWidth(m_xColumnModel->getColumn(col)->getColumnWidth()); - m_pTableModel->getColumnModel()[col]->setResizable(m_xColumnModel->getColumn(col)->getResizeable()); + tableColumn->setHorizontalAlign(xGridColumn->getHorizontalAlign()); + tableColumn->setWidth(xGridColumn->getColumnWidth()); + if(xGridColumn->getPreferredWidth() != 0) + tableColumn->setPreferredWidth(xGridColumn->getPreferredWidth()); + if(xGridColumn->getMaxWidth() != 0) + tableColumn->setMaxWidth(xGridColumn->getMaxWidth()); + if(xGridColumn->getMinWidth() != 0) + tableColumn->setMinWidth(xGridColumn->getMinWidth()); + tableColumn->setResizable(xGridColumn->getResizeable()); } } } @@ -544,7 +558,53 @@ void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid: } void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { - (void) Event; + TableControl* pTable = (TableControl*)GetWindow(); + if(Event.valueName == rtl::OUString::createFromAscii("RowHeight")) + { + sal_Int32 rowHeight = m_pTableModel->getRowHeight(); + Event.newValue>>=rowHeight; + m_pTableModel->setRowHeight(rowHeight); + pTable->Invalidate(); + } + else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaderWidth")) + { + sal_Int32 rowHeaderWidth = m_pTableModel->getRowHeaderWidth(); + Event.newValue>>=rowHeaderWidth; + m_pTableModel->setRowHeaderWidth(rowHeaderWidth); + pTable->Invalidate(); + } + else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaders")) + { + Sequence< rtl::OUString > headers(0); + Event.newValue>>=headers; + std::vector< rtl::OUString > headerNames( comphelper::sequenceToContainer >(headers) ); + m_pTableModel->setRowHeaderName(headerNames); + pTable->Invalidate(); + } + else if(Event.valueName == rtl::OUString::createFromAscii("CellUpdated")) + { + std::vector< std::vector< Any > >& rowContent = m_pTableModel->getCellContent(); + sal_Int32 col = -1; + Event.oldValue>>=col; + rowContent[Event.index][col] = Event.newValue; + pTable->InvalidateDataWindow(Event.index, Event.index, false); + } + else if(Event.valueName == rtl::OUString::createFromAscii("RowUpdated")) + { + std::vector >& rowContent = m_pTableModel->getCellContent(); + Sequence< sal_Int32 > cols(0); + Sequence< Any > values(0); + Event.oldValue>>=cols; + Event.newValue>>=values; + for(int i = 0; i< cols.getLength(); i++) + { + if(cols[i]>=0 && cols[i]getColumnCount()) + rowContent[Event.index][cols[i]]=values[i]; + else + break; + } + pTable->InvalidateDataWindow(Event.index, Event.index, false); + } } void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) @@ -583,34 +643,54 @@ void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObj void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); - std::vector& selectedRows = pTable->GetSelectedRows(); - if(!selectedRows.empty()) - selectedRows.clear(); - sal_Int32 start = rangeOfRows[0]; - int seqSize = rangeOfRows.getLength(); - sal_Int32 end = rangeOfRows[seqSize-1]; - for(int i=0;iselectionChanged(true); - pTable->InvalidateDataWindow(start, end, false); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); - + SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode(); + if(eSelMode != NO_SELECTION) + { + sal_Int32 start = rangeOfRows[0]; + int seqSize = rangeOfRows.getLength(); + sal_Int32 end = rangeOfRows[seqSize-1]; + if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) + { + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!selectedRows.empty()) + selectedRows.clear(); + if(eSelMode == SINGLE_SELECTION) + { + if(rangeOfRows.getLength() == 1) + selectedRows.push_back(start); + else + return; + } + else + { + for(int i=0;iselectionChanged(true); + pTable->InvalidateDataWindow(start, end, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); + } + } } void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); - std::vector& selectedRows = pTable->GetSelectedRows(); - if(!selectedRows.empty()) - selectedRows.clear(); - for(int i=0;igetRowCount();i++) - selectedRows.push_back(i); - pTable->Invalidate(); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); + SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode(); + if(eSelMode != NO_SELECTION) + { + std::vector& selectedRows = pTable->GetSelectedRows(); + if(!selectedRows.empty()) + selectedRows.clear(); + for(int i=0;igetRowCount();i++) + selectedRows.push_back(i); + pTable->Invalidate(); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); + } } void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { @@ -620,13 +700,16 @@ void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequenc std::vector::iterator itEnd = selectedRows.end(); sal_Int32 start = rangeOfRows[0]; sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1]; - std::vector::iterator iter = std::find(itStart, itEnd, start); - selectedRows.erase(iter, iter+(end-start)+1); - pTable->selectionChanged(true); - pTable->InvalidateDataWindow(start, end, false); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); + if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) + { + std::vector::iterator iter = std::find(itStart, itEnd, start); + selectedRows.erase(iter, iter+(end-start)+1); + pTable->selectionChanged(true); + pTable->InvalidateDataWindow(start, end, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); + } } void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) @@ -676,14 +759,34 @@ void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::s if(index<0 || index>=m_pTableModel->getRowCount()) return; TableControl* pTable = (TableControl*)GetWindow(); - std::vector& selectedRows = pTable->GetSelectedRows(); - if(!isSelectedIndex(index)) - selectedRows.push_back(index); - pTable->selectionChanged(true); - pTable->InvalidateDataWindow(index, index, false); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); + SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode(); + if(eSelMode != NO_SELECTION) + { + std::vector& selectedRows = pTable->GetSelectedRows(); + if(eSelMode == MULTIPLE_SELECTION) + { + if(!isSelectedIndex(index)) + selectedRows.push_back(index); + else + return; + } + else if(eSelMode == SINGLE_SELECTION) + { + if(!selectedRows.empty()) + { + if(!isSelectedIndex(index)) + deselectRows(getSelection()); + else + return; + } + selectedRows.push_back(index); + } + pTable->selectionChanged(true); + pTable->InvalidateDataWindow(index, index, false); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); + } } void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index 38e3ec694b96..7ffafdf0ddb6 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -41,6 +41,9 @@ using namespace ::com::sun::star::lang; #define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" )) #define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" )) +#define CELLUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellUpdated" )) +#define ROWUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowUpdated" )) +#define ROWHEADERWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaderWidth" )) namespace toolkit { @@ -83,11 +86,10 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& //--------------------------------------------------------------------- -void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException) +void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue) throw (::com::sun::star::uno::RuntimeException) { Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); - GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), - Sequence< Any >() ); + GridDataEvent aEvent( xSource, name, oldValue, newValue, index, ::rtl::OUString(), Sequence< Any >()); broadcast( data_changed, aEvent); } @@ -128,7 +130,7 @@ void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com sal_Int32 oldValue = rowHeight; rowHeight = value; - broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) ); + broadcast_changed( ROWHEIGHT, 0, Any(oldValue), Any(value)); } //--------------------------------------------------------------------- @@ -164,7 +166,7 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S i++; } - broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) ); + broadcast_changed( ROWHEADERS, 0, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) ); } //--------------------------------------------------------------------- @@ -244,7 +246,9 @@ void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException) //--------------------------------------------------------------------- void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException) { + sal_Int32 oldValue = m_nRowHeaderWidth; m_nRowHeaderWidth = _value; + broadcast_changed( ROWHEADERWIDTH, 0, Any(oldValue), Any(_value) ); } //--------------------------------------------------------------------- sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException) @@ -252,6 +256,33 @@ sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun:: return m_nRowHeaderWidth; } //--------------------------------------------------------------------- +void SAL_CALL DefaultGridDataModel::updateCell(::sal_Int32 row, ::sal_Int32 column, const Any& value) throw (::com::sun::star::uno::RuntimeException) +{ + if(row >= 0 && row < (signed)data.size()) + { + if(column >= 0 && column < (signed)data[0].size()) + { + data[row][column] = value; + Sequence< Any >dataSeq(comphelper::containerToSequence(data[row])); + broadcast_changed( CELLUPDATED, row, Any(column), value ); + } + } +} +//--------------------------------------------------------------------- +void SAL_CALL DefaultGridDataModel::updateRow(::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 > & columns, const ::com::sun::star::uno::Sequence< Any > & values) throw (::com::sun::star::uno::RuntimeException) +{ + if(row >= 0 && row < (signed)data.size()) + { + if(columns.getLength() == values.getLength()) + { + for(int i = 0; i < columns.getLength(); i++) + data[row][i] = values[i]; + Sequence< Any >dataSeq(comphelper::containerToSequence(data[row])); + broadcast_changed( ROWUPDATED, row, Any(columns), Any(values) ); + } + } +} +//--------------------------------------------------------------------- // XComponent //--------------------------------------------------------------------- diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx index 3c10a3e3cd73..ea11a8a9a00a 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx @@ -73,6 +73,8 @@ public: virtual void SAL_CALL removeAll() throw (RuntimeException); virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCell( ::sal_Int32 row, ::sal_Int32 column, const ::com::sun::star::uno::Any& value ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& values ) throw (::com::sun::star::uno::RuntimeException); // XComponent virtual void SAL_CALL dispose( ) throw (RuntimeException); virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); @@ -86,7 +88,7 @@ public: private: void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); - void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException); + void broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException); void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException); void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index e0f503a10aa9..0c8ddb1c02b6 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -91,8 +91,6 @@ public: virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); - //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::awt::grid::XGridSelection -- cgit From 96176d231f3737ef4eb96f2e08a5cfd958a12dcb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 26 Apr 2010 11:14:03 +0200 Subject: vcl111: #i111106# simplify XIOErrorHandler (thanks cmc) --- vcl/unx/gtk/app/gtkdata.cxx | 3 --- vcl/unx/inc/saldisp.hxx | 1 + vcl/unx/kde/kdedata.cxx | 3 --- vcl/unx/kde4/KDEXLib.cxx | 5 +---- vcl/unx/source/app/saldata.cxx | 6 +++--- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index d1e5c5954352..586bedca1066 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -636,9 +636,6 @@ void GtkXLib::Init() Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp ); - XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl ); - XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl ); - m_pGtkSalDisplay = new GtkSalDisplay( pGdkDisp ); gdk_window_add_filter( NULL, call_filterGdkEvent, m_pGtkSalDisplay ); diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index e54d6e828911..3734cbec6ef7 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -231,6 +231,7 @@ protected: XErrorHandler m_aHandler; }; std::vector< XErrorStackEntry > m_aXErrorHandlerStack; + XIOErrorHandler m_aOrigXIOErrorHandler; public: SalXLib(); virtual ~SalXLib(); diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 5e2801e47fc6..34b0ff652cde 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -182,9 +182,6 @@ void KDEXLib::Init() SalDisplay *pSalDisplay = new SalKDEDisplay( pDisp ); - XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl ); - XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl ); - pInputMethod->CreateMethod( pDisp ); pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 2e5b86b79f9c..6a2793b8abe3 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -148,9 +148,6 @@ void KDEXLib::Init() ((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay; - XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl ); - XSetErrorHandler ( (XErrorHandler)X11SalData::XErrorHdl ); - pInputMethod->CreateMethod( pDisp ); pInputMethod->AddConnectionWatch( pDisp, (void*)this ); pSalDisplay->SetInputMethod( pInputMethod ); @@ -175,4 +172,4 @@ void KDEXLib::doStartup() fprintf( stderr, "called KStartupInfo::appStarted()\n" ); #endif } -} \ No newline at end of file +} diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx index 4155887a9875..c337dc14a6f8 100644 --- a/vcl/unx/source/app/saldata.cxx +++ b/vcl/unx/source/app/saldata.cxx @@ -352,8 +352,9 @@ SalXLib::SalXLib() nFDs_ = m_pTimeoutFDS[0] + 1; } - PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) ); m_bHaveSystemChildFrames = false; + m_aOrigXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl ); + PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) ); } SalXLib::~SalXLib() @@ -363,6 +364,7 @@ SalXLib::~SalXLib() close (m_pTimeoutFDS[1]); PopXErrorLevel(); + XSetIOErrorHandler (m_aOrigXIOErrorHandler); } void SalXLib::PushXErrorLevel( bool bIgnore ) @@ -458,8 +460,6 @@ void SalXLib::Init() exit(0); } - XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl ); - SalDisplay *pSalDisplay = new SalX11Display( pDisp ); pInputMethod->CreateMethod( pDisp ); -- cgit From 04ccf52428a687b756c91bad8dbb5bb5a1c44920 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 26 Apr 2010 14:04:39 +0200 Subject: sb120: #i111159# disabled failing tests for now --- toolkit/qa/unoapi/knownissues.xcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 89528e04b0ae..e51f41373d68 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -247,3 +247,6 @@ toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess ### i111113 ### toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext + +### i111159 ### +toolkit.Toolkit::com::sun::star::awt::XMessageBoxFactory -- cgit From da1eb68aa874b58a1fe755a8df406f80d6be46bd Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 26 Apr 2010 15:35:49 +0200 Subject: sb120: #i111159# made XMessageBoxFactory test code more robust --- toolkit/qa/unoapi/knownissues.xcl | 3 --- 1 file changed, 3 deletions(-) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index e51f41373d68..89528e04b0ae 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -247,6 +247,3 @@ toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess ### i111113 ### toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext - -### i111159 ### -toolkit.Toolkit::com::sun::star::awt::XMessageBoxFactory -- cgit From 5369c4232ac93e99fad3e52604538dba7a5d68f2 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 26 Apr 2010 16:36:17 +0200 Subject: vcl111: #i103999# fix problem with moblin theme (thanks tml) --- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index de4d55b0230a..cb36b4613707 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3475,7 +3475,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetMenuColor( aBackColor ); aStyleSet.SetMenuTextColor( aTextColor ); - aTextColor = getColor( pMenubarStyle->text[GTK_STATE_NORMAL] ); + aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarTextColor( aTextColor ); #if OSL_DEBUG_LEVEL > 1 -- cgit From ae9d7c2cef9ecd42687d64f985b9e2dcbc68a034 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 27 Apr 2010 10:09:22 +0200 Subject: cws tl80: #i103552# Japanese word for 'shutdown' added to ja.dic --- i18npool/source/breakiterator/data/ja.dic | 1 + 1 file changed, 1 insertion(+) diff --git a/i18npool/source/breakiterator/data/ja.dic b/i18npool/source/breakiterator/data/ja.dic index ed76e4b4a271..d2923833e57d 100644 --- a/i18npool/source/breakiterator/data/ja.dic +++ b/i18npool/source/breakiterator/data/ja.dic @@ -21386,6 +21386,7 @@ シャッター シャット シャットアウト +シャットダウン シャッムシャツ シャトル -- cgit From 7fa4812d0283a9a4b9f06fc1e6c8dcc80bc62257 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 27 Apr 2010 12:20:11 +0200 Subject: vcl: use language in glyph fallback lookup through fontconfig --- vcl/source/gdi/outdev3.cxx | 1 + vcl/unx/source/gdi/salgdi3.cxx | 2 +- vcl/util/makefile.mk | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index e13ae6cbe64a..438f81bdc6c1 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -579,6 +579,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, { aFont.SetHeight( nDefaultHeight ); aFont.SetWeight( WEIGHT_NORMAL ); + aFont.SetLanguage( eLang ); if ( aFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW ) aFont.SetCharSet( gsl_getSystemTextEncoding() ); diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 7cf2009a3e07..760fb81cf1aa 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -2025,7 +2025,7 @@ static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData { ImplFontSelectData aRet(rFontSelData); - const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage ); + const rtl::OString aLangAttrib = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage ); psp::italic::type eItalic = psp::italic::Unknown; if( rFontSelData.GetSlant() != ITALIC_DONTKNOW ) diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index d501765c8491..eb54531c375c 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -299,6 +299,7 @@ SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN) SHL2STDLIBS=\ $(VCLLIB)\ $(I18NPAPERLIB) \ + $(I18NISOLANGLIB) \ $(TOOLSLIB) \ $(VOSLIB) \ $(BASEGFXLIB) \ -- cgit From b11f2df4d42f03c896b09b5c93ca4fcb63a407b9 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 27 Apr 2010 13:30:46 +0200 Subject: #i107213# notify a11y api if a toolbar popup window is opened --- svtools/source/control/toolbarmenu.cxx | 1 + svtools/source/uno/popupwindowcontroller.cxx | 36 ++++++++++++++++++++++++---- vcl/inc/vcl/window.hxx | 4 ++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 6a6edcc41f57..3a3c8bb885ab 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include "svtools/valueset.hxx" #include "svtools/toolbarmenu.hxx" diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index d431dd7911a8..97f03ba3320a 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -50,27 +50,29 @@ public: PopupWindowControllerImpl(); ~PopupWindowControllerImpl(); - void SetPopupWindow( ::Window* pPopupWindow ); + void SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox ); DECL_LINK( WindowEventListener, VclSimpleEvent* ); DECL_STATIC_LINK( PopupWindowControllerImpl, AsyncDeleteWindowHdl, Window* ); private: ::Window* mpPopupWindow; + ToolBox* mpToolBox; }; PopupWindowControllerImpl::PopupWindowControllerImpl() : mpPopupWindow( 0 ) +, mpToolBox( 0 ) { } PopupWindowControllerImpl::~PopupWindowControllerImpl() { if( mpPopupWindow ) - SetPopupWindow(0); + SetPopupWindow(0,0); } -void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow ) +void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow, ToolBox* pToolBox ) { if( mpPopupWindow ) { @@ -78,6 +80,8 @@ void PopupWindowControllerImpl::SetPopupWindow( ::Window* pPopupWindow ) Application::PostUserEvent( STATIC_LINK( this, PopupWindowControllerImpl, AsyncDeleteWindowHdl ), mpPopupWindow ); } mpPopupWindow = pPopupWindow; + mpToolBox = pToolBox; + if( mpPopupWindow ) { mpPopupWindow->AddEventListener( LINK( this, PopupWindowControllerImpl, WindowEventListener )); @@ -93,9 +97,31 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve { case VCLEVENT_WINDOW_CLOSE: case VCLEVENT_WINDOW_ENDPOPUPMODE: - SetPopupWindow(0); + SetPopupWindow(0,0); + break; + + case VCLEVENT_WINDOW_SHOW: + { + if( mpPopupWindow ) + { + if( mpToolBox ) + mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow ); + mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 ); + break; + } break; } + case VCLEVENT_WINDOW_HIDE: + { + if( mpPopupWindow ) + { + mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS, 0 ); + if( mpToolBox ) + mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_CLOSE, (void*)mpPopupWindow ); + } + break; + } + } } return 1; } @@ -209,7 +235,7 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th if( pWin ) { pWin->EnableDocking(true); - mpImpl->SetPopupWindow(pWin); + mpImpl->SetPopupWindow(pWin,pToolBox); ::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); } } diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 3d1cc91ee468..66f67ec4ac92 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -124,6 +124,8 @@ namespace dnd { namespace vcl { struct ControlLayoutData; } +namespace svt { class PopupWindowControllerImpl; } + // --------------- // - WindowTypes - // --------------- @@ -362,6 +364,8 @@ class VCL_DLLPUBLIC Window : public OutputDevice friend class ImplPopupFloatWin; friend class MenuFloatingWindow; + friend class svt::PopupWindowControllerImpl; + private: // NOTE: to remove many dependencies of other modules // to this central file, all members are now hidden -- cgit From de48ac823452730d09eed48cbfee70c2b3880055 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 27 Apr 2010 13:55:52 +0200 Subject: #161963# use modulo-2 arithmetic for access into indirect glyphid array --- vcl/source/gdi/metric.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index e5f54df41c9e..097cc3a6b901 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -401,7 +401,7 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const nGlyphIndex += nStartIndex; } else { // the glyphid array has the glyph index - nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex]; + nGlyphIndex = mpGlyphIds[ (nGlyphIndex - nStartIndex) & 0xFFFF ]; } return nGlyphIndex; -- cgit From 6d884e817f8e8d6d42fa4ccdfc56a5832ce90369 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 27 Apr 2010 15:40:24 +0200 Subject: vcl111: #i105472# add style to omit pointer evasion of help window --- vcl/inc/vcl/help.hxx | 1 + vcl/source/app/help.cxx | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx index 4bca986812ed..30308aa8a723 100644 --- a/vcl/inc/vcl/help.hxx +++ b/vcl/inc/vcl/help.hxx @@ -48,6 +48,7 @@ class Window; #define QUICKHELP_BOTTOM ((USHORT)0x0020) #define QUICKHELP_NOAUTOPOS (QUICKHELP_LEFT | QUICKHELP_CENTER | QUICKHELP_RIGHT | QUICKHELP_TOP | QUICKHELP_VCENTER | QUICKHELP_BOTTOM) #define QUICKHELP_CTRLTEXT ((USHORT)0x0040) +#define QUICKHELP_NOEVADEPOINTER ((USHORT)0x4000) #define QUICKHELP_BIDI_RTL ((USHORT)0x8000) // By changes you must also change: rsc/vclrsc.hxx diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index b4ab10887fcd..ac1da931ba06 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -759,18 +759,26 @@ void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle else if ( ( aPos.Y() + aSz.Height() ) > aScreenRect.Bottom() ) aPos.Y() = aScreenRect.Bottom() - aSz.Height(); - // the popup must not appear under the mouse - // otherwise it would directly be closed due to a focus change... - Rectangle aHelpRect( aPos, aSz ); - if( aHelpRect.IsInside( mPos ) ) + if( ! (nStyle & QUICKHELP_NOEVADEPOINTER) ) { - Point delta(2,2); - Point pSize( aSz.Width(), aSz.Height() ); - Point pTest( mPos - pSize - delta ); - if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() ) - aPos = pTest; - else - aPos = mPos + delta; + /* the remark below should be obsolete by now as the helpwindow should + not be focusable, leaving it as a hint. However it is sensible in most + conditions to evade the mouse pointer so the content window is fully visible. + + // the popup must not appear under the mouse + // otherwise it would directly be closed due to a focus change... + */ + Rectangle aHelpRect( aPos, aSz ); + if( aHelpRect.IsInside( mPos ) ) + { + Point delta(2,2); + Point pSize( aSz.Width(), aSz.Height() ); + Point pTest( mPos - pSize - delta ); + if( pTest.X() > aScreenRect.Left() && pTest.Y() > aScreenRect.Top() ) + aPos = pTest; + else + aPos = mPos + delta; + } } Window* pWindow = pHelpWin->GetParent()->ImplGetFrameWindow(); -- cgit From bf7e511ee990e956ff4bdf438425a00c05262624 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Tue, 27 Apr 2010 15:50:49 +0200 Subject: gridcontrol_03:bug fixes for resizing columns --- svtools/source/table/tablecontrol_impl.cxx | 189 ++++++++++++++-------------- svtools/source/table/tablecontrol_impl.hxx | 1 + toolkit/source/controls/grid/gridcolumn.cxx | 2 + 3 files changed, 96 insertions(+), 96 deletions(-) diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 37717c5c1833..1526dbdb778d 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -578,109 +578,111 @@ namespace svt { namespace table m_aColumnWidthsPixel.reserve( colCount ); m_aAccColumnWidthsPixel.reserve( colCount ); - std::vector aPrePixelWidths(0); - long accumulatedPixelWidth = 0; - int lastResizableCol = -1; - double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width(); - if(m_pModel->hasRowHeaders()) - { - TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); - gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); - } - if(m_pModel->hasVerticalScrollbar()) + if(colCount>0) { - sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); - gridWidth-=scrollbarWidth; - } - double colWidthsSum = 0.0; - double colWithoutFixedWidthsSum = 0.0; - double minColWithoutFixedSum = 0.0; - for ( ColPos col = 0; col < colCount; ++col ) - { - PColumnModel pColumn = m_pModel->getColumnModel( col ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - TableMetrics colWidth = 0; - TableMetrics colPrefWidth = pColumn->getPreferredWidth(); - bool bResizable = pColumn->isResizable(); - if(pColumn->getMinWidth() == 0 && bResizable) + std::vector aPrePixelWidths(0); + long accumulatedPixelWidth = 0; + int lastResizableCol = -1; + double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width(); + if(m_pModel->hasRowHeaders()) { - pColumn->setMinWidth(1); - minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth(); + gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width(); } - if(pColumn->getMaxWidth() == 0 && bResizable) - pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); - if( colPrefWidth != 0) + if(m_pModel->hasVerticalScrollbar()) { - if(m_bResizingGrid) + sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + gridWidth-=scrollbarWidth; + } + double colWidthsSum = 0.0; + double colWithoutFixedWidthsSum = 0.0; + double minColWithoutFixedSum = 0.0; + for ( ColPos col = 0; col < colCount; ++col ) + { + PColumnModel pColumn = m_pModel->getColumnModel( col ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + TableMetrics colWidth = 0; + TableMetrics colPrefWidth = pColumn->getPreferredWidth(); + bool bResizable = pColumn->isResizable(); + if(pColumn->getMinWidth() == 0 && bResizable) { - colWidth = pColumn->getWidth(); - pColumn->setPreferredWidth(0); + pColumn->setMinWidth(1); + minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + } + if(pColumn->getMaxWidth() == 0 && bResizable) + pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); + if( colPrefWidth != 0) + { + if(m_bResizingGrid) + { + colWidth = pColumn->getWidth(); + pColumn->setPreferredWidth(0); + } + else + { + colWidth = colPrefWidth; + pColumn->setWidth(colPrefWidth); + } } else + colWidth = pColumn->getWidth(); + long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); + if(bResizable && colPrefWidth == 0) { - colWidth = colPrefWidth; - pColumn->setWidth(colPrefWidth); + colWithoutFixedWidthsSum+=pixelWidth; + lastResizableCol = col; } + colWidthsSum+=pixelWidth; + aPrePixelWidths.push_back(pixelWidth); } - else - colWidth = pColumn->getWidth(); - long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width(); - if(bResizable && colPrefWidth == 0) + double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; + double scalingFactor = 1.0; + if(m_bResizingGrid) { - colWithoutFixedWidthsSum+=pixelWidth; - lastResizableCol = col; + if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) + scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; } - colWidthsSum+=pixelWidth; - aPrePixelWidths.push_back(pixelWidth); - } - double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum; - double scalingFactor = 1.0; - if(m_bResizingGrid) - { - if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum)) - scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; - } - else - { - if(colWidthsSum < gridWidthWithoutFixed) + else { - if(colWithoutFixedWidthsSum>0) - scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; + if(colWidthsSum < gridWidthWithoutFixed) + { + if(colWithoutFixedWidthsSum>0) + scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum; + } } - } - long pixelWidth = 0; - for ( ColPos i = 0; i < colCount; ++i ) - { - PColumnModel pColumn = m_pModel->getColumnModel( i ); - DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); - if ( !pColumn ) - continue; - if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + for ( ColPos i = 0; i < colCount; ++i ) { - aPrePixelWidths[i]*=scalingFactor; - TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width(); - pColumn->setWidth(logicColWidth); + PColumnModel pColumn = m_pModel->getColumnModel( i ); + DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" ); + if ( !pColumn ) + continue; + if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0) + { + aPrePixelWidths[i]*=scalingFactor; + TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width(); + pColumn->setWidth(logicColWidth); + } + m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] ); + m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] ); } - m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] ); - m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] ); - } - if(gridWidth > m_aAccColumnWidthsPixel[colCount-1]) - { - if(lastResizableCol >= 0) + if(gridWidth > m_aAccColumnWidthsPixel[colCount-1]) { - PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol); - m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1]; - TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width(); - pColumn->setWidth(logicColWidth1); - while(lastResizableCol < colCount) + if(lastResizableCol >= 0) { - if(lastResizableCol == 0) - m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol]; - else - m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol]; - ++lastResizableCol; + PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol); + m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1]; + TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width(); + pColumn->setWidth(logicColWidth1); + while(lastResizableCol < colCount) + { + if(lastResizableCol == 0) + m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol]; + else + m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol]; + ++lastResizableCol; + } } } } @@ -932,11 +934,15 @@ namespace svt { namespace table } } else + { //In the case that column headers are defined but data hasn't yet been set, //only column headers will be shown if(m_pModel->hasColumnHeaders()) if(m_nColHeaderHeightPixel>1) m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel()); + if(m_nColumnCount != 0) + impl_ni_updateScrollbars(); + } } //-------------------------------------------------------------------- @@ -1060,14 +1066,8 @@ namespace svt { namespace table //to avoid double lines if( aRowIterator.getRow() != 0 ) --aRect.Top(); - else - if(m_nColHeaderHeightPixel>1) - --aRect.Top(); if(m_nLeftColumn != 0) --aRect.Left(); - else - if(m_pModel->hasRowHeaders()) - --aRect.Left(); // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, *m_pDataWindow, aRect, rStyle ); @@ -1904,7 +1904,7 @@ namespace svt { namespace table //------------------------------------------------------------------------------- ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint ) { - ::rtl::OUString& aTooltipText(::rtl::OUString::createFromAscii("")); + ::rtl::OUString aTooltipText; RowPos current = getCurrentRow(rPoint); com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip(); com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip(); @@ -1971,7 +1971,7 @@ namespace svt { namespace table } } } - return aTooltipText; + return m_aTooltipText = aTooltipText; } //-------------------------------------------------------------------- void TableControl_Impl::resizeColumn(const Point& rPoint) @@ -2081,7 +2081,6 @@ namespace svt { namespace table { TableSize nVisCols = impl_getVisibleColumns(true); int widthsPixel = 0; - int pixelWidth = 0; m_aVisibleColumnWidthsPixel.resize(0); m_aVisibleColumnWidthsPixel.reserve(nVisCols); int headerRowWidth = 0; @@ -2093,8 +2092,6 @@ namespace svt { namespace table int col = m_nLeftColumn; while(nVisCols) { - // PColumnModel pColumn = m_pModel->getColumnModel(col); - // pixelWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getWidth(), 0 ), MAP_APPFONT ).Width(); m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=m_aColumnWidthsPixel[col]); col++; nVisCols--; diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 6e009ffd6fd9..0a487c77c76c 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -120,6 +120,7 @@ namespace svt { namespace table bool m_bResizing; ColPos m_nResizingColumn; bool m_bResizingGrid; + rtl::OUString m_aTooltipText; #if DBG_UTIL #define INV_SCROLL_POSITION 1 diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index ea1337561389..6720d639f5c1 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -61,6 +61,8 @@ GridColumn::GridColumn() ,index(0) ,columnWidth(4) ,preferredWidth(0) +,maxWidth(0) +,minWidth(0) ,bResizeable(true) ,horizontalAlign(HorizontalAlignment(0)) { -- cgit From fa41826eb243336dd767a9b9cd91ba05e7c307d4 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 27 Apr 2010 15:51:19 +0200 Subject: sb120: #i111195# disabled failing tests for now --- toolkit/qa/unoapi/knownissues.xcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 89528e04b0ae..429d7693c833 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -247,3 +247,6 @@ toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess ### i111113 ### toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext + +### i111195 ### +toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleValue -- cgit From 4335aa34a1e1e0d9dcb7b29547592692ffbd8b5b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 28 Apr 2010 09:41:55 +0200 Subject: slidecopy: make compile on unxsol[i|s]4.pro and unxmacxi[.pro] --- svtools/source/toolpanel/toolpaneldrawer.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index f58726c2d247..a465a0a6c9e1 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -99,6 +99,7 @@ namespace svt // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change. using Window::SetText; + using Window::Paint; private: ::std::auto_ptr< VirtualDevice > m_pPaintDevice; -- cgit From 2b7db7fb4e176d01bda38a58d1c0488a6ec9236e Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 28 Apr 2010 12:03:40 +0200 Subject: #i161963# fix indirect glyphid array access for aliased symbol codepoints --- vcl/source/gdi/metric.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 097cc3a6b901..325146b6be8a 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -386,8 +386,9 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const const bool bSymbolic = (mpRangeCodes[0]>=0xF000) & (mpRangeCodes[1]<=0xF0FF); if( !bSymbolic ) return 0; - // check for symbol aliasing (U+F0xx -> U+00xx) - nRange = ImplFindRangeIndex( cChar | 0xF000 ); + // check for symbol aliasing (U+00xx <-> U+F0xx) + cChar |= 0xF000; + nRange = ImplFindRangeIndex( cChar ); } // check that we are inside a range if( (nRange & 1) != 0 ) @@ -401,7 +402,7 @@ int ImplFontCharMap::GetGlyphIndex( sal_uInt32 cChar ) const nGlyphIndex += nStartIndex; } else { // the glyphid array has the glyph index - nGlyphIndex = mpGlyphIds[ (nGlyphIndex - nStartIndex) & 0xFFFF ]; + nGlyphIndex = mpGlyphIds[ nGlyphIndex - nStartIndex ]; } return nGlyphIndex; -- cgit From 806700f86b2b9c96d4ca076545c5f263a8c1b9c3 Mon Sep 17 00:00:00 2001 From: Wu Yan Date: Wed, 28 Apr 2010 18:45:33 +0800 Subject: findbar01: enhancements for findbar --- svl/source/items/srchitem.cxx | 72 +++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index b7422c56224b..cc033bc6905e 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -151,40 +151,44 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : rFlags |= TransliterationModules_IGNORE_CASE; if ( aOpt.IsMatchFullHalfWidthForms()) rFlags |= TransliterationModules_IGNORE_WIDTH; - if ( aOpt.IsMatchHiraganaKatakana()) - rFlags |= TransliterationModules_IGNORE_KANA; - if ( aOpt.IsMatchContractions()) - rFlags |= TransliterationModules_ignoreSize_ja_JP; - if ( aOpt.IsMatchMinusDashChoon()) - rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; - if ( aOpt.IsMatchRepeatCharMarks()) - rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; - if ( aOpt.IsMatchVariantFormKanji()) - rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if ( aOpt.IsMatchOldKanaForms()) - rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if ( aOpt.IsMatchDiziDuzu()) - rFlags |= TransliterationModules_ignoreZiZu_ja_JP; - if ( aOpt.IsMatchBavaHafa()) - rFlags |= TransliterationModules_ignoreBaFa_ja_JP; - if ( aOpt.IsMatchTsithichiDhizi()) - rFlags |= TransliterationModules_ignoreTiJi_ja_JP; - if ( aOpt.IsMatchHyuiyuByuvyu()) - rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; - if ( aOpt.IsMatchSesheZeje()) - rFlags |= TransliterationModules_ignoreSeZe_ja_JP; - if ( aOpt.IsMatchIaiya()) - rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if ( aOpt.IsMatchKiku()) - rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if ( aOpt.IsIgnorePunctuation()) - rFlags |= TransliterationModules_ignoreSeparator_ja_JP; - if ( aOpt.IsIgnoreWhitespace()) - rFlags |= TransliterationModules_ignoreSpace_ja_JP; - if ( aOpt.IsIgnoreProlongedSoundMark()) - rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if ( aOpt.IsIgnoreMiddleDot()) - rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; + if ( bAsianOptions ) + { + if ( aOpt.IsMatchHiraganaKatakana()) + rFlags |= TransliterationModules_IGNORE_KANA; + if ( aOpt.IsMatchContractions()) + rFlags |= TransliterationModules_ignoreSize_ja_JP; + if ( aOpt.IsMatchMinusDashChoon()) + rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; + if ( aOpt.IsMatchRepeatCharMarks()) + rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; + if ( aOpt.IsMatchVariantFormKanji()) + rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; + if ( aOpt.IsMatchOldKanaForms()) + rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; + if ( aOpt.IsMatchDiziDuzu()) + rFlags |= TransliterationModules_ignoreZiZu_ja_JP; + if ( aOpt.IsMatchBavaHafa()) + rFlags |= TransliterationModules_ignoreBaFa_ja_JP; + if ( aOpt.IsMatchTsithichiDhizi()) + rFlags |= TransliterationModules_ignoreTiJi_ja_JP; + if ( aOpt.IsMatchHyuiyuByuvyu()) + rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; + if ( aOpt.IsMatchSesheZeje()) + rFlags |= TransliterationModules_ignoreSeZe_ja_JP; + if ( aOpt.IsMatchIaiya()) + rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; + if ( aOpt.IsMatchKiku()) + rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; + if ( aOpt.IsIgnorePunctuation()) + rFlags |= TransliterationModules_ignoreSeparator_ja_JP; + if ( aOpt.IsIgnoreWhitespace()) + rFlags |= TransliterationModules_ignoreSpace_ja_JP; + if ( aOpt.IsIgnoreProlongedSoundMark()) + rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; + if ( aOpt.IsIgnoreMiddleDot()) + rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; + } + } // ----------------------------------------------------------------------- -- cgit From d282c98c9218f4abbd815d5309e3449045a366e3 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 28 Apr 2010 13:42:24 +0200 Subject: #i107213# use toolbox item window as parent for popup menu --- svtools/source/control/valueacc.cxx | 2 +- svtools/source/uno/popupwindowcontroller.cxx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 6712e75aa9b4..52fa40fcf00e 100755 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -1239,7 +1239,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getBackground( ) throw (uno::RuntimeException) { UINT32 nColor; - if (mpParent->meType == VALUESETITEM_COLOR) + if (mpParent && mpParent->meType == VALUESETITEM_COLOR) nColor = mpParent->maColor.GetColor(); else nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor(); diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 97f03ba3320a..52a636017806 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -231,7 +231,8 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th ToolBox* pToolBox = dynamic_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if( pToolBox ) { - ::Window* pWin = createPopupWindow(pToolBox); + ::Window* pItemWindow = pToolBox->GetItemWindow( pToolBox->GetDownItemId() ); + ::Window* pWin = createPopupWindow( pItemWindow ? pItemWindow : pToolBox ); if( pWin ) { pWin->EnableDocking(true); -- cgit From ec12d2bb2aeee7ec44119263bae3b04aad02b98c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 28 Apr 2010 14:33:45 +0200 Subject: cws tl79: warning free code --- svtools/source/misc/xwindowitem.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/svtools/source/misc/xwindowitem.cxx b/svtools/source/misc/xwindowitem.cxx index 7ddddc4c3195..a382d8293617 100755 --- a/svtools/source/misc/xwindowitem.cxx +++ b/svtools/source/misc/xwindowitem.cxx @@ -46,8 +46,8 @@ XWindowItem::XWindowItem() : } -XWindowItem::XWindowItem( USHORT nWhich, Window * pWin ) : - SfxPoolItem( nWhich ) +XWindowItem::XWindowItem( USHORT nWhichId, Window * pWin ) : + SfxPoolItem( nWhichId ) { if (pWin) { @@ -58,8 +58,8 @@ XWindowItem::XWindowItem( USHORT nWhich, Window * pWin ) : } -XWindowItem::XWindowItem( USHORT nWhich, uno::Reference< awt::XWindow > & rxWin ) : - SfxPoolItem( nWhich ), +XWindowItem::XWindowItem( USHORT nWhichId, uno::Reference< awt::XWindow > & rxWin ) : + SfxPoolItem( nWhichId ), m_xWin( rxWin ) { } -- cgit From b57975f75a01d5e79f8473c2b5481bed283bec2a Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 28 Apr 2010 14:59:56 +0200 Subject: sb120: #i111225# disabled failing tests for now --- toolkit/qa/unoapi/toolkit.sce | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce index 003c263fb37c..5a148feee573 100644 --- a/toolkit/qa/unoapi/toolkit.sce +++ b/toolkit/qa/unoapi/toolkit.sce @@ -15,7 +15,7 @@ #i52607 -o toolkit.AccessiblePopupMenu #i86107,i86110 -o toolkit.AccessibleRadioButton -o toolkit.AccessibleScrollBar --o toolkit.AccessibleStatusBar +#i111225 -o toolkit.AccessibleStatusBar -o toolkit.AccessibleStatusBarItem #i109643 -o toolkit.AccessibleTabControl #i109643 -o toolkit.AccessibleTabPage -- cgit From d22c384fac4fbf9977010da0b1348c1ab9d565e8 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 28 Apr 2010 16:04:47 +0200 Subject: #i107213# possible solution for the missing a11y focus --- svtools/source/control/toolbarmenu.cxx | 8 --- svtools/source/control/toolbarmenuacc.cxx | 87 +++++++++++++++++++++++++------ svtools/source/control/toolbarmenuimp.hxx | 16 ++---- 3 files changed, 74 insertions(+), 37 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 3a3c8bb885ab..6f7be376266e 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -704,10 +704,6 @@ void ToolbarMenu::GetFocus() implChangeHighlightEntry( 0 ); DockingWindow::GetFocus(); - - // Tell the accessible object that we got the focus. - if( mpImpl->mxAccessible.is() ) - mpImpl->mxAccessible->GetFocus(); } // -------------------------------------------------------------------- @@ -718,10 +714,6 @@ void ToolbarMenu::LoseFocus() implChangeHighlightEntry( -1 ); DockingWindow::LoseFocus(); - - // Tell the accessible object that we lost the focus. - if( mpImpl->mxAccessible.is() ) - mpImpl->mxAccessible->LoseFocus(); } // -------------------------------------------------------------------- diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index 702c1f72b83d..f227a4cb2558 100755 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -58,12 +58,81 @@ ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl& rParent ) , mpParent( &rParent ) , mbIsFocused(false) { + mpParent->mrMenu.AddEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) ); } // ----------------------------------------------------------------------------- ToolbarMenuAcc::~ToolbarMenuAcc() { + if( mpParent ) + mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) ); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( ToolbarMenuAcc, WindowEventListener, VclSimpleEvent*, pEvent ) +{ + DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); + + /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper + * might have been destroyed by the previous VCLEventListener (if no AT tool + * is running), e.g. sub-toolbars in impress. + */ + if ( mpParent && pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) ) + { + DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" ); + if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) + { + ProcessWindowEvent( *(VclWindowEvent*)pEvent ); + } + } + return 0; +} + +// ----------------------------------------------------------------------- + +void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + Any aOldValue, aNewValue; + + Window* pAccWindow = rVclWindowEvent.GetWindow(); + DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" ); + + switch ( rVclWindowEvent.GetId() ) + { + case VCLEVENT_OBJECT_DYING: + { + mpParent->mrMenu.RemoveEventListener( LINK( this, ToolbarMenuAcc, WindowEventListener ) ); + mpParent = 0; + } + break; + + case VCLEVENT_WINDOW_GETFOCUS: + { + if( !mbIsFocused ) + { + aNewValue <<= accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + mbIsFocused = true; + } + } + break; + case VCLEVENT_WINDOW_LOSEFOCUS: + { + if( mbIsFocused ) + { + aOldValue <<= accessibility::AccessibleStateType::FOCUSED; + FireAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + mbIsFocused = false; + } + } + break; + default: + { + } + break; + } } // ----------------------------------------------------------------------- @@ -98,22 +167,6 @@ void ToolbarMenuAcc::FireAccessibleEvent( short nEventId, const Any& rOldValue, // ----------------------------------------------------------------------------- -void ToolbarMenuAcc::GetFocus (void) -{ - mbIsFocused = true; - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any( AccessibleStateType::FOCUSED ) ); -} - -// ----------------------------------------------------------------------------- - -void ToolbarMenuAcc::LoseFocus (void) -{ - mbIsFocused = false; - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any( AccessibleStateType::FOCUSED ), Any() ); -} - -// ----------------------------------------------------------------------------- - Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException) { ThrowIfDisposed(); @@ -560,7 +613,7 @@ void SAL_CALL ToolbarMenuAcc::disposing (void) void ToolbarMenuAcc::ThrowIfDisposed (void) throw (DisposedException) { - if(rBHelper.bDisposed || rBHelper.bInDispose) + if(rBHelper.bDisposed || rBHelper.bInDispose || !mpParent) { throw DisposedException ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), static_cast(this)); } diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index 1d9037b61dc5..051fe23883a4 100755 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -135,18 +135,6 @@ public: bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); } public: - - /** Called by the corresponding ToolbarMenu when it gets the focus. - Stores the new focus state and broadcasts a state change event. - */ - void GetFocus (void); - - /** Called by the corresponding ToolbarMenu when it loses the focus. - Stores the new focus state and broadcasts a state change event. - */ - void LoseFocus (void); - - // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); @@ -189,12 +177,16 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + private: EventListenerVector mxEventListeners; ToolbarMenu_Impl* mpParent; /// The current FOCUSED state. bool mbIsFocused; + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + /** Tell all listeners that the object is dying. This callback is usually called from the WeakComponentImplHelper class. */ -- cgit From cfc9c68d07db4275041ee52e977f53c9b614934e Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 28 Apr 2010 18:43:47 +0200 Subject: #i107213# finaly got orca to read the toolbar menu! --- svtools/source/control/toolbarmenu.cxx | 170 +++++++++++++++--------------- svtools/source/control/toolbarmenuacc.cxx | 8 +- svtools/source/control/toolbarmenuimp.hxx | 9 ++ svtools/source/control/valueset.cxx | 31 ++---- 4 files changed, 105 insertions(+), 113 deletions(-) mode change 100755 => 100644 svtools/source/control/toolbarmenuacc.cxx mode change 100755 => 100644 svtools/source/control/toolbarmenuimp.hxx mode change 100755 => 100644 svtools/source/control/valueset.cxx diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 6f7be376266e..8ff327f26731 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -307,6 +307,25 @@ Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( sal_Int32 index ) throw IndexOutOfBoundsException(); } +// -------------------------------------------------------------------- + +Reference< XAccessible > ToolbarMenu_Impl::getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + const int nEntryCount = maEntryVector.size(); + for( int nEntry = 0; nEntry < nEntryCount; nEntry++ ) + { + ToolbarMenuEntry* pEntry = maEntryVector[nEntry]; + if( pEntry && (pEntry->mpControl == pControl) ) + { + return pEntry->getAccessibleChild( childIndex ); + } + } + + throw IndexOutOfBoundsException(); +} + +// -------------------------------------------------------------------- + void ToolbarMenu_Impl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { const int nEntryCount = maEntryVector.size(); @@ -381,13 +400,60 @@ void ToolbarMenu_Impl::clearAccessibleSelection() } } + +// -------------------------------------------------------------------- + +void ToolbarMenu_Impl::notifyHighlightedEntry() +{ + if( hasAccessibleListeners() ) + { + ToolbarMenuEntry* pEntry = implGetEntry( mnHighlightedEntry ); + if( pEntry && pEntry->mbEnabled && (pEntry->mnEntryId != TITLE_ID) ) + { + Any aNew; + Any aOld( mxOldSelection ); + if( pEntry->mpControl ) + { + sal_Int32 nChildIndex = 0; + // todo: if other controls than ValueSet are allowed, addapt this code + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl ); + if( pValueSet ) + nChildIndex = static_cast< sal_Int32 >( pValueSet->GetItemPos( pValueSet->GetSelectItemId() ) ); + + if( nChildIndex >= pEntry->getAccessibleChildCount() ) + return; + + aNew <<= getAccessibleChild( pEntry->mpControl, nChildIndex ); + } + else + { + aNew <<= pEntry->GetAccessible(true); + } + + fireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOld, aNew ); + fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOld, aNew ); + aNew >>= mxOldSelection; + } + } +} + +// -------------------------------------------------------------------- + +ToolbarMenuEntry* ToolbarMenu_Impl::implGetEntry( int nEntry ) const +{ + if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) ) + return NULL; + + return maEntryVector[nEntry]; +} + + // -------------------------------------------------------------------- IMPL_LINK( ToolbarMenu, HighlightHdl, Control *, pControl ) { (void)pControl; - if( mpImpl->hasAccessibleListeners() ) - mpImpl->fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + mpImpl->notifyHighlightedEntry(); return 0; } @@ -723,77 +789,6 @@ void ToolbarMenu::appendEntry( int nEntryId, const String& rStr, MenuItemBits nI appendEntry( new ToolbarMenuEntry( *this, nEntryId, rStr, nItemBits ) ); } - -#if 0 -todo acc selectentry? - if( ImplHasAccessibleListeners() ) - { - // focus event (deselect) - if( nOldItem ) - { - const USHORT nPos = GetItemPos( nItemId ); - - if( nPos != VALUESET_ITEM_NOTFOUND ) - { - ValueItemAcc* pItemAcc = ValueItemAcc::getImplementation( - mpImpl->mpItemList->GetObject( nPos )->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); - - if( pItemAcc ) - { - ::com::sun::star::uno::Any aOldAny, aNewAny; - if( !mpImpl->mbIsTransientChildrenDisabled) - { - aOldAny <<= ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( - static_cast< ::cppu::OWeakObject* >( pItemAcc )); - ImplFireAccessibleEvent (::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny ); - } - else - { - aOldAny <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - pItemAcc->FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); - } - } - } - } - - // focus event (select) - const USHORT nPos = GetItemPos( mnSelItemId ); - - ValueSetItem* pItem; - if( nPos != VALUESET_ITEM_NOTFOUND ) - pItem = mpImpl->mpItemList->GetObject(nPos); - else - pItem = mpNoneItem; - - ValueItemAcc* pItemAcc = NULL; - if (pItem != NULL) - pItemAcc = ValueItemAcc::getImplementation(pItem->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); - - if( pItemAcc ) - { - ::com::sun::star::uno::Any aOldAny, aNewAny; - if( !mpImpl->mbIsTransientChildrenDisabled) - { - aNewAny <<= ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( - static_cast< ::cppu::OWeakObject* >( pItemAcc )); - ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny ); - } - else - { - aNewAny <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - pItemAcc->FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); - } - } - - // selection event - ::com::sun::star::uno::Any aOldAny, aNewAny; - ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny ); - } - } -} - -#endif - // -------------------------------------------------------------------- void ToolbarMenu::appendEntry( int nEntryId, const Image& rImage, MenuItemBits nItemBits ) @@ -848,10 +843,7 @@ ValueSet* ToolbarMenu::createEmptyValueSetControl() ToolbarMenuEntry* ToolbarMenu::implGetEntry( int nEntry ) const { - if( (nEntry < 0) || (nEntry >= (int)mpImpl->maEntryVector.size() ) ) - return NULL; - - return mpImpl->maEntryVector[nEntry]; + return mpImpl->implGetEntry( nEntry ); } // -------------------------------------------------------------------- @@ -888,7 +880,17 @@ void ToolbarMenu::implHighlightEntry( int nHighlightEntry, bool bHighlight ) { // no highlights for controls only items if( pEntry->mpControl ) + { + if( !bHighlight ) + { + ValueSet* pValueSet = dynamic_cast< ValueSet* >( pEntry->mpControl ); + if( pValueSet ) + { + pValueSet->SetNoSelection(); + } + } break; + } bool bRestoreLineColor = false; Color oldLineColor; @@ -1070,8 +1072,7 @@ void ToolbarMenu::implChangeHighlightEntry( int nEntry ) implHighlightEntry( mpImpl->mnHighlightedEntry, true ); } - if( mpImpl->hasAccessibleListeners() ) - mpImpl->fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + mpImpl->notifyHighlightedEntry(); } // -------------------------------------------------------------------- @@ -1184,7 +1185,7 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) // -------------------------------------------------------------------- -static void implHighlightControl( USHORT nCode, Control* pControl, int nLastColumn ) +void ToolbarMenu_Impl::implHighlightControl( USHORT nCode, Control* pControl ) { ValueSet* pValueSet = dynamic_cast< ValueSet* >( pControl ); if( pValueSet ) @@ -1197,11 +1198,11 @@ static void implHighlightControl( USHORT nCode, Control* pControl, int nLastColu { const USHORT nColCount = pValueSet->GetColCount(); const USHORT nLastLine = nItemCount / nColCount; - nItemPos = std::min( ((nLastLine-1) * nColCount) + nLastColumn, nItemCount-1 ); + nItemPos = std::min( ((nLastLine-1) * nColCount) + mnLastColumn, nItemCount-1 ); break; } case KEY_DOWN: - nItemPos = std::min( nLastColumn, nItemCount-1 ); + nItemPos = std::min( mnLastColumn, nItemCount-1 ); break; case KEY_END: nItemPos = nItemCount -1; @@ -1211,6 +1212,7 @@ static void implHighlightControl( USHORT nCode, Control* pControl, int nLastColu break; } pValueSet->SelectItem( pValueSet->GetItemId( nItemPos ) ); + notifyHighlightedEntry(); } } @@ -1231,7 +1233,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) { if( nOldEntry != mpImpl->mnHighlightedEntry ) { - implHighlightControl( nCode, p->mpControl, mpImpl->mnLastColumn ); + mpImpl->implHighlightControl( nCode, p->mpControl ); } else { @@ -1247,7 +1249,7 @@ void ToolbarMenu::KeyInput( const KeyEvent& rKEvent ) ToolbarMenuEntry* p = implCursorUpDown( nCode == KEY_END, true ); if( p && p->mpControl ) { - implHighlightControl( nCode, p->mpControl, mpImpl->mnLastColumn ); + mpImpl->implHighlightControl( nCode, p->mpControl ); } } break; diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx old mode 100755 new mode 100644 index f227a4cb2558..14586ecd422b --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -96,9 +96,6 @@ void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { Any aOldValue, aNewValue; - Window* pAccWindow = rVclWindowEvent.GetWindow(); - DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" ); - switch ( rVclWindowEvent.GetId() ) { case VCLEVENT_OBJECT_DYING: @@ -112,8 +109,7 @@ void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if( !mbIsFocused ) { - aNewValue <<= accessibility::AccessibleStateType::FOCUSED; - FireAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + mpParent->notifyHighlightedEntry(); mbIsFocused = true; } } @@ -122,8 +118,6 @@ void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { if( mbIsFocused ) { - aOldValue <<= accessibility::AccessibleStateType::FOCUSED; - FireAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); mbIsFocused = false; } } diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx old mode 100755 new mode 100644 index 051fe23883a4..d1de4f704b76 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -273,6 +273,8 @@ struct ToolbarMenu_Impl rtl::Reference< svt::FrameStatusListener > mxStatusListener; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceManager; rtl::Reference< ToolbarMenuAcc > mxAccessible; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxOldSelection; + ToolbarMenuEntryVector maEntryVector; int mnCheckPos; @@ -297,9 +299,16 @@ struct ToolbarMenu_Impl sal_Int32 getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > getAccessibleChild( Control* pControl, sal_Int32 childIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); sal_Bool isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); void clearAccessibleSelection(); + + ToolbarMenuEntry* implGetEntry( int nEntry ) const; + void notifyHighlightedEntry(); + + void implHighlightControl( USHORT nCode, Control* pControl ); }; } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx old mode 100755 new mode 100644 index 92c51bd6640e..62193eadf735 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1526,32 +1526,20 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) nCalcPos - ( nLineCount * mnCols )); else { -#if 0 - if( (KEY_UP == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) ) + if ( mpNoneItem ) { - Window* pParent = GetParent(); - pParent->GrabFocus(); - pParent->KeyInput( rKEvt ); - break; + mnCurCol = nCalcPos%mnCols; + nItemPos = VALUESET_ITEM_NONEITEM; } else -#endif { - if ( mpNoneItem ) - { - mnCurCol = nCalcPos%mnCols; - nItemPos = VALUESET_ITEM_NONEITEM; - } + if ( nLastItem+1 <= mnCols ) + nItemPos = nCalcPos; else { - if ( nLastItem+1 <= mnCols ) - nItemPos = nCalcPos; - else - { - nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols); - if ( nItemPos+mnCols <= nLastItem ) - nItemPos = nItemPos + mnCols; - } + nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+(nCalcPos%mnCols); + if ( nItemPos+mnCols <= nLastItem ) + nItemPos = nItemPos + mnCols; } } } @@ -2279,9 +2267,8 @@ void ValueSet::SelectItem( USHORT nItemId ) // selection event ::com::sun::star::uno::Any aOldAny, aNewAny; ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny ); - - mpImpl->maHighlightHdl.Call(this); } + mpImpl->maHighlightHdl.Call(this); } } -- cgit From 46862f3143fc883a8152ba581ecc3bac52b39b8e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 29 Apr 2010 15:29:46 +0200 Subject: fs33a: #i111238# [s|g]etUserData -> [s|g]etItemData --- toolkit/inc/toolkit/controls/unocontrols.hxx | 4 ++-- toolkit/source/controls/unocontrols.cxx | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 71e0a915788d..88449418c70a 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -795,11 +795,11 @@ public: virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setUserData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getUserData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 975040ca9070..8b37978c58e6 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -1851,19 +1851,19 @@ struct ListItem { ::rtl::OUString ItemText; ::rtl::OUString ItemImageURL; - Any ItemUserData; + Any ItemData; ListItem() :ItemText() ,ItemImageURL() - ,ItemUserData() + ,ItemData() { } ListItem( const ::rtl::OUString& i_rItemText ) :ItemText( i_rItemText ) ,ItemImageURL() - ,ItemUserData() + ,ItemData() { } }; @@ -2168,11 +2168,11 @@ void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPositi } // --------------------------------------------------------------------------------------------------------------------- -void SAL_CALL UnoControlListBoxModel::setUserData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException) +void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::ClearableMutexGuard aGuard( GetMutex() ); ListItem& rItem( m_pData->getItem( i_nPosition ) ); - rItem.ItemUserData = i_rDataValue; + rItem.ItemData = i_rDataValue; } // --------------------------------------------------------------------------------------------------------------------- @@ -2200,11 +2200,11 @@ beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel: } // --------------------------------------------------------------------------------------------------------------------- -Any SAL_CALL UnoControlListBoxModel::getUserData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) +Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException) { ::osl::ClearableMutexGuard aGuard( GetMutex() ); const ListItem& rItem( m_pData->getItem( i_nPosition ) ); - return rItem.ItemUserData; + return rItem.ItemData; } // --------------------------------------------------------------------------------------------------------------------- -- cgit From 54841bec35525663331fcc8081c316d264332277 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 30 Apr 2010 10:22:04 +0200 Subject: gridcontrol_03: bug fixes --- svtools/inc/svtools/table/tabletypes.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx index f423b64c2faa..645120e30d4b 100644 --- a/svtools/inc/svtools/table/tabletypes.hxx +++ b/svtools/inc/svtools/table/tabletypes.hxx @@ -56,17 +56,17 @@ namespace svt { namespace table /** special column width value which indicates that the column should be automatically resized to fit the view */ -#define COLWIDTH_FIT_TO_VIEW ((TableMetrics)-1) +#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1) /// denotes the column containing the row headers -#define COL_ROW_HEADERS ((ColPos)-1) +#define COL_ROW_HEADERS ((::svt::table::ColPos)-1) /// denotes the row containing the column headers -#define ROW_COL_HEADERS ((RowPos)-1) +#define ROW_COL_HEADERS ((::svt::table::RowPos)-1) /// denotes an invalid column index -#define COL_INVALID ((ColPos)-2) +#define COL_INVALID ((::svt::table::ColPos)-2) /// denotes an invalid row index -#define ROW_INVALID ((RowPos)-2) +#define ROW_INVALID ((::svt::table::RowPos)-2) //........................................................................ -- cgit From 491858eb7551eaf5e9063ebbcc3a301395d2fb0a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 30 Apr 2010 16:49:16 +0200 Subject: vcl111: #i103999# fix menu text color --- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index cb36b4613707..4f8372c263d4 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3471,7 +3471,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarColor( aBackColor ); aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] ); - aTextColor = getColor( pMenuTextStyle->text[GTK_STATE_NORMAL] ); + aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuColor( aBackColor ); aStyleSet.SetMenuTextColor( aTextColor ); -- cgit From 840f8f92702d550390719027d5eb215d3ad07619 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 2 May 2010 13:19:38 +0200 Subject: fs33a: compile errors on unxlngi6.pro / unxmacxi.pro --- toolkit/source/awt/vclxwindows.cxx | 2 +- toolkit/source/controls/unocontrols.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index ff4dc6fb5ec4..43e0e50c315d 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2155,7 +2155,7 @@ void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) thr // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert - const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : pListBox->GetEntry( i_rEvent.ItemPosition ); + const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) ); const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) ); pListBox->RemoveEntry( i_rEvent.ItemPosition ); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 8b37978c58e6..3b037e3ca0d3 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -1881,9 +1881,9 @@ struct StripItemData : public ::std::unary_function< ListItem, UnoListItem > struct UnoControlListBoxModel_Data { UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl ) - :m_rAntiImpl( i_rAntiImpl ) + :m_bSettingLegacyProperty( false ) + ,m_rAntiImpl( i_rAntiImpl ) ,m_aListItems() - ,m_bSettingLegacyProperty( false ) { } -- cgit From 241880303c108b115be03b97dc25b47ac7070698 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 3 May 2010 09:08:38 +0200 Subject: cws tl78: build issues after merging with DEV300_m77 --- comphelper/source/misc/docpasswordrequest.cxx | 2 +- vcl/inc/vcl/abstdlg.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 585868822c18..5d1c58145963 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -71,7 +71,7 @@ private: class PasswordContinuation : public ::cppu::WeakImplHelper1< XInteractionPassword2 > { public: - inline explicit PasswordContinuation() : mbSelected( sal_False ), mbReadOnly( sal_False ) {} + inline explicit PasswordContinuation() : mbReadOnly( sal_False ), mbSelected( sal_False ) {} inline sal_Bool isSelected() const { return mbSelected; } inline void reset() { mbSelected = sal_False; } diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx index 8f23a73f6014..86bee942899e 100755 --- a/vcl/inc/vcl/abstdlg.hxx +++ b/vcl/inc/vcl/abstdlg.hxx @@ -66,7 +66,7 @@ public: virtual void Sync() = 0; }; -class AbstractPasswordToOpenModifyDialog : public VclAbstractDialog +class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog { public: virtual String GetPasswordToOpen() const = 0; -- cgit From 03efbb4e37d70ea1bd8f2616ce6c6e5a84e61378 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 3 May 2010 15:00:51 +0200 Subject: vcl111: #i106125# do not limit the system scrollbarsize anymore --- vcl/win/source/window/salframe.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index a6567464ac5e..7314fd2b6164 100755 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2891,8 +2891,8 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) 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( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) ); // #99956# do not allow huge scrollbars, most of the UI is not scaled anymore - aStyleSettings.SetSpinSize( Min( GetSystemMetrics( SM_CXVSCROLL ), 20 ) ); + aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) ); + aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) ); aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() ); if ( bCompBorder ) { -- cgit From 40de6609ed4a6d68c526e1e347955b83865bb3e3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 3 May 2010 15:38:30 +0200 Subject: os141: accept more URL schemes which are supported by the GraphicsProvider --- svtools/source/misc/imageresourceaccess.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index a4f19d9e004a..6481adc8c671 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -141,8 +141,13 @@ namespace svt //-------------------------------------------------------------------- bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL ) { - ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) ); - return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) ); + if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 ) + || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) + ) + return true; + return false; } //-------------------------------------------------------------------- -- cgit From 790987f24261489d3984388f6b6bc0eedb5b5390 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 3 May 2010 15:39:14 +0200 Subject: os141: getPhysicalLocation: do not destroy valid non-file URLs --- toolkit/source/controls/dialogcontrol.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index db9634fb44a1..49065302d217 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -2081,24 +2081,24 @@ throw (RuntimeException) ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl ) { - - - ::rtl::OUString ret; - ::rtl::OUString baseLocation; ::rtl::OUString url; rbase >>= baseLocation; rUrl >>= url; + ::rtl::OUString absoluteURL( url ); if ( url.getLength() > 0 ) { INetURLObject urlObj(baseLocation); urlObj.removeSegment(); baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE ); - ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret ); + + ::rtl::OUString testAbsoluteURL; + if ( osl_File_E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) ) + absoluteURL = testAbsoluteURL; } - return ret; + return absoluteURL; } -- cgit From 1c6e780b960f1f3f210b49d2607f36ae6c2583b3 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 4 May 2010 00:10:26 +0200 Subject: locales33a: #i110484# add Gikuyu [ki-KE] to language list --- i18npool/inc/i18npool/lang.h | 2 ++ i18npool/source/isolang/isolang.cxx | 1 + svtools/source/misc/langtab.src | 1 + 3 files changed, 4 insertions(+) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 8599ec75c634..557c0c9edfca 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -512,5 +512,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652 #define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653 #define LANGUAGE_USER_BAFIA 0x0654 +#define LANGUAGE_USER_GIKUYU 0x0655 + #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 28c86d39673e..96779a06e117 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -456,6 +456,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_TAHITIAN, "ty", "PF" }, { LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" }, { LANGUAGE_USER_BAFIA, "ksf", "CM" }, + { LANGUAGE_USER_GIKUYU, "ki", "KE" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 39f9362e3940..31660d4a64ad 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -319,6 +319,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Sardinian, Logudorese" ; LANGUAGE_USER_SARDINIAN_LOGUDORESE ; > ; < "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ; < "Bafia" ; LANGUAGE_USER_BAFIA ; > ; + < "Gikuyu" ; LANGUAGE_USER_GIKUYU ; > ; }; }; -- cgit From 8c7731ff58ffb89531fdb49e07dd239c50f01dad Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 4 May 2010 00:21:02 +0200 Subject: locales33a: #i106822# added Yoruba [yo-NG] to language list --- svtools/source/misc/langtab.src | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 31660d4a64ad..72e2750c7c5f 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -320,6 +320,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ; < "Bafia" ; LANGUAGE_USER_BAFIA ; > ; < "Gikuyu" ; LANGUAGE_USER_GIKUYU ; > ; + < "Yoruba" ; LANGUAGE_YORUBA ; > ; }; }; -- cgit From c59c00efa8bf1b934efeaa24ed98510fc7a23d7c Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 4 May 2010 00:36:05 +0200 Subject: locales33a: #i110903# added Rusyn (Ukraine) [rue-UA] and Rusyn (Slovakia) [rue-SK] --- i18npool/inc/i18npool/lang.h | 2 ++ i18npool/source/isolang/isolang.cxx | 2 ++ svtools/source/misc/langtab.src | 2 ++ 3 files changed, 6 insertions(+) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 557c0c9edfca..52e4e51d7a41 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -513,6 +513,8 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653 #define LANGUAGE_USER_BAFIA 0x0654 #define LANGUAGE_USER_GIKUYU 0x0655 +#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656 +#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */ #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 96779a06e117..026c505ef0e8 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -457,6 +457,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" }, { LANGUAGE_USER_BAFIA, "ksf", "CM" }, { LANGUAGE_USER_GIKUYU, "ki", "KE" }, + { LANGUAGE_USER_RUSYN_UKRAINE, "rue", "UA" }, + { LANGUAGE_USER_RUSYN_SLOVAKIA, "rue", "SK" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 72e2750c7c5f..5fb0428b1c36 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -321,6 +321,8 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Bafia" ; LANGUAGE_USER_BAFIA ; > ; < "Gikuyu" ; LANGUAGE_USER_GIKUYU ; > ; < "Yoruba" ; LANGUAGE_YORUBA ; > ; + < "Rusyn (Ukraine)" ; LANGUAGE_USER_RUSYN_UKRAINE ; > ; + < "Rusyn (Slovakia)" ; LANGUAGE_USER_RUSYN_SLOVAKIA ; > ; }; }; -- cgit From 3eb3bb8924acdf2ede721bb3cecba961b849b638 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 4 May 2010 00:58:12 +0200 Subject: locales33a: #i111003# add support for known glibc modifiers; patch from --- i18npool/source/isolang/isolang.cxx | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 026c505ef0e8..ff59fb02dcc4 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -1007,6 +1007,28 @@ LanguageType MsLangId::convertIsoByteStringToLanguage( } // ----------------------------------------------------------------------- + +struct IsoLangGLIBCModifiersEntry +{ + LanguageType mnLang; + sal_Char maLangStr[4]; + sal_Char maCountry[3]; + sal_Char maAtString[9]; +}; + +static IsoLangGLIBCModifiersEntry const aImplIsoLangGLIBCModifiersEntries[] = +{ + // MS-LANGID codes ISO639-1/2/3 ISO3166 glibc modifier + { LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "bs", "BA", "cyrillic" }, + { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr", "RS", "latin" }, // Serbian Latin in Serbia + { LANGUAGE_SERBIAN_LATIN, "sr", "CS", "latin" }, // Serbian Latin in Serbia and Montenegro + { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sr", "ME", "latin" }, // Serbian Latin in Montenegro + { LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sr", "", "latin" }, + { LANGUAGE_AZERI_CYRILLIC, "az", "AZ", "cyrillic" }, + { LANGUAGE_UZBEK_CYRILLIC, "uz", "UZ", "cyrillic" }, + { LANGUAGE_DONTKNOW, "", "", "" } // marks end of table +}; + // convert a unix locale string into LanguageType // static @@ -1015,15 +1037,20 @@ LanguageType MsLangId::convertUnxByteStringToLanguage( { rtl::OString aLang; rtl::OString aCountry; + rtl::OString aAtString; sal_Int32 nLangSepPos = rString.indexOf( (sal_Char)'_' ); sal_Int32 nCountrySepPos = rString.indexOf( (sal_Char)'.' ); + sal_Int32 nAtPos = rString.indexOf( (sal_Char)'@' ); if (nCountrySepPos < 0) - nCountrySepPos = rString.indexOf( (sal_Char)'@' ); + nCountrySepPos = nAtPos; if (nCountrySepPos < 0) nCountrySepPos = rString.getLength(); + if (nAtPos >= 0) + aAtString = rString.copy( nAtPos+1 ); + if ( ((nLangSepPos >= 0) && (nLangSepPos > nCountrySepPos)) || ((nLangSepPos < 0)) ) { @@ -1037,6 +1064,30 @@ LanguageType MsLangId::convertUnxByteStringToLanguage( aCountry = rString.copy( nLangSepPos+1, nCountrySepPos - nLangSepPos - 1); } + // if there is a glibc modifier, first look for exact match in modifier table + if (aAtString.getLength()) + { + // language is lower case in table + rtl::OString aLowerLang = aLang.toAsciiLowerCase(); + // country is upper case in table + rtl::OString aUpperCountry = aCountry.toAsciiUpperCase(); + const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries; + do + { + if (( aLowerLang.equals( pGLIBCModifiersEntry->maLangStr ) ) && + ( aAtString.equals( pGLIBCModifiersEntry->maAtString ) )) + { + if ( !aUpperCountry.getLength() || + aUpperCountry.equals( pGLIBCModifiersEntry->maCountry ) ) + { + return pGLIBCModifiersEntry->mnLang; + } + } + ++pGLIBCModifiersEntry; + } + while ( pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW ); + } + return convertIsoNamesToLanguage( aLang, aCountry ); } -- cgit From f645ed3b6bd82298df06c912ea2fadba0eea96eb Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 4 May 2010 15:38:17 +0200 Subject: #i95867# avoid GDI-internal integer overflow for extremely anisotropic text --- vcl/win/source/gdi/salgdi3.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index ebe470d3eb7e..abdfb2dac5bb 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -1272,15 +1272,24 @@ HFONT WinSalGraphics::ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFont && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) ) lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 ); - // limit font requests to MAXFONTHEIGHT + // #i47675# limit font requests to MAXFONTHEIGHT // TODO: share MAXFONTHEIGHT font instance - if( -aLogFont.lfHeight <= MAXFONTHEIGHT ) + if( (-aLogFont.lfHeight <= MAXFONTHEIGHT) + && (+aLogFont.lfWidth <= MAXFONTHEIGHT) ) + { o_rFontScale = 1.0; - else + } + else if( -aLogFont.lfHeight >= +aLogFont.lfWidth ) { o_rFontScale = -aLogFont.lfHeight / (float)MAXFONTHEIGHT; aLogFont.lfHeight = -MAXFONTHEIGHT; - aLogFont.lfWidth = static_cast( aLogFont.lfWidth / o_rFontScale ); + aLogFont.lfWidth = FRound( aLogFont.lfWidth / o_rFontScale ); + } + else // #i95867# also limit font widths + { + o_rFontScale = +aLogFont.lfWidth / (float)MAXFONTHEIGHT; + aLogFont.lfWidth = +MAXFONTHEIGHT; + aLogFont.lfHeight = FRound( aLogFont.lfHeight / o_rFontScale ); } hNewFont = ::CreateFontIndirectW( &aLogFont ); -- cgit From c999e914a371d37ec37aab2db3c2d5f8a62ee192 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 4 May 2010 18:15:36 +0200 Subject: vcl111: #i42282# do not position dialogs outside the screen just because the screen existed in the last session --- vcl/inc/vcl/syswin.hxx | 2 ++ vcl/source/window/syswin.cxx | 61 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index b0e74df9a767..b3a7d9b8775e 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -179,6 +179,8 @@ private: SystemWindow (const SystemWindow &); SystemWindow & operator= (const SystemWindow &); + SAL_DLLPRIVATE void ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin ); + protected: // Single argument ctors shall be explicit. explicit SystemWindow( WindowType nType ); diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 056b55dc3b61..f3624ef56f59 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -659,6 +659,63 @@ static void ImplWindowStateToStr( const WindowStateData& rData, ByteString& rStr // ----------------------------------------------------------------------- +void SystemWindow::ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, long i_nHeight, Window* i_pConfigureWin ) +{ + Rectangle aScreenRect; + if( Application::IsMultiDisplay() ) + { + aScreenRect = Application::GetScreenPosSizePixel( GetScreenNumber() ); + } + else + { + aScreenRect = Application::GetScreenPosSizePixel( 0 ); + for( unsigned int i = 1; i < Application::GetScreenCount(); i++ ) + aScreenRect.Union( Application::GetScreenPosSizePixel( i ) ); + } + // unfortunately most of the time width and height are not really known + if( i_nWidth < 1 ) + i_nWidth = 50; + if( i_nHeight < 1 ) + i_nHeight = 50; + + // check left border + bool bMove = false; + if( io_rX + i_nWidth < aScreenRect.Left() ) + { + bMove = true; + io_rX = aScreenRect.Left(); + } + // check right border + if( io_rX > aScreenRect.Right() - i_nWidth ) + { + bMove = true; + io_rX = aScreenRect.Right() - i_nWidth; + } + // check top border + if( io_rY + i_nHeight < aScreenRect.Top() ) + { + bMove = true; + io_rY = aScreenRect.Top(); + } + // check bottom border + if( io_rY > aScreenRect.Bottom() - i_nHeight ) + { + bMove = true; + io_rY = aScreenRect.Bottom() - i_nHeight; + } + Window* pParent = i_pConfigureWin->GetParent(); + if( bMove && pParent ) + { + // calculate absolute screen pos here, since that is what is contained in WindowState + Point aParentAbsPos( pParent->OutputToAbsoluteScreenPixel( Point(0,0) ) ); + Size aParentSizePixel( pParent->GetOutputSizePixel() ); + Point aPos( (aParentSizePixel.Width() - i_nWidth) / 2, + (aParentSizePixel.Height() - i_nHeight) / 2 ); + io_rX = aParentAbsPos.X() + aPos.X(); + io_rY = aParentAbsPos.Y() + aPos.Y(); + } +} + void SystemWindow::SetWindowStateData( const WindowStateData& rData ) { ULONG nValidMask = rData.GetMask(); @@ -701,6 +758,10 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData ) //nState &= ~(WINDOWSTATE_STATE_MINIMIZED); aState.mnState = nState & SAL_FRAMESTATE_SYSTEMMASK; + // normalize window positions onto screen + ImplMoveToScreen( aState.mnX, aState.mnY, aState.mnWidth, aState.mnHeight, pWindow ); + ImplMoveToScreen( aState.mnMaximizedX, aState.mnMaximizedY, aState.mnMaximizedWidth, aState.mnMaximizedHeight, pWindow ); + // #96568# avoid having multiple frames at the same screen location // do the check only if not maximized if( !((rData.GetMask() & WINDOWSTATE_MASK_STATE) && (nState & WINDOWSTATE_STATE_MAXIMIZED)) ) -- cgit From fb8e6e29e7de62c036d9267456f308b158510673 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 5 May 2010 00:29:32 +0200 Subject: locales33a: add globals.pm and msi-encodinglist.txt --- i18npool/source/isolang/langid.pl | 55 ++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/i18npool/source/isolang/langid.pl b/i18npool/source/isolang/langid.pl index 06883279345b..8035178b7bb5 100755 --- a/i18npool/source/isolang/langid.pl +++ b/i18npool/source/isolang/langid.pl @@ -39,7 +39,8 @@ sub Usage() "\n", "langid - a hackish utility to lookup lang.h language defines and LangIDs,\n", "isolang.cxx ISO639/ISO3166 mapping, locale data files, langtab.src language\n", - "listbox entries, postset.mk and file_ooo.scp registry name.\n\n", + "listbox entries, postset.mk, file_ooo.scp registry name, globals.pm and\n", + "msi-encodinglist.txt\n\n", "Usage: $0 [--single] {language string} | {LangID} | {primarylanguage sublanguage} | {language-country}\n\n", @@ -105,7 +106,8 @@ sub grepFile($$$$@) my( $regex, $path, $module, $name, @addregex) = @_; my @result; my $found = 0; - my $arefound = ''; + my $areopen = 0; + my $arecloser = ''; my $file; # Try module under current working directory first to catch local # modifications. A Not yet delivered lang.h is a special case. @@ -145,17 +147,22 @@ sub grepFile($$$$@) print "$line\n"; push( @result, $line); } - else + elsif (@addregex) { - for my $re (@addregex) + # By convention first element is opener, second element is closer. + if (!$areopen) { - if ($re ne $arefound && $line =~ /$re/) + if ($line =~ /$addregex[0]/) { - if ($arefound eq '') - { - $arefound = $re; - } - else + $areopen = 1; + $arecloser = $addregex[1]; + } + } + if ($areopen) + { + for (my $i = 2; $i < @addregex; ++$i) + { + if ($line =~ /$addregex[$i]/) { if (!$found) { @@ -167,13 +174,19 @@ sub grepFile($$$$@) push( @result, $line); } } + if ($line =~ /$arecloser/) + { + $areopen = 0; + } } } } close( IN); } if (!$found) { - print "Not found in $file\n"; } + print "Not found in $file\n"; + #print "Not found in $file for $regex @addregex\n"; + } return @result; } @@ -317,13 +330,13 @@ sub main() if ($coun) { $loca = $lang . "_" . $coun; - push( @langcoungreplist, $lang . '(-' . $coun . ')?'); + push( @langcoungreplist, '\b' . $lang . '\b(-' . $coun . ')?'); } else { $loca = $lang; $coun = ""; - push( @langcoungreplist, $lang); + push( @langcoungreplist, '\b' . $lang . '\b'); } my $file = "$SRC_ROOT/i18npool/source/localedata/data/$loca.xml"; my $found; @@ -385,12 +398,24 @@ sub main() grepFile( '^\s*Name\s*\(' . $langcoun . '\)\s*=', "$SRC_ROOT", "scp2", "source/ooo/file_ooo.scp", ()); + # completelangiso=af ar as-IN ... zu grepFile( - '^\s*completelangiso\s*[= ](.{2,3}(-..)?)*' . $langcoun . '', + '^\s*completelangiso\s*=\s*(\s*([a-z]{2,3})(-[A-Z][A-Z])?)*' . $langcoun . '', "$SRC_ROOT", "solenv", "inc/postset.mk", # needs a duplicated pair of backslashes to produce a literal \\ - ('^\s*completelangiso\s*=', '^\s*' . $langcoun . '\s*\\\\*$')); + ('^\s*completelangiso\s*=', '^\s*$', '^\s*' . $langcoun . '\s*\\\\*$')); + + # @noMSLocaleLangs = ( "br", "bs", ... ) + grepFile( + '^\s*@noMSLocaleLangs\s*=\s*\(\s*(\s*"([a-z]{2,3})(-[A-Z][A-Z])?"\s*,?)*' . $langcoun . '', + "$SRC_ROOT", "solenv", "bin/modules/installer/globals.pm", + ('^\s*@noMSLocaleLangs\s*=', '\)\s*$', '"' . $langcoun . '"')); + + # af 1252 1078 # Afrikaans + grepFile( + '^\s*' . $langcoun . '', + "$SRC_ROOT", "setup_native", "source/win32/msi-encodinglist.txt", ()); } } return 0; -- cgit From e494bb1b4549f170f1909c3958900335d075f40c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 10:46:06 +0200 Subject: os141: background handling: ue a reasonable default background (so we don not rely on the magic in Window::ImplInit), and propagate background changes from the TableControl to its DataWindow --- svtools/source/table/tablecontrol.cxx | 38 ++++++++++++++++++++++++++++++++ svtools/source/table/tabledatawindow.cxx | 5 +++++ svtools/source/uno/svtxgridcontrol.cxx | 12 ++++++++++ 3 files changed, 55 insertions(+) diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 2e7b28fd6aa4..1770bfd7dd02 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -76,6 +76,11 @@ namespace svt { namespace table aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) ); m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); + + // by default, use the background as determined by the style settings + const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); + SetBackground( Wallpaper( aWindowColor ) ); + SetFillColor( aWindowColor ); } //-------------------------------------------------------------------- @@ -120,6 +125,39 @@ namespace svt { namespace table } } } + + + //-------------------------------------------------------------------- + void TableControl::StateChanged( StateChangedType i_nStateChange ) + { + Control::StateChanged( i_nStateChange ); + + // forward certain settings to the data window + switch ( i_nStateChange ) + { + case STATE_CHANGE_CONTROLBACKGROUND: + if ( IsControlBackground() ) + getDataWindow()->SetControlBackground( GetControlBackground() ); + else + getDataWindow()->SetControlBackground(); + break; + + case STATE_CHANGE_CONTROLFOREGROUND: + if ( IsControlForeground() ) + getDataWindow()->SetControlForeground( GetControlForeground() ); + else + getDataWindow()->SetControlForeground(); + break; + + case STATE_CHANGE_CONTROLFONT: + if ( IsControlFont() ) + getDataWindow()->SetControlFont( GetControlFont() ); + else + getDataWindow()->SetControlFont(); + break; + } + } + //-------------------------------------------------------------------- void TableControl::Resize() { diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e307071e2699..3245b7e84aac 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -47,6 +47,10 @@ namespace svt { namespace table ,m_rTableControl ( _rTableControl ) ,m_nRowAlreadySelected( -1 ) { + // by default, use the background as determined by the style settings + const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); + SetBackground( Wallpaper( aWindowColor ) ); + SetFillColor( aWindowColor ); } //-------------------------------------------------------------------- @@ -54,6 +58,7 @@ namespace svt { namespace table { m_rTableControl.doPaintContent( rUpdateRect ); } + //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 728ee17bbda2..1514d585cd98 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -129,6 +129,18 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An TableControl* pTable = (TableControl*)GetWindow(); switch( GetPropertyId( PropertyName ) ) { + case BASEPROPERTY_BACKGROUNDCOLOR: + { + // let the base class handle this for the TableControl + VCLXWindow::setProperty( PropertyName, aValue ); + // and forward to the grid control's data window + if ( pTable->IsBackground() ) + pTable->getDataWindow()->SetBackground( pTable->GetBackground() ); + else + pTable->getDataWindow()->SetBackground(); + } + break; + case BASEPROPERTY_GRID_SELECTIONMODE: { SelectionType eSelectionType; -- cgit From a18ceca0a76f0b8d36d2e377dc929c8cea90c7fd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 10:49:44 +0200 Subject: os141: background handling: ue a reasonable default background (so we don not rely on the magic in Window::ImplInit), and propagate background changes from the TableControl to its DataWindow --- svtools/inc/svtools/table/tablecontrol.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 6419446d03be..6eb7f063f9fa 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -177,7 +177,7 @@ namespace svt { namespace table virtual void GetFocus(); virtual void LoseFocus(); virtual void KeyInput( const KeyEvent& rKEvt ); - //virtual long Notify(NotifyEvent& rNEvt); + virtual void StateChanged( StateChangedType i_nStateChange ); /** Creates and returns the accessible object of the whole GridControl. */ SVT_DLLPRIVATE virtual XACC CreateAccessible(); -- cgit From c59fc0d76cacdaaf1c1cdd4e8b820acb42f8b4d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 12:27:19 +0200 Subject: os141: do not consume COMMAND_CONTEXTMENU command events when not handled, otherwise they will not be propagated to the VCLXwindow, which means UNO listeners cannot handle them --- svtools/source/contnr/svimpbox.cxx | 42 +++++++++++++++++++++++++------------- svtools/source/contnr/svlbox.cxx | 3 ++- svtools/source/contnr/svtreebx.cxx | 3 ++- svtools/source/inc/svimpbox.hxx | 2 +- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 671b5a9f54e5..7111a29a6a8a 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -3115,7 +3115,7 @@ void lcl_DeleteSubPopups(PopupMenu* pPopup) } } -void SvImpLBox::Command( const CommandEvent& rCEvt ) +bool SvImpLBox::Command( const CommandEvent& rCEvt ) { USHORT nCommand = rCEvt.GetCommand(); @@ -3123,9 +3123,22 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) aEditTimer.Stop(); // Rollmaus-Event? - if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) ) - && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) ) - return; + if ( ( ( nCommand == COMMAND_WHEEL ) + || ( nCommand == COMMAND_STARTAUTOSCROLL ) + || ( nCommand == COMMAND_AUTOSCROLL ) + ) + && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) + ) + { + return true; + } + + if ( ( nCommand == COMMAND_CONTEXTMENU ) + && !bContextMenuHandling + ) + { + return false; + } if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU ) { @@ -3174,8 +3187,6 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) { // deselect all pView->SelectAll( FALSE ); } - - } else { // key event (or at least no mouse event) @@ -3235,15 +3246,18 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) aSelRestore.pop(); } } + return true; } -#ifndef NOCOMMAND - else - { - const Point& rPos = rCEvt.GetMousePosPixel(); - if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() ) - aSelEng.Command( rCEvt ); - } -#endif + + const Point& rPos = rCEvt.GetMousePosPixel(); + if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() ) + aSelEng.Command( rCEvt ); + + // strictly, this is not correct. However, it leads to a behavior compatible to the one at the time + // when this method did have a void return value ... + // A proper solution would be to give the EditEngine::Command also a boolean return value, and forward + // this (or false) to our caller + return true; } void SvImpLBox::BeginScroll() diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index 2752e813052e..dd19879e73b7 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -1515,9 +1515,10 @@ void SvLBox::MakeVisible( SvLBoxEntry* ) DBG_CHKTHIS(SvLBox,0); } -void SvLBox::Command( const CommandEvent& ) +void SvLBox::Command( const CommandEvent& i_rCommandEvent ) { DBG_CHKTHIS(SvLBox,0); + Control::Command( i_rCommandEvent ); } void SvLBox::KeyInput( const KeyEvent& rKEvt ) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 736f27a1eafb..9f599cbdb22e 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2250,7 +2250,8 @@ Region SvTreeListBox::GetDragRegion() const void SvTreeListBox::Command( const CommandEvent& rCEvt ) { DBG_CHKTHIS(SvTreeListBox,0); - pImp->Command( rCEvt ); + if ( !pImp->Command( rCEvt ) ) + SvLBox::Command( rCEvt ); } diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index cde986b3cb7d..92b9f960b65c 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -340,7 +340,7 @@ public: const Size& GetOutputSize() const { return aOutputSize;} void KeyUp( BOOL bPageUp, BOOL bNotifyScroll = TRUE ); void KeyDown( BOOL bPageDown, BOOL bNotifyScroll = TRUE ); - void Command( const CommandEvent& rCEvt ); + bool Command( const CommandEvent& rCEvt ); void Invalidate(); void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); } -- cgit From 69e661370538571d578552757bde5998c9d52fdf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 12:29:29 +0200 Subject: os141: do not crash on NULL Windows passed to ::Execute --- vcl/source/window/menu.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ddfb1125d0d7..cebe1d1f596c 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -32,6 +32,7 @@ #include "vcl/salinst.hxx" #include "tools/list.hxx" #include "tools/debug.hxx" +#include "tools/diagnose_ex.h" #include "vcl/svdata.hxx" #include "vcl/svapp.hxx" #include "vcl/mnemonic.hxx" @@ -3464,6 +3465,9 @@ USHORT PopupMenu::Execute( Window* pExecWindow, const Point& rPopupPos ) USHORT PopupMenu::Execute( Window* pExecWindow, const Rectangle& rRect, USHORT nFlags ) { + ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL window!", 0 ); + + ULONG nPopupModeFlags = 0; if ( nFlags & POPUPMENU_EXECUTE_DOWN ) nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN; -- cgit From 6a909277d937b2d809d1baaee51f94795405d3a8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 13:49:53 +0200 Subject: os141: added XTreeControl::getNodeRect --- svtools/source/uno/treecontrolpeer.cxx | 14 ++++++++++++++ svtools/source/uno/treecontrolpeer.hxx | 1 + toolkit/source/controls/tree/treecontrol.cxx | 7 +++++++ toolkit/source/controls/tree/treecontrol.hxx | 1 + 4 files changed, 23 insertions(+) diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 70ffe67b7759..7c202e3b2bdf 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -922,6 +923,19 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_ // ------------------------------------------------------------------- +awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode >& i_Node ) throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); + UnoTreeListEntry* pEntry = getEntry( i_Node, true ); + + ::Rectangle aEntryRect( rTree.GetFocusRect( pEntry, rTree.GetEntryPosition( pEntry ).Y() ) ); + return VCLUnoHelper::ConvertToAWTRect( aEntryRect ); +} + +// ------------------------------------------------------------------- + sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx index 015e131321f8..336830804a6f 100644 --- a/svtools/source/uno/treecontrolpeer.hxx +++ b/svtools/source/uno/treecontrolpeer.hxx @@ -91,6 +91,7 @@ public: virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index f70a73c3b5eb..8606792fdf2f 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -362,6 +362,13 @@ Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_I // ------------------------------------------------------------------- +awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException) +{ + return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node ); +} + +// ------------------------------------------------------------------- + sal_Bool SAL_CALL UnoTreeControl::isEditing( ) throw (RuntimeException) { return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing(); diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx index 0cae86616aa4..e646664c4a64 100644 --- a/toolkit/source/controls/tree/treecontrol.hxx +++ b/toolkit/source/controls/tree/treecontrol.hxx @@ -114,6 +114,7 @@ public: virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException); -- cgit From 119f78a4d99618ae1e788d70cd8aab012cf81d34 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 14:06:24 +0200 Subject: os141: also accept the brand-new vnd.sun.star.ext:// URL scheme --- svtools/source/misc/imageresourceaccess.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index 6481adc8c671..436c3f721833 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -48,8 +48,6 @@ namespace svt { //........................................................................ -#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" - using namespace ::utl; using namespace ::comphelper; using namespace ::com::sun::star::io; @@ -144,7 +142,8 @@ namespace svt if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 ) || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 ) || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 ) - || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 ) + || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.extension://" ) ) == 0 ) ) return true; return false; -- cgit From 47d8eeed3f8258b4efceeb4b1dfb40fcde2afce5 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 5 May 2010 19:43:28 +0200 Subject: dr76: #i111404# make FastSaxParser reentrant --- sax/source/fastparser/fastparser.cxx | 152 ++++++++++++++++++----------------- sax/source/fastparser/fastparser.hxx | 60 +++++++------- 2 files changed, 107 insertions(+), 105 deletions(-) diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index a43c7e52a353..e80a36b2d127 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -200,46 +200,43 @@ FastSaxParser::~FastSaxParser() void FastSaxParser::pushContext() { - bool bRootContext = false; - SaxContextImplPtr p; - if( maContextStack.empty() ) + Entity& rEntity = getEntity(); + if( rEntity.maContextStack.empty() ) { - p.reset( new SaxContextImpl() ); - bRootContext = true; + rEntity.maContextStack.push( SaxContextImplPtr( new SaxContextImpl ) ); + DefineNamespace( OString("xml"), "http://www.w3.org/XML/1998/namespace"); } else { - p.reset( new SaxContextImpl( maContextStack.top() ) ); + rEntity.maContextStack.push( SaxContextImplPtr( new SaxContextImpl( rEntity.maContextStack.top() ) ) ); } - maContextStack.push( p ); - - if( bRootContext ) - DefineNamespace( OString("xml"), "http://www.w3.org/XML/1998/namespace"); } // -------------------------------------------------------------------- void FastSaxParser::popContext() { - OSL_ENSURE( !maContextStack.empty(), "sax::FastSaxParser::popContext(), pop without push?" ); - if( !maContextStack.empty() ) - maContextStack.pop(); + Entity& rEntity = getEntity(); + OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::popContext(), pop without push?" ); + if( !rEntity.maContextStack.empty() ) + rEntity.maContextStack.pop(); } // -------------------------------------------------------------------- void FastSaxParser::DefineNamespace( const OString& rPrefix, const sal_Char* pNamespaceURL ) { - OSL_ENSURE( !maContextStack.empty(), "sax::FastSaxParser::DefineNamespace(), I need a context!" ); - if( !maContextStack.empty() ) + Entity& rEntity = getEntity(); + OSL_ENSURE( !rEntity.maContextStack.empty(), "sax::FastSaxParser::DefineNamespace(), I need a context!" ); + if( !rEntity.maContextStack.empty() ) { - sal_uInt32 nOffset = maContextStack.top()->mnNamespaceCount++; + sal_uInt32 nOffset = rEntity.maContextStack.top()->mnNamespaceCount++; - if( maNamespaceDefines.size() <= nOffset ) - maNamespaceDefines.resize( maNamespaceDefines.size() + 64 ); + if( rEntity.maNamespaceDefines.size() <= nOffset ) + rEntity.maNamespaceDefines.resize( rEntity.maNamespaceDefines.size() + 64 ); const OUString aNamespaceURL( pNamespaceURL, strlen( pNamespaceURL ), RTL_TEXTENCODING_UTF8 ); - maNamespaceDefines[nOffset].reset( new NamespaceDefine( rPrefix, GetNamespaceToken( aNamespaceURL ), aNamespaceURL ) ); + rEntity.maNamespaceDefines[nOffset].reset( new NamespaceDefine( rPrefix, GetNamespaceToken( aNamespaceURL ), aNamespaceURL ) ); } } @@ -268,12 +265,13 @@ sal_Int32 FastSaxParser::GetTokenWithPrefix( const OString& rPrefix, const OStri { sal_Int32 nNamespaceToken = FastToken::DONTKNOW; - sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount; + Entity& rEntity = getEntity(); + sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount; while( nNamespace-- ) { - if( maNamespaceDefines[nNamespace]->maPrefix == rPrefix ) + if( rEntity.maNamespaceDefines[nNamespace]->maPrefix == rPrefix ) { - nNamespaceToken = maNamespaceDefines[nNamespace]->mnToken; + nNamespaceToken = rEntity.maNamespaceDefines[nNamespace]->mnToken; break; } @@ -295,14 +293,15 @@ sal_Int32 FastSaxParser::GetTokenWithPrefix( const sal_Char*pPrefix, int nPrefix { sal_Int32 nNamespaceToken = FastToken::DONTKNOW; - sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount; + Entity& rEntity = getEntity(); + sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount; while( nNamespace-- ) { - const OString& rPrefix( maNamespaceDefines[nNamespace]->maPrefix ); + const OString& rPrefix( rEntity.maNamespaceDefines[nNamespace]->maPrefix ); if( (rPrefix.getLength() == nPrefixLen) && (strncmp( rPrefix.getStr(), pPrefix, nPrefixLen ) == 0 ) ) { - nNamespaceToken = maNamespaceDefines[nNamespace]->mnToken; + nNamespaceToken = rEntity.maNamespaceDefines[nNamespace]->mnToken; break; } @@ -335,12 +334,13 @@ sal_Int32 FastSaxParser::GetNamespaceToken( const OUString& rNamespaceURL ) OUString FastSaxParser::GetNamespaceURL( const OString& rPrefix ) throw (SAXException) { - if( !maContextStack.empty() ) + Entity& rEntity = getEntity(); + if( !rEntity.maContextStack.empty() ) { - sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount; + sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount; while( nNamespace-- ) - if( maNamespaceDefines[nNamespace]->maPrefix == rPrefix ) - return maNamespaceDefines[nNamespace]->maNamespaceURL; + if( rEntity.maNamespaceDefines[nNamespace]->maPrefix == rPrefix ) + return rEntity.maNamespaceDefines[nNamespace]->maNamespaceURL; } throw SAXException(); // prefix that has no defined namespace url @@ -348,16 +348,17 @@ OUString FastSaxParser::GetNamespaceURL( const OString& rPrefix ) throw (SAXExce OUString FastSaxParser::GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen ) throw(SAXException) { - if( pPrefix && !maContextStack.empty() ) + Entity& rEntity = getEntity(); + if( pPrefix && !rEntity.maContextStack.empty() ) { - sal_uInt32 nNamespace = maContextStack.top()->mnNamespaceCount; + sal_uInt32 nNamespace = rEntity.maContextStack.top()->mnNamespaceCount; while( nNamespace-- ) { - const OString& rPrefix( maNamespaceDefines[nNamespace]->maPrefix ); + const OString& rPrefix( rEntity.maNamespaceDefines[nNamespace]->maPrefix ); if( (rPrefix.getLength() == nPrefixLen) && (strncmp( rPrefix.getStr(), pPrefix, nPrefixLen ) == 0 ) ) { - return maNamespaceDefines[nNamespace]->maNamespaceURL; + return rEntity.maNamespaceDefines[nNamespace]->maNamespaceURL; } } } @@ -421,7 +422,7 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx // Only one text at one time MutexGuard guard( maMutex ); - struct Entity entity; + Entity entity; entity.maStructSource = maStructSource; if( !entity.maStructSource.aInputStream.is() ) @@ -442,9 +443,6 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx XML_SetCharacterDataHandler( entity.mpParser, call_callbackCharacters ); XML_SetExternalEntityRefHandler( entity.mpParser, call_callbackExternalEntityRef ); - // maSavedException used to transport exceptions through C callbacks - maSavedException.clear(); - pushEntity( entity ); try { @@ -619,29 +617,30 @@ void FastSaxParser::parse() const int BUFFER_SIZE = 16 * 1024; Sequence< sal_Int8 > seqOut( BUFFER_SIZE ); + Entity& rEntity = getEntity(); int nRead = 0; do { - nRead = getEntity().maConverter.readAndConvert( seqOut, BUFFER_SIZE ); + nRead = rEntity.maConverter.readAndConvert( seqOut, BUFFER_SIZE ); if( nRead <= 0 ) { - XML_Parse( getEntity().mpParser, (const char*) seqOut.getConstArray(), 0, 1 ); + XML_Parse( rEntity.mpParser, (const char*) seqOut.getConstArray(), 0, 1 ); break; } - bool bContinue = XML_Parse( getEntity().mpParser, (const char*) seqOut.getConstArray(), nRead, 0 ) != 0; + bool bContinue = XML_Parse( rEntity.mpParser, (const char*) seqOut.getConstArray(), nRead, 0 ) != 0; // callbacks used inside XML_Parse may have caught an exception - if( !bContinue || maSavedException.hasValue() ) + if( !bContinue || rEntity.maSavedException.hasValue() ) { // Error during parsing ! - XML_Error xmlE = XML_GetErrorCode( getEntity().mpParser ); + XML_Error xmlE = XML_GetErrorCode( rEntity.mpParser ); OUString sSystemId = mxDocumentLocator->getSystemId(); sal_Int32 nLine = mxDocumentLocator->getLineNumber(); SAXParseException aExcept( lclGetErrorMessage( xmlE, sSystemId, nLine ), Reference< XInterface >(), - Any( &maSavedException, getCppuType( &maSavedException ) ), + Any( &rEntity.maSavedException, getCppuType( &rEntity.maSavedException ) ), mxDocumentLocator->getPublicId(), mxDocumentLocator->getSystemId(), mxDocumentLocator->getLineNumber(), @@ -680,9 +679,10 @@ struct AttributeData void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char** awAttributes ) { Reference< XFastContextHandler > xParentContext; - if( !maContextStack.empty() ) + Entity& rEntity = getEntity(); + if( !rEntity.maContextStack.empty() ) { - xParentContext = maContextStack.top()->mxContext; + xParentContext = rEntity.maContextStack.top()->mxContext; if( !xParentContext.is() ) { // we ignore current elements, so no processing needed @@ -734,7 +734,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char if( (nNameLen == 5) && (strcmp( pName, "xmlns" ) == 0) ) { // namespace of the element found - maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 ); + rEntity.maContextStack.top()->maNamespace = OUString( awAttributes[i+1], strlen( awAttributes[i+1] ), RTL_TEXTENCODING_UTF8 ); } else { @@ -770,22 +770,22 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char splitName( pwName, pPrefix, nPrefixLen, pName, nNameLen ); if( nPrefixLen > 0 ) nElementToken = GetTokenWithPrefix( pPrefix, nPrefixLen, pName, nNameLen ); - else if( maContextStack.top()->maNamespace.getLength() > 0 ) - nElementToken = GetTokenWithNamespaceURL( maContextStack.top()->maNamespace, pName, nNameLen ); + else if( rEntity.maContextStack.top()->maNamespace.getLength() > 0 ) + nElementToken = GetTokenWithNamespaceURL( rEntity.maContextStack.top()->maNamespace, pName, nNameLen ); else nElementToken = GetToken( pName ); - maContextStack.top()->mnElementToken = nElementToken; + rEntity.maContextStack.top()->mnElementToken = nElementToken; Reference< XFastAttributeList > xAttr( mxAttributes.get() ); Reference< XFastContextHandler > xContext; if( nElementToken == FastToken::DONTKNOW ) { if( nPrefixLen > 0 ) - maContextStack.top()->maNamespace = GetNamespaceURL( pPrefix, nPrefixLen ); + rEntity.maContextStack.top()->maNamespace = GetNamespaceURL( pPrefix, nPrefixLen ); - const OUString aNamespace( maContextStack.top()->maNamespace ); + const OUString aNamespace( rEntity.maContextStack.top()->maNamespace ); const OUString aElementName( pPrefix, nPrefixLen, RTL_TEXTENCODING_UTF8 ); - maContextStack.top()->maElementName = aElementName; + rEntity.maContextStack.top()->maElementName = aElementName; if( xParentContext.is() ) xContext = xParentContext->createUnknownChildContext( aNamespace, aElementName, xAttr ); @@ -794,7 +794,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char if( xContext.is() ) { - maContextStack.top()->mxContext = xContext; + rEntity.maContextStack.top()->mxContext = xContext; xContext->startUnknownElement( aNamespace, aElementName, xAttr ); } } @@ -808,23 +808,24 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char if( xContext.is() ) { - maContextStack.top()->mxContext = xContext; + rEntity.maContextStack.top()->mxContext = xContext; xContext->startFastElement( nElementToken, xAttr ); } } } catch( Exception& e ) { - maSavedException <<= e; + rEntity.maSavedException <<= e; } } void FastSaxParser::callbackEndElement( const XML_Char* ) { - OSL_ENSURE( !maContextStack.empty(), "FastSaxParser::callbackEndElement - no context" ); - if( !maContextStack.empty() ) + Entity& rEntity = getEntity(); + OSL_ENSURE( !rEntity.maContextStack.empty(), "FastSaxParser::callbackEndElement - no context" ); + if( !rEntity.maContextStack.empty() ) { - SaxContextImplPtr pContext( maContextStack.top() ); + SaxContextImplPtr pContext = rEntity.maContextStack.top(); const Reference< XFastContextHandler >& xContext( pContext->mxContext ); if( xContext.is() ) try { @@ -836,7 +837,7 @@ void FastSaxParser::callbackEndElement( const XML_Char* ) } catch( Exception& e ) { - maSavedException <<= e; + rEntity.maSavedException <<= e; } popContext(); @@ -846,14 +847,15 @@ void FastSaxParser::callbackEndElement( const XML_Char* ) void FastSaxParser::callbackCharacters( const XML_Char* s, int nLen ) { - const Reference< XFastContextHandler >& xContext( maContextStack.top()->mxContext ); + Entity& rEntity = getEntity(); + const Reference< XFastContextHandler >& xContext( rEntity.maContextStack.top()->mxContext ); if( xContext.is() ) try { xContext->characters( OUString( s, nLen, RTL_TEXTENCODING_UTF8 ) ); } catch( Exception& e ) { - maSavedException <<= e; + rEntity.maSavedException <<= e; } } @@ -863,22 +865,23 @@ int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, bool bOK = true; InputSource source; - struct Entity entity; + Entity& rCurrEntity = getEntity(); + Entity aNewEntity; if( mxEntityResolver.is() ) try { - entity.maStructSource = mxEntityResolver->resolveEntity( + aNewEntity.maStructSource = mxEntityResolver->resolveEntity( OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) , OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) ); } catch( SAXParseException & e ) { - maSavedException <<= e; + rCurrEntity.maSavedException <<= e; bOK = false; } catch( SAXException & e ) { - maSavedException <<= SAXParseException( + rCurrEntity.maSavedException <<= SAXParseException( e.Message, e.Context, e.WrappedException, mxDocumentLocator->getPublicId(), mxDocumentLocator->getSystemId(), @@ -887,43 +890,42 @@ int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, bOK = false; } - if( entity.maStructSource.aInputStream.is() ) + if( aNewEntity.maStructSource.aInputStream.is() ) { - entity.mpParser = XML_ExternalEntityParserCreate( parser, context, 0 ); - if( ! entity.mpParser ) + aNewEntity.mpParser = XML_ExternalEntityParserCreate( parser, context, 0 ); + if( !aNewEntity.mpParser ) { return false; } - entity.maConverter.setInputStream( entity.maStructSource.aInputStream ); - pushEntity( entity ); + aNewEntity.maConverter.setInputStream( aNewEntity.maStructSource.aInputStream ); + pushEntity( aNewEntity ); try { parse(); } catch( SAXParseException & e ) { - maSavedException <<= e; + rCurrEntity.maSavedException <<= e; bOK = false; } catch( IOException &e ) { SAXException aEx; aEx.WrappedException <<= e; - maSavedException <<= aEx; + rCurrEntity.maSavedException <<= aEx; bOK = false; } catch( RuntimeException &e ) { SAXException aEx; aEx.WrappedException <<= e; - maSavedException <<= aEx; + rCurrEntity.maSavedException <<= aEx; bOK = false; } popEntity(); - - XML_ParserFree( entity.mpParser ); + XML_ParserFree( aNewEntity.mpParser ); } return bOK; diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 3d494a6d3c81..4802702bf098 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -47,25 +47,33 @@ #define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser" #define PARSER_SERVICE_NAME "com.sun.star.xml.sax.FastParser" -namespace sax_fastparser -{ +namespace sax_fastparser { + +class FastLocatorImpl; +struct NamespaceDefine; +struct SaxContextImpl; + +typedef ::boost::shared_ptr< SaxContextImpl > SaxContextImplPtr; +typedef ::boost::shared_ptr< NamespaceDefine > NamespaceDefineRef; - class FastLocatorImpl; - struct NamespaceDefine; - struct SaxContextImpl; - typedef boost::shared_ptr< SaxContextImpl > SaxContextImplPtr; - typedef ::std::hash_map< ::rtl::OUString, sal_Int32, - ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > - > NamespaceMap; +typedef ::std::hash_map< ::rtl::OUString, sal_Int32, + ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NamespaceMap; // -------------------------------------------------------------------- -// Entity binds all information neede for a single file +// Entity binds all information needed for a single file struct Entity { - ::com::sun::star::xml::sax::InputSource maStructSource; - XML_Parser mpParser; - sax_expatwrap::XMLFile2UTFConverter maConverter; + ::com::sun::star::xml::sax::InputSource maStructSource; + XML_Parser mpParser; + ::sax_expatwrap::XMLFile2UTFConverter maConverter; + + // Exceptions cannot be thrown through the C-XmlParser (possible resource leaks), + // therefore the exception must be saved somewhere. + ::com::sun::star::uno::Any maSavedException; + + ::std::stack< SaxContextImplPtr > maContextStack; + ::std::vector< NamespaceDefineRef > maNamespaceDefines; }; // -------------------------------------------------------------------- @@ -75,7 +83,7 @@ class FastSaxParser : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::sax { public: FastSaxParser(); - ~FastSaxParser(); + virtual ~FastSaxParser(); // The implementation details static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void); @@ -100,9 +108,9 @@ public: void callbackCharacters( const XML_Char* s, int nLen ); int callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); - void pushEntity( const struct Entity &entity ) { vecEntity.push_back( entity ); } - void popEntity() { vecEntity.pop_back( ); } - struct Entity &getEntity() { return vecEntity.back(); } + inline void pushEntity( const Entity& rEntity ) { maEntities.push( rEntity ); } + inline void popEntity() { maEntities.pop(); } + Entity& getEntity() { return maEntities.top(); } private: void parse(); @@ -131,21 +139,13 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver; - rtl::Reference < FastLocatorImpl > mxDocumentLocator; - rtl::Reference < FastAttributeList > mxAttributes; + ::rtl::Reference< FastLocatorImpl > mxDocumentLocator; + ::rtl::Reference< FastAttributeList > mxAttributes; + ::com::sun::star::lang::Locale maLocale; + NamespaceMap maNamespaceMap; // External entity stack - std::vector< struct Entity > vecEntity; - - // Exceptions cannot be thrown through the C-XmlParser (possible resource leaks), - // therefore the exception must be saved somewhere. - ::com::sun::star::uno::Any maSavedException; - - ::com::sun::star::lang::Locale maLocale; - - std::stack< SaxContextImplPtr > maContextStack; - std::vector< boost::shared_ptr< NamespaceDefine > > maNamespaceDefines; - NamespaceMap maNamespaceMap; + ::std::stack< Entity > maEntities; }; } -- cgit From 45bf9199f52c19f3302c25b799133027b4addcd1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 5 May 2010 22:26:58 +0200 Subject: slidecopy: set the WB_DIALOGCONTROL and WB_CHILDLDGCTRL bits both at the generic panel anchor window, and the panel window provided by the XToolPanel --- svtools/source/toolpanel/toolpaneldeck.cxx | 2 +- svtools/source/uno/treecontrolpeer.cxx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index e939eb027141..e157090bbf0e 100755 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -79,7 +79,7 @@ namespace svt public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) - ,m_aPanelAnchor( &i_rDeck ) + ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL ) ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index a46b9605a00d..e5a273bbbf6d 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -196,7 +196,9 @@ void TreeControlPeer::addEntry( UnoTreeListEntry* pEntry ) mpTreeNodeMap = new TreeNodeMap(); } - (*mpTreeNodeMap)[ pEntry->mxNode ] = pEntry; + const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); + (*mpTreeNodeMap)[ xNormalizedNode ] = pEntry; + OSL_TRACE( "tree: adding %p => %p", xNormalizedNode.get(), pEntry ); } } @@ -206,9 +208,13 @@ void TreeControlPeer::removeEntry( UnoTreeListEntry* pEntry ) { if( mpTreeNodeMap && pEntry && pEntry->mxNode.is() ) { - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( pEntry->mxNode ) ); + const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); if( aIter != mpTreeNodeMap->end() ) + { + OSL_TRACE( "tree: removing %p => %p", xNormalizedNode.get(), pEntry ); mpTreeNodeMap->erase( aIter ); + } } } @@ -218,7 +224,8 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode { if( mpTreeNodeMap ) { - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNode ) ); + const Reference< XTreeNode > xNormalizedNode( xNode, UNO_QUERY ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); if( aIter != mpTreeNodeMap->end() ) return (*aIter).second; } -- cgit From 770b45622ec89c3fe430f379a05737841e979bdd Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Thu, 6 May 2010 09:01:43 +0200 Subject: #i11054# #i111272# fix graphite line breaking and expanded/condensed text (thanks kstribley) --- vcl/inc/vcl/graphite_cache.hxx | 19 +-- vcl/inc/vcl/graphite_layout.hxx | 9 ++ vcl/source/glyphs/graphite_layout.cxx | 227 ++++++++++++++++++++++++++-------- 3 files changed, 194 insertions(+), 61 deletions(-) diff --git a/vcl/inc/vcl/graphite_cache.hxx b/vcl/inc/vcl/graphite_cache.hxx index eba5109c7446..5472b32dd62f 100644 --- a/vcl/inc/vcl/graphite_cache.hxx +++ b/vcl/inc/vcl/graphite_cache.hxx @@ -127,7 +127,7 @@ public: } m_segMap.clear(); }; - GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl) + GrSegRecord * getSegment(ImplLayoutArgs & layoutArgs, bool bIsRtl, int segCharLimit) { GrSegRecord * found = NULL; // try to find a segment starting at correct place, if not, try to find a @@ -152,8 +152,6 @@ public: if (found->m_seg->startCharacter() <= layoutArgs.mnMinCharPos && found->m_seg->stopCharacter() >= layoutArgs.mnEndCharPos) { - const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos - + GraphiteLayout::EXTRA_CONTEXT_LENGTH); DBG_ASSERT(found && found->m_seg, "null entry in GraphiteSegmentCache"); // restore original start character, in case it has changed found->m_seg->setTextSourceOffset(found->m_startChar); @@ -161,7 +159,7 @@ public: // interest // We could use substr and ==, but substr does a copy, // so its probably faster to do it like this - for (size_t i = layoutArgs.mnMinCharPos; i < seg_char_limit; i++) + for (int i = layoutArgs.mnMinCharPos; i < segCharLimit; i++) { //if (!found->m_rope->match(rtl::OUString(layoutArgs.mpStr[i], layoutArgs.mnLength), i - found->m_seg->startCharacter())) if (found->m_rope->getStr()[i-found->m_seg->startCharacter()] != layoutArgs.mpStr[i]) @@ -171,6 +169,15 @@ public: { return NULL; } + if (found->m_seg->stopCharacter() > layoutArgs.mnEndCharPos && + static_cast(found->char2BaseGlyph().size()) > layoutArgs.mnEndCharPos) + { + // check that the requested end character isn't mid cluster + if (found->char2BaseGlyph()[layoutArgs.mnEndCharPos-layoutArgs.mnMinCharPos] == -1) + { + return NULL; + } + } // if (found->m_lockCount != 0) // OutputDebugString("Multple users of SegRecord!"); found->m_lockCount++; @@ -183,10 +190,8 @@ public: // this is expecially needed when editing a large paragraph // each edit changes the pointers, but if we don't reuse any segments it gets very // slow. - const size_t seg_char_limit = min(layoutArgs.mnLength, layoutArgs.mnEndCharPos - + GraphiteLayout::EXTRA_CONTEXT_LENGTH); rtl::OUString * rope = new rtl::OUString(layoutArgs.mpStr + layoutArgs.mnMinCharPos, - seg_char_limit - layoutArgs.mnMinCharPos); + segCharLimit - layoutArgs.mnMinCharPos); if (!rope) return NULL; size_t nHash = (*(rope)).hashCode(); GrRMEntry range = m_ropeMap.equal_range(nHash); diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx index 1fbb11211ca0..520f4620cd90 100644 --- a/vcl/inc/vcl/graphite_layout.hxx +++ b/vcl/inc/vcl/graphite_layout.hxx @@ -75,6 +75,14 @@ namespace grutils { class GrFeatureParser; } class VCL_DLLPUBLIC GraphiteLayout : public SalLayout { public: + // Mask to allow Word break status to be stored within mvChar2BaseGlyph + enum { + WORD_BREAK_BEFORE = 0x40000000, + HYPHEN_BREAK_BEFORE = 0x80000000, + BREAK_MASK = 0xC0000000, + GLYPH_INDEX_MASK = 0x3FFFFFFF + } LineBreakMask; + class Glyphs : public std::vector { public: @@ -159,6 +167,7 @@ private: std::pair glyph_to_chars(const GlyphItem &) const; std::pair caret_positions(size_t) const; + void expandOrCondense(ImplLayoutArgs &rArgs); }; diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 6e75d1fde868..a0aa20a73fde 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -353,6 +353,46 @@ std::pair GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg, assert(size() < rGlyph2Char.size()); rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size(); rGlyph2Char[size()] = nFirstCharInCluster; + + // can we break before this cluster? + // Glyphs may have either a positive or negative breakWeight refering to + // the position after or before the glyph respectively + int nPrevBreakWeight = 0; + if (nFirstGlyphInCluster > 0) + { + nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight(); + } + int nBreakWeight = aFirstGlyph.breakweight(); + if (nBreakWeight < 0) + { + // negative means it applies to the position before the glyph's character + nBreakWeight *= -1; + if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight) + { + // prevBreakWeight wins + nBreakWeight = nPrevBreakWeight; + } + } + else + { + nBreakWeight = 0; + // positive means break after + if (nPrevBreakWeight > 0) + nBreakWeight = nPrevBreakWeight; + } + if (nBreakWeight > gr::klbNoBreak/*0*/ && + // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation + nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272 + { + if (nBreakWeight < gr::klbHyphenBreak) + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; + else + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE; + } + // always allow a break before a space even if graphite doesn't + if (rArgs.mpStr[nFirstCharInCluster] == 0x20) + rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE; + bool bBaseGlyph = true; for (int j = nFirstGlyphInCluster; j != nNextGlyph; j += nDelta) @@ -409,7 +449,7 @@ std::pair GraphiteLayout::Glyphs::appendCluster(gr::Segment & rSeg, } } #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset()); + fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight); #endif return aBounds; } @@ -641,6 +681,19 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl)) maLayout.setRightToLeft(bRtl); + // Context is often needed beyond the specified end, however, we don't + // want it if there has been a direction change, since it is hard + // to tell between reordering within one direction and multi-directional + // text. Extra context, can also cause problems with ligatures stradling + // a hyphenation point, so disable if CTL is disabled. + const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); + int limit = rArgs.mnEndCharPos; + if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags)) + { + limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, + nSegCharLimit - rArgs.mnEndCharPos, bRtl); + } + #ifdef GRCACHE GrFontHasher hasher(mrFont); sal_Int32 aFontHash = hasher.hashCode(mpFeatures); @@ -648,7 +701,7 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) (GraphiteCacheHandler::instance).getCache(aFontHash); if (pCache) { - *pSegRecord = pCache->getSegment(rArgs, bRtl); + *pSegRecord = pCache->getSegment(rArgs, bRtl, nSegCharLimit); if (*pSegRecord) { pSegment = (*pSegRecord)->getSegment(); @@ -667,18 +720,6 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) } #endif - // Context is often needed beyond the specified end, however, we don't - // want it if there has been a direction change, since it is hard - // to tell between reordering within one direction and multi-directional - // text. - const int segCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); - int limit = rArgs.mnEndCharPos; - if (segCharLimit > limit) - { - limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos, - segCharLimit - rArgs.mnEndCharPos, bRtl); - } - // Create a new TextSource object for the engine. mpTextSrc = new TextSourceAdaptor(rArgs, limit); if (mpFeatures) mpTextSrc->setFeatures(mpFeatures); @@ -795,27 +836,35 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment) int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) const { - // Adjust maxmnWidth so FindNextBreakPoint returns a sensible answer. - maxmnWidth -= (mnEndCharPos-mnMinCharPos-1)*char_extra; // extra character spacing. - maxmnWidth /= factor; // scaling factor. +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(),"Gr::GetTextBreak c[%d-%d) maxWidth %ld char extra %ld factor %d\n", + mnMinCharPos, mnEndCharPos, maxmnWidth, char_extra, factor); +#endif - // Ask the segment for the nearest whole letter break for the width. - //float width; - float targetWidth = maxmnWidth/mfScaling; // return quickly if this segment is narrower than the target width - // (sometimes graphite doesn't seem to realise this!) - if (targetWidth > mnWidth) + if (maxmnWidth > mnWidth * factor + char_extra * (mnEndCharPos - mnMinCharPos - 1)) return STRING_LEN; - //int nBreak = mpSegment->findNextBreakPoint(mnMinCharPos, - // gr::klbWordBreak, gr::klbLetterBreak, targetWidth, &width); - // LineFillSegment seems to give better results that findNextBreakPoint - // though it may be slower - gr::LayoutEnvironment aLE; - gr::LineFillSegment lineSeg(const_cast(&mrFont), mpTextSrc, &aLE, - mnMinCharPos, mpTextSrc->getContextLength(), - targetWidth); - int nBreak = lineSeg.stopCharacter(); + long nWidth = mvCharDxs[0] * factor; + int nLastBreak = -1; + for (size_t i = 1; i < mvCharDxs.size(); i++) + { + nWidth += char_extra; + if (nWidth > maxmnWidth) break; + if (mvChar2BaseGlyph[i] != -1) + { + if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE)) + nLastBreak = static_cast(i); + } + nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor; + } + int nBreak = mnMinCharPos; + if (nLastBreak > -1) + nBreak += nLastBreak; + +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos); +#endif if (nBreak > mnEndCharPos) nBreak = STRING_LEN; else if (nBreak < mnMinCharPos) nBreak = mnMinCharPos; @@ -833,9 +882,10 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const { for (size_t i = 0; i < mvCharDxs.size(); i++) { - assert((mvChar2BaseGlyph[i] >= -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size())); + assert((mvChar2BaseGlyph[i] >= -1) && + ((mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size())); if (mvChar2BaseGlyph[i] != -1 && - mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED) + mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED) { // when used in MultiSalLayout::GetTextBreak dropped glyphs // must have zero width @@ -865,7 +915,6 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); - if(rArgs.mpDXArray) { std::vector vDeltaWidths(mvGlyphs.size(), 0); @@ -894,8 +943,75 @@ void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) } } } + else if (rArgs.mnLayoutWidth > 0) + { +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "AdjustLayout width %ld=>%ld\n", mnWidth, rArgs.mnLayoutWidth); +#endif + expandOrCondense(rArgs); + } } +void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs) +{ + int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth; + if (nDeltaWidth > 0) // expand, just expand between clusters + { + int nClusterCount = 0; + for (size_t j = 0; j < mvGlyphs.size(); j++) + { + if (mvGlyphs[j].IsClusterStart()) + { + ++nClusterCount; + } + } + if (nClusterCount > 1) + { + float fExtraPerCluster = static_cast(nDeltaWidth) / static_cast(nClusterCount - 1); + int nCluster = 0; + int nOffset = 0; + for (size_t i = 0; i < mvGlyphs.size(); i++) + { + if (mvGlyphs[i].IsClusterStart()) + { + nOffset = fExtraPerCluster * nCluster; + size_t nCharIndex = mvGlyph2Char[i]; + mvCharDxs[nCharIndex] += nOffset; + // adjust char dxs for rest of characters in cluster + while (++nCharIndex < mvGlyph2Char.size()) + { + int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK; + if (nChar2Base == -1 || nChar2Base == static_cast(i)) + mvCharDxs[nCharIndex] += nOffset; + } + ++nCluster; + } + mvGlyphs[i].maLinearPos.X() += nOffset; + } + } + } + else // condense - apply a factor to all glyph positions + { + if (mvGlyphs.size() == 0) return; + Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1); + // position last glyph using original width + float fXFactor = static_cast(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast(iLastGlyph->maLinearPos.X()); +#ifdef GRLAYOUT_DEBUG + fprintf(grLog(), "Condense by factor %f\n", fXFactor); +#endif + iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth; + Glyphs::iterator iGlyph = mvGlyphs.begin(); + while (iGlyph != iLastGlyph) + { + iGlyph->maLinearPos.X() = static_cast(iGlyph->maLinearPos.X()) * fXFactor; + ++iGlyph; + } + for (size_t i = 0; i < mvCharDxs.size(); i++) + { + mvCharDxs[i] = fXFactor * static_cast(mvCharDxs[i]); + } + } +} void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & rDeltaWidth) { @@ -917,37 +1033,39 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & rDelt int nPrevClusterLastChar = -1; for (size_t i = 0; i < nChars; i++) { - if (mvChar2BaseGlyph[i] > -1 && mvChar2BaseGlyph[i] != nPrevClusterGlyph) + int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK; + if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph)) { - assert((mvChar2BaseGlyph[i] > -1) && (mvChar2BaseGlyph[i] < (signed)mvGlyphs.size())); - GlyphItem & gi = mvGlyphs[mvChar2BaseGlyph[i]]; + assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size())); + GlyphItem & gi = mvGlyphs[nChar2Base]; if (!gi.IsClusterStart()) continue; // find last glyph of this cluster size_t j = i + 1; int nLastChar = i; - int nLastGlyph = mvChar2BaseGlyph[i]; + int nLastGlyph = nChar2Base; for (; j < nChars; j++) { - assert((mvChar2BaseGlyph[j] >= -1) && (mvChar2BaseGlyph[j] < (signed)mvGlyphs.size())); - if (mvChar2BaseGlyph[j] != -1 && mvGlyphs[mvChar2BaseGlyph[j]].IsClusterStart()) + int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK; + assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size())); + if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart()) { - nLastGlyph = mvChar2BaseGlyph[j] + ((bRtl)? 1 : -1); + nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1); nLastChar = j - 1; break; } } if (nLastGlyph < 0) { - nLastGlyph = mvChar2BaseGlyph[i]; + nLastGlyph = nChar2Base; } // Its harder to find the last glyph rtl, since the first of // cluster is still on the left so we need to search towards // the previous cluster to the right if (bRtl) { - nLastGlyph = mvChar2BaseGlyph[i]; + nLastGlyph = nChar2Base; while (nLastGlyph + 1 < (signed)mvGlyphs.size() && !mvGlyphs[nLastGlyph+1].IsClusterStart()) { @@ -983,7 +1101,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & rDelt // update glyph positions if (bRtl) { - for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++) + for (int n = nChar2Base; n <= nLastGlyph; n++) { assert((n > - 1) && (n < (signed)mvGlyphs.size())); mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset; @@ -991,17 +1109,17 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & rDelt } else { - for (int n = mvChar2BaseGlyph[i]; n <= nLastGlyph; n++) + for (int n = nChar2Base; n <= nLastGlyph; n++) { assert((n > - 1) && (n < (signed)mvGlyphs.size())); mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset; } } - rDeltaWidth[mvChar2BaseGlyph[i]] = nDWidth; + rDeltaWidth[nChar2Base] = nDWidth; #ifdef GRLAYOUT_DEBUG - fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, mvChar2BaseGlyph[i], nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[mvChar2BaseGlyph[i]].maLinearPos.X()); + fprintf(grLog(),"c%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld\t", (int)i, nChar2Base, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[nChar2Base].maLinearPos.X()); #endif - nPrevClusterGlyph = mvChar2BaseGlyph[i]; + nPrevClusterGlyph = nChar2Base; nPrevClusterLastChar = nLastChar; i = nLastChar; } @@ -1043,7 +1161,7 @@ void GraphiteLayout::kashidaJustify(std::vector& rDeltaWidths, sal_GlyphId continue; } // calculate gap, ignore if too small - int nGapWidth = rDeltaWidths[nOrigGlyphIndex];; + int nGapWidth = rDeltaWidths[nOrigGlyphIndex]; // worst case is one kashida even for mini-gaps if( 3 * nGapWidth < nKashidaWidth ) { @@ -1104,13 +1222,14 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray { if (mvChar2BaseGlyph[nCharSlot] != -1) { - assert((mvChar2BaseGlyph[nCharSlot] > -1) && (mvChar2BaseGlyph[nCharSlot] < (signed)mvGlyphs.size())); - GlyphItem gi = mvGlyphs[mvChar2BaseGlyph[nCharSlot]]; + int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK; + assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size())); + GlyphItem gi = mvGlyphs[nChar2Base]; if (gi.mnGlyphIndex == GF_DROPPED) { continue; } - int nCluster = mvChar2BaseGlyph[nCharSlot]; + int nCluster = nChar2Base; long origClusterWidth = gi.mnNewWidth; long nMin = gi.maLinearPos.X(); long nMax = gi.maLinearPos.X() + gi.mnNewWidth; @@ -1135,7 +1254,7 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray pCaretXArray[i] = nMin; pCaretXArray[i+1] = nMax; } - prevBase = mvChar2BaseGlyph[nCharSlot]; + prevBase = nChar2Base; prevClusterWidth = origClusterWidth; } else if (prevBase > -1) @@ -1268,7 +1387,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out, #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1, - mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, + GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance, aPosOut.X(), aPosOut.Y()); #endif -- cgit From a7c84375db517769035080c8fed33b2f303fc42f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 12:09:28 +0200 Subject: os141: allow the VCLXWindow to process arbitrary callbacks asynchronously, without a locked SolarMutex. Intended for UNO listeners. Employ this mechanism for VCLXButton's actionPerformed callbacks, so we don't get threading problems in those callbacks. Normally, *each and every* UNO notification would need to happen without a SolarMutex, like VCLXWindow itself already does this for mouse events and window enabled/disabled events. However, for each and every event which we migrate to this new mechanism, we need to carefully evaluate which C++ clients might need to be adjusted. Java clients don't have a problem with this, of course. --- toolkit/inc/toolkit/awt/vclxwindow.hxx | 18 +++++++ toolkit/source/awt/vclxwindow.cxx | 99 +++++++++++++++++++++++++++------- toolkit/source/awt/vclxwindows.cxx | 11 +++- 3 files changed, 108 insertions(+), 20 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx index 97f36850dff9..6ad3c3ab6076 100644 --- a/toolkit/inc/toolkit/awt/vclxwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx @@ -51,6 +51,7 @@ #include #include +#include class Window; class VclSimpleEvent; @@ -113,6 +114,23 @@ protected: ::cppu::OInterfaceContainerHelper& GetContainerListeners(); ::cppu::OInterfaceContainerHelper& GetTopWindowListeners(); +public: + typedef ::boost::function0< void > Callback; + +protected: + /** executes the given callback asynchronously + + At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that + you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e. + having a ref count > 0). + + As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers + care for the disposed state themself, and are alive as long as |this| is alive. + */ + void ImplExecuteAsyncWithoutSolarLock( + const Callback& i_callback + ); + public: VCLXWindow( bool bWithDefaultProps = false ); ~VCLXWindow(); diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 248571819067..bb880fe68b66 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -218,8 +218,8 @@ namespace class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor { private: - typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > > - EventArray; + typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > > LegacyEventArray; + typedef ::std::vector< VCLXWindow::Callback > CallbackArray; private: VCLXWindow& mrAntiImpl; @@ -243,8 +243,11 @@ private: VclContainerListenerMultiplexer maContainerListeners; TopWindowListenerMultiplexer maTopWindowListeners; - EventArray maEvents; - ULONG mnEventId; + LegacyEventArray maLegacyEvents; + ULONG mnLegacyEventId; + + CallbackArray maCallbackEvents; + ULONG mnCallbackEventId; public: bool mbDisposing : 1; @@ -293,6 +296,10 @@ public: */ void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType ); + /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock + */ + void callBackAsync( const VCLXWindow::Callback& i_callback ); + /** notifies the object that its VCLXWindow is being disposed */ void disposing(); @@ -326,7 +333,8 @@ protected: virtual void processEvent( const ::comphelper::AnyEvent& _rEvent ); private: - DECL_LINK( OnProcessEvent, void* ); + DECL_LINK( OnProcessLegacyEvent, void* ); + DECL_LINK( OnProcessCallbacks, void* ); private: /** notifies an arbitrary event @@ -373,7 +381,8 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, ,maPaintListeners( _rAntiImpl ) ,maContainerListeners( _rAntiImpl ) ,maTopWindowListeners( _rAntiImpl ) - ,mnEventId( 0 ) + ,mnLegacyEventId( 0 ) + ,mnCallbackEventId( 0 ) ,mbDisposing( false ) ,mbDesignMode( false ) ,mbSynthesizingVCLEvent( false ) @@ -394,9 +403,14 @@ VCLXWindowImpl::~VCLXWindowImpl() void VCLXWindowImpl::disposing() { ::vos::OGuard aGuard( mrMutex ); - if ( mnEventId ) - Application::RemoveUserEvent( mnEventId ); - mnEventId = 0; + if ( mnLegacyEventId ) + Application::RemoveUserEvent( mnLegacyEventId ); + mnLegacyEventId = 0; + + if ( mnCallbackEventId ) + Application::RemoveUserEvent( mnCallbackEventId ); + mnCallbackEventId = 0; + mbDisposed= true; ::com::sun::star::lang::EventObject aEvent; @@ -417,9 +431,9 @@ void VCLXWindowImpl::disposing() //-------------------------------------------------------------------- void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ) { - maEvents.push_back( _rEvent ); - if ( !mnEventId ) - mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) ); + maLegacyEvents.push_back( _rEvent ); + if ( !mnLegacyEventId ) + mnLegacyEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessLegacyEvent ) ); } //-------------------------------------------------------------------- @@ -439,25 +453,25 @@ void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, Pl } //-------------------------------------------------------------------- -IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG ) +IMPL_LINK( VCLXWindowImpl, OnProcessLegacyEvent, void*, EMPTYARG ) { // work on a copy of the events array - EventArray aEventsCopy; + LegacyEventArray aEventsCopy; { ::vos::OGuard aGuard( mrMutex ); - aEventsCopy = maEvents; - maEvents.clear(); + aEventsCopy = maLegacyEvents; + maLegacyEvents.clear(); - if ( !mnEventId ) + if ( !mnLegacyEventId ) // we were disposed while waiting for the mutex to lock return 1L; - mnEventId = 0; + mnLegacyEventId = 0; } { ::toolkit::ReleaseSolarMutex aReleaseSolar; - for ( EventArray::const_iterator loop = aEventsCopy.begin(); + for ( LegacyEventArray::const_iterator loop = aEventsCopy.begin(); loop != aEventsCopy.end(); ++loop ) @@ -522,6 +536,46 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) } } +//-------------------------------------------------------------------- +void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback ) +{ + DBG_TESTSOLARMUTEX(); + maCallbackEvents.push_back( i_callback ); + if ( !mnCallbackEventId ) + mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) ); +} + +//---------------------------------------------------------------------------------------------------------------------- +IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) +{ + // work on a copy of the callback array + CallbackArray aCallbacksCopy; + { + ::vos::OGuard aGuard( mrMutex ); + aCallbacksCopy = maCallbackEvents; + maCallbackEvents.clear(); + + if ( !mnCallbackEventId ) + // we were disposed while waiting for the mutex to lock + return 1L; + + mnCallbackEventId = 0; + } + + { + ::toolkit::ReleaseSolarMutex aReleaseSolar; + for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin(); + loop != aCallbacksCopy.end(); + ++loop + ) + { + (*loop)(); + } + } + + return 0L; +} + //-------------------------------------------------------------------- void SAL_CALL VCLXWindowImpl::acquire() { @@ -581,6 +635,13 @@ VCLXWindow::~VCLXWindow() } } +//---------------------------------------------------------------------------------------------------------------------- +void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback ) +{ + mpImpl->callBackAsync( i_callback ); +} + +//---------------------------------------------------------------------------------------------------------------------- ::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory() { return mpImpl->getAccessibleFactory().getFactory(); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 43e0e50c315d..00124b58ae93 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -63,6 +63,9 @@ #include #include +#include +#include + using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::makeAny; @@ -634,7 +637,13 @@ void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ::com::sun::star::awt::ActionEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.ActionCommand = maActionCommand; - maActionListeners.actionPerformed( aEvent ); + + Callback aCallback = ::boost::bind( + &ActionListenerMultiplexer::actionPerformed, + &maActionListeners, + aEvent + ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } } break; -- cgit From 1678607abe3925444f6d0d282180ab34893e2c0f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 14:18:16 +0200 Subject: os141: before accessing the VCL menu in any public API method, lock the SolarMutex --- toolkit/source/awt/vclxmenu.cxx | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 1992a8d721a6..5e44df58318e 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -37,11 +37,13 @@ #include #include #include +#include #include #include #include #include +#include #include @@ -416,6 +418,7 @@ void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -424,6 +427,7 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount(); @@ -438,6 +442,7 @@ void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun:: sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->GetItemCount() : 0; @@ -445,6 +450,7 @@ sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeExcepti sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->GetItemId( nPos ) : 0; @@ -452,6 +458,7 @@ sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::Run sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->GetItemPos( nId ) : 0; @@ -459,6 +466,7 @@ sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::Run void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -467,6 +475,7 @@ void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::su sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False; @@ -474,6 +483,7 @@ sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::un void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -482,6 +492,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th ::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::rtl::OUString aItemText; @@ -492,6 +503,7 @@ void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) th void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu ); @@ -510,6 +522,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef; @@ -533,6 +546,7 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref // ::com::sun::star::awt::XPopupMenu void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -541,6 +555,7 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -549,6 +564,7 @@ void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno:: sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->GetDefaultItem() : 0; @@ -556,6 +572,7 @@ sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeExcep void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -564,6 +581,7 @@ void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun: sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False; @@ -571,6 +589,7 @@ sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::un sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); sal_Int16 nRet = 0; @@ -582,6 +601,7 @@ sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun: void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -590,6 +610,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC ::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::rtl::OUString aItemCommand; @@ -600,6 +621,7 @@ void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aC void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -608,6 +630,7 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString ::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::rtl::OUString aHelpCommand; @@ -708,12 +731,14 @@ namespace ::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); return IsPopupMenu(); } void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) mpMenu->Clear(); @@ -724,6 +749,7 @@ void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::awt::MenuItemType aMenuItemType = @@ -740,6 +766,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) { @@ -761,6 +788,7 @@ throw (::com::sun::star::uno::RuntimeException) ::sal_Bool SAL_CALL VCLXMenu::isInExecute( ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -773,6 +801,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL VCLXMenu::endExecute() throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -783,6 +812,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) @@ -807,6 +837,7 @@ throw (::com::sun::star::uno::RuntimeException) ::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::awt::MenuLogo aAWTMenuLogo; @@ -827,6 +858,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) { @@ -843,6 +875,7 @@ void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -858,6 +891,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::awt::KeyEvent aKeyEvent; @@ -876,6 +910,7 @@ void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -890,6 +925,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); rtl::OUString sHelpText; @@ -907,6 +943,7 @@ void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUStri throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -921,6 +958,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); rtl::OUString sTipHelpText; @@ -939,6 +977,7 @@ void SAL_CALL VCLXMenu::setItemImage( throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -954,6 +993,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic; @@ -973,6 +1013,7 @@ void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAng throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -987,6 +1028,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); ::sal_Int32 nItemImageAngle( 0 ); @@ -1003,6 +1045,7 @@ void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu && IsPopupMenu() ) @@ -1017,6 +1060,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); sal_Bool bMirrorMode( sal_False ); -- cgit From ef87f256df12b618d410182c6b70cf5302e92c31 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 14:21:12 +0200 Subject: os141: notify mouse events without a locked SolarMutex --- toolkit/source/awt/vclxwindow.cxx | 195 +++++++++++--------------------------- 1 file changed, 55 insertions(+), 140 deletions(-) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index bb880fe68b66..d1fb12f2cf6f 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -67,6 +67,8 @@ #include +#include + using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -111,104 +113,38 @@ namespace }; //................................................................ - //. MouseEventType + //. EventType //................................................................ - enum MouseEventType + enum EventType { - META_FIRST_MOUSE_EVENT = 0, - - EVENT_MOUSE_PRESSED = 0, - EVENT_MOUSE_RELEASED = 1, - EVENT_MOUSE_ENTERED = 2, - EVENT_MOUSE_EXITED = 3, - - META_LAST_MOUSE_EVENT = 3 + EVENT_WINDOW_ENABLED = 1, + EVENT_WINDOW_DISABLED = 2, }; - //................................................................ - //. PlainEventType - //................................................................ - enum PlainEventType - { - META_FIRST_PLAIN_EVENT = 4, - - EVENT_WINDOW_ENABLED = 4, - EVENT_WINDOW_DISABLED = 5, - - META_LAST_PLAIN_EVENT = 5 - }; - -#if OSL_DEBUG_LEVEL > 0 - static void checkEventDefinitions() - { - OSL_ENSURE( (int)META_LAST_MOUSE_EVENT < (int)META_FIRST_PLAIN_EVENT, "checkEventDefinitions: invalid event definitions!" ); - } - #define DBG_CHECK_EVENTS() checkEventDefinitions() -#else - #define DBG_CHECK_EVENTS() -#endif - //................................................................ //. AnyWindowEvent //................................................................ struct AnyWindowEvent : public ::comphelper::AnyEvent { private: - awt::MouseEvent m_aMouseEvent; - lang::EventObject m_aPlainEvent; - - sal_Int32 m_nEventType; + lang::EventObject m_aEvent; + EventType m_nEventType; public: - AnyWindowEvent( const awt::MouseEvent& _rEvent, MouseEventType _nType ) + AnyWindowEvent( const lang::EventObject& _rEvent, EventType _nType ) :comphelper::AnyEvent() - ,m_aMouseEvent( _rEvent ) - ,m_nEventType( static_cast< sal_Int32 >( _nType ) ) + ,m_aEvent( _rEvent ) + ,m_nEventType( _nType ) { - DBG_CHECK_EVENTS(); } - AnyWindowEvent( const lang::EventObject& _rEvent, PlainEventType _nType ) - :comphelper::AnyEvent() - ,m_aPlainEvent( _rEvent ) - ,m_nEventType( static_cast< sal_Int32 >( _nType ) ) + const lang::EventObject& getEvent() const { - DBG_CHECK_EVENTS(); + return m_aEvent; } - bool isMouseEvent() const - { - return ( META_FIRST_MOUSE_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_MOUSE_EVENT ); - } + EventType getEventType() const { return m_nEventType; } - bool isPlainEvent() const - { - return ( META_FIRST_PLAIN_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_PLAIN_EVENT ); - } - - const awt::MouseEvent& getMouseEvent() const - { - OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" ); - return m_aMouseEvent; - } - - MouseEventType getMouseEventType() const - { - OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" ); - return static_cast< MouseEventType >( m_nEventType ); - } - - const lang::EventObject& getPlainEvent() const - { - OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" ); - return m_aPlainEvent; - } - - PlainEventType getPlainEventType() const - { - OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" ); - return static_cast< PlainEventType >( m_nEventType ); - } }; } @@ -288,13 +224,9 @@ public: void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; } sal_Bool isDirectVisible() { return mbDirectVisible; } - /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners - */ - void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType ); - /** asynchronously notifies an event described by an EventObject to the respective listeners */ - void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType ); + void notifyEvent( const lang::EventObject& _rEvent, EventType _nType ); /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock */ @@ -437,19 +369,11 @@ void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper:: } //-------------------------------------------------------------------- -void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType ) -{ - ::vos::OClearableGuard aGuard( mrMutex ); - if ( maMouseListeners.getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) ); -} - -//-------------------------------------------------------------------- -void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType ) +void VCLXWindowImpl::notifyEvent( const lang::EventObject& _rEvent, EventType _nType ) { ::vos::OClearableGuard aGuard( mrMutex ); if ( maWindow2Listeners.getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) ); + impl_notifyAnyEvent( new AnyWindowEvent( _rEvent, _nType ) ); } //-------------------------------------------------------------------- @@ -492,47 +416,19 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) return; const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) ); - if ( rEventDescriptor.isMouseEvent() ) - { - const awt::MouseEvent& rEvent( rEventDescriptor.getMouseEvent() ); - switch ( rEventDescriptor.getMouseEventType() ) - { - case EVENT_MOUSE_PRESSED: - maMouseListeners.mousePressed( rEvent ); - break; - case EVENT_MOUSE_RELEASED: - maMouseListeners.mouseReleased( rEvent ); - break; - case EVENT_MOUSE_ENTERED: - maMouseListeners.mouseEntered( rEvent ); - break; - case EVENT_MOUSE_EXITED: - maMouseListeners.mouseExited( rEvent ); - break; - default: - DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" ); - break; - } - } - else if ( rEventDescriptor.isPlainEvent() ) - { - const lang::EventObject& rEvent( rEventDescriptor.getPlainEvent() ); - switch ( rEventDescriptor.getPlainEventType() ) - { - case EVENT_WINDOW_ENABLED: - maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent ); - break; - case EVENT_WINDOW_DISABLED: - maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent ); - break; - default: - DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" ); - break; - } - } - else + + const lang::EventObject& rEvent( rEventDescriptor.getEvent() ); + switch ( rEventDescriptor.getEventType() ) { - DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" ); + case EVENT_WINDOW_ENABLED: + maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent ); + break; + case EVENT_WINDOW_DISABLED: + maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent ); + break; + default: + DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" ); + break; } } @@ -713,7 +609,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ); EventObject aEvent( *this ); - mpImpl->notifyPlainEvent( aEvent, + mpImpl->notifyEvent( aEvent, bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED ); } break; @@ -945,7 +841,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 ); awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) ); aEvent.PopupTrigger = sal_True; - mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED ); + + Callback aCallback = ::boost::bind( + &MouseListenerMultiplexer::mousePressed, + &mpImpl->getMouseListeners(), + aEvent + ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } } break; @@ -955,10 +857,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) { awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) ); - mpImpl->notifyMouseEvent( - aEvent, - pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED + + Callback aCallback = ::boost::bind( + pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited, + &mpImpl->getMouseListeners(), + aEvent ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) @@ -977,7 +882,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); - mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED ); + Callback aCallback = ::boost::bind( + &MouseListenerMultiplexer::mousePressed, + &mpImpl->getMouseListeners(), + aEvent + ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } } break; @@ -986,7 +896,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) ); - mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED ); + Callback aCallback = ::boost::bind( + &MouseListenerMultiplexer::mouseReleased, + &mpImpl->getMouseListeners(), + aEvent + ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } } break; -- cgit From 8ea33b344f497d819e48ef819bc23aef5de8c831 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Thu, 6 May 2010 14:23:16 +0200 Subject: #i110213# - setup master password container on demand. --- ucbhelper/source/provider/simpleauthenticationrequest.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx index f292fdf5fc06..8fc0cd4aec4f 100644 --- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx +++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx @@ -67,7 +67,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( sal_True, sal_True, aRequest.HasAccount, - sal_False, + sal_True, sal_False ); } //========================================================================= @@ -149,7 +149,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest( eUserNameType == ENTITY_MODIFY, ePasswordType == ENTITY_MODIFY, eAccountType == ENTITY_MODIFY, - sal_False, + sal_True, sal_False ); } @@ -211,11 +211,12 @@ void SimpleAuthenticationRequest::initialize( setRequest( uno::makeAny( rRequest ) ); // Fill continuations... - uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 ); + uno::Sequence< ucb::RememberAuthentication > aRememberModes( + bAllowPersistentStoring ? 3 : 2 ); aRememberModes[ 0 ] = ucb::RememberAuthentication_NO; aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION; if (bAllowPersistentStoring) - aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT; + aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT; m_xAuthSupplier = new InteractionSupplyAuthentication( -- cgit From 1afc19fa95b833e68330b91f06e036d908f9e30f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 14:34:00 +0200 Subject: os141: windowEnabled/Disabled events now also using the new mechanism, implies the SolarMutex is not locked when they're called --- toolkit/source/awt/vclxwindow.cxx | 166 +++++++------------------------------- 1 file changed, 29 insertions(+), 137 deletions(-) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index d1fb12f2cf6f..fe906d8557d3 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -111,50 +111,14 @@ namespace m_rFlag = false; } }; - - //................................................................ - //. EventType - //................................................................ - enum EventType - { - EVENT_WINDOW_ENABLED = 1, - EVENT_WINDOW_DISABLED = 2, - }; - - //................................................................ - //. AnyWindowEvent - //................................................................ - struct AnyWindowEvent : public ::comphelper::AnyEvent - { - private: - lang::EventObject m_aEvent; - EventType m_nEventType; - - public: - AnyWindowEvent( const lang::EventObject& _rEvent, EventType _nType ) - :comphelper::AnyEvent() - ,m_aEvent( _rEvent ) - ,m_nEventType( _nType ) - { - } - - const lang::EventObject& getEvent() const - { - return m_aEvent; - } - - EventType getEventType() const { return m_nEventType; } - - }; } //==================================================================== //= VCLXWindowImpl //==================================================================== -class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor +class SAL_DLLPRIVATE VCLXWindowImpl { private: - typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > > LegacyEventArray; typedef ::std::vector< VCLXWindow::Callback > CallbackArray; private: @@ -179,9 +143,6 @@ private: VclContainerListenerMultiplexer maContainerListeners; TopWindowListenerMultiplexer maTopWindowListeners; - LegacyEventArray maLegacyEvents; - ULONG mnLegacyEventId; - CallbackArray maCallbackEvents; ULONG mnCallbackEventId; @@ -224,10 +185,6 @@ public: void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; } sal_Bool isDirectVisible() { return mbDirectVisible; } - /** asynchronously notifies an event described by an EventObject to the respective listeners - */ - void notifyEvent( const lang::EventObject& _rEvent, EventType _nType ); - /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock */ void callBackAsync( const VCLXWindow::Callback& i_callback ); @@ -261,22 +218,10 @@ protected: virtual void SAL_CALL acquire(); virtual void SAL_CALL release(); - // IEventProcessor - virtual void processEvent( const ::comphelper::AnyEvent& _rEvent ); - private: - DECL_LINK( OnProcessLegacyEvent, void* ); DECL_LINK( OnProcessCallbacks, void* ); private: - /** notifies an arbitrary event - @param _rEvent - the event to notify - */ - void impl_notifyAnyEvent( - const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent - ); - private: /** determines whether the instance is already disposed @precond @@ -313,7 +258,6 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, ,maPaintListeners( _rAntiImpl ) ,maContainerListeners( _rAntiImpl ) ,maTopWindowListeners( _rAntiImpl ) - ,mnLegacyEventId( 0 ) ,mnCallbackEventId( 0 ) ,mbDisposing( false ) ,mbDesignMode( false ) @@ -335,10 +279,6 @@ VCLXWindowImpl::~VCLXWindowImpl() void VCLXWindowImpl::disposing() { ::vos::OGuard aGuard( mrMutex ); - if ( mnLegacyEventId ) - Application::RemoveUserEvent( mnLegacyEventId ); - mnLegacyEventId = 0; - if ( mnCallbackEventId ) Application::RemoveUserEvent( mnCallbackEventId ); mnCallbackEventId = 0; @@ -360,78 +300,6 @@ void VCLXWindowImpl::disposing() } -//-------------------------------------------------------------------- -void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ) -{ - maLegacyEvents.push_back( _rEvent ); - if ( !mnLegacyEventId ) - mnLegacyEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessLegacyEvent ) ); -} - -//-------------------------------------------------------------------- -void VCLXWindowImpl::notifyEvent( const lang::EventObject& _rEvent, EventType _nType ) -{ - ::vos::OClearableGuard aGuard( mrMutex ); - if ( maWindow2Listeners.getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rEvent, _nType ) ); -} - -//-------------------------------------------------------------------- -IMPL_LINK( VCLXWindowImpl, OnProcessLegacyEvent, void*, EMPTYARG ) -{ - // work on a copy of the events array - LegacyEventArray aEventsCopy; - { - ::vos::OGuard aGuard( mrMutex ); - aEventsCopy = maLegacyEvents; - maLegacyEvents.clear(); - - if ( !mnLegacyEventId ) - // we were disposed while waiting for the mutex to lock - return 1L; - - mnLegacyEventId = 0; - } - - { - ::toolkit::ReleaseSolarMutex aReleaseSolar; - for ( LegacyEventArray::const_iterator loop = aEventsCopy.begin(); - loop != aEventsCopy.end(); - ++loop - ) - { - processEvent( *(*loop) ); - } - } - - return 0L; -} - -//-------------------------------------------------------------------- -void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) -{ - ::vos::OGuard aGuard( mrMutex ); - if ( impl_isDisposed() ) - // while we were waiting for our mutex, another thread disposed us - return; - - const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) ); - - const lang::EventObject& rEvent( rEventDescriptor.getEvent() ); - switch ( rEventDescriptor.getEventType() ) - { - case EVENT_WINDOW_ENABLED: - maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent ); - break; - case EVENT_WINDOW_DISABLED: - maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent ); - break; - default: - DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" ); - break; - } -} - //-------------------------------------------------------------------- void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback ) { @@ -598,6 +466,28 @@ IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent ) return 0; } +namespace +{ + struct CallWindow2Listener + { + CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent ) + :m_rWindow2Listeners( i_rWindow2Listeners ) + ,m_bEnabled( i_bEnabled ) + ,m_aEvent( i_rEvent ) + { + } + + void operator()() + { + m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent ); + } + + ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners; + const bool m_bEnabled; + const EventObject m_aEvent; + }; +} + void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this ); @@ -607,10 +497,12 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_WINDOW_ENABLED: case VCLEVENT_WINDOW_DISABLED: { - bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ); - EventObject aEvent( *this ); - mpImpl->notifyEvent( aEvent, - bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED ); + Callback aCallback = CallWindow2Listener( + mpImpl->getWindow2Listeners(), + ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ), + EventObject( *this ) + ); + ImplExecuteAsyncWithoutSolarLock( aCallback ); } break; -- cgit From ac084249c20528bd55092715fff2b124639e0868 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 14:43:01 +0200 Subject: os141: ensure the VCLXWindow is not destroyed while the callback event is underway --- toolkit/source/awt/vclxwindow.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index fe906d8557d3..dd4d56586b03 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -306,12 +306,18 @@ void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback ) DBG_TESTSOLARMUTEX(); maCallbackEvents.push_back( i_callback ); if ( !mnCallbackEventId ) + { + // ensure our VCLXWindow is not destroyed while the event is underway + mrAntiImpl.acquire(); mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) ); + } } //---------------------------------------------------------------------------------------------------------------------- IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) { + const Reference< uno::XInterface > xKeepAlive( mrAntiImpl ); + // work on a copy of the callback array CallbackArray aCallbacksCopy; { @@ -319,6 +325,9 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG ) aCallbacksCopy = maCallbackEvents; maCallbackEvents.clear(); + // we acquired our VCLXWindow once before posting the event, release this one ref now + mrAntiImpl.release(); + if ( !mnCallbackEventId ) // we were disposed while waiting for the mutex to lock return 1L; -- cgit From 637bebf4f13e83ee1eacdc6b158a86613e388080 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 6 May 2010 15:50:03 +0200 Subject: os141: removed debug code which slipped in with some recent change ... --- svtools/source/uno/treecontrolpeer.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 7c202e3b2bdf..7fb1a007960f 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -197,9 +197,7 @@ void TreeControlPeer::addEntry( UnoTreeListEntry* pEntry ) mpTreeNodeMap = new TreeNodeMap(); } - const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); - (*mpTreeNodeMap)[ xNormalizedNode ] = pEntry; - OSL_TRACE( "tree: adding %p => %p", xNormalizedNode.get(), pEntry ); + (*mpTreeNodeMap)[ pEntry->mxNode ] = pEntry; } } @@ -209,11 +207,9 @@ void TreeControlPeer::removeEntry( UnoTreeListEntry* pEntry ) { if( mpTreeNodeMap && pEntry && pEntry->mxNode.is() ) { - const Reference< XTreeNode > xNormalizedNode( pEntry->mxNode, UNO_QUERY ); - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( pEntry->mxNode ) ); if( aIter != mpTreeNodeMap->end() ) { - OSL_TRACE( "tree: removing %p => %p", xNormalizedNode.get(), pEntry ); mpTreeNodeMap->erase( aIter ); } } @@ -225,8 +221,7 @@ UnoTreeListEntry* TreeControlPeer::getEntry( const Reference< XTreeNode >& xNode { if( mpTreeNodeMap ) { - const Reference< XTreeNode > xNormalizedNode( xNode, UNO_QUERY ); - TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNormalizedNode ) ); + TreeNodeMap::iterator aIter( mpTreeNodeMap->find( xNode ) ); if( aIter != mpTreeNodeMap->end() ) return (*aIter).second; } -- cgit From ec097e0b381b6b9d126d77c47ba89f6da70687a3 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 7 May 2010 09:30:53 +0200 Subject: #100000# fix compile warning and assertion --- vcl/source/glyphs/graphite_layout.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index a0aa20a73fde..ff2fd8f306b1 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -882,8 +882,8 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const { for (size_t i = 0; i < mvCharDxs.size(); i++) { - assert((mvChar2BaseGlyph[i] >= -1) && - ((mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size())); + assert( (mvChar2BaseGlyph[i] == -1) || + ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size())); if (mvChar2BaseGlyph[i] != -1 && mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED) { -- cgit From 5b7cf789a0c84c60c738d2249bf82ba0220487c3 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 7 May 2010 10:40:12 +0200 Subject: cws tl78: fixing windows specific build problems after merging with DEV300_m77 --- comphelper/inc/comphelper/docpasswordrequest.hxx | 10 +++++++++- comphelper/source/misc/docpasswordrequest.cxx | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) mode change 100644 => 100755 comphelper/inc/comphelper/docpasswordrequest.hxx diff --git a/comphelper/inc/comphelper/docpasswordrequest.hxx b/comphelper/inc/comphelper/docpasswordrequest.hxx old mode 100644 new mode 100755 index 6c369b41cf71..cf04d22c7a6d --- a/comphelper/inc/comphelper/docpasswordrequest.hxx +++ b/comphelper/inc/comphelper/docpasswordrequest.hxx @@ -32,6 +32,7 @@ #include #include #include +#include namespace comphelper { @@ -52,7 +53,9 @@ class PasswordContinuation; /** Implements the task.XInteractionRequest interface for requesting a password string for a document. */ -class COMPHELPER_DLLPUBLIC DocPasswordRequest : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > +class COMPHELPER_DLLPUBLIC DocPasswordRequest : + public ::com::sun::star::task::XInteractionRequest, + public ::cppu::OWeakObject { public: explicit DocPasswordRequest( @@ -62,6 +65,11 @@ public: sal_Bool bPasswordToModify = sal_False ); virtual ~DocPasswordRequest(); + // XInterface / OWeakObject + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw (); + virtual void SAL_CALL release( ) throw (); + sal_Bool isAbort() const; sal_Bool isPassword() const; diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 5d1c58145963..17cdb0ae2d92 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -36,6 +36,7 @@ using ::rtl::OUString; using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Type; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; @@ -47,6 +48,7 @@ using ::com::sun::star::task::PasswordRequestMode; using ::com::sun::star::task::XInteractionAbort; using ::com::sun::star::task::XInteractionContinuation; using ::com::sun::star::task::XInteractionPassword2; +using ::com::sun::star::task::XInteractionRequest; namespace comphelper { @@ -131,6 +133,26 @@ DocPasswordRequest::~DocPasswordRequest() { } +/*uno::*/Any SAL_CALL DocPasswordRequest::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) +{ + return ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( (XInteractionRequest *) this ), + static_cast< XWeak* > ( this ), + // my own interfaces + static_cast< XInteractionRequest* > ( this ) ); +} + +void SAL_CALL DocPasswordRequest::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +void SAL_CALL DocPasswordRequest::release( ) throw () +{ + OWeakObject::release(); +} + sal_Bool DocPasswordRequest::isAbort() const { return mpAbort->isSelected(); -- cgit From 5cee63480fb7d483018d9ee30972b3c311cd0792 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 7 May 2010 15:59:50 +0100 Subject: cmcfixes75: #i111459# sync paper defaults with CLDR 1.8.1 --- i18npool/source/paper/paper.cxx | 53 ++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx index 21be12588e37..e94efa6e06c5 100644 --- a/i18npool/source/paper/paper.cxx +++ b/i18npool/source/paper/paper.cxx @@ -436,8 +436,8 @@ Paper PaperInfo::fromPSName(const rtl::OString &rName) } //http://wiki.services.openoffice.org/wiki/DefaultPaperSize -//http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/localedata/locales/?cvsroot=glibc //http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html +//http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales //http://en.wikipedia.org/wiki/Paper_size //http://msdn.microsoft.com/en-us/library/cc195164.aspx PaperInfo PaperInfo::getDefaultPaperForLocale( @@ -448,22 +448,57 @@ PaperInfo PaperInfo::getDefaultPaperForLocale( if ( //United States, Letter !rLocale.Country.compareToAscii("US") || - //Puerto Rico, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html + //Puerto Rico: + // http://unicode.org/cldr/trac/ticket/1710 + // http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html !rLocale.Country.compareToAscii("PR") || - //Canada, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html + //Canada: + // http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html !rLocale.Country.compareToAscii("CA") || - //Venuzuela, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html + //Venuzuela: + // http://unicode.org/cldr/trac/ticket/1710 + // https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html !rLocale.Country.compareToAscii("VE") || - //Chile, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html + //Chile: + // http://unicode.org/cldr/trac/ticket/1710 + // https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html !rLocale.Country.compareToAscii("CL") || - //Mexico, http://qa.openoffice.org/issues/show_bug.cgi?id=49739 + //Mexico: + // http://unicode.org/cldr/trac/ticket/1710 + // http://qa.openoffice.org/issues/show_bug.cgi?id=49739 !rLocale.Country.compareToAscii("MX") || - //Colombia, http://qa.openoffice.org/issues/show_bug.cgi?id=69703 + //Colombia: + // http://unicode.org/cldr/trac/ticket/1710 + // http://qa.openoffice.org/issues/show_bug.cgi?id=69703 !rLocale.Country.compareToAscii("CO") || - //Philippines, + //Philippines: + // http://unicode.org/cldr/trac/ticket/1710 // http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html // http://www.gov.ph/faqs/driverslicense.asp - !rLocale.Country.compareToAscii("PH") + !rLocale.Country.compareToAscii("PH") || + //Belize: + // http://unicode.org/cldr/trac/ticket/2585 + // http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27 + !rLocale.Country.compareToAscii("BZ") || + //Costa Rica: + // http://unicode.org/cldr/trac/ticket/2585 + // http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258 + !rLocale.Country.compareToAscii("CR") || + //Guatemala: + // http://unicode.org/cldr/trac/ticket/2585 + // http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936 + !rLocale.Country.compareToAscii("GT") || + //Nicaragua: + // http://unicode.org/cldr/trac/ticket/2585 + !rLocale.Country.compareToAscii("NI") || + //Panama: + // http://unicode.org/cldr/trac/ticket/2585 + // http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf + !rLocale.Country.compareToAscii("PA") || + //El Salvador: + // http://unicode.org/cldr/trac/ticket/2585 + // http://www.tse.gob.sv + !rLocale.Country.compareToAscii("SV") ) { eType = PAPER_LETTER; -- cgit From aec9a646b55911c65ae96d9e415ef83b56ae73fa Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Fri, 7 May 2010 17:02:22 +0200 Subject: jl152 #i77196# adapting configuration backend to changes introduced by SB on DEV300 branch concering different handling of configuration files in extensions, also fixed writing of compiled help files into the user installation --- l10ntools/source/help/HelpLinker.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 256ed850d49e..e270a525393d 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -401,7 +401,8 @@ void HelpLinker::link() throw( HelpProcessingException ) if( bExtensionMode ) { - indexDirParentName = sourceRoot; + //indexDirParentName = sourceRoot; + indexDirParentName = extensionDestination; } else { -- cgit From 3741f79c53b0d216cd097f10d218b4b3dd774884 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 10 May 2010 11:12:15 +0200 Subject: fwk142: #i104468# Ensure that focus is set to a floating window created by a toolbar controller --- vcl/unx/gtk/window/gtkframe.cxx | 38 ++++++++++++++++-------------------- vcl/unx/inc/plugins/gtk/gtkframe.hxx | 1 + 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index ef356eb57aa9..ad694cf5bbc1 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon() m_nExtStyle = 0; m_pRegion = NULL; m_ePointerStyle = 0xffff; + m_bSetFocusOnMap = false; gtk_widget_set_app_paintable( m_pWindow, TRUE ); gtk_widget_set_double_buffered( m_pWindow, FALSE ); @@ -803,18 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); - /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME - at some point that may be fixed in metacity and we will have to revisit this - */ - - // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack - // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues - // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo. - // As a work around for such old systems, people might consider to not use the GTK plugin. - - bool bMetaCityToolWindowHack = false; - // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); - if( bDecoHandling ) { bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) ); @@ -830,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) { eType = GDK_WINDOW_TYPE_HINT_UTILITY; gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true ); - if( bMetaCityToolWindowHack ) - lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); } else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) { @@ -881,7 +868,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -1364,9 +1351,9 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // // i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused. // awesome. + bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity"); if( nUserTime == 0 && - ( - getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") || + ( bMetaCity || ( getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") && (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) @@ -1378,9 +1365,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) nUserTime= getDisplay()->GetLastUserEventTime( true ); //nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window); } - lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime ); + if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) + m_bSetFocusOnMap = true; + gtk_widget_show( m_pWindow ); if( isFloatGrabWindow() ) @@ -2848,6 +2837,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) GTK_YIELD_GRAB(); + bool bSetFocus = pThis->m_bSetFocusOnMap; + pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) { /* #i76541# testtool needs the focus to be in a new document @@ -2857,9 +2848,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) * so this is done when running in testtool only */ if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 ) - XSetInputFocus( pThis->getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), - RevertToParent, CurrentTime ); + bSetFocus = true; + } + + if( bSetFocus ) + { + XSetInputFocus( pThis->getDisplay()->GetDisplay(), + GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window), + RevertToParent, CurrentTime ); } pThis->CallCallback( SALEVENT_RESIZE, NULL ); diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 0a91d99fd839..88a26b401eed 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -185,6 +185,7 @@ class GtkSalFrame : public SalFrame bool m_bDefaultSize; bool m_bSendModChangeOnRelease; bool m_bWindowIsGtkPlug; + bool m_bSetFocusOnMap; String m_aTitle; IMHandler* m_pIMHandler; -- cgit From d24b570e7db3127356f0807d765c0be1fcb3ba19 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 10 May 2010 14:25:18 +0200 Subject: #i107213# enable reading of toolbar menu entries on mac --- svtools/inc/svtools/toolbarmenu.hxx | 2 ++ svtools/source/control/toolbarmenu.cxx | 9 +++++++++ svtools/source/control/toolbarmenuacc.cxx | 2 +- svtools/source/control/valueacc.cxx | 5 +---- svtools/source/uno/popupwindowcontroller.cxx | 5 +++++ 5 files changed, 18 insertions(+), 5 deletions(-) mode change 100755 => 100644 svtools/source/control/valueacc.cxx diff --git a/svtools/inc/svtools/toolbarmenu.hxx b/svtools/inc/svtools/toolbarmenu.hxx index 943f714b0097..92b873158a98 100644 --- a/svtools/inc/svtools/toolbarmenu.hxx +++ b/svtools/inc/svtools/toolbarmenu.hxx @@ -103,6 +103,8 @@ public: int getSelectedEntryId() const; int getHighlightedEntryId() const; + void highlightFirstEntry(); + protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 8ff327f26731..f07ebd7fe8cd 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -30,6 +30,7 @@ #include "precompiled_svtools.hxx" #include +#include #include #include @@ -432,6 +433,7 @@ void ToolbarMenu_Impl::notifyHighlightedEntry() fireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOld, aNew ); fireAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOld, aNew ); + fireAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), Any( AccessibleStateType::FOCUSED ) ); aNew >>= mxOldSelection; } } @@ -764,6 +766,13 @@ Size ToolbarMenu::implCalcSize() // -------------------------------------------------------------------- +void ToolbarMenu::highlightFirstEntry() +{ + implChangeHighlightEntry( 0 ); +} + +// -------------------------------------------------------------------- + void ToolbarMenu::GetFocus() { if( mpImpl->mnHighlightedEntry == -1 ) diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index 14586ecd422b..020467084748 100644 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -765,7 +765,7 @@ sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeExcept ::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException) { - return OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolbarMenu item" ) ); + return ::rtl::OUString(); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx old mode 100755 new mode 100644 index 52fa40fcf00e..66da5636d89c --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -976,10 +976,7 @@ sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole() ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet item" ) ); - - return aRet; + return ::rtl::OUString(); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 52a636017806..4fbaff23714d 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -34,6 +34,7 @@ #include #include "svtools/popupwindowcontroller.hxx" +#include "svtools/toolbarmenu.hxx" using rtl::OUString; using namespace ::com::sun::star; @@ -107,6 +108,10 @@ IMPL_LINK( PopupWindowControllerImpl, WindowEventListener, VclSimpleEvent*, pEve if( mpToolBox ) mpToolBox->CallEventListeners( VCLEVENT_DROPDOWN_OPEN, (void*)mpPopupWindow ); mpPopupWindow->CallEventListeners( VCLEVENT_WINDOW_GETFOCUS, 0 ); + + svtools::ToolbarMenu* pToolbarMenu = dynamic_cast< svtools::ToolbarMenu* >( mpPopupWindow ); + if( pToolbarMenu ) + pToolbarMenu->highlightFirstEntry(); break; } break; -- cgit From 8a7501fdc4dce26a4be91eef144b6bae48e55845 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Mon, 10 May 2010 15:15:32 +0200 Subject: #i110768# use better subdivision for fat beziers when printing --- vcl/source/gdi/outdev.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 62be0130e068..bb5e4e3ba36d 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -2383,6 +2383,16 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( { const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5); + if(aLinePolyPolygon.areControlPointsUsed()) + { + // #i110768# When area geometry has to be created, do not + // use the fallback bezier decomposition inside createAreaGeometry, + // but one that is at least as good as ImplSubdivideBezier was. + // There, Polygon::AdaptiveSubdivide was used with default parameter + // 1.0 as quality index. + aLinePolyPolygon = basegfx::tools::adaptiveSubdivideByDistance(aLinePolyPolygon, 1.0); + } + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) { aFillPolyPolygon.append(basegfx::tools::createAreaGeometry( -- cgit From 0ddbd71a7ac5a25aa92666d26d5f264821c3bad8 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 10 May 2010 17:35:24 +0200 Subject: jl152: #i108704# allow to restart the office --- comphelper/source/misc/comphelper_services.cxx | 2 + comphelper/source/misc/makefile.mk | 1 + comphelper/source/misc/officerestartmanager.cxx | 210 ++++++++++++++++++++++++ comphelper/source/misc/officerestartmanager.hxx | 91 ++++++++++ 4 files changed, 304 insertions(+) create mode 100644 comphelper/source/misc/officerestartmanager.cxx create mode 100644 comphelper/source/misc/officerestartmanager.hxx diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index a2d4dd8fc0de..b46dcea68ba7 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -41,6 +41,7 @@ extern void createRegistryInfo_OfficeInstallationDirectories(); extern void createRegistryInfo_OInstanceLocker(); extern void createRegistryInfo_Map(); extern void createRegistryInfo_OSimpleLogRing(); +extern void createRegistryInfo_OOfficeRestartManager(); //........................................................................ namespace comphelper { namespace module @@ -66,6 +67,7 @@ namespace comphelper { namespace module createRegistryInfo_OInstanceLocker(); createRegistryInfo_Map(); createRegistryInfo_OSimpleLogRing(); + createRegistryInfo_OOfficeRestartManager(); } } } diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index 94837ce49df9..a49c2eb59c84 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -72,6 +72,7 @@ SLOFILES= \ $(SLO)$/numberedcollection.obj \ $(SLO)$/numbers.obj \ $(SLO)$/officeresourcebundle.obj \ + $(SLO)$/officerestartmanager.obj \ $(SLO)$/proxyaggregation.obj \ $(SLO)$/querydeep.obj \ $(SLO)$/regpathhelper.obj \ diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx new file mode 100644 index 000000000000..1a98ddfce8da --- /dev/null +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_comphelper.hxx" + +#include +#include +#include +#include + +#include +#include "officerestartmanager.hxx" + +using namespace ::com::sun::star; + +namespace comphelper +{ + +// ---------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames_static() +{ + uno::Sequence< rtl::OUString > aResult( 1 ); + aResult[0] = getServiceName_static(); + return aResult; +} + +// ---------------------------------------------------------- +::rtl::OUString SAL_CALL OOfficeRestartManager::getImplementationName_static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.task.OfficeRestartManager" ) ); +} + +// ---------------------------------------------------------- +::rtl::OUString SAL_CALL OOfficeRestartManager::getSingletonName_static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ); +} + +// ---------------------------------------------------------- +::rtl::OUString SAL_CALL OOfficeRestartManager::getServiceName_static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.task.OfficeRestartManager" ) ); +} + +// ---------------------------------------------------------- +uno::Reference< uno::XInterface > SAL_CALL OOfficeRestartManager::Create( const uno::Reference< uno::XComponentContext >& rxContext ) +{ + return static_cast< cppu::OWeakObject* >( new OOfficeRestartManager( rxContext ) ); +} + +// XRestartManager +// ---------------------------------------------------------- +void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task::XInteractionHandler >& /* xInteractionHandler */ ) + throw (uno::Exception, uno::RuntimeException) +{ + if ( !m_xContext.is() ) + throw uno::RuntimeException(); + + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // if the restart already running there is no need to trigger it again + if ( m_bRestartRequested ) + return; + + m_bRestartRequested = sal_True; + + // the office is still not initialized, no need to terminate, changing the state is enough + if ( !m_bOfficeInitialized ) + return; + } + + // TODO: use InteractionHandler to report errors + try + { + // register itself as a job that should be executed asynchronously + uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_SET_THROW ); + + uno::Reference< awt::XRequestCallback > xRequestCallback( + xFactory->createInstanceWithContext( + ::rtl::OUString::createFromAscii("com.sun.star.awt.AsyncCallback"), + m_xContext ), + uno::UNO_QUERY_THROW ); + + xRequestCallback->addCallback( this, uno::Any() ); + } + catch ( uno::Exception& ) + { + // the try to request restart has failed + m_bRestartRequested = sal_False; + } +} + +// ---------------------------------------------------------- +::sal_Bool SAL_CALL OOfficeRestartManager::isRestartRequested( ::sal_Bool bOfficeInitialized ) + throw (uno::Exception, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( bOfficeInitialized && !m_bOfficeInitialized ) + m_bOfficeInitialized = bOfficeInitialized; + + return m_bRestartRequested; +} + +// XCallback +// ---------------------------------------------------------- +void SAL_CALL OOfficeRestartManager::notify( const uno::Any& /* aData */ ) + throw ( uno::RuntimeException ) +{ + try + { + sal_Bool bSuccess = sal_False; + + if ( m_xContext.is() ) + { + uno::Reference< lang::XMultiComponentFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_SET_THROW ); + uno::Reference< frame::XDesktop > xDesktop( + xFactory->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), m_xContext ), + uno::UNO_QUERY_THROW ); + + // Turn Quickstarter veto off + uno::Reference< beans::XPropertySet > xPropertySet( xDesktop, uno::UNO_QUERY_THROW ); + ::rtl::OUString aVetoPropName( RTL_CONSTASCII_USTRINGPARAM( "SuspendQuickstartVeto" ) ); + uno::Any aValue; + aValue <<= (sal_Bool)sal_True; + xPropertySet->setPropertyValue( aVetoPropName, aValue ); + + try + { + bSuccess = xDesktop->terminate(); + } catch( uno::Exception& ) + {} + + if ( !bSuccess ) + { + aValue <<= (sal_Bool)sal_False; + xPropertySet->setPropertyValue( aVetoPropName, aValue ); + } + } + + if ( !bSuccess ) + m_bRestartRequested = sal_False; + } + catch( uno::Exception& ) + { + // the try to restart has failed + m_bRestartRequested = sal_False; + } +} + +// XServiceInfo +// ---------------------------------------------------------- +::rtl::OUString SAL_CALL OOfficeRestartManager::getImplementationName() throw (uno::RuntimeException) +{ + return getImplementationName_static(); +} + +// ---------------------------------------------------------- +::sal_Bool SAL_CALL OOfficeRestartManager::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException) +{ + const uno::Sequence< rtl::OUString > & aSupportedNames = getSupportedServiceNames_static(); + for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ ) + { + if ( aSupportedNames[ nInd ].equals( aServiceName ) ) + return sal_True; + } + + return sal_False; +} + +// ---------------------------------------------------------- +uno::Sequence< ::rtl::OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames() throw (uno::RuntimeException) +{ + return getSupportedServiceNames_static(); +} + +} // namespace comphelper + +void createRegistryInfo_OOfficeRestartManager() +{ + static ::comphelper::module::OAutoRegistration< ::comphelper::OOfficeRestartManager > aAutoRegistration; + static ::comphelper::module::OSingletonRegistration< ::comphelper::OOfficeRestartManager > aSingletonRegistration; +} diff --git a/comphelper/source/misc/officerestartmanager.hxx b/comphelper/source/misc/officerestartmanager.hxx new file mode 100644 index 000000000000..2317d0217060 --- /dev/null +++ b/comphelper/source/misc/officerestartmanager.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __OFFICESTARTMANAGER_HXX_ +#define __OFFICESTARTMANAGER_HXX_ + +#include +#include +#include +#include + +#include +#include + +namespace comphelper +{ + +class OOfficeRestartManager : public ::cppu::WeakImplHelper3< ::com::sun::star::task::XRestartManager + , ::com::sun::star::awt::XCallback + , ::com::sun::star::lang::XServiceInfo > +{ + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + + sal_Bool m_bOfficeInitialized; + sal_Bool m_bRestartRequested; + +public: + OOfficeRestartManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) + : m_xContext( xContext ) + , m_bOfficeInitialized( sal_False ) + , m_bRestartRequested( sal_False ) + {} + + virtual ~OOfficeRestartManager() + {} + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames_static(); + + static ::rtl::OUString SAL_CALL getImplementationName_static(); + + static ::rtl::OUString SAL_CALL getSingletonName_static(); + + static ::rtl::OUString SAL_CALL getServiceName_static(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + +// XRestartManager + virtual void SAL_CALL requestRestart( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xInteractionHandler ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isRestartRequested( ::sal_Bool bInitialized ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + +// XCallback + virtual void SAL_CALL notify( const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + +// XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + +}; + +} // namespace comphelper + +#endif + -- cgit From de0b00d03dd81bc77b65dd310268b7e523e62630 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 10 May 2010 19:22:34 +0200 Subject: removed cygwin_path / added mkdir --- l10ntools/scripts/localize.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index a6a370385f21..47f4e91d8b7f 100755 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -284,9 +284,11 @@ sub write_sdf foreach my $lang( keys( %{ $string_hash } ) ) { my @sdf_file; + next , if( $lang eq "en-US" ); + + mkdir $l10n_file."/$lang"; + my $current_l10n_file = $l10n_file."/$lang/localize.sdf"; - # mkdir!!!! - my $current_l10n_file = $WIN eq "TRUE" ? $l10n_file."\\$lang\\localize.sdf" : $l10n_file."/$lang/localize.sdf"; print "Writing '$current_l10n_file'\n"; if( open DESTFILE , "< $current_l10n_file" ){ @@ -393,7 +395,7 @@ sub merge_gsicheck{ close ( $TMPHANDLE ); $command = "$ENV{WRAPCMD} " if( $ENV{WRAPCMD} ); - $command .= fix_cygwin_path("$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck"); + $command .= "$ENV{SOLARVER}/$ENV{INPATH}/bin/gsicheck"; my $errfile = $sdffile.".err"; $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $sdffile"; -- cgit From 38179b7dc5d63993c08657ddc74937c42d6f66e3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 10 May 2010 22:56:05 +0200 Subject: os141: make compile with GCC --- toolkit/source/controls/dialogcontrol.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 49065302d217..cf1bff991430 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -2095,7 +2095,7 @@ throw (RuntimeException) baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE ); ::rtl::OUString testAbsoluteURL; - if ( osl_File_E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) ) + if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) ) absoluteURL = testAbsoluteURL; } -- cgit From 255ad2449d0e2b7b4c32a28484207c4f9c4d3c40 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 11 May 2010 15:35:59 +0200 Subject: #i111077# support app-specific config-files for fontconfig --- vcl/unx/source/fontmanager/fontconfig.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 2f92154605f0..d6cb074162fd 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -123,6 +123,8 @@ class FontCfgWrapper FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*); FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*); FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*); + FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool); + FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind); FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int); FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double); @@ -221,6 +223,9 @@ public: { return m_pFcConfigAppFontAddFile( pConfig, pFileName ); } FcBool FcConfigAppFontAddDir(FcConfig* pConfig, const FcChar8* pDirName ) { return m_pFcConfigAppFontAddDir( pConfig, pDirName ); } + FcBool FcConfigParseAndLoad( FcConfig* pConfig, const FcChar8* pFileName, FcBool bComplain ) + { return m_pFcConfigParseAndLoad( pConfig, pFileName, bComplain ); } + void FcDefaultSubstitute( FcPattern* pPattern ) { m_pFcDefaultSubstitute( pPattern ); } FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult ) @@ -326,6 +331,8 @@ FontCfgWrapper::FontCfgWrapper() loadSymbol( "FcConfigAppFontAddFile" ); m_pFcConfigAppFontAddDir = (FcBool(*)(FcConfig*, const FcChar8*)) loadSymbol( "FcConfigAppFontAddDir" ); + m_pFcConfigParseAndLoad = (FcBool(*)(FcConfig*, const FcChar8*, FcBool)) + loadSymbol( "FcConfigParseAndLoad" ); m_pFcDefaultSubstitute = (void(*)(FcPattern *)) loadSymbol( "FcDefaultSubstitute" ); m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*)) @@ -383,6 +390,7 @@ FontCfgWrapper::FontCfgWrapper() m_pFcPatternGetBool && m_pFcConfigAppFontAddFile && m_pFcConfigAppFontAddDir && + m_pFcConfigParseAndLoad && m_pFcDefaultSubstitute && m_pFcConfigSubstitute && m_pFcPatternAddInteger && @@ -846,6 +854,14 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet ); #endif + const rtl::OString aConfFileName = rDirName + "/fc_local.conf"; + bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), (FcChar8*)aConfFileName.getStr(), FcTrue ); + (void)bCfgOk; // silence compiler warning + +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); +#endif + return bRet; } -- cgit From 28ed50012951a1230853500b643bb782c27d1279 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 11 May 2010 15:42:00 +0200 Subject: #i111077# enable fc_local config-files only for activated fonts --- vcl/unx/source/fontmanager/fontconfig.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index d6cb074162fd..816c8fb0b4c4 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -848,21 +848,25 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) if( nVersion <= 20400 ) return false; const char* pDirName = (const char*)rDirName.getStr(); - bool bRet = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); + bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet ); #endif - const rtl::OString aConfFileName = rDirName + "/fc_local.conf"; - bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), (FcChar8*)aConfFileName.getStr(), FcTrue ); - (void)bCfgOk; // silence compiler warning + if( bDirOk ) + { + const rtl::OString aConfFileName = rDirName + "/fc_local.conf"; + bool bCfgOk = rWrapper.FcConfigParseAndLoad( rWrapper.FcConfigGetCurrent(), + (FcChar8*)aConfFileName.getStr(), FcTrue ); + (void)bCfgOk; // silence compiler warning #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); + fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk ); #endif + } - return bRet; + return bDirOk; } static void addtopattern(FontCfgWrapper& rWrapper, FcPattern *pPattern, -- cgit From 06724c5d66489fcbbb0a3226f327abf5d7f6dcee Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 11 May 2010 22:41:44 +0200 Subject: ext03: implement XUnitConversion for the control, too (not only for the control's peer) --- toolkit/inc/toolkit/controls/unocontrol.hxx | 12 +++++-- toolkit/source/controls/unocontrol.cxx | 52 +++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx index 19d498ef2a85..0515abe27128 100644 --- a/toolkit/inc/toolkit/controls/unocontrol.hxx +++ b/toolkit/inc/toolkit/controls/unocontrol.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -46,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -73,13 +74,14 @@ struct UnoControl_Data; // ---------------------------------------------------- // class UnoControl // ---------------------------------------------------- -typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControl +typedef ::cppu::WeakAggImplHelper8 < ::com::sun::star::awt::XControl , ::com::sun::star::awt::XWindow2 , ::com::sun::star::awt::XView , ::com::sun::star::beans::XPropertiesChangeListener , ::com::sun::star::lang::XServiceInfo , ::com::sun::star::accessibility::XAccessible , ::com::sun::star::util::XModeChangeBroadcaster + , ::com::sun::star::awt::XUnitConversion > UnoControl_Base; class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base @@ -220,6 +222,12 @@ public: virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + // XUnitConversion + virtual ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& Point, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + private: // ::com::sun::star::beans::XPropertiesChangeListener void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 1abe0b34004f..d91077823495 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1535,3 +1535,55 @@ void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XMod throw NoSupportException( ); } +//---------------------------------------------------------------------------------------------------------------------- +awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException) +{ + Reference< XUnitConversion > xPeerConversion; + { + ::osl::MutexGuard aGuard( GetMutex() ); + xPeerConversion = xPeerConversion.query( getPeer() ); + } + if ( xPeerConversion.is() ) + return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit ); + return awt::Point( ); +} + +//---------------------------------------------------------------------------------------------------------------------- +awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException) +{ + Reference< XUnitConversion > xPeerConversion; + { + ::osl::MutexGuard aGuard( GetMutex() ); + xPeerConversion = xPeerConversion.query( getPeer() ); + } + if ( xPeerConversion.is() ) + return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit ); + return awt::Point( ); +} + +//---------------------------------------------------------------------------------------------------------------------- +awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException) +{ + Reference< XUnitConversion > xPeerConversion; + { + ::osl::MutexGuard aGuard( GetMutex() ); + xPeerConversion = xPeerConversion.query( getPeer() ); + } + if ( xPeerConversion.is() ) + return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit ); + return awt::Size( ); +} + +//---------------------------------------------------------------------------------------------------------------------- +awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException) +{ + Reference< XUnitConversion > xPeerConversion; + { + ::osl::MutexGuard aGuard( GetMutex() ); + xPeerConversion = xPeerConversion.query( getPeer() ); + } + if ( xPeerConversion.is() ) + return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit ); + return awt::Size( ); +} + -- cgit From 67edcd669363101648408035737f33c73c78da01 Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 12 May 2010 10:45:45 +0200 Subject: obo48: #i109700# lucene indexer generates segments_n (n>3) files --- l10ntools/source/help/HelpIndexerTool.java | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java index 1245247c3c9a..2a49f964d48f 100644 --- a/l10ntools/source/help/HelpIndexerTool.java +++ b/l10ntools/source/help/HelpIndexerTool.java @@ -69,6 +69,7 @@ public class HelpIndexerTool String aModule = ""; String aTargetZipFileStr = ""; String aCfsName = ""; + String aSegmentName = ""; // Scan arguments boolean bLang = false; @@ -77,6 +78,7 @@ public class HelpIndexerTool boolean bSrcDir = false; boolean bOutput = false; boolean bCfsName = false; + boolean bSegmentName = false; int nArgCount = args.length; for( int i = 0 ; i < nArgCount ; i++ ) @@ -126,7 +128,7 @@ public class HelpIndexerTool } i++; } - else if( "-checkcfsname".equals(args[i]) ) + else if( "-checkcfsandsegname".equals(args[i]) ) { if( i + 1 < nArgCount ) { @@ -134,6 +136,17 @@ public class HelpIndexerTool bCfsName = true; } i++; + if( i + 1 < nArgCount ) + { + aSegmentName = "segments" + args[i + 1]; + bSegmentName = true; + } + i++; + if (!(bCfsName && bSegmentName)) + { + System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)"); + System.exit( -1 ); + } } } @@ -173,12 +186,17 @@ public class HelpIndexerTool writer.close(); boolean bCfsFileOk = true; - if( bCfsName && !bExtensionMode && nRet != -1 ) + boolean bSegmentFileOk = true; + if( bCfsName && bSegmentName && !bExtensionMode && nRet != -1 ) { String aCompleteCfsFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aCfsName; + String aCompleteSegmentFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aSegmentName; File aCfsFile = new File( aCompleteCfsFileName ); + File aSegmentFile = new File( aCompleteSegmentFileName ); bCfsFileOk = aCfsFile.exists(); + bSegmentFileOk = aSegmentFile.exists(); System.out.println( "Checking cfs file " + aCfsName+ ": " + (bCfsFileOk ? "Found" : "Not found") ); + System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") ); } if( bExtensionMode ) @@ -194,7 +212,7 @@ public class HelpIndexerTool if( nRet == -1 ) deleteRecursively( aIndexDir ); - if( bCfsFileOk ) + if( bCfsFileOk && bSegmentFileOk ) System.out.println( "Zipping ..." ); File aDirToZipFile = new File( aDirToZipStr ); createZipFile( aDirToZipFile, aTargetZipFileStr ); @@ -207,6 +225,12 @@ public class HelpIndexerTool System.exit( -1 ); } + if( !bSegmentFileOk ) + { + System.out.println( "segment file check failed, terminating..." ); + System.exit( -1 ); + } + Date end = new Date(); if( !bExtensionMode ) System.out.println(end.getTime() - start.getTime() + " total milliseconds"); -- cgit From 95d72876f31b2b0d4c398236354401ee93ac6b72 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 12 May 2010 10:35:18 -0400 Subject: koheiautodecimal: #i111533# Adjust the default display format for general number format cells. --- svl/source/numbers/zformat.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index accf306a20df..589bfd1b31dd 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1824,14 +1824,14 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutStr } #endif - // If truncating the value to desired precision alters the original value, - // we should show the trailing zeros, otherwise strip them. - double fRounded = ::rtl::math::round(rNumber, nPrecision); - bool bRemoveZeros = ::rtl::math::approxEqual(fRounded, rNumber); + // We decided to strip trailing zeros unconditionally, since binary + // double-precision rounding error makes it impossible to determine e.g. + // whether 844.10000000000002273737 is what the user has typed, or the + // user has typed 844.1 but IEEE 754 represents it that way internally. rOutString = ::rtl::math::doubleToUString( rNumber, rtl_math_StringFormat_F, nPrecision /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), bRemoveZeros ); + GetFormatter().GetNumDecimalSep().GetChar(0), true ); if (rOutString.GetChar(0) == '-' && rOutString.GetTokenCount('0') == rOutString.Len()) rOutString.EraseLeadingChars('-'); // nicht -0 @@ -2079,7 +2079,7 @@ BOOL SvNumberformat::GetOutputString(double fNumber, bool bSign = ::rtl::math::isSignBitSet(fNumber); if (bSign) fNumber = -fNumber; - ImpGetOutputInputLine(fNumber, OutString); + ImpGetOutputStdToPrecision(fNumber, OutString, 10); // Use 10 decimals for general 'unlimited' format. if (fNumber < EXP_LOWER_BOUND) { xub_StrLen nLen = OutString.Len(); -- cgit From 51066323fd14918f65ea7ba66e14b9c7604eb978 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 12 May 2010 18:21:14 +0200 Subject: #i10000# added missing variable --- svtools/source/filter.vcl/wmf/winmtf.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx index d2f5d0f39aee..fb4fd2fe0c57 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.hxx +++ b/svtools/source/filter.vcl/wmf/winmtf.hxx @@ -314,6 +314,7 @@ class WinMtfClipPath { PolyPolygon aPolyPoly; WinMtfClipPathType eType; + sal_Int32 nDepth; void ImpUpdateType(); -- cgit From 8c0d1c18d0cee550fcee22c6e1e28d766d9f260d Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 13 May 2010 10:12:41 -0400 Subject: calctabcolor: Removed code that was not intended. --- svtools/source/control/tabbar.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 5773a482768f..e5e2e0c8eb69 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1633,7 +1633,6 @@ void TabBar::SetTabBgColor( USHORT nPageId, const Color& aTabBgColor ) if ( nPos != PAGE_NOT_FOUND ) { pItem = mpItemList->GetObject( nPos ); - // TODO: Need to take the text color specification out of this code! if ( aTabBgColor != Color( COL_AUTO ) ) { pItem->maTabBgColor = aTabBgColor; -- cgit From a2c557f7fa002c2b52a103ec910f454d10a17ecf Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 13 May 2010 14:46:13 -0400 Subject: calctabcolor: added header. --- svtools/source/control/tabbar.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index e5e2e0c8eb69..7a927f57e7e2 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -39,6 +39,8 @@ #include #include "svtaccessiblefactory.hxx" +#include + // ======================================================================= #define TABBAR_OFFSET_X 7 -- cgit From 5025e2acbba31177c0effc46227ad1e00457ed43 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 14 May 2010 19:33:04 +0200 Subject: dr76: #i111404# remaining problems with the FastSaxParser --- sax/source/fastparser/fastparser.cxx | 81 ++++++++++++++++++++++-------------- sax/source/fastparser/fastparser.hxx | 31 +++++++++----- 2 files changed, 71 insertions(+), 41 deletions(-) diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index e80a36b2d127..1a4cc9278e1e 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -175,19 +175,39 @@ OUString SAL_CALL FastLocatorImpl::getSystemId(void) throw (RuntimeException) return mpParser->getEntity().maStructSource.sSystemId; } -// -------------------------------------------------------------------- -// FastSaxParser implementation // -------------------------------------------------------------------- -FastSaxParser::FastSaxParser() +ParserData::ParserData() { - mxDocumentLocator.set( new FastLocatorImpl( this ) ); +} + +ParserData::~ParserData() +{ +} + +// -------------------------------------------------------------------- +Entity::Entity( const ParserData& rData ) : + ParserData( rData ) +{ // performance-Improvment. Reference is needed when calling the startTag callback. // Handing out the same object with every call is allowed (see sax-specification) mxAttributes.set( new FastAttributeList( mxTokenHandler ) ); } +Entity::~Entity() +{ +} + +// -------------------------------------------------------------------- +// FastSaxParser implementation +// -------------------------------------------------------------------- + +FastSaxParser::FastSaxParser() +{ + mxDocumentLocator.set( new FastLocatorImpl( this ) ); +} + // -------------------------------------------------------------------- FastSaxParser::~FastSaxParser() @@ -246,7 +266,7 @@ sal_Int32 FastSaxParser::GetToken( const OString& rToken ) { Sequence< sal_Int8 > aSeq( (sal_Int8*)rToken.getStr(), rToken.getLength() ); - return mxTokenHandler->getTokenFromUTF8( aSeq ); + return getEntity().mxTokenHandler->getTokenFromUTF8( aSeq ); } sal_Int32 FastSaxParser::GetToken( const sal_Char* pToken, sal_Int32 nLen /* = 0 */ ) @@ -256,7 +276,7 @@ sal_Int32 FastSaxParser::GetToken( const sal_Char* pToken, sal_Int32 nLen /* = 0 Sequence< sal_Int8 > aSeq( (sal_Int8*)pToken, nLen ); - return mxTokenHandler->getTokenFromUTF8( aSeq ); + return getEntity().mxTokenHandler->getTokenFromUTF8( aSeq ); } // -------------------------------------------------------------------- @@ -422,7 +442,7 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx // Only one text at one time MutexGuard guard( maMutex ); - Entity entity; + Entity entity( maData ); entity.maStructSource = maStructSource; if( !entity.maStructSource.aInputStream.is() ) @@ -447,19 +467,19 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx try { // start the document - if( mxDocumentHandler.is() ) + if( entity.mxDocumentHandler.is() ) { Reference< XLocator > xLoc( mxDocumentLocator.get() ); - mxDocumentHandler->setDocumentLocator( xLoc ); - mxDocumentHandler->startDocument(); + entity.mxDocumentHandler->setDocumentLocator( xLoc ); + entity.mxDocumentHandler->startDocument(); } parse(); // finish document - if( mxDocumentHandler.is() ) + if( entity.mxDocumentHandler.is() ) { - mxDocumentHandler->endDocument(); + entity.mxDocumentHandler->endDocument(); } } catch( SAXException & ) @@ -487,13 +507,12 @@ void FastSaxParser::parseStream( const InputSource& maStructSource) throw (SAXEx void FastSaxParser::setFastDocumentHandler( const Reference< XFastDocumentHandler >& Handler ) throw (RuntimeException) { - mxDocumentHandler = Handler; + maData.mxDocumentHandler = Handler; } void SAL_CALL FastSaxParser::setTokenHandler( const Reference< XFastTokenHandler >& Handler ) throw (RuntimeException) { - mxTokenHandler = Handler; - mxAttributes.set( new FastAttributeList( mxTokenHandler ) ); + maData.mxTokenHandler = Handler; } void SAL_CALL FastSaxParser::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (IllegalArgumentException, RuntimeException) @@ -511,17 +530,17 @@ void SAL_CALL FastSaxParser::registerNamespace( const OUString& NamespaceURL, sa void FastSaxParser::setErrorHandler(const Reference< XErrorHandler > & Handler) throw (RuntimeException) { - mxErrorHandler = Handler; + maData.mxErrorHandler = Handler; } void FastSaxParser::setEntityResolver(const Reference < XEntityResolver > & Resolver) throw (RuntimeException) { - mxEntityResolver = Resolver; + maData.mxEntityResolver = Resolver; } void FastSaxParser::setLocale( const Locale & Locale ) throw (RuntimeException) { - maLocale = Locale; + maData.maLocale = Locale; } Sequence< OUString > FastSaxParser::getSupportedServiceNames_Static(void) @@ -648,8 +667,8 @@ void FastSaxParser::parse() ); // error handler is set, it may throw the exception - if( mxErrorHandler.is() ) - mxErrorHandler->fatalError( Any( aExcept ) ); + if( rEntity.mxErrorHandler.is() ) + rEntity.mxErrorHandler->fatalError( Any( aExcept ) ); // error handler has not thrown, but parsing cannot go on, the // exception MUST be thrown @@ -693,7 +712,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char pushContext(); - mxAttributes->clear(); + rEntity.mxAttributes->clear(); // create attribute map and process namespace instructions int i = 0; @@ -752,17 +771,17 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char { sal_Int32 nAttributeToken = GetTokenWithPrefix( aIt->maPrefix, aIt->maName ); if( nAttributeToken != FastToken::DONTKNOW ) - mxAttributes->add( nAttributeToken, aIt->maValue ); + rEntity.mxAttributes->add( nAttributeToken, aIt->maValue ); else - mxAttributes->addUnknown( GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue ); + rEntity.mxAttributes->addUnknown( GetNamespaceURL( aIt->maPrefix ), aIt->maName, aIt->maValue ); } else { sal_Int32 nAttributeToken = GetToken( aIt->maName ); if( nAttributeToken != FastToken::DONTKNOW ) - mxAttributes->add( nAttributeToken, aIt->maValue ); + rEntity.mxAttributes->add( nAttributeToken, aIt->maValue ); else - mxAttributes->addUnknown( aIt->maName, aIt->maValue ); + rEntity.mxAttributes->addUnknown( aIt->maName, aIt->maValue ); } } @@ -776,7 +795,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char nElementToken = GetToken( pName ); rEntity.maContextStack.top()->mnElementToken = nElementToken; - Reference< XFastAttributeList > xAttr( mxAttributes.get() ); + Reference< XFastAttributeList > xAttr( rEntity.mxAttributes.get() ); Reference< XFastContextHandler > xContext; if( nElementToken == FastToken::DONTKNOW ) { @@ -790,7 +809,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char if( xParentContext.is() ) xContext = xParentContext->createUnknownChildContext( aNamespace, aElementName, xAttr ); else - xContext = mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr ); + xContext = rEntity.mxDocumentHandler->createUnknownChildContext( aNamespace, aElementName, xAttr ); if( xContext.is() ) { @@ -803,7 +822,7 @@ void FastSaxParser::callbackStartElement( const XML_Char* pwName, const XML_Char if( xParentContext.is() ) xContext = xParentContext->createFastChildContext( nElementToken, xAttr ); else - xContext = mxDocumentHandler->createFastChildContext( nElementToken, xAttr ); + xContext = rEntity.mxDocumentHandler->createFastChildContext( nElementToken, xAttr ); if( xContext.is() ) @@ -866,11 +885,11 @@ int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, InputSource source; Entity& rCurrEntity = getEntity(); - Entity aNewEntity; + Entity aNewEntity( rCurrEntity ); - if( mxEntityResolver.is() ) try + if( rCurrEntity.mxEntityResolver.is() ) try { - aNewEntity.maStructSource = mxEntityResolver->resolveEntity( + aNewEntity.maStructSource = rCurrEntity.mxEntityResolver->resolveEntity( OUString( publicId, strlen( publicId ), RTL_TEXTENCODING_UTF8 ) , OUString( systemId, strlen( systemId ), RTL_TEXTENCODING_UTF8 ) ); } diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 4802702bf098..a0331fe4035a 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -61,12 +61,27 @@ typedef ::std::hash_map< ::rtl::OUString, sal_Int32, // -------------------------------------------------------------------- +struct ParserData +{ + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler > mxDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver; + ::com::sun::star::lang::Locale maLocale; + + ParserData(); + ~ParserData(); +}; + +// -------------------------------------------------------------------- + // Entity binds all information needed for a single file -struct Entity +struct Entity : public ParserData { ::com::sun::star::xml::sax::InputSource maStructSource; XML_Parser mpParser; ::sax_expatwrap::XMLFile2UTFConverter maConverter; + ::rtl::Reference< FastAttributeList > mxAttributes; // Exceptions cannot be thrown through the C-XmlParser (possible resource leaks), // therefore the exception must be saved somewhere. @@ -74,6 +89,9 @@ struct Entity ::std::stack< SaxContextImplPtr > maContextStack; ::std::vector< NamespaceDefineRef > maNamespaceDefines; + + explicit Entity( const ParserData& rData ); + ~Entity(); }; // -------------------------------------------------------------------- @@ -134,18 +152,11 @@ private: private: ::osl::Mutex maMutex; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler > mxDocumentHandler; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver; - ::rtl::Reference< FastLocatorImpl > mxDocumentLocator; - ::rtl::Reference< FastAttributeList > mxAttributes; - ::com::sun::star::lang::Locale maLocale; NamespaceMap maNamespaceMap; - // External entity stack - ::std::stack< Entity > maEntities; + ParserData maData; /// Cached parser configuration for next call of parseStream(). + ::std::stack< Entity > maEntities; /// Entity stack for each call of parseStream(). }; } -- cgit From 4986d0508799b5e743cb6ccc9af6d84824d2e198 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 17 May 2010 12:40:01 +0200 Subject: vcl111: #i111464# fix frame width (thanks kendy !) --- vcl/unx/kde4/KDESalGraphics.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 25dd50ce3958..a34bf861b83d 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -744,7 +744,7 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, { if( part == PART_BORDER ) { - int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); USHORT nStyle = val.getNumericVal(); if( nStyle & FRAME_DRAW_NODRAW ) { -- cgit From 5d74e58fe163e423f29b075502e726a0e012a038 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 18 May 2010 09:43:20 +0200 Subject: #i107915# all TIP/SIP unicodes get the same vertical flags --- vcl/source/gdi/sallayout.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 3e4ca9fc3df6..5e187944c706 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -144,10 +144,10 @@ int GetVerticalFlags( sal_UCS4 nChar ) return GF_ROTR; // right return GF_ROTL; // left } - else if( (nChar >= 0x02F800 && nChar <= 0x02FFFF) ) // non-BMP CJK ideographs - return GF_NONE; // not rotated + else if( (nChar >= 0x20000) && (nChar <= 0x3FFFF) ) // all SIP/TIP ideographs + return GF_ROTL; // left - return GF_NONE; + return GF_NONE; // not rotated as default } // ----------------------------------------------------------------------- -- cgit From df3eba513b2f936e07ac173a61b4599695b1e0e3 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 18 May 2010 11:10:00 +0200 Subject: #i111021# #i11575#desc5#b adjust B2D tesselator result to raster --- vcl/unx/source/gdi/salgdi.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 32aeed2dbc95..15e391256344 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1224,13 +1224,18 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : const SalColor aKeepBrushColor = nBrushColor_; nBrushColor_ = nPenColor_; + // #i11575#desc5#b adjust B2D tesselation result to raster positions + basegfx::B2DPolygon aPolygon = rPolygon; + const double fHalfWidth = 0.5 * rLineWidth.getX(); + aPolygon.transform( basegfx::tools::createTranslateB2DHomMatrix(+fHalfWidth,+fHalfWidth) ); + // shortcut for hairline drawing to improve performance if( bIsHairline ) { // hairlines can benefit from a simplified tesselation // e.g. for hairlines the linejoin style can be ignored basegfx::B2DTrapezoidVector aB2DTrapVector; - basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, rPolygon, rLineWidth.getX() ); + basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() ); // draw tesselation result const int nTrapCount = aB2DTrapVector.size(); @@ -1242,16 +1247,15 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : } // get the area polygon for the line polygon - basegfx::B2DPolygon aPolygon = rPolygon; if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getY() ) ) { // prepare for createAreaGeometry() with anisotropic linewidth - aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); + aPolygon.transform( basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); } // create the area-polygon for the line - const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) ); + const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, fHalfWidth, eLineJoin) ); if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) @@ -1278,3 +1282,4 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + -- cgit From 88323a664a3f57b7bae62d0af892c9de5750defe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 18 May 2010 12:01:02 +0200 Subject: slidecopy: HelpID support for tool panels --- svtools/inc/svtools/toolpanel/toolpanel.hxx | 4 ++++ svtools/source/toolpanel/drawerlayouter.cxx | 1 + svtools/source/toolpanel/dummypanel.cxx | 6 ++++++ svtools/source/toolpanel/dummypanel.hxx | 1 + svtools/workben/toolpanel/toolpaneltest.cxx | 7 +++++++ 5 files changed, 19 insertions(+) diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx index d4d009b5c169..432dea64e8b5 100644 --- a/svtools/inc/svtools/toolpanel/toolpanel.hxx +++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx @@ -32,6 +32,7 @@ #include #include +#include #include @@ -60,6 +61,9 @@ namespace svt /// retrieves the image associated with the panel, if any virtual Image GetImage() const = 0; + /// retrieves the help ID associated with the panel, if any. + virtual SmartId GetHelpID() const = 0; + /** activates the panel Usually, this means the panel's Window is created (if not previosly done so) and shown. diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index f10e9439ef0b..040f33045fff 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -165,6 +165,7 @@ namespace svt OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); PToolPanelDrawer pDrawer( new ToolPanelDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ) ); + pDrawer->SetSmartHelpId( i_pPanel->GetHelpID() ); // proper Z-Order if ( i_nPosition == 0 ) { diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index dae50723d4f1..20f140a6e610 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -79,6 +79,12 @@ namespace svt return Image(); } + //-------------------------------------------------------------------- + SmartId DummyPanel::GetHelpID() const + { + return SmartId(); + } + //-------------------------------------------------------------------- void DummyPanel::GrabFocus() { diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index b37e5cca19af..adb98e52077e 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -49,6 +49,7 @@ namespace svt // IToolPanel virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; + virtual SmartId GetHelpID() const; virtual void Activate( Window& i_rParentWindow ); virtual void Deactivate(); virtual void SetSizePixel( const Size& i_rPanelWindowSize ); diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx index 812d6479b887..6d044cee7c93 100755 --- a/svtools/workben/toolpanel/toolpaneltest.cxx +++ b/svtools/workben/toolpanel/toolpaneltest.cxx @@ -145,6 +145,7 @@ public: // IToolPanel virtual ::rtl::OUString GetDisplayName() const; virtual Image GetImage() const; + virtual SmartId GetHelpID() const; virtual void Activate( Window& i_rParentWindow ); virtual void Deactivate(); virtual void SetSizePixel( const Size& i_rPanelWindowSize ); @@ -270,6 +271,12 @@ Image ColoredPanel::GetImage() const return Image( m_aPanelIcon ); } +//----------------------------------------------------------------------------- +SmartId ColoredPanel::GetHelpID() const +{ + return SmartId(); +} + //============================================================================= //= OptionsWindow //============================================================================= -- cgit From f9425a94186c33c2571bdc32b689c3706251f416 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 18 May 2010 13:26:39 +0200 Subject: unoawt: call UpdateContextBmpWidthVector in the LISTACTION_INSERTED notification. This way, we'll also handle cases where somebody creates and inserts SvLBoxEntry bypassing InsertEntry (and using the base classes Insert) --- svtools/source/contnr/svtreebx.cxx | 42 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 9f599cbdb22e..bf6e41f93f36 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -40,6 +40,7 @@ class TabBar; #include #include #include +#include #include #include #include @@ -427,17 +428,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)rDefExpBmp.GetSizePixel().Width(); - short nColWidth = (short)rDefColBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = rDefExpBmp; aPrevInsertedColBmp = rDefColBmp; @@ -468,17 +458,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText, else SvLBox::Insert( pEntry, pParent, nPos ); - short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width(); - short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width(); - short nMax = Max(nExpWidth, nColWidth); - // #97680# ---------------- - nMax = pImp->UpdateContextBmpWidthVector( pEntry, nMax ); - if( nMax > nContextBmpWidthMax ) - { - nContextBmpWidthMax = nMax; - SetTabs(); - } - aPrevInsertedExpBmp = aExpEntryBmp; aPrevInsertedColBmp = aCollEntryBmp; @@ -2347,6 +2326,25 @@ void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1, SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); switch( nActionId ) { + case LISTACTION_INSERTED: + { + SvLBoxEntry* pEntry( dynamic_cast< SvLBoxEntry* >( pEntry1 ) ); + ENSURE_OR_BREAK( pEntry, "SvTreeListBox::ModelNotification: invalid entry!" ); + SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); + if ( !pBmpItem ) + break; + const Image& rBitmap1( pBmpItem->GetBitmap1() ); + const Image& rBitmap2( pBmpItem->GetBitmap2() ); + short nMaxWidth = short( Max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) ); + nMaxWidth = pImp->UpdateContextBmpWidthVector( pEntry, nMaxWidth ); + if( nMaxWidth > nContextBmpWidthMax ) + { + nContextBmpWidthMax = nMaxWidth; + SetTabs(); + } + } + break; + case LISTACTION_RESORTING: SetUpdateMode( FALSE ); break; -- cgit From 7eba4ceaf574246d971ae01a8f52c5f075aca35a Mon Sep 17 00:00:00 2001 From: Rene Engelhard Date: Tue, 18 May 2010 14:05:20 +0200 Subject: systemlibc: migrate systemlibc to hg; try again from scratch --- tools/bootstrp/rscdep.cxx | 49 +---------------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 5c18793c9833..ebe1e2f412e2 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -70,15 +70,6 @@ void RscHrcDep::Execute() //static String aDelim; -/* poor man's getopt() */ -int simple_getopt(char *argv[], const char *optstring); -#if defined(WNT) || defined(OS2) -static char *optarg = NULL; -static int optind = 1; -static int optopt = 0; -static int opterr = 0; -#endif - SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) { int c; @@ -179,7 +170,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) while( 1 ) { - c = simple_getopt( argv, + c = getopt( argc, argv, "_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\""); if ( c == -1 ) break; @@ -296,41 +287,3 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) return 0; } -/* my very simple minded implementation of getopt() - * it's too sad that getopt() is not available everywhere - * note: this is not a full POSIX conforming getopt() - */ -int simple_getopt(char *argv[], const char *optstring) -{ - char *arg = argv[optind]; - - /* skip all response file arguments */ - if ( arg ) { - while ( *arg == '@' ) - arg = argv[++optind]; - - if ( arg[0] == '-' && arg[1] != '\0' ) { - const char *popt; - int c = arg[1]; - if ( (popt = strchr(optstring, c)) == NULL ) { - optopt = c; - if ( opterr ) - fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); - return '?'; - } - if ( *(++popt) == ':') { - if ( arg[2] != '\0' ) { - optarg = ++arg; - } else { - optarg = argv[++optind]; - } - } else { - optarg = NULL; - } - ++optind; - return c; - } - } - return -1; -} - -- cgit From 2d9286f6bbb59d392f57e4a4031ee2bf49f9f3d0 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 18 May 2010 15:59:03 +0200 Subject: #i111682# remove module fondu for good --- toolkit/src2xml/include.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst index a93449625585..2bf5fced6fd3 100644 --- a/toolkit/src2xml/include.lst +++ b/toolkit/src2xml/include.lst @@ -106,7 +106,6 @@ ../../basic/unxlngi6.pro/inc ../../boost/unxlngi6.pro/inc ../../XmlSearch/unxlngi6.pro/inc -../../fondu/unxlngi6.pro/inc ../../forms/inc ../../forms/source/inc ../../forms/source/solar/inc -- cgit From 52a825459618ea98cfa6978ab7eeeace2c2f3a61 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 19 May 2010 15:47:51 +0200 Subject: #i110214# fix b2dpoly drawing on aqua --- vcl/aqua/source/gdi/salgdi.cxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index a54a7fad7ac5..9c2641256cd9 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -473,7 +473,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath, const CGAffineTransform* pTransform = NULL; const bool bHasCurves = rPolygon.areControlPointsUsed(); - bool bPendingCurve = false; for( int nPointIdx = 0, nPrevIdx = 0;; nPrevIdx = nPointIdx++ ) { int nClosedIdx = nPointIdx; @@ -488,7 +487,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath, ::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx ); - if(bPixelSnap) + if( bPixelSnap) { // snap device coordinates to full pixels aPoint.setX( basegfx::fround( aPoint.getX() ) ); @@ -498,9 +497,19 @@ static void AddPolygonToPath( CGMutablePathRef xPath, if( bLineDraw ) aPoint += aHalfPointOfs; - if( !nPointIdx ) // first point + if( nClosedIdx != 0 ) { // first point => just move there CGPathMoveToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() ); - else if( !bPendingCurve ) // line segment + continue; + } + + bool bPendingCurve = false; + if( bHasCurves ) + { + bPendingCurve = rPolygon.isNextControlPointUsed( nPrevIdx ); + bPendingCurve |= rPolygon.isPrevControlPointUsed( nPointIdx ); + } + + if( !bPendingCurve ) // line segment CGPathAddLineToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() ); else // cubic bezier segment { @@ -514,9 +523,6 @@ static void AddPolygonToPath( CGMutablePathRef xPath, CGPathAddCurveToPoint( xPath, pTransform, aCP1.getX(), aCP1.getY(), aCP2.getX(), aCP2.getY(), aPoint.getX(), aPoint.getY() ); } - - if( bHasCurves ) - bPendingCurve = rPolygon.isNextControlPointUsed( nClosedIdx ); } if( bClosePath ) -- cgit From e2c090708e089258087396d46acacf513f70e809 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 19 May 2010 16:33:51 +0200 Subject: #i110214# fix typo in b2dpoly drawing on aqua --- vcl/aqua/source/gdi/salgdi.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 9c2641256cd9..9c4ae4a40165 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -497,7 +497,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath, if( bLineDraw ) aPoint += aHalfPointOfs; - if( nClosedIdx != 0 ) { // first point => just move there + if( !nPointIdx ) { // first point => just move there CGPathMoveToPoint( xPath, pTransform, aPoint.getX(), aPoint.getY() ); continue; } @@ -506,7 +506,7 @@ static void AddPolygonToPath( CGMutablePathRef xPath, if( bHasCurves ) { bPendingCurve = rPolygon.isNextControlPointUsed( nPrevIdx ); - bPendingCurve |= rPolygon.isPrevControlPointUsed( nPointIdx ); + bPendingCurve |= rPolygon.isPrevControlPointUsed( nClosedIdx ); } if( !bPendingCurve ) // line segment -- cgit From 874bb80f4fe59a5920084b92edf0f583a22cb8f5 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 19 May 2010 18:35:11 +0200 Subject: sw33bf04: #i111712#: sax: convert crude test in converter.cxx to cppunit test --- sax/inc/sax/tools/converter.hxx | 1 + sax/prj/build.lst | 1 + sax/qa/cppunit/makefile.mk | 71 +++++++++++ sax/qa/cppunit/test_converter.cxx | 244 ++++++++++++++++++++++++++++++++++++++ sax/qa/cppunit/version.map | 34 ++++++ sax/source/tools/converter.cxx | 165 -------------------------- 6 files changed, 351 insertions(+), 165 deletions(-) create mode 100644 sax/qa/cppunit/makefile.mk create mode 100644 sax/qa/cppunit/test_converter.cxx create mode 100644 sax/qa/cppunit/version.map diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 1e783b4a4ec9..4b65c1dc83b2 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -32,6 +32,7 @@ #include +#include #include diff --git a/sax/prj/build.lst b/sax/prj/build.lst index e3f70c484610..653d77ce9e25 100644 --- a/sax/prj/build.lst +++ b/sax/prj/build.lst @@ -3,3 +3,4 @@ ax sax usr1 - all ax_mkout NULL ax sax\source\expatwrap nmake - all ax_expatwrap NULL ax sax\source\tools nmake - all ax_tools NULL ax sax\source\fastparser nmake - all ax_fastparser ax_expatwrap ax_tools NULL +ax sax\qa\cppunit nmake - all ax_qa_cppunit ax_tools NULL diff --git a/sax/qa/cppunit/makefile.mk b/sax/qa/cppunit/makefile.mk new file mode 100644 index 000000000000..e06eca25a737 --- /dev/null +++ b/sax/qa/cppunit/makefile.mk @@ -0,0 +1,71 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + +PRJ=../.. +PRJNAME=sax +TARGET=qa_cppunit + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) +DLLPRE = # no leading "lib" on .so files + +# --- Libs --------------------------------------------------------- + +SHL1OBJS= \ + $(SLO)/test_converter.obj \ + + +SHL1STDLIBS= \ + $(SAXLIB) \ + $(SALLIB) \ + $(CPPUNITLIB) \ + + +SHL1TARGET= test_converter +SHL1RPATH = NONE +SHL1IMPLIB= i$(SHL1TARGET) +# SHL1DEF= $(MISC)/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +# DEF1EXPORTFILE= export.exp +SHL1VERSIONMAP= version.map + +# --- All object files --------------------------------------------- + +SLOFILES= \ + $(SHL1OBJS) \ + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk +.INCLUDE : _cppunit.mk + diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx new file mode 100644 index 000000000000..1ea781afff95 --- /dev/null +++ b/sax/qa/cppunit/test_converter.cxx @@ -0,0 +1,244 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "sax/tools/converter.hxx" + + +using namespace ::com::sun::star; +using sax::Converter; + + +namespace { + +class ConverterTest + : public ::CppUnit::TestFixture +{ +public: + virtual void setUp(); + virtual void tearDown(); + + void testDuration(); + void testDateTime(); + + CPPUNIT_TEST_SUITE(ConverterTest); + CPPUNIT_TEST(testDuration); + CPPUNIT_TEST(testDateTime); + CPPUNIT_TEST_SUITE_END(); + +private: +}; + +void ConverterTest::setUp() +{ +} + +void ConverterTest::tearDown() +{ +} + +static bool eqDuration(util::Duration a, util::Duration b) { + return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.MilliSeconds == b.MilliSeconds + && a.Negative == b.Negative; +} + +static void doTest(util::Duration const & rid, char const*const pis, + char const*const i_pos = 0) +{ + char const*const pos((i_pos) ? i_pos : pis); + util::Duration od; + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + bool bSuccess = Converter::convertDuration(od, is); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT(eqDuration(rid, od)); + ::rtl::OUStringBuffer buf; + Converter::convertDuration(buf, od); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); +} + +static void doTestDurationF(char const*const pis) +{ + util::Duration od; + bool bSuccess = Converter::convertDuration(od, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); + CPPUNIT_ASSERT(!bSuccess); +} + +void ConverterTest::testDuration() +{ + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); + doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); + doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); + doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); + doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), + "PT9.999999999999999999999999999999S", "PT9.999S" ); + doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), + "-P7Y6M5DT4H3M2.01S" ); + doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); + doTestDurationF("1Y1M"); // invalid: no ^P + doTestDurationF("P-1Y1M"); // invalid: - after P + doTestDurationF("P1M1Y"); // invalid: Y after M + doTestDurationF("PT1Y"); // invalid: Y after T + doTestDurationF("P1Y1M1M"); // invalid: M twice, no T + doTestDurationF("P1YT1MT1M"); // invalid: T twice + doTestDurationF("P1YT"); // invalid: T but no H,M,S + doTestDurationF("P99999999999Y"); // cannot parse so many Ys + doTestDurationF("PT.1S"); // invalid: no 0 preceding . + doTestDurationF("PT5M.134S"); // invalid: no 0 preceding . + doTestDurationF("PT1.S"); // invalid: no digit following . + OSL_TRACE("\nSAX CONVERTER TEST END\n"); +} + + +static bool eqDateTime(util::DateTime a, util::DateTime b) { + return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.HundredthSeconds == b.HundredthSeconds; +} + +static void doTest(util::DateTime const & rdt, char const*const pis, + char const*const i_pos = 0) +{ + char const*const pos((i_pos) ? i_pos : pis); + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + util::DateTime odt; + bool bSuccess( Converter::convertDateTime(odt, is) ); + OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + CPPUNIT_ASSERT(bSuccess); + CPPUNIT_ASSERT(eqDateTime(rdt, odt)); + ::rtl::OUStringBuffer buf; + Converter::convertDateTime(buf, odt, true); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); +} + +static void doTestDateTimeF(char const*const pis) +{ + util::DateTime odt; + bool bSuccess = Converter::convertDateTime(odt, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + CPPUNIT_ASSERT(!bSuccess); +} + +void ConverterTest::testDateTime() +{ + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/, + "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" ); +// "0001-02-01T12:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, + "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); +// "0001-01-01T12:00:00" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333) + /*(0, 0, 0, 0, 2, 1, 333)*/, + "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ ); + doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+ + doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y + doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M + doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D + doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H + doTestDateTimeF( "0001-01-01T00:0:00" ); // invalid: < 2 M + doTestDateTimeF( "0001-01-01T00:00:0" ); // invalid: < 2 S + doTestDateTimeF( "0001-01-01T00:00:00." ); // invalid: .$ + doTestDateTimeF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H + doTestDateTimeF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M + doTestDateTimeF( "0001-13-01T00:00:00" ); // invalid: M > 12 + doTestDateTimeF( "0001-01-32T00:00:00" ); // invalid: D > 31 + doTestDateTimeF( "0001-01-01T25:00:00" ); // invalid: H > 24 + doTestDateTimeF( "0001-01-01T00:60:00" ); // invalid: H > 59 + doTestDateTimeF( "0001-01-01T00:00:60" ); // invalid: S > 59 + doTestDateTimeF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0 + doTestDateTimeF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0 + doTestDateTimeF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0 + doTestDateTimeF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00 + doTestDateTimeF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00 + doTestDateTimeF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00 + doTestDateTimeF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00 + OSL_TRACE("\nSAX CONVERTER TEST END\n"); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + diff --git a/sax/qa/cppunit/version.map b/sax/qa/cppunit/version.map new file mode 100644 index 000000000000..3308588ef6f8 --- /dev/null +++ b/sax/qa/cppunit/version.map @@ -0,0 +1,34 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + +UDK_3_0_0 { + global: + cppunitTestPlugIn; + + local: + *; +}; diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 35bfba29c904..5df3044bd6d3 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -1217,78 +1217,6 @@ bool Converter::convertDuration(util::Duration& rDuration, return bSuccess; } -#if 0 -//FIXME -struct Test { - static bool eqDuration(util::Duration a, util::Duration b) { - return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days - && a.Hours == b.Hours && a.Minutes == b.Minutes - && a.Seconds == b.Seconds - && a.MilliSeconds == b.MilliSeconds - && a.Negative == b.Negative; - } - static void doTest(util::Duration const & rid, char const*const pis, - char const*const i_pos = 0) - { - char const*const pos((i_pos) ? i_pos : pis); - util::Duration od; - ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); - bool bSuccess = Converter::convertDuration(od, is); - OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm", - od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); - OSL_ASSERT(bSuccess); - OSL_ASSERT(eqDuration(rid, od)); - ::rtl::OUStringBuffer buf; - Converter::convertDuration(buf, od); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); - OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); - } - static void doTestF(const char * pis) - { - util::Duration od; - bool bSuccess = Converter::convertDuration(od, - ::rtl::OUString::createFromAscii(pis)); - OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", - od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); - OSL_ASSERT(!bSuccess); - } - Test() { - OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); - doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); - doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); - doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); - doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); - doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), - "PT9.999999999999999999999999999999S", "PT9.999S" ); - doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); - doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), - "-P7Y6M5DT4H3M2.01S" ); - doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); - doTestF("1Y1M"); // invalid: no ^P - doTestF("P-1Y1M"); // invalid: - after P - doTestF("P1M1Y"); // invalid: Y after M - doTestF("PT1Y"); // invalid: Y after T - doTestF("P1Y1M1M"); // invalid: M twice, no T - doTestF("P1YT1MT1M"); // invalid: T twice - doTestF("P1YT"); // invalid: T but no H,M,S - doTestF("P99999999999Y"); // cannot parse so many Ys - doTestF("PT.1S"); // invalid: no 0 preceding . - doTestF("PT5M.134S"); // invalid: no 0 preceding . - doTestF("PT1.S"); // invalid: no digit following . - OSL_TRACE("\nSAX CONVERTER TEST END\n"); - } -}; -static Test test; -#endif /** convert util::Date to ISO "date" string */ void Converter::convertDate( @@ -1675,99 +1603,6 @@ bool Converter::convertDateOrDateTime( return bSuccess; } -#if 0 -struct Test { - static bool eqDateTime(util::DateTime a, util::DateTime b) { - return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day - && a.Hours == b.Hours && a.Minutes == b.Minutes - && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds; - } - static void doTest(util::DateTime const & rdt, char const*const pis, - char const*const i_pos = 0) - { - char const*const pos((i_pos) ? i_pos : pis); - ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); - util::DateTime odt; - bool bSuccess( Converter::convertDateTime(odt, is) ); - OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d", - odt.Year, odt.Month, odt.Day, - odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); - OSL_ASSERT(bSuccess); - OSL_ASSERT(eqDateTime(rdt, odt)); - ::rtl::OUStringBuffer buf; - Converter::convertDateTime(buf, odt, true); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); - OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); - } - static void doTestF(const char * pis) - { - util::DateTime odt; - bool bSuccess = Converter::convertDateTime(odt, - ::rtl::OUString::createFromAscii(pis)); - OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d", - odt.Year, odt.Month, odt.Day, - odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); - OSL_ASSERT(!bSuccess); - } - Test() { - OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" ); -// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" ); -// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), - "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/, - "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" ); -// "0001-02-01T12:00:00" ); - doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, - "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); -// "0001-01-01T12:00:00" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.9999999999999999999999999999999999999", - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333) - /*(0, 0, 0, 0, 2, 1, 333)*/, - "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ ); - doTestF( "+0001-01-01T00:00:00" ); // invalid: ^+ - doTestF( "1-01-01T00:00:00" ); // invalid: < 4 Y - doTestF( "0001-1-01T00:00:00" ); // invalid: < 2 M - doTestF( "0001-01-1T00:00:00" ); // invalid: < 2 D - doTestF( "0001-01-01T0:00:00" ); // invalid: < 2 H - doTestF( "0001-01-01T00:0:00" ); // invalid: < 2 M - doTestF( "0001-01-01T00:00:0" ); // invalid: < 2 S - doTestF( "0001-01-01T00:00:00." ); // invalid: .$ - doTestF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H - doTestF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M - doTestF( "0001-13-01T00:00:00" ); // invalid: M > 12 - doTestF( "0001-01-32T00:00:00" ); // invalid: D > 31 - doTestF( "0001-01-01T25:00:00" ); // invalid: H > 24 - doTestF( "0001-01-01T00:60:00" ); // invalid: H > 59 - doTestF( "0001-01-01T00:00:60" ); // invalid: S > 59 - doTestF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0 - doTestF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0 - doTestF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0 - doTestF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00 - doTestF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00 - doTestF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00 - doTestF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00 - OSL_TRACE("\nSAX CONVERTER TEST END\n"); - } -}; -static Test test; -#endif /** gets the position of the first comma after npos in the string rStr. Commas inside '"' pairs are not matched */ -- cgit From 6641398317d5f6681b2cf1715e834a1393038fe1 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Thu, 20 May 2010 11:04:13 +0200 Subject: cws tl79: #i111422# pre-notify for 'Toggle' of check box --- tools/inc/tools/wintypes.hxx | 1 + vcl/source/control/button.cxx | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx index 8f13af8fd842..7d6296b76e8c 100644 --- a/tools/inc/tools/wintypes.hxx +++ b/tools/inc/tools/wintypes.hxx @@ -215,6 +215,7 @@ typedef sal_Int64 WinBits; // Window-Bits for CheckBox #define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) +#define WB_EARLYTOGGLE ((WinBits)SAL_CONST_INT64(0x4000000000)) // Window-Bits for Edit #define WB_PASSWORD ((WinBits)0x01000000) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 1f45b5902381..5b15330ed927 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -3675,11 +3675,14 @@ void CheckBox::ImplCheck() else eNewState = STATE_NOCHECK; meState = eNewState; - ImplInvalidateOrDrawCheckBoxState(); ImplDelData aDelData; ImplAddDel( &aDelData ); - Toggle(); + if( (GetStyle() & WB_EARLYTOGGLE) ) + Toggle(); + ImplInvalidateOrDrawCheckBoxState(); + if( ! (GetStyle() & WB_EARLYTOGGLE) ) + Toggle(); if ( aDelData.IsDelete() ) return; ImplRemoveDel( &aDelData ); -- cgit From ffe5faef611a17abf300a049f5158dd6662c46de Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 20 May 2010 12:38:21 +0200 Subject: unoawt: MultiSelectionSimpleMode property for list boxes, allowing 'browser-like' multi selection (where a single click onto an entry only toggles this entry) --- toolkit/inc/toolkit/helper/property.hxx | 3 ++- toolkit/source/awt/vclxwindows.cxx | 9 +++++++++ toolkit/source/controls/unocontrolmodel.cxx | 1 + toolkit/source/helper/property.cxx | 1 + vcl/source/control/lstbox.cxx | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index d5f484145316..ed86c3fe4ded 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -199,7 +199,8 @@ namespace rtl { #define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148 #define BASEPROPERTY_GRID_HEADER_BACKGROUND 149 #define BASEPROPERTY_GRID_LINE_COLOR 150 -#define BASEPROPERTY_GRID_ROW_BACKGROUND 151 +#define BASEPROPERTY_GRID_ROW_BACKGROUND 151 +#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 00124b58ae93..5649ed4248dd 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -1546,6 +1546,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HELPURL, BASEPROPERTY_LINECOUNT, BASEPROPERTY_MULTISELECTION, + BASEPROPERTY_MULTISELECTION_SIMPLEMODE, BASEPROPERTY_PRINTABLE, BASEPROPERTY_SELECTEDITEMS, BASEPROPERTY_STRINGITEMLIST, @@ -1929,6 +1930,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: pListBox->EnableMultiSelection( b ); } break; + case BASEPROPERTY_MULTISELECTION_SIMPLEMODE: + ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False ); + break; case BASEPROPERTY_LINECOUNT: { sal_Int16 n = sal_Int16(); @@ -1993,6 +1997,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled(); } break; + case BASEPROPERTY_MULTISELECTION_SIMPLEMODE: + { + aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 ); + } + break; case BASEPROPERTY_LINECOUNT: { aProp <<= (sal_Int16) pListBox->GetDropDownLineCount(); diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index d34f5d9d9006..c5e1f70b15b8 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -338,6 +338,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const case BASEPROPERTY_HARDLINEBREAKS: case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break; + case BASEPROPERTY_MULTISELECTION_SIMPLEMODE: case BASEPROPERTY_HIDEINACTIVESELECTION: case BASEPROPERTY_ENFORCE_FORMAT: case BASEPROPERTY_AUTOCOMPLETE: diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 6711e4503511..b878112eed69 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -203,6 +203,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ), DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ), diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index dde34d52806c..6c7df5b106bf 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -885,6 +885,8 @@ void ListBox::StateChanged( StateChangedType nType ) { SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); + BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE; + mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode ); } else if( nType == STATE_CHANGE_MIRRORING ) { -- cgit From b393dc5d63ffdf35459a7a6a1863df066ee82ae1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 20 May 2010 12:45:50 +0200 Subject: unoawt: UNO API for generic wizards, wrapping around the existing C++ RoadmapWizard --- svtools/inc/svtools/roadmapwizard.hxx | 9 +- svtools/inc/svtools/wizardmachine.hxx | 8 +- svtools/prj/build.lst | 3 +- svtools/source/dialogs/roadmapwizard.cxx | 40 +++ svtools/source/dialogs/wizardmachine.cxx | 54 ++-- svtools/source/uno/makefile.mk | 2 +- svtools/source/uno/miscservices.cxx | 23 +- svtools/source/uno/unowizard.hxx | 111 ++++++++ svtools/source/uno/wizard/makefile.mk | 48 ++++ svtools/source/uno/wizard/unowizard.cxx | 374 ++++++++++++++++++++++++++ svtools/source/uno/wizard/wizardpageshell.cxx | 170 ++++++++++++ svtools/source/uno/wizard/wizardpageshell.hxx | 73 +++++ svtools/source/uno/wizard/wizardshell.cxx | 251 +++++++++++++++++ svtools/source/uno/wizard/wizardshell.hxx | 115 ++++++++ svtools/util/makefile.mk | 1 + 15 files changed, 1260 insertions(+), 22 deletions(-) create mode 100644 svtools/source/uno/unowizard.hxx create mode 100644 svtools/source/uno/wizard/makefile.mk create mode 100644 svtools/source/uno/wizard/unowizard.cxx create mode 100644 svtools/source/uno/wizard/wizardpageshell.cxx create mode 100644 svtools/source/uno/wizard/wizardpageshell.hxx create mode 100644 svtools/source/uno/wizard/wizardshell.cxx create mode 100644 svtools/source/uno/wizard/wizardshell.hxx diff --git a/svtools/inc/svtools/roadmapwizard.hxx b/svtools/inc/svtools/roadmapwizard.hxx index 49a0f441c49c..ee02f3b33ed7 100644 --- a/svtools/inc/svtools/roadmapwizard.hxx +++ b/svtools/inc/svtools/roadmapwizard.hxx @@ -80,6 +80,11 @@ namespace svt const ResId& _rRes, sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP ); + RoadmapWizard( + Window* _pParent, + const WinBits i_nStyle, + sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP + ); ~RoadmapWizard( ); void SetRoadmapBitmap( const BitmapEx& _rBitmap ); @@ -230,13 +235,15 @@ protected: private: SVT_DLLPRIVATE void ResizeFixedLine(); - private: DECL_DLLPRIVATE_LINK( OnRoadmapItemSelected, void* ); /** updates the roadmap control to show the given path, as far as possible (modulo conflicts with other paths) */ SVT_DLLPRIVATE void implUpdateRoadmap( ); + + private: + SVT_DLLPRIVATE void impl_construct(); }; //........................................................................ diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx index f45087f78705..45d15390440f 100644 --- a/svtools/inc/svtools/wizardmachine.hxx +++ b/svtools/inc/svtools/wizardmachine.hxx @@ -62,8 +62,7 @@ namespace svt eTravelForward, // traveling forward (maybe with skipping pages) eTravelBackward, // traveling backward (maybe with skipping pages) eFinish, // the wizard is about to be finished - eValidate, // the data should be validated only, no traveling wll happen - eValidateNoUI // the data should be validated only, without displaying error messages and other UI + eValidate // the data should be validated only, no traveling wll happen }; }; @@ -189,6 +188,7 @@ namespace svt For the button flags, use any combination of the WZB_* flags. */ OWizardMachine(Window* _pParent, const ResId& _rRes, sal_uInt32 _nButtonFlags ); + OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ); ~OWizardMachine(); /// enable (or disable) buttons @@ -355,6 +355,9 @@ namespace svt void resumeTraveling( AccessGuard ); bool isTravelingSuspended() const; + protected: + TabPage* GetOrCreatePage( const WizardState i_nState ); + private: // long OnNextPage( PushButton* ); DECL_DLLPRIVATE_LINK(OnNextPage, PushButton*); @@ -363,6 +366,7 @@ namespace svt SVT_DLLPRIVATE void implResetDefault(Window* _pWindow); SVT_DLLPRIVATE void implUpdateTitle(); + SVT_DLLPRIVATE void implConstruct( const sal_uInt32 _nButtonFlags ); }; /// helper class to temporarily suspend any traveling in the wizard diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 2645b9e6bf6a..a7d8569de301 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -23,8 +23,9 @@ st svtools\source\svrtf nmake - all st_rtf st_inc NULL st svtools\source\table nmake - all st_table st_inc NULL st svtools\source\toolpanel nmake - all st_toolpanel st_inc NULL st svtools\source\uno nmake - all st_uno st_inc NULL +st svtools\source\uno\wizard nmake - all st_uno_wiz st_inc NULL st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\util nmake - all st_util st_svtgraphic st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_toolpanel st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL +st svtools\util nmake - all st_util st_svtgraphic st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_toolpanel st_uno st_uno_wiz st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 9a03a9b16c2d..32a04bae7d5f 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -182,7 +182,45 @@ namespace svt ,m_pImpl( new RoadmapWizardImpl ) { DBG_CTOR( RoadmapWizard, CheckInvariants ); + impl_construct(); + } + + //-------------------------------------------------------------------- + RoadmapWizard::RoadmapWizard( Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ) + :OWizardMachine( _pParent, i_nStyle, _nButtonFlags ) + ,m_pImpl( new RoadmapWizardImpl ) + { + DBG_CTOR( RoadmapWizard, CheckInvariants ); + impl_construct(); + } + + namespace + { + void lcl_dump( const Window& i_rWindow, const size_t i_level ) + { + for ( size_t i=0; iGetWindow( WINDOW_NEXT ); + } + fflush( stderr ); + } + } + + //-------------------------------------------------------------------- + void RoadmapWizard::impl_construct() + { SetLeftAlignedButtonCount( 1 ); SetEmptyViewMargin(); @@ -534,6 +572,8 @@ namespace svt enableButtons( WZB_PREVIOUS, bHaveEnabledState ); implUpdateRoadmap(); + + lcl_dump( *this, 0 ); } //-------------------------------------------------------------------- diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 3aaf279889d8..1d1293334a3a 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -160,6 +160,25 @@ namespace svt ,m_pPrevPage(NULL) ,m_pHelp(NULL) ,m_pImpl( new WizardMachineImplData ) + { + implConstruct( _nButtonFlags ); + } + + //--------------------------------------------------------------------- + OWizardMachine::OWizardMachine(Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ) + :WizardDialog( _pParent, i_nStyle ) + ,m_pFinish(NULL) + ,m_pCancel(NULL) + ,m_pNextPage(NULL) + ,m_pPrevPage(NULL) + ,m_pHelp(NULL) + ,m_pImpl( new WizardMachineImplData ) + { + implConstruct( _nButtonFlags ); + } + + //--------------------------------------------------------------------- + void OWizardMachine::implConstruct( const sal_uInt32 _nButtonFlags ) { m_pImpl->sTitleBase = GetText(); @@ -225,8 +244,6 @@ namespace svt AddButton( m_pCancel, WIZARDDIALOG_BUTTON_STDOFFSET_X ); } - - } //--------------------------------------------------------------------- @@ -274,35 +291,42 @@ namespace svt } //--------------------------------------------------------------------- - void OWizardMachine::ActivatePage() + TabPage* OWizardMachine::GetOrCreatePage( const WizardState i_nState ) { - WizardDialog::ActivatePage(); - - WizardState nCurrentLevel = GetCurLevel(); - if (NULL == GetPage(nCurrentLevel)) + if ( NULL == GetPage( i_nState ) ) { - TabPage* pNewPage = createPage(nCurrentLevel); - DBG_ASSERT(pNewPage, "OWizardMachine::ActivatePage: invalid new page (NULL)!"); + TabPage* pNewPage = createPage( i_nState ); + DBG_ASSERT( pNewPage, "OWizardMachine::GetOrCreatePage: invalid new page (NULL)!" ); // fill up the page sequence of our base class (with dummies) - while (m_pImpl->nFirstUnknownPage < nCurrentLevel) + while ( m_pImpl->nFirstUnknownPage < i_nState ) { - AddPage(NULL); + AddPage( NULL ); ++m_pImpl->nFirstUnknownPage; } - if (m_pImpl->nFirstUnknownPage == nCurrentLevel) + if ( m_pImpl->nFirstUnknownPage == i_nState ) { // encountered this page number the first time - AddPage(pNewPage); + AddPage( pNewPage ); ++m_pImpl->nFirstUnknownPage; } else // already had this page - just change it - SetPage(nCurrentLevel, pNewPage); + SetPage( i_nState, pNewPage ); } + return GetPage( i_nState ); + } + + //--------------------------------------------------------------------- + void OWizardMachine::ActivatePage() + { + WizardDialog::ActivatePage(); + + WizardState nCurrentLevel = GetCurLevel(); + GetOrCreatePage( nCurrentLevel ); - enterState(nCurrentLevel); + enterState( nCurrentLevel ); } //--------------------------------------------------------------------- diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 4a52960f448c..d207b1effd97 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -52,7 +52,7 @@ SLOFILES= \ $(SLO)$/unoevent.obj \ $(SLO)$/unoiface.obj \ $(SLO)$/unoimap.obj \ - $(SLO)$/svtxgridcontrol.obj + $(SLO)$/svtxgridcontrol.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 433c1e1acbcb..e16a1ecb56dc 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -38,10 +38,13 @@ #include #include "provider.hxx" #include "renderer.hxx" +#include "unowizard.hxx" #include #include "comphelper/servicedecl.hxx" +#include "cppuhelper/implementationentry.hxx" + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; @@ -67,6 +70,20 @@ extern sdecl::ServiceDecl const serviceDecl; Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ } +namespace +{ + static struct ::cppu::ImplementationEntry s_aServiceEntries[] = + { + { + ::svt::uno::Wizard::Create, + ::svt::uno::Wizard::getImplementationName_static, + ::svt::uno::Wizard::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, NULL, 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; +} + // ------------------------------------------------------------------------------------- DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) @@ -126,9 +143,9 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey( aServices.getConstArray()[ i ] ); if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( _pRegistryKey ), serviceDecl ) ) - return false; + return false; - return sal_True; + return ::cppu::component_writeInfoHelper( pServiceManager, _pRegistryKey, s_aServiceEntries ); } return sal_False; } @@ -185,6 +202,8 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( else { pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ); + if ( !pResult ) + pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries ); } if ( xFactory.is() ) diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx new file mode 100644 index 000000000000..cf09646a690e --- /dev/null +++ b/svtools/source/uno/unowizard.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNO_WIZARD_HXX +#define SVT_UNO_WIZARD_HXX + +#include "svtools/genericunodialog.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + //================================================================================================================== + //= Wizard - declaration + //================================================================================================================== + typedef ::cppu::ImplInheritanceHelper1 < ::svt::OGenericUnoDialog + , ::com::sun::star::ui::dialogs::XWizard + > Wizard_Base; + class Wizard; + typedef ::comphelper::OPropertyArrayUsageHelper< Wizard > Wizard_PBase; + class Wizard : public Wizard_Base + , public Wizard_PBase + { + public: + Wizard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ); + + // ::com::sun::star::lang::XServiceInfo - static version + static ::rtl::OUString SAL_CALL getImplementationName_static() throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static() throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext ); + + protected: + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + // ::com::sun::star::ui::dialogs::XWizard + virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL travelNext( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL travelPrevious( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::ui::dialogs::XExecutableDialog + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL execute( ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + protected: + ~Wizard(); + + protected: + virtual Dialog* createDialog( Window* _pParent ); + virtual void destroyDialog(); + + private: + ::comphelper::ComponentContext m_aContext; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > > m_aWizardSteps; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNO_WIZARD_HXX diff --git a/svtools/source/uno/wizard/makefile.mk b/svtools/source/uno/wizard/makefile.mk new file mode 100644 index 000000000000..2beef5060475 --- /dev/null +++ b/svtools/source/uno/wizard/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=../../.. + +PRJNAME=svtools +TARGET=unowiz +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svt.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/unowizard.obj \ + $(SLO)$/wizardshell.obj \ + $(SLO)$/wizardpageshell.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx new file mode 100644 index 000000000000..b832162ef92f --- /dev/null +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -0,0 +1,374 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "../unowizard.hxx" +#include "wizardshell.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::lang::XServiceInfo; + using ::com::sun::star::ui::dialogs::XWizard; + using ::com::sun::star::lang::XInitialization; + using ::com::sun::star::beans::XPropertySetInfo; + using ::com::sun::star::uno::XComponentContext; + using ::com::sun::star::beans::Property; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::ucb::AlreadyInitializedException; + using ::com::sun::star::ui::dialogs::XWizardController; + /** === end UNO using === **/ + namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; + + //------------------------------------------------------------------------------------------------------------------ + namespace + { + sal_uInt32 lcl_convertWizardButtonToWZB( const sal_Int16 i_nWizardButton ) + { + switch ( i_nWizardButton ) + { + case WizardButton::NEXT: return WZB_NEXT; + case WizardButton::PREVIOUS: return WZB_PREVIOUS; + case WizardButton::FINISH: return WZB_FINISH; + case WizardButton::CANCEL: return WZB_CANCEL; + case WizardButton::HELP: return WZB_HELP; + } + OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); + return 0; + } + } + + //================================================================================================================== + //= Wizard - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + Wizard::Wizard( const Reference< XComponentContext >& _rxContext ) + :Wizard_Base( _rxContext ) + ,m_aContext( _rxContext ) + { + } + + //-------------------------------------------------------------------- + Wizard::~Wizard() + { + // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor, + // so this virtual-method-call the base class does does not work, we're already dead then ... + if ( m_pDialog ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pDialog ) + destroyDialog(); + } + } + + //-------------------------------------------------------------------- + Reference< XInterface > SAL_CALL Wizard::Create( const Reference< XComponentContext >& _rxContext ) + { + return *(new Wizard( _rxContext ) ); + } + + //-------------------------------------------------------------------- + namespace + { + static void lcl_checkPaths( const Sequence< Sequence< sal_Int16 > >& i_rPaths, const Reference< XInterface >& i_rContext ) + { + // need at least one path + if ( i_rPaths.getLength() == 0 ) + throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); + + // each path must be of length 1, at least + for ( sal_Int32 i = 0; i < i_rPaths.getLength(); ++i ) + { + if ( i_rPaths[i].getLength() == 0 ) + throw IllegalArgumentException( ::rtl::OUString(), i_rContext, 2 ); + + // page IDs must be in ascending order + sal_Int16 nPreviousPageID = i_rPaths[i][0]; + for ( sal_Int32 j=1; j& i_Arguments ) throw (Exception, RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_bInitialized ) + throw AlreadyInitializedException( ::rtl::OUString(), *this ); + + if ( i_Arguments.getLength() != 2 ) + throw IllegalArgumentException( ::rtl::OUString(), *this, -1 ); + + // the second argument must be a XWizardController, for each constructor + m_xController.set( i_Arguments[1], UNO_QUERY ); + if ( !m_xController.is() ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 2 ); + + // the first arg is either a single path (short[]), or multiple paths (short[][]) + Sequence< sal_Int16 > aSinglePath; + i_Arguments[0] >>= aSinglePath; + Sequence< Sequence< sal_Int16 > > aMultiplePaths; + i_Arguments[0] >>= aMultiplePaths; + + if ( !aMultiplePaths.getLength() ) + { + aMultiplePaths.realloc(1); + aMultiplePaths[0] = aSinglePath; + } + lcl_checkPaths( aMultiplePaths, *this ); + // if we survived this, the paths are valid, and we're done here ... + m_aWizardSteps = aMultiplePaths; + + m_bInitialized = true; + } + + //-------------------------------------------------------------------- + Dialog* Wizard::createDialog( Window* i_pParent ) + { + return new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ); + } + + //-------------------------------------------------------------------- + void Wizard::destroyDialog() + { + Wizard_Base::destroyDialog(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL Wizard::getImplementationName_static() throw(RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.uno.Wizard" ) ); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames_static() throw(RuntimeException) + { + Sequence< ::rtl::OUString > aServices(1); + aServices[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.Wizard" ) ); + return aServices; + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL Wizard::getImplementationName() throw(RuntimeException) + { + return getImplementationName_static(); + } + + //-------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL Wizard::getSupportedServiceNames() throw(RuntimeException) + { + return getSupportedServiceNames_static(); + } + + //-------------------------------------------------------------------- + Reference< XPropertySetInfo > SAL_CALL Wizard::getPropertySetInfo() throw(RuntimeException) + { + return createPropertySetInfo( getInfoHelper() ); + } + + //-------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper& SAL_CALL Wizard::getInfoHelper() + { + return *const_cast< Wizard* >( this )->getArrayHelper(); + } + + //-------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* Wizard::createArrayHelper( ) const + { + Sequence< Property > aProps; + describeProperties( aProps ); + return new ::cppu::OPropertyArrayHelper( aProps ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enableButtons: invalid dialog implementation!" ); + + pWizardImpl->enableButtons( lcl_convertWizardButtonToWZB( i_WizardButton ), i_Enable ); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::setDefaultButton: invalid dialog implementation!" ); + + pWizardImpl->defaultButton( lcl_convertWizardButtonToWZB( i_WizardButton ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelNext: invalid dialog implementation!" ); + + return pWizardImpl->travelNext(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::travelPrevious: invalid dialog implementation!" ); + + return pWizardImpl->travelPrevious(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); + + pWizardImpl->updateTravelUI(); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::advanceTo: invalid dialog implementation!" ); + + return pWizardImpl->advanceTo( i_PageId ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::goBackTo: invalid dialog implementation!" ); + + return pWizardImpl->goBackTo( i_PageId ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Int16 SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" ); + + return pWizardImpl->getCurrentPage(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException) + { + // simply disambiguate + Wizard_Base::OGenericUnoDialog::setTitle( i_Title ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException) + { + // simply disambiguate + return Wizard_Base::OGenericUnoDialog::execute(); + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpageshell.cxx b/svtools/source/uno/wizard/wizardpageshell.cxx new file mode 100644 index 000000000000..f75efe05da3d --- /dev/null +++ b/svtools/source/uno/wizard/wizardpageshell.cxx @@ -0,0 +1,170 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "wizardpageshell.hxx" +#include "wizardshell.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::lang::XComponent; + /** === end UNO using === **/ + using namespace ::com::sun::star; + + //================================================================================================================== + //= WizardPageShell + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + WizardPageShell::WizardPageShell( WizardShell& i_rParent, const Reference< XWizardController >& i_rController, + const sal_Int16 i_nPageId ) + :OWizardPage( &i_rParent, WB_CHILDDLGCTRL | WB_NODIALOGCONTROL ) + ,m_xController( i_rController ) + ,m_xWizardPage() + ,m_nPageId( i_nPageId ) + { + ENSURE_OR_THROW( m_xController.is(), "no controller" ); + try + { + m_xWizardPage.set( m_xController->createPage( + Reference< XWindow >( GetComponentInterface( TRUE ), UNO_QUERY_THROW ), + m_nPageId + ), UNO_SET_THROW ); + + Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); + + awt::Rectangle aContentRect( xPageWindow->getPosSize() ); + SetSizePixel( Size( aContentRect.X + aContentRect.Width, aContentRect.Y + aContentRect.Height ) ); + + xPageWindow->setVisible( sal_True ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + Show(); + } + + //------------------------------------------------------------------------------------------------------------------ + WizardPageShell::~WizardPageShell() + { + try + { + if ( m_xWizardPage.is() ) + m_xWizardPage->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardPageShell::initializePage() + { + OWizardPage::initializePage(); + if ( !m_xWizardPage.is() ) + return; + + try + { + m_xWizardPage->activatePage(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardPageShell::commitPage( CommitPageReason i_eReason ) + { + if ( !OWizardPage::commitPage( i_eReason ) ) + return sal_False; + + if ( !m_xWizardPage.is() ) + return sal_True; + + try + { + return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + bool WizardPageShell::canAdvance() const + { + if ( !OWizardPage::canAdvance() ) + return false; + + if ( !m_xWizardPage.is() ) + return true; + + try + { + return m_xWizardPage->canAdvance(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return true; + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpageshell.hxx b/svtools/source/uno/wizard/wizardpageshell.hxx new file mode 100644 index 000000000000..8f36a19c0fe4 --- /dev/null +++ b/svtools/source/uno/wizard/wizardpageshell.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNOWIZ_WIZARDPAGESHELL_HXX +#define SVT_UNOWIZ_WIZARDPAGESHELL_HXX + +#include "svtools/wizardmachine.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + class WizardShell; + + //================================================================================================================== + //= WizardPageShell + //================================================================================================================== + class WizardPageShell : public OWizardPage + { + public: + WizardPageShell( + WizardShell& i_rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, + const sal_Int16 i_nPageId + ); + ~WizardPageShell(); + + // IWizardPage overridables + virtual void initializePage(); + virtual sal_Bool commitPage( CommitPageReason _eReason ); + + // OWizardPage overridables (why isn't this method part of IWizardPage?) + virtual bool canAdvance() const; + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage; + const sal_Int16 m_nPageId; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNOWIZ_WIZARDPAGESHELL_HXX diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx new file mode 100644 index 000000000000..859ab38a3f3a --- /dev/null +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -0,0 +1,251 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "wizardshell.hxx" +#include "wizardpageshell.hxx" + +#include + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::ui::dialogs::XWizard; + /** === end UNO using === **/ + namespace WizardTravelType = ::com::sun::star::ui::dialogs::WizardTravelType; + + //================================================================================================================== + namespace + { + //-------------------------------------------------------------------------------------------------------------- + sal_Int16 lcl_determineFirstPageID( const Sequence< Sequence< sal_Int16 > >& i_rPaths ) + { + ENSURE_OR_THROW( ( i_rPaths.getLength() > 0 ) && ( i_rPaths[0].getLength() > 0 ), "illegal paths" ); + return i_rPaths[0][0]; + } + } + + //================================================================================================================== + //= WizardShell + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + WizardShell::WizardShell( Window* i_pParent, const Reference< XWizard >& i_rWizard, const Reference< XWizardController >& i_rController, + const Sequence< Sequence< sal_Int16 > >& i_rPaths ) + :WizardShell_Base( i_pParent, WB_MOVEABLE | WB_CLOSEABLE ) + ,m_xWizard( i_rWizard ) + ,m_xController( i_rController ) + ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) ) + { + ENSURE_OR_THROW( m_xWizard.is() && m_xController.is(), "invalid wizard/controller" ); + + // declare the paths + for ( sal_Int32 i=0; i& rPath( i_rPaths[i] ); + WizardPath aPath( rPath.getLength() ); + for ( sal_Int32 j=0; jGetSizePixel() ); + + // some defaults + ShowButtonFixedLine( true ); + SetRoadmapInteractive( true ); + enableAutomaticNextButtonState(); + + // activate the first page + ActivatePage(); + } + + //------------------------------------------------------------------------------------------------------------------ + WizardShell::~WizardShell() + { + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason ) + { + switch ( i_eReason ) + { + case WizardTypes::eTravelForward: + return WizardTravelType::FORWARD; + + case WizardTypes::eTravelBackward: + return WizardTravelType::BACKWARD; + + case WizardTypes::eFinish: + return WizardTravelType::FINISH; + } + OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" ); + return WizardTravelType::FINISH; + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardShell::enterState( WizardState i_nState ) + { + WizardShell_Base::enterState( i_nState ); + + if ( !m_xController.is() ) + return; + + try + { + m_xController->onActivatePage( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardShell::prepareLeaveCurrentState( CommitPageReason i_eReason ) + { + if ( !WizardShell_Base::prepareLeaveCurrentState( i_eReason ) ) + return sal_False; + + if ( !m_xController.is() ) + return sal_True; + + try + { + return m_xController->confirmDeactivatePage( + impl_stateToPageId( getCurrentState() ), + convertCommitReasonToTravelType( i_eReason ) + ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardShell::leaveState( WizardState i_nState ) + { + if ( !WizardShell_Base::leaveState( i_nState ) ) + return sal_False; + + if ( !m_xController.is() ) + return sal_True; + + try + { + m_xController->onDeactivatePage( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + TabPage* WizardShell::createPage( WizardState i_nState ) + { + ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL ); + return new WizardPageShell( *this, m_xController, impl_stateToPageId( i_nState ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + String WizardShell::getStateDisplayName( WizardState i_nState ) const + { + try + { + if ( m_xController.is() ) + return m_xController->getPageTitle( impl_stateToPageId( i_nState ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return String::CreateFromInt32( i_nState ); + } + + //------------------------------------------------------------------------------------------------------------------ + bool WizardShell::canAdvance() const + { + try + { + if ( m_xController.is() && !m_xController->canAdvance() ) + return false; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return WizardShell_Base::canAdvance(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardShell::onFinish( sal_Int32 i_nResult ) + { + try + { + if ( ( i_nResult == RET_OK ) && m_xController.is() && !m_xController->confirmFinish() ) + return sal_False; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return WizardShell_Base::onFinish( i_nResult ); + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx new file mode 100644 index 000000000000..0d2ba7836ebc --- /dev/null +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNO_WIZARD_SHELL +#define SVT_UNO_WIZARD_SHELL + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + //================================================================================================================== + //= WizardShell + //================================================================================================================== + typedef ::svt::RoadmapWizard WizardShell_Base; + class WizardShell : public WizardShell_Base + { + public: + WizardShell( + Window* _pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths + ); + virtual ~WizardShell(); + + // OWizardMachine overridables + virtual TabPage* createPage( WizardState i_nState ); + virtual void enterState( WizardState i_nState ); + virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); + virtual sal_Bool leaveState( WizardState i_nState ); + virtual String getStateDisplayName( WizardState i_nState ) const; + virtual bool canAdvance() const; + virtual sal_Bool onFinish( sal_Int32 _nResult ); + + // attribute access + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& + getWizard() const { return m_xWizard; } + + static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason ); + + // operations + sal_Bool advanceTo( const sal_Int16 i_nPageId ) + { + return skipUntil( impl_pageIdToState( i_nPageId ) ); + } + sal_Bool goBackTo( const sal_Int16 i_nPageId ) + { + return skipBackwardUntil( impl_pageIdToState( i_nPageId ) ); + } + sal_Int16 getCurrentPage() const + { + return impl_stateToPageId( getCurrentState() ); + } + sal_Bool travelNext() { return WizardShell_Base::travelNext(); } + sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } + + private: + sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const + { + return static_cast< sal_Int16 >( i_nState + m_nFirstPageID ); + } + + WizardState impl_pageIdToState( const sal_Int16 i_nPageId ) const + { + return static_cast< WizardState >( i_nPageId - m_nFirstPageID ); + } + + // prevent outside access to some base class members + using WizardShell_Base::skip; + using WizardShell_Base::skipUntil; + using WizardShell_Base::skipBackwardUntil; + using WizardShell_Base::getCurrentState; + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard; + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + const sal_Int16 m_nFirstPageID; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNO_WIZARD_SHELL diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 0040b1d1ee65..f9c14a540410 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -71,6 +71,7 @@ LIB1FILES= \ $(SLB)/svrtf.lib \ $(SLB)/table.lib \ $(SLB)/unoiface.lib \ + $(SLB)/unowiz.lib \ $(SLB)/urlobj.lib \ $(SLB)/toolpanel.lib -- cgit From e11315fea42a010fb2248b54be599bdbf98be127 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 20 May 2010 12:45:50 +0200 Subject: fwk139: #i110066# Fixed typo for Malay string --- svtools/source/misc/langtab.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 39f9362e3940..0e4117b52e35 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -138,7 +138,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Lithuanian" ; LANGUAGE_LITHUANIAN ; > ; < "Macedonian" ; LANGUAGE_MACEDONIAN ; > ; < "Malay (Malaysia)" ; LANGUAGE_MALAY_MALAYSIA ; > ; - < "Malay (Brunei Darusalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; + < "Malay (Brunei Darussalam)" ; LANGUAGE_MALAY_BRUNEI_DARUSSALAM ; > ; < "Malayalam" ; LANGUAGE_MALAYALAM ; > ; < "Manipuri" ; LANGUAGE_MANIPURI ; > ; < "Marathi" ; LANGUAGE_MARATHI ; > ; -- cgit From e1fc491b8a3cdea1be576873f121fb580ebb3ee1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 20 May 2010 13:23:25 +0200 Subject: unoawt: compile with GCC --- svtools/source/uno/wizard/wizardshell.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 859ab38a3f3a..dfc14ba53cc1 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -124,6 +124,9 @@ namespace svt { namespace uno case WizardTypes::eFinish: return WizardTravelType::FINISH; + + default: + break; } OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" ); return WizardTravelType::FINISH; -- cgit From af0a5febf954c46655bc5392ffbaeb4e49c317cd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 13:17:30 +0200 Subject: unoawt: evolution of the UNO-API for wizards --- svtools/source/uno/unowizard.hxx | 2 +- svtools/source/uno/wizard/unowizard.cxx | 6 +++--- svtools/source/uno/wizard/wizardpageshell.hxx | 3 +++ svtools/source/uno/wizard/wizardshell.cxx | 20 +++++++++++++++++--- svtools/source/uno/wizard/wizardshell.hxx | 16 ++++++++++++---- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx index cf09646a690e..1aa639597d05 100644 --- a/svtools/source/uno/unowizard.hxx +++ b/svtools/source/uno/unowizard.hxx @@ -82,7 +82,7 @@ namespace svt { namespace uno virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::ui::dialogs::XExecutableDialog virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException); diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index b832162ef92f..c01d7eb5f4cc 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -69,6 +69,7 @@ namespace svt { namespace uno using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::ui::dialogs::XWizardPage; /** === end UNO using === **/ namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; @@ -344,7 +345,7 @@ namespace svt { namespace uno } //------------------------------------------------------------------------------------------------------------------ - ::sal_Int16 SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) + Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::MutexGuard aGuard( m_aMutex ); @@ -352,7 +353,7 @@ namespace svt { namespace uno WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" ); - return pWizardImpl->getCurrentPage(); + return pWizardImpl->getCurrentWizardPage(); } //------------------------------------------------------------------------------------------------------------------ @@ -365,7 +366,6 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ ::sal_Int16 SAL_CALL Wizard::execute( ) throw (RuntimeException) { - // simply disambiguate return Wizard_Base::OGenericUnoDialog::execute(); } diff --git a/svtools/source/uno/wizard/wizardpageshell.hxx b/svtools/source/uno/wizard/wizardpageshell.hxx index 8f36a19c0fe4..25cfbb8b8505 100644 --- a/svtools/source/uno/wizard/wizardpageshell.hxx +++ b/svtools/source/uno/wizard/wizardpageshell.hxx @@ -60,6 +60,9 @@ namespace svt { namespace uno // OWizardPage overridables (why isn't this method part of IWizardPage?) virtual bool canAdvance() const; + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >& + getWizardPage() const { return m_xWizardPage; } + private: const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage; diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index dfc14ba53cc1..140a65455f8e 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -56,6 +56,7 @@ namespace svt { namespace uno using ::com::sun::star::uno::Type; using ::com::sun::star::ui::dialogs::XWizardController; using ::com::sun::star::ui::dialogs::XWizard; + using ::com::sun::star::ui::dialogs::XWizardPage; /** === end UNO using === **/ namespace WizardTravelType = ::com::sun::star::ui::dialogs::WizardTravelType; @@ -101,9 +102,6 @@ namespace svt { namespace uno ShowButtonFixedLine( true ); SetRoadmapInteractive( true ); enableAutomaticNextButtonState(); - - // activate the first page - ActivatePage(); } //------------------------------------------------------------------------------------------------------------------ @@ -111,6 +109,13 @@ namespace svt { namespace uno { } + //------------------------------------------------------------------------------------------------------------------ + short WizardShell::Execute() + { + ActivatePage(); + return WizardShell_Base::Execute(); + } + //------------------------------------------------------------------------------------------------------------------ sal_Int16 WizardShell::convertCommitReasonToTravelType( const CommitPageReason i_eReason ) { @@ -195,6 +200,15 @@ namespace svt { namespace uno return sal_True; } + //------------------------------------------------------------------------------------------------------------------ + Reference< XWizardPage > WizardShell::getCurrentWizardPage() const + { + const WizardState eState = getCurrentState(); + const WizardPageShell* pPage = dynamic_cast< const WizardPageShell* >( GetPage( eState ) ); + ENSURE_OR_RETURN( pPage, "WizardShell::getCurrentWizardPage: invalid page/implementation!", NULL ); + return pPage->getWizardPage(); + } + //------------------------------------------------------------------------------------------------------------------ TabPage* WizardShell::createPage( WizardState i_nState ) { diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 0d2ba7836ebc..f61666f46cc3 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -54,6 +54,9 @@ namespace svt { namespace uno ); virtual ~WizardShell(); + // Dialog overridables + virtual short Execute(); + // OWizardMachine overridables virtual TabPage* createPage( WizardState i_nState ); virtual void enterState( WizardState i_nState ); @@ -78,13 +81,18 @@ namespace svt { namespace uno { return skipBackwardUntil( impl_pageIdToState( i_nPageId ) ); } - sal_Int16 getCurrentPage() const - { - return impl_stateToPageId( getCurrentState() ); - } sal_Bool travelNext() { return WizardShell_Base::travelNext(); } sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } + void preExecute() + { + // activate the first page + ActivatePage(); + } + + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > + getCurrentWizardPage() const; + private: sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const { -- cgit From 89d95059bdf9530e6e9b1a9aadf3573364cd1718 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 13:18:39 +0200 Subject: unoawt: removed debug code used for diagnostics --- svtools/source/dialogs/roadmapwizard.cxx | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 32a04bae7d5f..e3e2350c62da 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -194,30 +194,6 @@ namespace svt impl_construct(); } - namespace - { - void lcl_dump( const Window& i_rWindow, const size_t i_level ) - { - for ( size_t i=0; iGetWindow( WINDOW_NEXT ); - } - fflush( stderr ); - } - } - //-------------------------------------------------------------------- void RoadmapWizard::impl_construct() { @@ -572,8 +548,6 @@ namespace svt enableButtons( WZB_PREVIOUS, bHaveEnabledState ); implUpdateRoadmap(); - - lcl_dump( *this, 0 ); } //-------------------------------------------------------------------- -- cgit From c20d10ab416cb1abb4f1e6ed3f75c379355db8c8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 13:25:08 +0200 Subject: slidecopy: #i10000# include version.mk, so the lib can be built without the module being delivered beforehand --- ucbhelper/workben/myucp/makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk index 0d7f273fe877..e2f19563cb1c 100644 --- a/ucbhelper/workben/myucp/makefile.mk +++ b/ucbhelper/workben/myucp/makefile.mk @@ -46,6 +46,7 @@ NO_BSYMBOLIC=TRUE # --- Settings --------------------------------------------------------- .INCLUDE: settings.mk +.INCLUDE : ../../version.mk # --- General ----------------------------------------------------- -- cgit From 1f8a320a9caec6354f3a2f6bbc38ba8f85e7f16c Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 21 May 2010 14:06:12 +0200 Subject: vcl111: #i102694# metacity and compiz need the same workaround --- vcl/unx/gtk/window/gtkframe.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index c0eae3d2f0d0..11d567c85098 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1353,15 +1353,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) // // i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused. // awesome. - bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity"); - if( nUserTime == 0 && - ( bMetaCity || - ( - getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") && - (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) - ) - ) - ) + bool bHack = + getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") || + getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") + ; + if( nUserTime == 0 && bHack ) { /* #i99360# ugly workaround an X11 library bug */ nUserTime= getDisplay()->GetLastUserEventTime( true ); @@ -1369,7 +1365,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate ) } lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime ); - if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) + if( bHack && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) m_bSetFocusOnMap = true; gtk_widget_show( m_pWindow ); -- cgit From bceb0afba091cf5a9ccddb363aafb1d490bedaf6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 21 May 2010 14:16:31 +0200 Subject: vcl112: #i111735# fix a leaked file handle (thanks cmc !) --- vcl/unx/source/app/keysymnames.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/unx/source/app/keysymnames.cxx b/vcl/unx/source/app/keysymnames.cxx index cf7f7e082e69..c9515f016433 100644 --- a/vcl/unx/source/app/keysymnames.cxx +++ b/vcl/unx/source/app/keysymnames.cxx @@ -637,6 +637,7 @@ const char* SalDisplay::GetKeyboardName( BOOL bRefresh ) } } } + close(kbd); } } #else -- cgit From 0b4adf0acb50662e8bb625e9cadaf70f4e88bb33 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 21 May 2010 14:26:40 +0200 Subject: vcl112: #i111735# fix a memory leak (thanks cmc !) --- vcl/source/gdi/pdfwriter_impl.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6a24775219d9..ee9ca373d145 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4081,15 +4081,15 @@ bool PDFWriterImpl::emitFonts() } else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA? { - unsigned char* pBuffer = new unsigned char[ (int)nLength1 ]; + boost::shared_array pBuffer( new unsigned char[ nLength1 ] ); sal_uInt64 nBytesRead = 0; - CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer, nLength1, &nBytesRead ) ) ); + CHECK_RETURN( (osl_File_E_None == osl_readFile( aFontFile, pBuffer.get(), nLength1, &nBytesRead ) ) ); DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" ); CHECK_RETURN( (osl_File_E_None == osl_setFilePos( aFontFile, osl_Pos_Absolut, 0 ) ) ); // get the PFB-segment lengths ThreeInts aSegmentLengths = {0,0,0}; - getPfbSegmentLengths( pBuffer, (int)nBytesRead, aSegmentLengths ); + getPfbSegmentLengths( pBuffer.get(), (int)nBytesRead, aSegmentLengths ); // the lengths below are mandatory for PDF-exported Type1 fonts // because the PFB segment headers get stripped! WhyOhWhy. aLine.append( (sal_Int32)aSegmentLengths[0] ); @@ -4106,11 +4106,9 @@ bool PDFWriterImpl::emitFonts() // emit PFB-sections without section headers beginCompression(); checkAndEnableStreamEncryption( nFontStream ); - CHECK_RETURN( writeBuffer( pBuffer+ 6, aSegmentLengths[0] ) ); - CHECK_RETURN( writeBuffer( pBuffer+12 + aSegmentLengths[0], aSegmentLengths[1] ) ); - CHECK_RETURN( writeBuffer( pBuffer+18 + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) ); - - delete[] pBuffer; + CHECK_RETURN( writeBuffer( &pBuffer[6], aSegmentLengths[0] ) ); + CHECK_RETURN( writeBuffer( &pBuffer[12] + aSegmentLengths[0], aSegmentLengths[1] ) ); + CHECK_RETURN( writeBuffer( &pBuffer[18] + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) ); } else { -- cgit From bdb2890c55676da4b4a569ff914bf1a5bd717725 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 15:03:31 +0200 Subject: unoawt: added more functionality to XWizard --- svtools/inc/svtools/roadmapwizard.hxx | 6 ++- svtools/source/dialogs/roadmapwizard.cxx | 31 ++++++++++++-- svtools/source/uno/unowizard.hxx | 7 +++- svtools/source/uno/wizard/unowizard.cxx | 67 ++++++++++++++++++++++++++++++- svtools/source/uno/wizard/wizardshell.cxx | 6 +++ svtools/source/uno/wizard/wizardshell.hxx | 17 ++++++-- 6 files changed, 124 insertions(+), 10 deletions(-) diff --git a/svtools/inc/svtools/roadmapwizard.hxx b/svtools/inc/svtools/roadmapwizard.hxx index ee02f3b33ed7..5d8e0d9b01bb 100644 --- a/svtools/inc/svtools/roadmapwizard.hxx +++ b/svtools/inc/svtools/roadmapwizard.hxx @@ -142,7 +142,7 @@ protected: You can only activate paths which share the first k states with the path which is previously active (if any), where k is the index of the - current state within the current page. + current state within the current path. Say you have paths, (0,1,2,5) and (0,1,4,5). This means that after @@ -202,6 +202,10 @@ protected: */ void enableState( WizardState _nState, bool _bEnable = true ); + /** returns true if and only if the given state is known in at least one declared path + */ + bool knowsState( WizardState _nState ) const; + // OWizardMachine overriables virtual void enterState( WizardState _nState ); diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index e3e2350c62da..a2ffb8ad5849 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -342,15 +342,16 @@ namespace svt if ( (sal_Int32)aNewPathPos->second.size() <= nCurrentStatePathIndex ) return; -#if OSL_DEBUG_LEVEL > 0 // assert that the current and the new path are equal, up to nCurrentStatePathIndex Paths::const_iterator aActivePathPos = m_pImpl->aPaths.find( m_pImpl->nActivePath ); if ( aActivePathPos != m_pImpl->aPaths.end() ) { - DBG_ASSERT( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) > nCurrentStatePathIndex, - "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); + if ( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) <= nCurrentStatePathIndex ) + { + OSL_ENSURE( false, "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); + return; + } } -#endif m_pImpl->nActivePath = _nPathId; m_pImpl->bActivePathIsDefinite = _bDecideForIt; @@ -655,11 +656,33 @@ namespace svt // if the state is currently in the roadmap, reflect it's new status m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable ); } + + //-------------------------------------------------------------------- + bool RoadmapWizard::knowsState( WizardState i_nState ) const + { + for ( Paths::const_iterator path = m_pImpl->aPaths.begin(); + path != m_pImpl->aPaths.end(); + ++path + ) + { + for ( WizardPath::const_iterator state = path->second.begin(); + state != path->second.end(); + ++state + ) + { + if ( *state == i_nState ) + return true; + } + } + return false; + } + //-------------------------------------------------------------------- bool RoadmapWizard::isStateEnabled( WizardState _nState ) const { return m_pImpl->aDisabledStates.find( _nState ) == m_pImpl->aDisabledStates.end(); } + //-------------------------------------------------------------------- void RoadmapWizard::Resize() { diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx index 1aa639597d05..f227160f96bc 100644 --- a/svtools/source/uno/unowizard.hxx +++ b/svtools/source/uno/unowizard.hxx @@ -75,14 +75,18 @@ namespace svt { namespace uno virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; // ::com::sun::star::ui::dialogs::XWizard + virtual ::rtl::OUString SAL_CALL getHelpURL() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpURL( const ::rtl::OUString& _helpurl ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL travelNext( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL travelPrevious( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enablePage( ::sal_Int16 PageID, ::sal_Bool Enable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL updateTravelUI( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL advanceTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL goBackTo( ::sal_Int16 PageId ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL activatePath( ::sal_Int16 PathIndex, ::sal_Bool Final ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException); // ::com::sun::star::ui::dialogs::XExecutableDialog virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (::com::sun::star::uno::RuntimeException); @@ -102,6 +106,7 @@ namespace svt { namespace uno ::comphelper::ComponentContext m_aContext; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > > m_aWizardSteps; ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + ::rtl::OUString m_sHelpURL; }; //...................................................................................................................... diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index c01d7eb5f4cc..3169f5342f50 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -70,6 +70,8 @@ namespace svt { namespace uno using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::ui::dialogs::XWizardController; using ::com::sun::star::ui::dialogs::XWizardPage; + using ::com::sun::star::container::NoSuchElementException; + using ::com::sun::star::util::InvalidStateException; /** === end UNO using === **/ namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; @@ -205,12 +207,17 @@ namespace svt { namespace uno //-------------------------------------------------------------------- Dialog* Wizard::createDialog( Window* i_pParent ) { - return new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ); + Dialog* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); + pDialog->SetSmartHelpId( SmartId( m_sHelpURL ) ); + return pDialog; } //-------------------------------------------------------------------- void Wizard::destroyDialog() { + if ( m_pDialog ) + m_sHelpURL = m_pDialog->GetSmartHelpId().GetStr(); + Wizard_Base::destroyDialog(); } @@ -260,6 +267,31 @@ namespace svt { namespace uno return new ::cppu::OPropertyArrayHelper( aProps ); } + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pDialog ) + return m_sHelpURL; + + const SmartId aSmartId( m_pDialog->GetSmartHelpId() ); + return aSmartId.GetStr(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pDialog ) + m_sHelpURL = i_HelpURL; + else + m_pDialog->SetSmartHelpId( SmartId( i_HelpURL ) ); + } + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) { @@ -308,6 +340,24 @@ namespace svt { namespace uno return pWizardImpl->travelPrevious(); } + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); + + if ( !pWizardImpl->knowsPage( i_PageID ) ) + throw NoSuchElementException( ::rtl::OUString(), *this ); + + if ( i_PageID == pWizardImpl->getCurrentPage() ) + throw InvalidStateException( ::rtl::OUString(), *this ); + + pWizardImpl->enablePage( i_PageID, i_Enable ); + } + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException) { @@ -356,6 +406,21 @@ namespace svt { namespace uno return pWizardImpl->getCurrentWizardPage(); } + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) + throw NoSuchElementException( ::rtl::OUString(), *this ); + + WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); + + pWizardImpl->activatePath( i_PathIndex ); + } + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::setTitle( const ::rtl::OUString& i_Title ) throw (RuntimeException) { diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 140a65455f8e..1db8588ca713 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -209,6 +209,12 @@ namespace svt { namespace uno return pPage->getWizardPage(); } + //------------------------------------------------------------------------------------------------------------------ + void WizardShell::enablePage( const sal_Int16 i_nPageID, const sal_Bool i_bEnable ) + { + enableState( impl_pageIdToState( i_nPageID ), i_bEnable ); + } + //------------------------------------------------------------------------------------------------------------------ TabPage* WizardShell::createPage( WizardState i_nState ) { diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index f61666f46cc3..4c44f5512d58 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -84,15 +84,26 @@ namespace svt { namespace uno sal_Bool travelNext() { return WizardShell_Base::travelNext(); } sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } - void preExecute() + void activatePath( const sal_Int16 i_nPathID ) { - // activate the first page - ActivatePage(); + WizardShell_Base::activatePath( PathId( i_nPathID ) ); } ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > getCurrentWizardPage() const; + sal_Int16 getCurrentPage() const + { + return impl_stateToPageId( getCurrentState() ); + } + + void enablePage( const sal_Int16 i_PageID, const sal_Bool i_Enable ); + + bool knowsPage( const sal_Int16 i_nPageID ) const + { + return knowsState( impl_pageIdToState( i_nPageID ) ); + } + private: sal_Int16 impl_stateToPageId( const WizardTypes::WizardState i_nState ) const { -- cgit From 67beb47e3a75703c4e64becfcd144e1343bd08e9 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 21 May 2010 15:17:51 +0200 Subject: sw33bf04: #i111747#: nranges.cxx: remove superfluous wrong memset calls --- svl/source/items/nranges.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/svl/source/items/nranges.cxx b/svl/source/items/nranges.cxx index 284bc251a3a4..ae633276300f 100644 --- a/svl/source/items/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -480,7 +480,6 @@ SfxNumRanges& SfxNumRanges::operator -= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; @@ -690,7 +689,6 @@ SfxNumRanges& SfxNumRanges::operator /= NUMTYPE nThisSize = Count_Impl(_pRanges); NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) ); NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ]; - memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 ); memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize ); NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0; -- cgit From 0a19bf808bd6871825296c03993f5a6b49286802 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 15:44:37 +0200 Subject: unoawt: fixed a bug found by GCC's compiler warning --- svtools/source/uno/wizard/unowizard.cxx | 2 +- svtools/source/uno/wizard/wizardshell.hxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 3169f5342f50..ae9109fdfa00 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -418,7 +418,7 @@ namespace svt { namespace uno WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::activatePath: invalid dialog implementation!" ); - pWizardImpl->activatePath( i_PathIndex ); + pWizardImpl->activatePath( i_PathIndex, i_Final ); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 4c44f5512d58..b20c9bd6678a 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -84,9 +84,9 @@ namespace svt { namespace uno sal_Bool travelNext() { return WizardShell_Base::travelNext(); } sal_Bool travelPrevious() { return WizardShell_Base::travelPrevious(); } - void activatePath( const sal_Int16 i_nPathID ) + void activatePath( const sal_Int16 i_nPathID, const sal_Bool i_bFinal ) { - WizardShell_Base::activatePath( PathId( i_nPathID ) ); + WizardShell_Base::activatePath( PathId( i_nPathID ), i_bFinal ); } ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > -- cgit From a5bd7ab9d12517a3dacfc9201a616acad855c4cd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 21 May 2010 16:01:22 +0200 Subject: unoawt: some SolarMutex locks in the notification methods, to prevent deadlocks --- svtools/source/uno/svtxgridcontrol.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 1514d585cd98..264dfd6342f7 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -437,6 +437,8 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx } void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + std::vector< Any > newRow; Sequence< Any > rawRowData = Event.rowData; int colCount = m_xColumnModel->getColumnCount(); @@ -483,6 +485,8 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.index == -1) { @@ -524,6 +528,8 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize")) { @@ -571,6 +577,8 @@ void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid: } void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); + TableControl* pTable = (TableControl*)GetWindow(); if(Event.valueName == rtl::OUString::createFromAscii("RowHeight")) { -- cgit From c938b8a6908c27d74738b097d35092abc7329ef0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 24 May 2010 10:24:59 +0100 Subject: cmcfixes75: #i111792# check fread return value --- i18npool/source/localedata/saxparser.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx index 083d2097a54a..9787b9c810a6 100644 --- a/i18npool/source/localedata/saxparser.cxx +++ b/i18npool/source/localedata/saxparser.cxx @@ -125,13 +125,14 @@ Reference< XInputStream > createStreamFromFile( if( f ) { fseek( f , 0 , SEEK_END ); - int nLength = ftell( f ); + size_t nLength = ftell( f ); fseek( f , 0 , SEEK_SET ); Sequence seqIn(nLength); - fread( seqIn.getArray() , nLength , 1 , f ); - - r = Reference< XInputStream > ( new OInputStream( seqIn ) ); + if (fread( seqIn.getArray() , nLength , 1 , f ) == 1) + r = Reference< XInputStream > ( new OInputStream( seqIn ) ); + else + fprintf(stderr, "failure reading %s\n", pcFile); fclose( f ); } return r; -- cgit From f786d740fb0e108efbd471c8628daf3bf5f4bfe9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 10:17:24 +0200 Subject: unoawt: completely separated the controller functionality of a wizard page from the wizard page itself, by moving the canAdvance method from OWizardPage to the IWizardPage interface, which in this course has been renamed to IWizardPageController. This will later on allow to have implementations where the TabPage is provided by an external component (e.g. as UNO Service), but the controlling of those pages is still intercepted and handled internally. --- svtools/inc/svtools/wizardmachine.hxx | 37 +++--- svtools/source/dialogs/roadmapwizard.cxx | 10 +- svtools/source/dialogs/wizardmachine.cxx | 30 ++--- svtools/source/uno/wizard/wizardpageshell.cxx | 170 -------------------------- svtools/source/uno/wizard/wizardpageshell.hxx | 76 ------------ 5 files changed, 41 insertions(+), 282 deletions(-) delete mode 100644 svtools/source/uno/wizard/wizardpageshell.cxx delete mode 100644 svtools/source/uno/wizard/wizardpageshell.hxx diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx index 45d15390440f..9c1b8e2a6867 100644 --- a/svtools/inc/svtools/wizardmachine.hxx +++ b/svtools/inc/svtools/wizardmachine.hxx @@ -66,7 +66,7 @@ namespace svt }; }; - class SAL_NO_VTABLE IWizardPage : public WizardTypes + class SAL_NO_VTABLE IWizardPageController { public: //----------------------------------------------------------------- @@ -77,7 +77,16 @@ namespace svt // to be committed for this. // So initializePage and commitPage are designated to initialitzing/committing data on the page. virtual void initializePage() = 0; - virtual sal_Bool commitPage( CommitPageReason _eReason ) = 0; + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ) = 0; + + /** determines whether or not it is allowed to advance to a next page + + You should make this dependent on the current state of the page only, not on + states on other pages of the whole dialog. + + The default implementation always returns . + */ + virtual bool canAdvance() const = 0; }; //===================================================================== @@ -86,7 +95,7 @@ namespace svt class OWizardMachine; struct WizardPageImplData; - class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPage + class SVT_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController { private: WizardPageImplData* m_pImpl; @@ -100,23 +109,10 @@ namespace svt OWizardPage( Window* _pParent, const ResId& _rResId ); ~OWizardPage(); - // This methods behave somewhat different than ActivatePage/DeactivatePage - // The latter are handled by the base class itself whenever changing the pages is in the offing, - // i.e., when it's already decided which page is the next. - // We may have situations where the next page depends on the state of the current, which needs - // to be committed for this. - // So initializePage and commitPage are designated to initialitzing/committing data on the page. + // IWizardPageController overridables virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); - - /** determines whether or not it is allowed to advance to a next page - - You should make this dependent on the current state of the page only, not on - states on other pages of the whole dialog. - - The default implementation always returns . - */ - virtual bool canAdvance() const; + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; protected: // TabPage overridables @@ -342,7 +338,8 @@ namespace svt */ WizardState getCurrentState() const { return WizardDialog::GetCurLevel(); } - virtual IWizardPage* getWizardPage(TabPage* _pCurrentPage) const; + virtual IWizardPageController* + getPageController( TabPage* _pCurrentPage ) const; /** retrieves a copy of the state history, i.e. all states we already visited */ diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index a2ffb8ad5849..c28cfe1d4b18 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -398,8 +398,14 @@ namespace svt } // can we advance from the current page? - const OWizardPage* pCurrentPage = dynamic_cast< const OWizardPage* >( GetPage( getCurrentState() ) ); - const bool bCurrentPageCanAdvance = !pCurrentPage || pCurrentPage->canAdvance(); + bool bCurrentPageCanAdvance = true; + TabPage* pCurrentPage = GetPage( getCurrentState() ); + if ( pCurrentPage ) + { + const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + OSL_ENSURE( pController != NULL, "RoadmapWizard::implUpdateRoadmap: no controller for the current page!" ); + bCurrentPageCanAdvance = !pController || pController->canAdvance(); + } // now, we have to remove all items after nCurrentStatePathIndex, and insert the items from the active // path, up to (excluding) nUpperStepBoundary diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 1d1293334a3a..bc19a588a204 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #ifndef _SVTOOLS_HRC @@ -101,7 +102,7 @@ namespace svt } //--------------------------------------------------------------------- - sal_Bool OWizardPage::commitPage( CommitPageReason ) + sal_Bool OWizardPage::commitPage( WizardTypes::CommitPageReason ) { return sal_True; } @@ -419,9 +420,10 @@ namespace svt void OWizardMachine::enterState(WizardState _nState) { // tell the page - IWizardPage* pCurrentPage = getWizardPage(GetPage(_nState)); - if ( pCurrentPage ) - pCurrentPage->initializePage(); + IWizardPageController* pController = getPageController( GetPage( _nState ) ); + OSL_ENSURE( pController, "OWizardMachine::enterState: no controller for the given page!" ); + if ( pController ) + pController->initializePage(); if ( isAutomaticNextButtonStateEnabled() ) enableButtons( WZB_NEXT, canAdvance() ); @@ -471,10 +473,9 @@ namespace svt //--------------------------------------------------------------------- sal_Bool OWizardMachine::prepareLeaveCurrentState( CommitPageReason _eReason ) { - IWizardPage* pCurrentPage = getWizardPage(GetPage(getCurrentState())); - if ( pCurrentPage ) - return pCurrentPage->commitPage( _eReason ); - return sal_True; + IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + ENSURE_OR_RETURN( pController != NULL, "OWizardMachine::prepareLeaveCurrentState: no controller for the current page!", sal_True ); + return pController->commitPage( _eReason ); } //--------------------------------------------------------------------- @@ -688,10 +689,10 @@ namespace svt } //--------------------------------------------------------------------- - IWizardPage* OWizardMachine::getWizardPage(TabPage* _pCurrentPage) const + IWizardPageController* OWizardMachine::getPageController( TabPage* _pCurrentPage ) const { - OWizardPage* pPage = dynamic_cast< OWizardPage* >( _pCurrentPage ); - return pPage; + IWizardPageController* pController = dynamic_cast< IWizardPageController* >( _pCurrentPage ); + return pController; } //--------------------------------------------------------------------- @@ -714,11 +715,12 @@ namespace svt //--------------------------------------------------------------------- void OWizardMachine::updateTravelUI() { - OWizardPage* pPage = dynamic_cast< OWizardPage* >( GetPage( getCurrentState() ) ); + const IWizardPageController* pController = getPageController( GetPage( getCurrentState() ) ); + OSL_ENSURE( pController != NULL, "RoadmapWizard::updateTravelUI: no controller for the current page!" ); bool bCanAdvance = - ( !pPage || pPage->canAdvance() ) // the current page allows to advance - && canAdvance(); // the dialog as a whole allows to advance + ( !pController || pController->canAdvance() ) // the current page allows to advance + && canAdvance(); // the dialog as a whole allows to advance enableButtons( WZB_NEXT, bCanAdvance ); } diff --git a/svtools/source/uno/wizard/wizardpageshell.cxx b/svtools/source/uno/wizard/wizardpageshell.cxx deleted file mode 100644 index f75efe05da3d..000000000000 --- a/svtools/source/uno/wizard/wizardpageshell.cxx +++ /dev/null @@ -1,170 +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. - * - ************************************************************************/ - -#include "precompiled_svtools.hxx" - -#include "wizardpageshell.hxx" -#include "wizardshell.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -#include - -//...................................................................................................................... -namespace svt { namespace uno -{ -//...................................................................................................................... - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::ui::dialogs::XWizardController; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::lang::XComponent; - /** === end UNO using === **/ - using namespace ::com::sun::star; - - //================================================================================================================== - //= WizardPageShell - //================================================================================================================== - //------------------------------------------------------------------------------------------------------------------ - WizardPageShell::WizardPageShell( WizardShell& i_rParent, const Reference< XWizardController >& i_rController, - const sal_Int16 i_nPageId ) - :OWizardPage( &i_rParent, WB_CHILDDLGCTRL | WB_NODIALOGCONTROL ) - ,m_xController( i_rController ) - ,m_xWizardPage() - ,m_nPageId( i_nPageId ) - { - ENSURE_OR_THROW( m_xController.is(), "no controller" ); - try - { - m_xWizardPage.set( m_xController->createPage( - Reference< XWindow >( GetComponentInterface( TRUE ), UNO_QUERY_THROW ), - m_nPageId - ), UNO_SET_THROW ); - - Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); - - awt::Rectangle aContentRect( xPageWindow->getPosSize() ); - SetSizePixel( Size( aContentRect.X + aContentRect.Width, aContentRect.Y + aContentRect.Height ) ); - - xPageWindow->setVisible( sal_True ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - Show(); - } - - //------------------------------------------------------------------------------------------------------------------ - WizardPageShell::~WizardPageShell() - { - try - { - if ( m_xWizardPage.is() ) - m_xWizardPage->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - void WizardPageShell::initializePage() - { - OWizardPage::initializePage(); - if ( !m_xWizardPage.is() ) - return; - - try - { - m_xWizardPage->activatePage(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //------------------------------------------------------------------------------------------------------------------ - sal_Bool WizardPageShell::commitPage( CommitPageReason i_eReason ) - { - if ( !OWizardPage::commitPage( i_eReason ) ) - return sal_False; - - if ( !m_xWizardPage.is() ) - return sal_True; - - try - { - return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return sal_True; - } - - //------------------------------------------------------------------------------------------------------------------ - bool WizardPageShell::canAdvance() const - { - if ( !OWizardPage::canAdvance() ) - return false; - - if ( !m_xWizardPage.is() ) - return true; - - try - { - return m_xWizardPage->canAdvance(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return true; - } - -//...................................................................................................................... -} } // namespace svt::uno -//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpageshell.hxx b/svtools/source/uno/wizard/wizardpageshell.hxx deleted file mode 100644 index 25cfbb8b8505..000000000000 --- a/svtools/source/uno/wizard/wizardpageshell.hxx +++ /dev/null @@ -1,76 +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 SVT_UNOWIZ_WIZARDPAGESHELL_HXX -#define SVT_UNOWIZ_WIZARDPAGESHELL_HXX - -#include "svtools/wizardmachine.hxx" - -/** === begin UNO includes === **/ -#include -/** === end UNO includes === **/ - -//...................................................................................................................... -namespace svt { namespace uno -{ -//...................................................................................................................... - - class WizardShell; - - //================================================================================================================== - //= WizardPageShell - //================================================================================================================== - class WizardPageShell : public OWizardPage - { - public: - WizardPageShell( - WizardShell& i_rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, - const sal_Int16 i_nPageId - ); - ~WizardPageShell(); - - // IWizardPage overridables - virtual void initializePage(); - virtual sal_Bool commitPage( CommitPageReason _eReason ); - - // OWizardPage overridables (why isn't this method part of IWizardPage?) - virtual bool canAdvance() const; - - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >& - getWizardPage() const { return m_xWizardPage; } - - private: - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage; - const sal_Int16 m_nPageId; - }; - -//...................................................................................................................... -} } // namespace svt::uno -//...................................................................................................................... - -#endif // SVT_UNOWIZ_WIZARDPAGESHELL_HXX -- cgit From 593efd10b43af2db28333e3601d9abf94ce53bc6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 25 May 2010 11:02:07 +0200 Subject: vcl112: #i111798# assert failed system() call (thanks cmc!) --- vcl/unx/source/printergfx/printerjob.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx index 3e885d8af5b4..5e18849b8dfe 100644 --- a/vcl/unx/source/printergfx/printerjob.cxx +++ b/vcl/unx/source/printergfx/printerjob.cxx @@ -284,7 +284,8 @@ removeSpoolDir (const rtl::OUString& rSpoolDir) nChar = psp::appendStr ("rm -rf ", pSystem); nChar += psp::appendStr (aSysPathByte.getStr(), pSystem + nChar); - system (pSystem); + if (system (pSystem) == -1) + OSL_ENSURE( 0, "psprint: couldn't remove spool directory" ); } /* creates a spool directory with a "pidgin random" value based on -- cgit From 054dcada5c1432a70d20834445a248678b3318c7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 11:27:01 +0200 Subject: unoawt: now that we can separate the WizardPageController from the actual page, there's no need for a TabPage whose sole purpose was being a container for the externally-provided TabPage - hopefully this change will allow us fixing the keyboard traveling --- svtools/source/uno/wizard/makefile.mk | 2 +- svtools/source/uno/wizard/wizardpagecontroller.cxx | 186 +++++++++++++++++++++ svtools/source/uno/wizard/wizardpagecontroller.hxx | 75 +++++++++ svtools/source/uno/wizard/wizardshell.cxx | 32 +++- svtools/source/uno/wizard/wizardshell.hxx | 13 ++ 5 files changed, 302 insertions(+), 6 deletions(-) create mode 100644 svtools/source/uno/wizard/wizardpagecontroller.cxx create mode 100644 svtools/source/uno/wizard/wizardpagecontroller.hxx diff --git a/svtools/source/uno/wizard/makefile.mk b/svtools/source/uno/wizard/makefile.mk index 2beef5060475..521496fc5d48 100644 --- a/svtools/source/uno/wizard/makefile.mk +++ b/svtools/source/uno/wizard/makefile.mk @@ -41,7 +41,7 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= \ $(SLO)$/unowizard.obj \ $(SLO)$/wizardshell.obj \ - $(SLO)$/wizardpageshell.obj + $(SLO)$/wizardpagecontroller.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx new file mode 100644 index 000000000000..fae58a6d6dcd --- /dev/null +++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + +#include "precompiled_svtools.hxx" + +#include "wizardpagecontroller.hxx" +#include "wizardshell.hxx" + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::ui::dialogs::XWizardController; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::awt::XControl; + /** === end UNO using === **/ + using namespace ::com::sun::star; + + //================================================================================================================== + //= WizardPageController + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + WizardPageController::WizardPageController( WizardShell& i_rParent, const Reference< XWizardController >& i_rController, + const sal_Int16 i_nPageId ) + :m_xController( i_rController ) + ,m_xWizardPage() + ,m_nPageId( i_nPageId ) + { + ENSURE_OR_THROW( m_xController.is(), "no controller" ); + try + { + m_xWizardPage.set( m_xController->createPage( + Reference< XWindow >( i_rParent.GetComponentInterface( TRUE ), UNO_QUERY_THROW ), + m_nPageId + ), UNO_SET_THROW ); + + Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); + xPageWindow->setVisible( sal_True ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + WizardPageController::~WizardPageController() + { + try + { + if ( m_xWizardPage.is() ) + m_xWizardPage->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + TabPage* WizardPageController::getTabPage() const + { + ENSURE_OR_RETURN( m_xWizardPage.is(), "WizardPageController::getTabPage: no external wizard page!", NULL ); + try + { + Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); + Window* pPageWindow = VCLUnoHelper::GetWindow( xPageWindow ); + if ( pPageWindow == NULL ) + { + // windows created via the XContainerWindowProvider might be controls, not real windows, so resolve + // that one indirection + const Reference< XControl > xPageControl( m_xWizardPage->getWindow(), UNO_QUERY_THROW ); + xPageWindow.set( xPageControl->getPeer(), UNO_QUERY_THROW ); + pPageWindow = VCLUnoHelper::GetWindow( xPageWindow ); + } + + OSL_ENSURE( pPageWindow != NULL, "WizardPageController::getTabPage: unable to find the Window implementation for the page's window!" ); + return dynamic_cast< TabPage* >( pPageWindow ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void WizardPageController::initializePage() + { + if ( !m_xWizardPage.is() ) + return; + + try + { + m_xWizardPage->activatePage(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Bool WizardPageController::commitPage( WizardTypes::CommitPageReason i_eReason ) + { + if ( !m_xWizardPage.is() ) + return sal_True; + + try + { + return m_xWizardPage->commitPage( WizardShell::convertCommitReasonToTravelType( i_eReason ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_True; + } + + //------------------------------------------------------------------------------------------------------------------ + bool WizardPageController::canAdvance() const + { + if ( !m_xWizardPage.is() ) + return true; + + try + { + return m_xWizardPage->canAdvance(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return true; + } + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx new file mode 100644 index 000000000000..9de04d2f0dd4 --- /dev/null +++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX +#define SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX + +#include "svtools/wizardmachine.hxx" + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +//...................................................................................................................... +namespace svt { namespace uno +{ +//...................................................................................................................... + + class WizardShell; + + //================================================================================================================== + //= WizardPageController + //================================================================================================================== + class WizardPageController : public IWizardPageController + { + public: + WizardPageController( + WizardShell& i_rParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, + const sal_Int16 i_nPageId + ); + ~WizardPageController(); + + // IWizardPageController overridables + virtual void initializePage(); + virtual sal_Bool commitPage( WizardTypes::CommitPageReason _eReason ); + virtual bool canAdvance() const; + + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage >& + getWizardPage() const { return m_xWizardPage; } + TabPage* getTabPage() const; + + private: + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > m_xWizardPage; + const sal_Int16 m_nPageId; + }; + +//...................................................................................................................... +} } // namespace svt::uno +//...................................................................................................................... + +#endif // SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 1db8588ca713..51dbbe3f2013 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -27,7 +27,7 @@ #include "precompiled_svtools.hxx" #include "wizardshell.hxx" -#include "wizardpageshell.hxx" +#include "wizardpagecontroller.hxx" #include @@ -200,13 +200,23 @@ namespace svt { namespace uno return sal_True; } + //------------------------------------------------------------------------------------------------------------------ + PWizardPageController WizardShell::impl_getController( TabPage* i_pPage ) const + { + Page2ControllerMap::const_iterator pos = m_aPageControllers.find( i_pPage ); + ENSURE_OR_RETURN( pos != m_aPageControllers.end(), "WizardShell::impl_getController: no controller for this page!", PWizardPageController() ); + return pos->second; + } + //------------------------------------------------------------------------------------------------------------------ Reference< XWizardPage > WizardShell::getCurrentWizardPage() const { const WizardState eState = getCurrentState(); - const WizardPageShell* pPage = dynamic_cast< const WizardPageShell* >( GetPage( eState ) ); - ENSURE_OR_RETURN( pPage, "WizardShell::getCurrentWizardPage: invalid page/implementation!", NULL ); - return pPage->getWizardPage(); + + PWizardPageController pController( impl_getController( GetPage( eState ) ) ); + ENSURE_OR_RETURN( pController, "WizardShell::getCurrentWizardPage: invalid page/controller!", NULL ); + + return pController->getWizardPage(); } //------------------------------------------------------------------------------------------------------------------ @@ -219,7 +229,19 @@ namespace svt { namespace uno TabPage* WizardShell::createPage( WizardState i_nState ) { ENSURE_OR_RETURN( m_xController.is(), "WizardShell::createPage: no WizardController!", NULL ); - return new WizardPageShell( *this, m_xController, impl_stateToPageId( i_nState ) ); + + ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) ); + TabPage* pPage = pController->getTabPage(); + ENSURE_OR_RETURN( pPage != NULL, "WizardShell::createPage: illegal tab page!", NULL ); + + m_aPageControllers[ pPage ] = pController; + return pPage; + } + + //------------------------------------------------------------------------------------------------------------------ + IWizardPageController* WizardShell::getPageController( TabPage* i_pCurrentPage ) const + { + return impl_getController( i_pCurrentPage ).get(); } //------------------------------------------------------------------------------------------------------------------ diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index b20c9bd6678a..b21e1c4756e5 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -34,11 +34,17 @@ #include +#include +#include + //...................................................................................................................... namespace svt { namespace uno { //...................................................................................................................... + class WizardPageController; + typedef ::boost::shared_ptr< WizardPageController > PWizardPageController; + //================================================================================================================== //= WizardShell //================================================================================================================== @@ -65,6 +71,8 @@ namespace svt { namespace uno virtual String getStateDisplayName( WizardState i_nState ) const; virtual bool canAdvance() const; virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual IWizardPageController* + getPageController( TabPage* _pCurrentPage ) const; // attribute access const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& @@ -115,6 +123,8 @@ namespace svt { namespace uno return static_cast< WizardState >( i_nPageId - m_nFirstPageID ); } + PWizardPageController impl_getController( TabPage* i_pPage ) const; + // prevent outside access to some base class members using WizardShell_Base::skip; using WizardShell_Base::skipUntil; @@ -122,9 +132,12 @@ namespace svt { namespace uno using WizardShell_Base::getCurrentState; private: + typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard; const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; const sal_Int16 m_nFirstPageID; + Page2ControllerMap m_aPageControllers; }; //...................................................................................................................... -- cgit From 07030790f7a7fb4d16806cd1f70047717cc07129 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 11:43:39 +0200 Subject: unoawt: onFinish does not need this parameter, it's always called with RET_OK --- svtools/inc/svtools/wizardmachine.hxx | 2 +- svtools/source/dialogs/wizardmachine.cxx | 7 +++---- svtools/source/uno/wizard/wizardshell.cxx | 6 +++--- svtools/source/uno/wizard/wizardshell.hxx | 2 +- svtools/workben/unodialog/roadmapskeleton.cxx | 4 ++-- svtools/workben/unodialog/roadmapskeleton.hxx | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx index 9c1b8e2a6867..05e796646253 100644 --- a/svtools/inc/svtools/wizardmachine.hxx +++ b/svtools/inc/svtools/wizardmachine.hxx @@ -259,7 +259,7 @@ namespace svt /** called when the finish button is pressed

By default, only the base class' Finnish method (which is not virtual) is called

*/ - virtual sal_Bool onFinish(sal_Int32 _nResult); + virtual sal_Bool onFinish(); /// travel to the next state sal_Bool travelNext(); diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index bc19a588a204..5a5c094c1572 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -445,9 +445,9 @@ namespace svt } //--------------------------------------------------------------------- - sal_Bool OWizardMachine::onFinish(sal_Int32 _nResult) + sal_Bool OWizardMachine::onFinish() { - return Finnish(_nResult); + return Finnish( RET_OK ); } //--------------------------------------------------------------------- @@ -460,8 +460,7 @@ namespace svt { return 0L; } - long nRet = onFinish( RET_OK ); - return nRet; + return onFinish() ? 1L : 0L; } //--------------------------------------------------------------------- diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 51dbbe3f2013..fb78e4a7bd11 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -276,11 +276,11 @@ namespace svt { namespace uno } //------------------------------------------------------------------------------------------------------------------ - sal_Bool WizardShell::onFinish( sal_Int32 i_nResult ) + sal_Bool WizardShell::onFinish() { try { - if ( ( i_nResult == RET_OK ) && m_xController.is() && !m_xController->confirmFinish() ) + if ( m_xController.is() && !m_xController->confirmFinish() ) return sal_False; } catch( const Exception& ) @@ -288,7 +288,7 @@ namespace svt { namespace uno DBG_UNHANDLED_EXCEPTION(); } - return WizardShell_Base::onFinish( i_nResult ); + return WizardShell_Base::onFinish(); } //...................................................................................................................... diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index b21e1c4756e5..ffe4c1fc37f8 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -70,7 +70,7 @@ namespace svt { namespace uno virtual sal_Bool leaveState( WizardState i_nState ); virtual String getStateDisplayName( WizardState i_nState ) const; virtual bool canAdvance() const; - virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual sal_Bool onFinish(); virtual IWizardPageController* getPageController( TabPage* _pCurrentPage ) const; diff --git a/svtools/workben/unodialog/roadmapskeleton.cxx b/svtools/workben/unodialog/roadmapskeleton.cxx index f261f219c3fd..e3ed06707f14 100644 --- a/svtools/workben/unodialog/roadmapskeleton.cxx +++ b/svtools/workben/unodialog/roadmapskeleton.cxx @@ -103,9 +103,9 @@ namespace udlg } //-------------------------------------------------------------------- - sal_Bool RoadmapSkeletonDialog::onFinish( sal_Int32 _nResult ) + sal_Bool RoadmapSkeletonDialog::onFinish() { - return RoadmapSkeletonDialog_Base::onFinish( _nResult ); + return RoadmapSkeletonDialog_Base::onFinish(); } //........................................................................ diff --git a/svtools/workben/unodialog/roadmapskeleton.hxx b/svtools/workben/unodialog/roadmapskeleton.hxx index 216c940b842a..8859390c4b58 100644 --- a/svtools/workben/unodialog/roadmapskeleton.hxx +++ b/svtools/workben/unodialog/roadmapskeleton.hxx @@ -52,7 +52,7 @@ namespace udlg virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); virtual sal_Bool leaveState( WizardState _nState ); virtual WizardState determineNextState( WizardState _nCurrentState ) const; - virtual sal_Bool onFinish( sal_Int32 _nResult ); + virtual sal_Bool onFinish(); private: ::comphelper::ComponentContext m_aContext; -- cgit From 55ddf84a5f06e93afe9e03ccc4a97b5af280e17f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 12:23:56 +0200 Subject: unoawt: set the WB_CHILDDLGCTRL bit at the tab page, this ensures proper keyboard (TAB) traveling --- svtools/source/uno/wizard/wizardpagecontroller.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx index fae58a6d6dcd..d6f7029b477c 100644 --- a/svtools/source/uno/wizard/wizardpagecontroller.cxx +++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx @@ -81,6 +81,10 @@ namespace svt { namespace uno Reference< XWindow > xPageWindow( m_xWizardPage->getWindow(), UNO_SET_THROW ); xPageWindow->setVisible( sal_True ); + + TabPage* pTabPage( getTabPage() ); + if ( pTabPage ) + pTabPage->SetStyle( pTabPage->GetStyle() | WB_CHILDDLGCTRL | WB_DIALOGCONTROL ); } catch( const Exception& ) { -- cgit From 4e5d6754bfc3b3c9f726483be467e7c0ea59c43c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 25 May 2010 14:15:22 +0200 Subject: unoawt: set Title as TitleBase --- svtools/source/uno/wizard/unowizard.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index ae9109fdfa00..08b0211d6173 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -207,8 +207,9 @@ namespace svt { namespace uno //-------------------------------------------------------------------- Dialog* Wizard::createDialog( Window* i_pParent ) { - Dialog* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); + WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); pDialog->SetSmartHelpId( SmartId( m_sHelpURL ) ); + pDialog->setTitleBase( m_sTitle ); return pDialog; } -- cgit From 7295d72f7c3b49039bad9db00588813d27ab72df Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 25 May 2010 15:48:41 +0200 Subject: vcl112: #i110881# do not set mwm hint on fullscreen window --- vcl/unx/source/app/wmadaptor.cxx | 99 +++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index fb2317e19573..1a116fcbe8d6 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -1407,56 +1407,59 @@ void WMAdaptor::setFrameTypeAndDecoration( X11SalFrame* pFrame, WMWindowType eTy pFrame->meWindowType = eType; pFrame->mnDecorationFlags = nDecorationFlags; - // set mwm hints - struct _mwmhints { - unsigned long flags, func, deco; - long input_mode; - unsigned long status; - } aHint; - - aHint.flags = 15; /* flags for functions, decoration, input mode and status */ - aHint.deco = 0; - aHint.func = 1L << 2; - aHint.status = 0; - aHint.input_mode = 0; - - // evaluate decoration flags - if( nDecorationFlags & decoration_All ) - aHint.deco = 1, aHint.func = 1; - else - { - if( nDecorationFlags & decoration_Title ) - aHint.deco |= 1L << 3; - if( nDecorationFlags & decoration_Border ) - aHint.deco |= 1L << 1; - if( nDecorationFlags & decoration_Resize ) - aHint.deco |= 1L << 2, aHint.func |= 1L << 1; - if( nDecorationFlags & decoration_MinimizeBtn ) - aHint.deco |= 1L << 5, aHint.func |= 1L << 3; - if( nDecorationFlags & decoration_MaximizeBtn ) - aHint.deco |= 1L << 6, aHint.func |= 1L << 4; - if( nDecorationFlags & decoration_CloseBtn ) - aHint.deco |= 1L << 4, aHint.func |= 1L << 5; - } - // evaluate window type - switch( eType ) + if( ! pFrame->mbFullScreen ) { - case windowType_ModalDialogue: - aHint.input_mode = 1; - break; - default: - break; - } + // set mwm hints + struct _mwmhints { + unsigned long flags, func, deco; + long input_mode; + unsigned long status; + } aHint; + + aHint.flags = 15; /* flags for functions, decoration, input mode and status */ + aHint.deco = 0; + aHint.func = 1L << 2; + aHint.status = 0; + aHint.input_mode = 0; + + // evaluate decoration flags + if( nDecorationFlags & decoration_All ) + aHint.deco = 1, aHint.func = 1; + else + { + if( nDecorationFlags & decoration_Title ) + aHint.deco |= 1L << 3; + if( nDecorationFlags & decoration_Border ) + aHint.deco |= 1L << 1; + if( nDecorationFlags & decoration_Resize ) + aHint.deco |= 1L << 2, aHint.func |= 1L << 1; + if( nDecorationFlags & decoration_MinimizeBtn ) + aHint.deco |= 1L << 5, aHint.func |= 1L << 3; + if( nDecorationFlags & decoration_MaximizeBtn ) + aHint.deco |= 1L << 6, aHint.func |= 1L << 4; + if( nDecorationFlags & decoration_CloseBtn ) + aHint.deco |= 1L << 4, aHint.func |= 1L << 5; + } + // evaluate window type + switch( eType ) + { + case windowType_ModalDialogue: + aHint.input_mode = 1; + break; + default: + break; + } - // set the hint - XChangeProperty( m_pDisplay, - pFrame->GetShellWindow(), - m_aWMAtoms[ MOTIF_WM_HINTS ], - m_aWMAtoms[ MOTIF_WM_HINTS ], - 32, - PropModeReplace, - (unsigned char*)&aHint, - 5 ); + // set the hint + XChangeProperty( m_pDisplay, + pFrame->GetShellWindow(), + m_aWMAtoms[ MOTIF_WM_HINTS ], + m_aWMAtoms[ MOTIF_WM_HINTS ], + 32, + PropModeReplace, + (unsigned char*)&aHint, + 5 ); + } // set transientFor hint /* #91030# dtwm will not map a dialogue if the transient -- cgit From 27ed1825a087bedfb0e1f117a7bfc2a2f405333a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 26 May 2010 15:50:21 +0200 Subject: fwk139: #i101937# integrate patch --- comphelper/source/misc/makefile.mk | 1 + comphelper/source/misc/mediadescriptor.cxx | 121 +---------------------------- 2 files changed, 2 insertions(+), 120 deletions(-) diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index 94837ce49df9..5ad7e3ed289e 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -92,6 +92,7 @@ SLOFILES= \ $(SLO)$/comphelper_module.obj \ $(SLO)$/comphelper_services.obj \ $(SLO)$/componentbase.obj \ + $(SLO)$/stillreadwriteinteraction.obj \ # --- Targets ---------------------------------- diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 7e3be338992b..23daea5543a9 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" #include +#include //_______________________________________________ // includes @@ -59,22 +60,10 @@ #include #endif -#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ -#include -#endif - -#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ -#include -#endif - #ifndef __COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP__ #include #endif -#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ -#include -#endif - #ifndef __COM_SUN_STAR_URI_XURIREFERENCEFACTORY_HPP__ #include #endif @@ -667,114 +656,6 @@ sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference } /*-----------------------------------------------*/ -class StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction -{ - private: - static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0; - static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1; - - sal_Bool m_bUsed; - sal_Bool m_bHandledByMySelf; - sal_Bool m_bHandledByInternalHandler; - - public: - StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler) - : m_bUsed (sal_False) - , m_bHandledByMySelf (sal_False) - , m_bHandledByInternalHandler(sal_False) - { - ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions; - ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest; - - aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; - aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); - aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); - aInterceptedRequest.MatchExact = sal_False; - lInterceptions.push_back(aInterceptedRequest); - - aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; - aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); - aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); - aInterceptedRequest.MatchExact = sal_False; - lInterceptions.push_back(aInterceptedRequest); - - setInterceptedHandler(xHandler); - setInterceptions(lInterceptions); - } - - void resetInterceptions() - { - setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >()); - } - - void resetErrorStates() - { - m_bUsed = sal_False; - m_bHandledByMySelf = sal_False; - m_bHandledByInternalHandler = sal_False; - } - - sal_Bool wasWriteError() - { - return (m_bUsed && m_bHandledByMySelf); - } - - private: - virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest) - { - // we are used! - m_bUsed = sal_True; - - // check if its a real interception - might some parameters are not the right ones ... - sal_Bool bAbort = sal_False; - switch(aRequest.Handle) - { - case HANDLE_INTERACTIVEIOEXCEPTION: - { - css::ucb::InteractiveIOException exIO; - xRequest->getRequest() >>= exIO; - bAbort = ( - (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) - || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) -#ifdef MACOSX - // this is a workaround for MAC, on this platform if the file is locked - // the returned error code looks to be wrong - || (exIO.Code == css::ucb::IOErrorCode_GENERAL ) -#endif - ); - } - break; - - case HANDLE_UNSUPPORTEDDATASINKEXCEPTION: - { - bAbort = sal_True; - } - break; - } - - // handle interaction by ourself - if (bAbort) - { - m_bHandledByMySelf = sal_True; - css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation( - xRequest->getContinuations(), - ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0))); - if (!xAbort.is()) - return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND; - xAbort->select(); - return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; - } - - // Otherwhise use internal handler. - if (m_xInterceptedHandler.is()) - { - m_bHandledByInternalHandler = sal_True; - m_xInterceptedHandler->handle(xRequest); - } - return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; - } -}; /*----------------------------------------------- 25.03.2004 12:29 -- cgit From 8134108d479d5671577a4680c4f912fd8fbdc5e3 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 26 May 2010 15:59:27 +0200 Subject: fwk139: #i101937# integrate patch --- .../inc/comphelper/stillreadwriteinteraction.hxx | 69 ++++++++++ .../source/misc/stillreadwriteinteraction.cxx | 144 +++++++++++++++++++++ 2 files changed, 213 insertions(+) create mode 100644 comphelper/inc/comphelper/stillreadwriteinteraction.hxx create mode 100644 comphelper/source/misc/stillreadwriteinteraction.cxx diff --git a/comphelper/inc/comphelper/stillreadwriteinteraction.hxx b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx new file mode 100644 index 000000000000..1ade47220c6f --- /dev/null +++ b/comphelper/inc/comphelper/stillreadwriteinteraction.hxx @@ -0,0 +1,69 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef _COMPHELPER_STILLREADWRITEINTERACTION_HXX_ +#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_ + +//_______________________________________________ +// includes +#include + +#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__ +#include +#endif + +#include +#include "comphelper/comphelperdllapi.h" + +//_______________________________________________ +// namespace + +namespace comphelper{ +class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction +{ +private: + static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0; + static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1; + + sal_Bool m_bUsed; + sal_Bool m_bHandledByMySelf; + sal_Bool m_bHandledByInternalHandler; + +public: + StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler); + + void resetInterceptions(); + void resetErrorStates(); + sal_Bool wasWriteError(); + +private: + virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest); + +}; +} +#endif diff --git a/comphelper/source/misc/stillreadwriteinteraction.cxx b/comphelper/source/misc/stillreadwriteinteraction.cxx new file mode 100644 index 000000000000..9054f0754b5e --- /dev/null +++ b/comphelper/source/misc/stillreadwriteinteraction.cxx @@ -0,0 +1,144 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied 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_comphelper.hxx" +#include + +#ifndef __COM_SUN_STAR_UCB_INTERACTIVEIOEXCEPTION_HPP__ +#include +#endif + +#ifndef __COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP__ +#include +#endif + +#ifndef __COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP__ +#include +#endif + +namespace comphelper{ + + namespace css = ::com::sun::star; + +StillReadWriteInteraction::StillReadWriteInteraction(const css::uno::Reference< css::task::XInteractionHandler >& xHandler) + : m_bUsed (sal_False) + , m_bHandledByMySelf (sal_False) + , m_bHandledByInternalHandler(sal_False) +{ + ::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest > lInterceptions; + ::ucbhelper::InterceptedInteraction::InterceptedRequest aInterceptedRequest; + + aInterceptedRequest.Handle = HANDLE_INTERACTIVEIOEXCEPTION; + aInterceptedRequest.Request <<= css::ucb::InteractiveIOException(); + aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); + aInterceptedRequest.MatchExact = sal_False; + lInterceptions.push_back(aInterceptedRequest); + + aInterceptedRequest.Handle = HANDLE_UNSUPPORTEDDATASINKEXCEPTION; + aInterceptedRequest.Request <<= css::ucb::UnsupportedDataSinkException(); + aInterceptedRequest.Continuation = ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0)); + aInterceptedRequest.MatchExact = sal_False; + lInterceptions.push_back(aInterceptedRequest); + + setInterceptedHandler(xHandler); + setInterceptions(lInterceptions); +} + +void StillReadWriteInteraction::resetInterceptions() +{ + setInterceptions(::std::vector< ::ucbhelper::InterceptedInteraction::InterceptedRequest >()); +} + +void StillReadWriteInteraction::resetErrorStates() +{ + m_bUsed = sal_False; + m_bHandledByMySelf = sal_False; + m_bHandledByInternalHandler = sal_False; +} + +sal_Bool StillReadWriteInteraction::wasWriteError() +{ + return (m_bUsed && m_bHandledByMySelf); +} + +ucbhelper::InterceptedInteraction::EInterceptionState StillReadWriteInteraction::intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest, + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest) +{ + // we are used! + m_bUsed = sal_True; + + // check if its a real interception - might some parameters are not the right ones ... + sal_Bool bAbort = sal_False; + switch(aRequest.Handle) + { + case HANDLE_INTERACTIVEIOEXCEPTION: + { + css::ucb::InteractiveIOException exIO; + xRequest->getRequest() >>= exIO; + bAbort = ( + (exIO.Code == css::ucb::IOErrorCode_ACCESS_DENIED ) + || (exIO.Code == css::ucb::IOErrorCode_LOCKING_VIOLATION ) + || (exIO.Code == css::ucb::IOErrorCode_NOT_EXISTING ) +#ifdef MACOSX + // this is a workaround for MAC, on this platform if the file is locked + // the returned error code looks to be wrong + || (exIO.Code == css::ucb::IOErrorCode_GENERAL ) +#endif + ); + } + break; + + case HANDLE_UNSUPPORTEDDATASINKEXCEPTION: + { + bAbort = sal_True; + } + break; + } + + // handle interaction by ourself + if (bAbort) + { + m_bHandledByMySelf = sal_True; + css::uno::Reference< css::task::XInteractionContinuation > xAbort = ::ucbhelper::InterceptedInteraction::extractContinuation( + xRequest->getContinuations(), + ::getCppuType(static_cast< css::uno::Reference< css::task::XInteractionAbort >* >(0))); + if (!xAbort.is()) + return ::ucbhelper::InterceptedInteraction::E_NO_CONTINUATION_FOUND; + xAbort->select(); + return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; + } + + // Otherwhise use internal handler. + if (m_xInterceptedHandler.is()) + { + m_bHandledByInternalHandler = sal_True; + m_xInterceptedHandler->handle(xRequest); + } + return ::ucbhelper::InterceptedInteraction::E_INTERCEPTED; +} +} -- cgit From d0fdd4f0c77bd5fdccb7f7eb1d49dba4e5d1657a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 26 May 2010 16:28:48 +0200 Subject: vcl112: #i111824# fix detached monitors case for more than two monitors (thanks thb !) --- vcl/win/source/app/salinfo.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index b7ea81d313ae..14cb5d63437a 100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -160,7 +160,8 @@ bool WinSalSystem::initMonitors() std::hash_map< rtl::OUString, int, rtl::OUStringHash > aDeviceStringCount; while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) ) { - if( (aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) == 0 ) // sort out non monitors + if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE) + && !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors { aDev.DeviceName[31] = 0; aDev.DeviceString[127] = 0; -- cgit From f02b283bb7a6264f33cbfc106ff8f93a19ad4d6f Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 27 May 2010 12:34:12 +0200 Subject: #i111715# corrected numerical cases for polygon clipper and geometry creator --- basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 11955ceb22f9..e03aadfe1577 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -364,7 +364,8 @@ namespace basegfx if(fTools::moreOrEqual(fCutB, fZero) && fTools::less(fCutB, fOne)) { // cut is in both ranges. Add points for A and B - if(fTools::equalZero(fCutA)) + // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy + if(fTools::equal(fCutA, fZero)) { // ignore for start point in first edge; this is handled // by outer methods and would just produce a double point @@ -379,7 +380,8 @@ namespace basegfx rTempPointsA.push_back(temporaryPoint(aCutPoint, a, fCutA)); } - if(fTools::equalZero(fCutB)) + // #i111715# use fTools::equal instead of fTools::equalZero for better accuracy + if(fTools::equal(fCutB, fZero)) { // ignore for start point in first edge; this is handled // by outer methods and would just produce a double point -- cgit From 03772c9d2d0261426fe455fcd191677579131d0c Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 27 May 2010 14:50:17 +0200 Subject: l10ntooling18: fixed some windows build issues --- l10ntools/source/localize.cxx | 2 +- l10ntools/source/merge.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 9379590d089c..ec34650060ea 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -965,7 +965,7 @@ int _cdecl main( int argc, char *argv[] ) { ByteString sFileNameWithExt( sFileName ); sFileNameWithExt += ByteString( "." ); - sFileNameWithExt += ByteString( (*iter).c_str() , (*iter).length() ); + sFileNameWithExt += ByteString( (*iter).c_str() ); aIter.Extract( sFileNameWithExt ); } if( bQuiet2 ){ printf("\n%d files found!\n",aIter.GetFileCnt());} diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index ace119da106c..b98bc53a6adb 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -55,7 +55,7 @@ BOOL PFormEntrys::GetTransex3Text( ByteString &rReturn, { BOOL rc = GetText( rReturn , nTyp , nLangIndex , bDel ); ByteString test( rReturn ); - for( int idx = 0; idx < rReturn.Len(); idx++ ) + for( USHORT idx = 0; idx < rReturn.Len(); idx++ ) { if( rReturn.GetChar( idx ) == '\"' && ( idx-1 > 0 ) && rReturn.GetChar( idx-1 ) == '\\' ) { -- cgit From 5afb6daf09274f33457198cfd4d3448f0bfc05bb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 27 May 2010 18:07:17 +0200 Subject: vcl112: #b6951113# be robust wrt slighly standard deviating PPD files --- vcl/unx/source/gdi/salprnpsp.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index 3491622f783c..90c6a196143e 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -694,6 +694,18 @@ BOOL PspSalInfoPrinter::SetData( pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : NULL; + + // some PPD files do not specify the standard paper names (e.g. C5 instead of EnvC5) + // try to find the correct paper anyway using the size + if( pKey && ! pValue && pJobSetup->mePaperFormat != PAPER_USER ) + { + PaperInfo aInfo( pJobSetup->mePaperFormat ); + aPaper = aData.m_pParser->matchPaper( + TenMuToPt( aInfo.getWidth() ), + TenMuToPt( aInfo.getHeight() ) ); + pValue = pKey->getValueCaseInsensitive( aPaper ); + } + if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) ) return FALSE; } -- cgit From 126d4b4f8dde5f4f7588a9c49043f9c90fe86ebb Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 28 May 2010 13:51:26 +0200 Subject: l10ntooling17: #i100845# add support for java properties --- l10ntools/java/jpropex/build.xml | 169 +++++++++ l10ntools/java/jpropex/java/JPropEx.java | 428 ++++++++++++++++++++++ l10ntools/java/jpropex/java/Main.java | 38 ++ l10ntools/java/jpropex/java/NoLocalizeFilter.java | 56 +++ l10ntools/java/jpropex/java/OrderedHashMap.java | 96 +++++ l10ntools/java/jpropex/java/SdfData.java | 109 ++++++ l10ntools/java/jpropex/java/SdfEntity.java | 254 +++++++++++++ l10ntools/java/jpropex/jpropex | 10 + l10ntools/java/jpropex/jpropex.MF | 1 + l10ntools/java/jpropex/makefile.mk | 36 ++ 10 files changed, 1197 insertions(+) create mode 100755 l10ntools/java/jpropex/build.xml create mode 100644 l10ntools/java/jpropex/java/JPropEx.java create mode 100644 l10ntools/java/jpropex/java/Main.java create mode 100644 l10ntools/java/jpropex/java/NoLocalizeFilter.java create mode 100644 l10ntools/java/jpropex/java/OrderedHashMap.java create mode 100644 l10ntools/java/jpropex/java/SdfData.java create mode 100644 l10ntools/java/jpropex/java/SdfEntity.java create mode 100755 l10ntools/java/jpropex/jpropex create mode 100755 l10ntools/java/jpropex/jpropex.MF create mode 100755 l10ntools/java/jpropex/makefile.mk diff --git a/l10ntools/java/jpropex/build.xml b/l10ntools/java/jpropex/build.xml new file mode 100755 index 000000000000..d74fb3975d0f --- /dev/null +++ b/l10ntools/java/jpropex/build.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java new file mode 100644 index 000000000000..a4a17060d1f8 --- /dev/null +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -0,0 +1,428 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +import java.util.*; +import java.io.*; + +public class JPropEx +{ + private String inputFileArg = ""; + private String outputFileArg = ""; + private String pathPrefixArg = ""; + private String pathPostfixArg = ""; + private String projectArg = ""; + private String rootArg = ""; + private Vector forcedLangsArg; + private Vector langsArg; + private String inputSdfFileArg = ""; + private boolean isQuiet = false; + private final String resourceType = "javaproperties"; + private final String sourceLanguage = "en-US"; + //private SdfData data; + + public JPropEx() + { + //data = new SdfData(); + } + + public JPropEx( String args[] ) + { + super(); + parseArguments( args ); + testCL(); + //testArguments(); + if( inputSdfFileArg != null && inputSdfFileArg.length() > 0 ) + merge(); + else + extract(); + } + + private String getSimpleArg( String[] args , int x ) + { + if( x < args.length ) x++; + else + { + System.err.println("ERROR: Missing arg for "+args[ x ]+"\n"); + help(); + } + return args[ x ]; + } + private Vector getComplexArg( String[] args , int x ) + { + if( x < args.length ) x++; + else + { + System.err.println("ERROR: Missing arg for "+args[ x ]+"\n"); + help(); + } + String value = args[ x ]; + Vector values = new Vector( Arrays.asList( value.split(",") ) ); + return values; + } + + private void testCL() + { + if( inputFileArg.length()>0 && ( ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) || outputFileArg.length()>0 ) && projectArg.length()>0 && rootArg.length()>0 && langsArg.size()>0 ) + if( ( inputSdfFileArg.length()>0 && ( outputFileArg.length()>0 || ( pathPrefixArg.length()>0 && pathPostfixArg.length()>0 ) ) ) || ( inputFileArg.length()>0 && outputFileArg.length()>0 ) ) + return; + System.out.println("ERROR: Strange parameters!"); + help(); + System.exit( -1 ); + } + private void help() + { + System.out.println("jpropex -> extract / merge java properties files"); + System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata"); + System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US"); + System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename )"); + System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); + System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); + System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -o ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/ -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); + System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivooo -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); + System.exit( -1 ); + } + + private void extract() + { + SdfData data = new SdfData(); + java.util.Properties prop = loadProp( inputFileArg ); + + // Get a prototype that already contains the most common settings + SdfEntity dolly = prepareSdfObj( inputFileArg ); + String key; + SdfEntity currentStr; + String value; + for( Enumeration e = prop.propertyNames() ; e.hasMoreElements() ; ) + { + key = (String) e.nextElement(); + currentStr = (SdfEntity) dolly.clone(); + // Set the new LID and the string text + currentStr.setLid( key ); + value = prop.getProperty( key , "" ); + //if( value.equals("") ) System.err.println("Warning: in file "+inputFileArg+" the string with the key "+key+" has a empty string!"); + currentStr.setText( (prop.getProperty( key )).replaceAll("\t" , " " ) ); // TODO: Quoting!!!! + data.add( currentStr ); + } + data.write( outputFileArg ); + } + + private SdfEntity prepareSdfObj( String filename ) + { + String path = makeAbs( filename ); + //String path = makeAbs( inputFileArg ); + path = path.replace( rootArg + "/" , "" ); + path = path.replace("/","\\"); + return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ , + sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" ); + } + + private void merge() + { + SdfData data = getSdfData(); + if( inputFileArg.startsWith("@") ) + { + // Read files + Vector fileList = readFileList( inputFileArg ); + for( Enumeration e = fileList.elements(); e.hasMoreElements(); ) + mergeFile( (String) e.nextElement() , data , false ); + } + else + { + // Single file + mergeFile( inputFileArg , data , true ); + } + } + + private Vector readFileList( String filename ) + { + Vector lines = new Vector(); + try + { + BufferedReader in = new BufferedReader( new FileReader( filename.substring( 1 ) ) ); + while( in.ready() ) + lines.add( in.readLine() ); + } + catch( IOException e ) + { + System.out.println("ERROR: Can't open file '"+filename.substring( 1 )+"'"); + System.exit( -1 ); + } + return lines; + } + + private void mergeFile( String filename , SdfData data , boolean isSingleFile ) + { + java.util.Properties sourceProp = loadProp( filename ); + Vector langs = getLanguages( data ); + HashMap props = new HashMap(); + // Create a properties object for every language + for( Enumeration e = langs.elements(); e.hasMoreElements();) + { + props.put( (String)e.nextElement() , new java.util.Properties() ); + } + // Get a prototype that already contains the most common settings + + SdfEntity dolly = prepareSdfObj( filename ); + String key; + String sourceString; + SdfEntity curStr; + SdfEntity curEntity; + SdfEntity mergedEntity; + String curLang; + for( Enumeration e = sourceProp.propertyNames() ; e.hasMoreElements() ; ) // For all property keys + { + key = (String) e.nextElement(); + sourceString = sourceProp.getProperty( key ); + curStr = (SdfEntity) dolly.clone(); + curStr.setLid( key ); + for( Enumeration lang = langs.elements(); lang.hasMoreElements(); ) // merge in every language + { + curEntity = (SdfEntity) curStr.clone(); + curLang = (String) lang.nextElement(); + curEntity.setLangid( curLang ); + mergedEntity = data.get( curEntity ); + if( mergedEntity == null ) + { + // if case there is not translation the fallback to the en-US source string + ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString ); + } + else + { + // Set the merged text from the sdf file + ( (java.util.Properties) props.get( curLang )).setProperty( mergedEntity.getLid() , mergedEntity.getText() ); // TODO: Quoting ??? + } + } + + } + // Now write them out + String lang; + for( Iterator i = props.keySet().iterator() ; i.hasNext() ; ) + { + lang = (String) i.next(); + writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile ); + } + } + private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile ) + { + // Prepare path to file + int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ; + String path = new String(); + String name = new String(); + String lcLang = lang.toLowerCase(); + // use of -x -y + // -> // + if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 ) + { + path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lcLang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString(); + name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); + } + //use of -i + else if( !isSingleFile && outputFileArg != null && outputFileArg.length()>0 ) + { + name = outputFileArg; + name += new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); + //name = outputFileArg; + } + //use of -i @ + else if( isSingleFile && outputFileArg != null && outputFileArg.length()>0 ) + { + name = outputFileArg; + name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); + //name = outputFileArg; + } + else + { + System.err.println("ERROR: No outputfile specified .. either -o or -x -y !"); + System.exit( -1 ); + } + + File dir = new File( path ); + try + { + if( !dir.exists() && path.length()>0 ) + { + if( !dir.mkdirs() ) + { + System.out.println("ERROR: Can't create directory '"+path+"' !!!"); + System.exit( -1 ); + } + } + } + catch( SecurityException e ) + { + System.out.println("ERROR: Can't create directory '"+path+"'!!!Wrong Permissions?"); + System.exit( -1 ); + } + path += name; + // Write the properties file + System.out.println("DBG: Writing to "+path); + try{ + BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) ); + if( prop == null ) + System.out.println("DBG: prop == null!!!"); + prop.store( out , "" ); // Legal headers? + } + catch( IOException e ) + { + System.out.println("ERROR: Can't write file '"+path+"' !!!!"); + System.exit( -1 ); + } + } + + private SdfData getSdfData() + { + SdfData data = new SdfData( inputSdfFileArg ); + data.read(); + return data; + } + private Vector getLanguages( SdfData data ) + { + Vector langs = new Vector(); + + if( ((String)langsArg.get( 0 )).equalsIgnoreCase( "all" ) ) // for "-l all" use all languages found in the -m sdf file + langs.addAll( data.getLanguages() ); + else + langs.addAll( langsArg ); // use the langs giving by -l + + if( forcedLangsArg != null ) + langs.addAll( forcedLangsArg ); + + return removeDupes( langs ); + } + private Vector removeDupes( Vector vec ) + { + Collection coll = new LinkedHashSet( vec ); + return new Vector( coll ); + } + private java.util.Properties loadProp( String filename ) + { + java.util.Properties prop = new java.util.Properties(); + try + { + prop.load( new BufferedInputStream( new NoLocalizeFilter( new FileInputStream( filename ) ) ) ); + } + catch( IOException e ) + { + System.err.println("ERROR: Can't read file '"+filename+"'!!!"); + } + return prop; + } + private void parseArguments( String[] args ) + { + + if( args.length == 0 ) + { + System.out.println("ERROR: No args???"); + help(); + System.exit( -1 ); + } + for( int x = 0; x < args.length ; x++ ) + { + if( args[ x ].equalsIgnoreCase("-i") ) + { + // Input resource file + inputFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-o") ) + { + // Output sdf file + outputFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-x") ) + { + // path prefix + pathPrefixArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-y") ) + { + // path postfix + pathPostfixArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-p") ) + { + // project + projectArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-r") ) + { + // root + rootArg = getSimpleArg( args , x ); + rootArg = makeAbs( rootArg ); + } + else if( args[ x ].equalsIgnoreCase("-lf") ) + { + // forced langs + forcedLangsArg = getComplexArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-l") ) + { + // langs + langsArg = getComplexArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-m") ) + { + // input sdf file + inputSdfFileArg = getSimpleArg( args , x ); + } + else if( args[ x ].equalsIgnoreCase("-qq") ) + { + isQuiet = true; + } + } + } + private String makeAbs( String path ) + { + File file; + try + { + file = new File( path ); + return file.getCanonicalPath(); + }catch( IOException e ) + { + e.printStackTrace(); + System.exit( -1 ); + } + return null; + } +/* private boolean testArguments() + { + // nice merge + if( inputSdfFileArg != null && inputSdfFileArg.length()>0 ) + // nice merge + return projectArg != null && rootArg != null && inputFileArg != null && pathPrefixArg != null && pathPostfixArg != null && langsArg != null && + projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && pathPrefixArg.length()>0 && pathPostfixArg.length()>0 && langsArg.size()>0 ; + else + // nice extract + return projectArg != null && rootArg != null && inputFileArg != null && outputFileArg != null && langsArg != null && + projectArg.length()>0 && rootArg.length()>0 && inputFileArg.length()>0 && outputFileArg.length()>0 && langsArg.size()>0; + } +*/ +} diff --git a/l10ntools/java/jpropex/java/Main.java b/l10ntools/java/jpropex/java/Main.java new file mode 100644 index 000000000000..23dc477ddec3 --- /dev/null +++ b/l10ntools/java/jpropex/java/Main.java @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +class Main +{ + + public static void main( String args[] ) + { + JPropEx jpropex = new JPropEx( args ); + //jpropex.init(); + } +} + diff --git a/l10ntools/java/jpropex/java/NoLocalizeFilter.java b/l10ntools/java/jpropex/java/NoLocalizeFilter.java new file mode 100644 index 000000000000..3bfa53df2296 --- /dev/null +++ b/l10ntools/java/jpropex/java/NoLocalizeFilter.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +import java.io.*; +import java.util.regex.*; + +// exit if the sequence x-no-localize is found in stream! +public class NoLocalizeFilter extends FilterInputStream +{ + InputStream in; + Pattern p = Pattern.compile("#[\\s]*x-no-translate"); + + public NoLocalizeFilter( InputStream in ) { + super(in); + this.in = in; + } + public int read(byte[] b, int off, int len) throws IOException + { + String search = new String( b ); + Matcher m = p.matcher( search ); + if( m.find() ) + //if( search.contains("x-no-translate" ) ) // TODO: fixme! + { + System.out.println("found x-no-translate"); + in.close(); + close(); + System.exit( 0 ); + } + return in.read( b , off , len ); + } +} diff --git a/l10ntools/java/jpropex/java/OrderedHashMap.java b/l10ntools/java/jpropex/java/OrderedHashMap.java new file mode 100644 index 000000000000..a462d598b307 --- /dev/null +++ b/l10ntools/java/jpropex/java/OrderedHashMap.java @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +import java.util.*; + +// LinkedHashMap implrementation +public class OrderedHashMap +{ + private HashMap hm = new HashMap(); + private LinkedList list = new LinkedList(); + + public Iterator iterator() { return list.iterator(); } + + public boolean isEmpty() { return hm.isEmpty(); } + public Object get( Object key ) { return hm.get( key ); } + public Object get( int index ) { return hm.get( list.get( index ) ); } + public Iterator keys() { return list.iterator(); } + public Object add( Object key , Object value ) + { + list.add( key ); + return hm.put( key, value ); + } + public Object add( int index , Object key , Object value ) + { + list.add( index , key ); + return hm.put( key, value ); + } + public Object remove( Object key ) + { + list.remove( list.indexOf( key ) ); + return hm.remove( key ); + } + public void move( int idxFrom , int idxTo ) + { + Object key = list.get( idxFrom ); + list.remove( idxFrom ); + list.add( idxTo , key ); + } + public void move( Object key , int idxTo ) + { + move( list.indexOf( key ) , idxTo ); + } + public int size() + { + return hm.size(); + } + public Enumeration elements() + { + return new OHMenum( this ); + } +} + +final class OHMenum implements Enumeration +{ + OrderedHashMap ohm; + int index = 0; + + private OHMenum(){}; + public OHMenum( OrderedHashMap ohm ){ + this.ohm = ohm ; + } + + public boolean hasMoreElements() + { + return index < ohm.size(); + } + public Object nextElement() + { + return ohm.get( index++ ); + } +} diff --git a/l10ntools/java/jpropex/java/SdfData.java b/l10ntools/java/jpropex/java/SdfData.java new file mode 100644 index 000000000000..80b8ea890f26 --- /dev/null +++ b/l10ntools/java/jpropex/java/SdfData.java @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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. + * + ************************************************************************/ + + +import java.util.*; +import java.io.*; + +public class SdfData +{ + private String filename; + private OrderedHashMap ohm; + private LinkedHashSet languagesFound; + + public SdfData() + { + languagesFound = new LinkedHashSet(); + ohm = new OrderedHashMap(); + languagesFound = new LinkedHashSet(); + } + public SdfData( String filename ) + { + this(); + this.filename = filename; + } + + public LinkedHashSet getLanguages() + { + return languagesFound; + } + public SdfEntity get( SdfEntity obj ) + { + return (SdfEntity) ohm.get( (String)obj.getId() ); + } + public SdfEntity get( String key ){ + return (SdfEntity) ohm.get( key ); + } + public void add( SdfEntity obj ) + { + ohm.add( obj.getId() , obj ); + } + + public void read() + { + BufferedReader in; + try + { + in = new BufferedReader( new FileReader( filename ) ); + SdfEntity entity; + while( in.ready() ) + { + String line = in.readLine(); + if( line.length() > 0 ) + { + entity = new SdfEntity( line ); + ohm.add( entity.getId() , entity ); // test if is valid + languagesFound.add( entity.getLangid() ); + } + } + in.close(); + } + catch( IOException e ) + { + System.out.println("Error: reading file " + filename); + System.exit( -1 ); + } + } + public void write( String filename ) + { + FileWriter out; + try + { + out = new FileWriter( filename , true ); // Always append + for( Enumeration e = ohm.elements(); e.hasMoreElements(); ) + { + out.write( ( (SdfEntity) e.nextElement() ).toString() + "\n" ); + } + out.close(); + } + catch( IOException e ) + { + System.out.println("Error: Can't write to file " + filename); + System.exit( -1 ); + } + } +} diff --git a/l10ntools/java/jpropex/java/SdfEntity.java b/l10ntools/java/jpropex/java/SdfEntity.java new file mode 100644 index 000000000000..52dc61ca40ca --- /dev/null +++ b/l10ntools/java/jpropex/java/SdfEntity.java @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +public class SdfEntity implements Cloneable{ + private String project = new String(""); + private String source_file = new String(""); + private String dummy1 = new String(""); + private String resource_type= new String(""); + private String gid = new String(""); + private String lid = new String(""); + private String helpid = new String(""); + private String platform = new String(""); + private String dummy2 = new String(""); + private String langid = new String(""); + private String text = new String(""); + private String helptext = new String(""); + private String quickhelptext= new String(""); + private String title = new String(""); + private String date = new String(""); + + public static int PROJECT_POS = 0; + public static int SOURCE_FILE_POS = 1; + public static int DUMMY1_POS = 2; + public static int RESOURCE_TYPE_POS = 3; + public static int GID_POS = 4; + public static int LID_POS = 5; + public static int HELPID_POS = 6; + public static int PLATFORM_POS = 7; + public static int DUMMY2_POS = 8; + public static int LANGID_POS = 9; + public static int TEXT_POS = 10; + public static int HELPTEXT_POS = 11; + public static int QUICKHELPTEXT_POS = 12; + public static int TITLE_POS = 13; + public static int DATE_POS = 14; + + public Object clone() + { + try + { + return super.clone(); + } + catch( CloneNotSupportedException e ) + { + System.out.println("ERROR: Can not clone, something is broken here ...."); + System.exit( -1 ); + } + return null; // dummy + } + + public SdfEntity( String line ){ + // isValid? + setProperties( line ) ; + } + public SdfEntity(String project, String source_file, String dummy1, String resource_type, String gid, String lid, String helpid, String platform, String dummy2, String langid, String text, String helptext, String quickhelptext, String title , String date) { + super(); + this.project = project; + this.source_file = source_file; + this.dummy1 = dummy1; + this.resource_type = resource_type; + this.gid = gid; + this.lid = lid; + this.helpid = helpid; + this.platform = platform; + this.dummy2 = dummy2; + this.langid = langid; + this.text = text; + this.helptext = helptext; + this.quickhelptext = quickhelptext; + this.title = title; + this.date = date; + } + + public void setProperties( String line ){ + + String[] splitted = line.split("\t"); + + setProject( splitted[ SdfEntity.PROJECT_POS ] ); + setSource_file( splitted[ SdfEntity.SOURCE_FILE_POS ] ); + setDummy1( splitted[ SdfEntity.DUMMY1_POS ] ); + setResource_type( splitted[ SdfEntity.RESOURCE_TYPE_POS ] ); + setGid( splitted[ SdfEntity.GID_POS ] ); + setLid( splitted[ SdfEntity.LID_POS ] ); + setHelpid( splitted[ SdfEntity.HELPID_POS ] ); + setPlatform( splitted[ SdfEntity.PLATFORM_POS ] ); + setDummy2( splitted[ SdfEntity.DUMMY2_POS ] ); + setLangid( splitted[ SdfEntity.LANGID_POS ] ); + setText( splitted[ SdfEntity.TEXT_POS ] ); + setHelptext( splitted[ SdfEntity.HELPTEXT_POS ] ); + setQuickhelptext( splitted[ SdfEntity.QUICKHELPTEXT_POS ] ); + setTitle( splitted[ SdfEntity.TITLE_POS ] ); + setDate( splitted[ SdfEntity.DATE_POS ] ); + } + + public String getFileId(){ + return project+"\\"+source_file; + } + public String getResourcePath(){ + return source_file.substring(0 , source_file.lastIndexOf( "\\" )-1 ); + } + public String toString(){ + return new StringBuffer( project ).append( "\t" ).append( source_file ).append( "\t" ).append( dummy1 ).append( "\t" ).append( resource_type ).append( "\t" ).append( gid ).append( "\t" ) + .append( lid ).append( "\t" ).append( helpid ).append( "\t" ).append( platform ).append( "\t" ).append( dummy2 ).append( "\t" ).append( langid ).append( "\t" ) + .append( text ).append( "\t" ).append( helptext ).append( "\t" ).append( quickhelptext ).append( "\t" ).append( title ).append( "\t" ).append( date ).toString(); + } + public String getId(){ + return new StringBuffer( project ).append( gid ).append( lid ).append( source_file ).append( resource_type ).append( platform ).append( helpid ).append( langid ).toString(); + } + + public String getDummy1() { + return dummy1; + } + + public void setDummy1(String dummy1) { + this.dummy1 = dummy1; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getDummy2() { + return dummy2; + } + + public void setDummy2(String dummy2) { + this.dummy2 = dummy2; + } + + public String getGid() { + return gid; + } + + public void setGid(String gid) { + this.gid = gid; + } + + public String getHelpid() { + return helpid; + } + + public void setHelpid(String helpid) { + this.helpid = helpid; + } + + public String getHelptext() { + return helptext; + } + + public void setHelptext(String helptext) { + this.helptext = helptext; + } + + public String getLangid() { + return langid; + } + + public void setLangid(String langid) { + this.langid = langid; + } + + public String getLid() { + return lid; + } + + public void setLid(String lid) { + this.lid = lid; + } + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + public String getQuickhelptext() { + return quickhelptext; + } + + public void setQuickhelptext(String quickhelptext) { + this.quickhelptext = quickhelptext; + } + + public String getResource_type() { + return resource_type; + } + + public void setResource_type(String resource_type) { + this.resource_type = resource_type; + } + + public String getSource_file() { + return source_file; + } + + public void setSource_file(String source_file) { + this.source_file = source_file; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + + +} diff --git a/l10ntools/java/jpropex/jpropex b/l10ntools/java/jpropex/jpropex new file mode 100755 index 000000000000..2d62d13b093e --- /dev/null +++ b/l10ntools/java/jpropex/jpropex @@ -0,0 +1,10 @@ +#!/bin/sh +if [ x${SOLARENV}x = xx ]; then + echo No environment found, please use 'configure' or 'setsolar' + exit 1 +fi +if [ x${JAVA_HOME}x = xx ]; then + echo No Java found! + exit 1 +fi +exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@" diff --git a/l10ntools/java/jpropex/jpropex.MF b/l10ntools/java/jpropex/jpropex.MF new file mode 100755 index 000000000000..3e22e7e9bfbf --- /dev/null +++ b/l10ntools/java/jpropex/jpropex.MF @@ -0,0 +1 @@ +Main-Class: Main diff --git a/l10ntools/java/jpropex/makefile.mk b/l10ntools/java/jpropex/makefile.mk new file mode 100755 index 000000000000..f86d2c830025 --- /dev/null +++ b/l10ntools/java/jpropex/makefile.mk @@ -0,0 +1,36 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied 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. +# +#************************************************************************* + + +PRJ=../.. +PRJNAME=transex3 +TARGET=jpropex + +.INCLUDE : ant.mk + +ALLTAR : ANTBUILD + -- cgit From f53bc41b0a0a19a017d13d31d39cfe8db914f606 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 28 May 2010 13:56:15 +0200 Subject: l10ntooling17: #i100845# add support for java properties. help() fixed --- l10ntools/java/jpropex/java/JPropEx.java | 1 + 1 file changed, 1 insertion(+) diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index a4a17060d1f8..00775ec54c41 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -97,6 +97,7 @@ public class JPropEx private void help() { System.out.println("jpropex -> extract / merge java properties files"); + System.out.println("-p -r -i |@ -o -x -y -m -l \n"); System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata"); System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US"); System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename )"); -- cgit From 196b2a884a7843095bffaebe5ad1197e569db11d Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 28 May 2010 13:57:49 +0200 Subject: l10ntooling17: #i100845# add support for java properties. help() fixed --- l10ntools/java/jpropex/java/JPropEx.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index 00775ec54c41..d0f72d627aaf 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -100,7 +100,7 @@ public class JPropEx System.out.println("-p -r -i |@ -o -x -y -m -l \n"); System.out.println("Example:\ncd /data/cws/l10ntooling17/DEV300/ooo/reportbuilder/java/com/sun/star/report/function/metadata"); System.out.println("Extract:\njpropex -p reportbuilder -r ../../../../../../.. -i Title-Function.properties -o new.sdf -l en-US"); - System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename )"); + System.out.println("Merge: use either ( -x path -y more_path ) or ( -o ) and ( -i filename ) or ( -i @filename ). @filename contains a list with files"); System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -x ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata -y ivo -i @abc -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); System.out.println("jpropex -p reportbuilder -r ../../../../../../.. -o ../../../../../../../unxlngx6.pro/class/com/sun/star/report/function/metadata/ -i Title-Function.properties -l all -lf en-US,de,fr,pt -m ../../../../../../../common.pro/misc/reportbuilder/java/com/sun/star/report/function/metadata/localize.sdf"); -- cgit From 0fe86b35c9baec1abd1fb4fb9f634de5f06b38e6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 28 May 2010 15:23:19 +0200 Subject: unoawt: WINDOW_*BOX also do not require a parent window, so allow creating them without parent --- toolkit/source/awt/vclxtoolkit.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 2eeafa73d2d2..f85e29c21099 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -632,7 +632,15 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, // Wenn die Component einen Parent braucht, dann NULL zurueckgeben, // spaeter mal ::com::sun::star::uno::Exception... sal_Bool bException = sal_True; - if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) ) + if ( ( nType == WINDOW_DIALOG ) + || ( nType == WINDOW_MODALDIALOG ) + || ( nType == WINDOW_MODELESSDIALOG ) + || ( nType == WINDOW_MESSBOX ) + || ( nType == WINDOW_INFOBOX ) + || ( nType == WINDOW_WARNINGBOX ) + || ( nType == WINDOW_ERRORBOX ) + || ( nType == WINDOW_QUERYBOX ) + ) bException = sal_False; else if ( ( nType == WINDOW_WINDOW ) || ( nType == WINDOW_WORKWINDOW ) || -- cgit From 024b04532d81f4e9c18e12d7dba418214cac969f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 28 May 2010 15:24:02 +0200 Subject: unoawt: fixed assertion --- svtools/source/uno/wizard/unowizard.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 08b0211d6173..3d601a51c49e 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -348,7 +348,7 @@ namespace svt { namespace uno ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); - ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::updateTravelUI: invalid dialog implementation!" ); + ENSURE_OR_RETURN_VOID( pWizardImpl, "Wizard::enablePage: invalid dialog implementation!" ); if ( !pWizardImpl->knowsPage( i_PageID ) ) throw NoSuchElementException( ::rtl::OUString(), *this ); -- cgit From 8f5ff4a4cbe7d33417a7b884e1c3093168738581 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 28 May 2010 15:24:45 +0200 Subject: vcl111: #i108490# fix handling of greyscale jpeg images in PDF export --- svtools/inc/svtools/filter.hxx | 5 ++++- svtools/source/filter.vcl/filter/filter.cxx | 8 ++++++-- svtools/source/filter.vcl/jpeg/jpeg.cxx | 15 +++++++++++---- svtools/source/inc/jpeg.hxx | 11 +++++++++-- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 770e81b00551..49ec77adfea5 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -62,6 +62,8 @@ class Graphic; #define GRFILTER_ABORT 6 #define GRFILTER_TOOBIG 7 +#define GRFILTER_OUTHINT_GREY 1 + #define GRFILTER_FORMAT_NOTFOUND ((USHORT)0xFFFF) #define GRFILTER_FORMAT_DONTKNOW ((USHORT)0xFFFF) @@ -323,7 +325,7 @@ protected: sal_Bool bDummy2; sal_Bool bDummy3; sal_Bool bDummy4; - long nDummy1; + long nExpGraphHint; long nDummy2; void* pDummy1; void* pDummy2; @@ -374,6 +376,7 @@ public: USHORT ExportGraphic( const Graphic& rGraphic, const String& rPath, SvStream& rOStm, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData = NULL ); + long GetExportGraphicHint() const { return nExpGraphHint; } USHORT CanImportGraphic( const INetURLObject& rPath, USHORT nFormat = GRFILTER_FORMAT_DONTKNOW, diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index e8121f1d7e94..c8a79d3a35cd 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -992,7 +992,8 @@ namespace { struct Cache : public rtl::Static {}; } // ----------------- GraphicFilter::GraphicFilter( sal_Bool bConfig ) : - bUseConfig ( bConfig ) + bUseConfig ( bConfig ), + nExpGraphHint ( 0 ) { ImplInit(); } @@ -1678,6 +1679,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat USHORT nFormatCount = GetExportFormatCount(); ResetLastError(); + nExpGraphHint = 0; if( nFormat == GRFILTER_FORMAT_DONTKNOW ) { @@ -1850,8 +1852,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat } else if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) { - if( !ExportJPEG( rOStm, aGraphic, pFilterData ) ) + bool bExportedGrayJPEG = false; + if( !ExportJPEG( rOStm, aGraphic, pFilterData, &bExportedGrayJPEG ) ) nStatus = GRFILTER_FORMATERROR; + nExpGraphHint = bExportedGrayJPEG ? GRFILTER_OUTHINT_GREY : 0; if( rOStm.GetError() ) nStatus = GRFILTER_IOERROR; diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx index 7fd2e09a82dd..a2de92171af3 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.cxx +++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx @@ -590,10 +590,11 @@ ReadState JPEGReader::Read( Graphic& rGraphic ) // - JPEGWriter - // -------------- -JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData ) : +JPEGWriter::JPEGWriter( SvStream& rStm, const uno::Sequence< beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) : rOStm ( rStm ), pAcc ( NULL ), - pBuffer ( NULL ) + pBuffer ( NULL ), + pExpWasGrey ( pExportWasGrey ) { FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData ); bGreys = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ) != 0; @@ -704,6 +705,9 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) bGreys = sal_True; } + if( pExpWasGrey ) + *pExpWasGrey = bGreys; + if( pAcc ) { bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); @@ -765,8 +769,11 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 // - ExportJPEG - // -------------- -BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ) +BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey + ) { - JPEGWriter aJPEGWriter( rOStm, pFilterData ); + JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey ); return aJPEGWriter.Write( rGraphic ); } diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx index 906bcd9ea2de..9923190c5e21 100644 --- a/svtools/source/inc/jpeg.hxx +++ b/svtools/source/inc/jpeg.hxx @@ -99,13 +99,16 @@ class JPEGWriter sal_Bool bGreys; sal_Int32 nQuality; + bool* pExpWasGrey; + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; public: void* GetScanline( long nY ); - JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); + JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey = NULL ); ~JPEGWriter() {}; BOOL Write( const Graphic& rGraphic ); @@ -119,6 +122,10 @@ public: BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags ); -BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData ); +BOOL ExportJPEG( SvStream& rStream, + const Graphic& rGraphic, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, + bool* pExportWasGrey = NULL + ); #endif // _JPEG_HXX -- cgit From ccc9774139e48f266e40c99f7243f03f4a728517 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 28 May 2010 15:36:22 +0200 Subject: unoawt: XWizard now has an attribute giving access to the XWindow interface of the dialog's main window --- svtools/source/uno/unowizard.hxx | 1 + svtools/source/uno/wizard/unowizard.cxx | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx index f227160f96bc..ceb8fac14eb6 100644 --- a/svtools/source/uno/unowizard.hxx +++ b/svtools/source/uno/unowizard.hxx @@ -77,6 +77,7 @@ namespace svt { namespace uno // ::com::sun::star::ui::dialogs::XWizard virtual ::rtl::OUString SAL_CALL getHelpURL() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setHelpURL( const ::rtl::OUString& _helpurl ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getDialogWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardPage > SAL_CALL getCurrentPage( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL enableButton( ::sal_Int16 WizardButton, ::sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDefaultButton( ::sal_Int16 WizardButton ) throw (::com::sun::star::uno::RuntimeException); diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 3d601a51c49e..e310aceaca75 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -72,6 +72,7 @@ namespace svt { namespace uno using ::com::sun::star::ui::dialogs::XWizardPage; using ::com::sun::star::container::NoSuchElementException; using ::com::sun::star::util::InvalidStateException; + using ::com::sun::star::awt::XWindow; /** === end UNO using === **/ namespace WizardButton = ::com::sun::star::ui::dialogs::WizardButton; @@ -293,6 +294,16 @@ namespace svt { namespace uno m_pDialog->SetSmartHelpId( SmartId( i_HelpURL ) ); } + //------------------------------------------------------------------------------------------------------------------ + Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException) + { + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL ); + return Reference< XWindow >( m_pDialog->GetComponentInterface(), UNO_QUERY ); + } + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) { -- cgit From b078cc62e4e07c0259d54ff0cd3236fa3182d377 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 31 May 2010 09:33:12 +0200 Subject: unoawt: for ill-behaved clients which do not provide a page, have an empty page as fallback --- svtools/source/uno/wizard/wizardshell.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index fb78e4a7bd11..28591e1616f6 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -232,7 +232,13 @@ namespace svt { namespace uno ::boost::shared_ptr< WizardPageController > pController( new WizardPageController( *this, m_xController, impl_stateToPageId( i_nState ) ) ); TabPage* pPage = pController->getTabPage(); - ENSURE_OR_RETURN( pPage != NULL, "WizardShell::createPage: illegal tab page!", NULL ); + OSL_ENSURE( pPage != NULL, "WizardShell::createPage: illegal tab page!" ); + if ( pPage == NULL ) + { + // fallback for ill-behaved clients: empty page + pPage = new TabPage( this, 0 ); + pPage->SetSizePixel( LogicToPixel( Size( 280, 185 ), MAP_APPFONT ) ); + } m_aPageControllers[ pPage ] = pController; return pPage; @@ -256,6 +262,7 @@ namespace svt { namespace uno { DBG_UNHANDLED_EXCEPTION(); } + // fallback for ill-behaved clients: the numeric state return String::CreateFromInt32( i_nState ); } -- cgit From 84175290121a452462f1cc261b4e092ae0ff7282 Mon Sep 17 00:00:00 2001 From: tono Date: Mon, 31 May 2010 21:51:32 +0900 Subject: i#111956: MinGW port fix: dependency to shared library --- i18npool/source/localedata/data/makefile.mk | 12 ++++++++++++ svtools/util/makefile.mk | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 2591b70fb63d..37f38b9f6e2d 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -285,7 +285,11 @@ SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME=$(SHL2TARGET) SHL2STDLIBS= $(LINK_LOCALEDATA_EN_LIB) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) +.ELSE +SHL2DEPN=$(SHL1IMPLIBN) +.ENDIF SHL2OBJS= \ $(SLO)$/localedata_es_AR.obj \ $(SLO)$/localedata_es_BO.obj \ @@ -323,7 +327,11 @@ SHL3DEF=$(MISC)$/$(SHL3TARGET).def DEF3NAME=$(SHL3TARGET) SHL3STDLIBS= $(LINK_LOCALEDATA_EN_LIB) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL3DEPN=$(SHL1TARGETN) $(SHL2TARGETN) +.ELSE +SHL3DEPN=$(SHL1IMPLIBN) $(SHL2IMPLIBN) +.ENDIF SHL3OBJS= \ $(SLO)$/localedata_ast_ES.obj \ $(SLO)$/localedata_be_BY.obj \ @@ -410,7 +418,11 @@ SHL4DEF=$(MISC)$/$(SHL4TARGET).def DEF4NAME=$(SHL4TARGET) SHL4STDLIBS= $(LINK_LOCALEDATA_EN_LIB) +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL4DEPN=$(SHL1TARGETN) +.ELSE +SHL4DEPN=$(SHL1IMPLIBN) +.ENDIF SHL4OBJS= \ $(SLO)$/localedata_af_NA.obj \ $(SLO)$/localedata_af_ZA.obj \ diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index ab05facdb065..9239b36cc6dc 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -153,7 +153,11 @@ DEF1DES =SvTools APP2TARGET = g2g APP2BASE = 0x10000000 +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) +.ELSE +APP2DEPN = $(SHL1IMPLIBN) $(SHL2IMPLIBN) +.ENDIF APP2OBJS = $(OBJ)$/g2g.obj -- cgit From 891b5a314552a1d2e6bdacec2806e4b2e220ffc6 Mon Sep 17 00:00:00 2001 From: tono Date: Mon, 31 May 2010 21:53:32 +0900 Subject: i#111958: MinGW port enhancement: runtime-pseude-reloc-v2 --- svtools/source/svhtml/parhtml.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 67fc5f619fdf..ade58688dc55 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2118,11 +2118,7 @@ enum eHtmlMetas { }; // -#ifdef __MINGW32__ // for runtime pseudo reloc -static HTMLOptionEnum aHTMLMetaNameTable[] = -#else static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] = -#endif { { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR }, { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED }, -- cgit From dc0a8418dfbfd5d2927f36902270df5587c74f2d Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 31 May 2010 15:24:31 +0200 Subject: l10ntooling17: #i110687# fetch cfg file from solver --- l10ntools/prj/d.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst index ffd1b211f2ff..0b6a43444613 100644 --- a/l10ntools/prj/d.lst +++ b/l10ntools/prj/d.lst @@ -52,6 +52,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx ..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx ..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx +..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc%_EXT%\l10ntools\FCFGMerge.cfg ..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx ..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib -- cgit From 6df221320543d79ac1a0ef8ba290ed318e885442 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 31 May 2010 16:29:55 +0200 Subject: fwk143: #i102271# Fixed crash docking Draw/Impress panes --- vcl/source/window/dockwin.cxx | 2 +- vcl/source/window/window.cxx | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index c8e382bad982..63451299756a 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -912,7 +912,7 @@ void DockingWindow::SetFloatingMode( BOOL bFloatMode ) mpWindowImpl->mpBorderWindow = mpOldBorderWin; SetParent( pRealParent ); mpWindowImpl->mpRealParent = pRealParent; - delete static_cast(mpFloatWin); + mpFloatWin->doLazyDelete(); mpFloatWin = NULL; SetPosPixel( maDockPos ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b47aa50a2e72..092ff0fe1a9d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -6260,6 +6260,23 @@ void Window::SetParent( Window* pNewParent ) pSysWin->GetTaskPaneList()->RemoveWindow( this ); } } + + // de-register as "top window child" at our parent, if necessary + if ( mpWindowImpl->mbFrame ) + { + BOOL bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 ); + if ( mpWindowImpl->mpRealParent && bIsTopWindow ) + { + ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData(); + + ::std::list< Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(), + pParentWinData->maTopWindowChildren.end(), this ); + DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" ); + if ( myPos != pParentWinData->maTopWindowChildren.end() ) + pParentWinData->maTopWindowChildren.erase( myPos ); + } + } + // remove ownerdraw decorated windows from list in the top-most frame window if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) { @@ -6398,6 +6415,12 @@ void Window::SetParent( Window* pNewParent ) if( bChangeTaskPaneList ) pNewSysWin->GetTaskPaneList()->AddWindow( this ); + if ( mpWindowImpl->mbFrame && pNewParent && IsTopWindow() ) + { + ImplWinData* pParentWinData = pNewParent->ImplGetWinData(); + pParentWinData->maTopWindowChildren.push_back( this ); + } + if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) ImplGetOwnerDrawList().push_back( this ); -- cgit From b00bc48046d9f886d172cb7be09a219dec554bab Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 31 May 2010 17:06:03 +0200 Subject: l10ntooling18: #i110687# fetch cfg file from solver --- l10ntools/prj/d.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst index f75c16b43764..1eb46aafc08b 100644 --- a/l10ntools/prj/d.lst +++ b/l10ntools/prj/d.lst @@ -50,6 +50,7 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\inc\l10ntools\directory.hxx %_DEST%\inc%_EXT%\l10ntools\directory.hxx ..\inc\l10ntools\file.hxx %_DEST%\inc%_EXT%\l10ntools\file.hxx ..\inc\l10ntools\vosapp.hxx %_DEST%\inc%_EXT%\l10ntools\vosapp.hxx +..\source\filter\merge\FCFGMerge.cfg %_DEST%\inc%_EXT%\l10ntools\FCFGMerge.cfg ..\inc\utf8conv.hxx %_DEST%\inc%_EXT%\l10ntools\utf8conv.hxx ..\%__SRC%\lib\transex.lib %_DEST%\lib%_EXT%\transex.lib -- cgit From b1017660ecac2d0f3755544f394238fea0fc71ff Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 1 Jun 2010 11:30:19 +0200 Subject: vcl112: #i111972# avoid sshutdown problems in default ICE IO error handler (thanks cmc!) --- vcl/unx/source/app/sm.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index dbaa278a780b..959d6af5912d 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -159,6 +159,10 @@ class ICEConnectionObserver static int nWakeupFiles[2]; static oslMutex ICEMutex; static oslThread ICEThread; +#ifdef USE_SM_EXTENSION + static IceIOErrorHandler origIOErrorHandler; + static IceErrorHandler origErrorHandler; +#endif public: static void activate(); @@ -179,6 +183,19 @@ oslMutex ICEConnectionObserver::ICEMutex = NULL; oslThread ICEConnectionObserver::ICEThread = NULL; int ICEConnectionObserver::nWakeupFiles[2] = { 0, 0 }; +#ifdef USE_SM_EXTENSION +IceIOErrorHandler ICEConnectionObserver::origIOErrorHandler = NULL; +IceErrorHandler ICEConnectionObserver::origErrorHandler = NULL; + +static void IgnoreIceErrors(IceConn, Bool, int, unsigned long, int, int, IcePointer) +{ +} + +static void IgnoreIceIOErrors(IceConn) +{ +} +#endif + // HACK bool SessionManagerClient::bDocSaveDone = false; @@ -591,6 +608,12 @@ void ICEConnectionObserver::activate() ICEMutex = osl_createMutex(); bIsWatching = TRUE; #ifdef USE_SM_EXTENSION + /* + * Default handlers call exit, we don't care that strongly if something + * happens to fail + */ + origIOErrorHandler = IceSetIOErrorHandler( IgnoreIceIOErrors ); + origErrorHandler = IceSetErrorHandler( IgnoreIceErrors ); IceAddConnectionWatch( ICEWatchProc, NULL ); #endif } @@ -604,6 +627,8 @@ void ICEConnectionObserver::deactivate() bIsWatching = FALSE; #ifdef USE_SM_EXTENSION IceRemoveConnectionWatch( ICEWatchProc, NULL ); + IceSetErrorHandler( origErrorHandler ); + IceSetIOErrorHandler( origIOErrorHandler ); #endif nConnections = 0; if( ICEThread ) -- cgit From cbe15fe5fdace258050a287a6074780cc6cb44ba Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 1 Jun 2010 12:45:01 +0200 Subject: #i100925# added translation for some ZH-WIN font names --- unotools/source/misc/fontdefs.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 4a3532b44659..878ed0b938ae 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -72,6 +72,8 @@ static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMSYaHei[] = { 0x5FAE, 0x8F6F, 0x96C5, 0x9ED1, 0 }; +static sal_Unicode const aMSJhengHei[] = { 0x5FAE, 0x8EDF, 0x6B63, 0x9ED1, 0x9AD4, 0 }; static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; @@ -179,7 +181,7 @@ static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; - +static sal_Unicode const aTimesNewRoman[] = { 0x5B8B, 0x4F53 }; static ImplLocalizedFontName aImplLocalizedNamesList[] = { @@ -216,6 +218,8 @@ static ImplLocalizedFontName aImplLocalizedNamesList[] = { "mspgothic", aMSPGothic }, { "msmincho", aMSMincho }, { "mspmincho", aMSPMincho }, +{ "microsoftjhenghei", aMSJhengHei }, +{ "microsoftyahei", aMSYaHei }, { "meiryo", aMeiryo }, { "hgminchol", aHGMinchoL }, { "hggothicb", aHGGothicB }, @@ -314,6 +318,7 @@ static ImplLocalizedFontName aImplLocalizedNamesList[] = { "hiraginokakugothicpron", aHiraginoKakuGothicProN }, { "hiraginomarugothicpro", aHiraginoMaruGothicPro }, { "hiraginomarugothicpron", aHiraginoMaruGothicProN }, +{ "timesnewroman", aTimesNewRoman }, { NULL, NULL }, }; -- cgit From 757ea8f89a27e1fe0878a1bdf66cc2dc6a1a766c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 1 Jun 2010 12:50:46 +0200 Subject: unoawt: XWizardController::confirmDeactivatePage is not necessary, /me thinks --- svtools/source/uno/wizard/wizardshell.cxx | 24 ------------------------ svtools/source/uno/wizard/wizardshell.hxx | 1 - 2 files changed, 25 deletions(-) diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 28591e1616f6..7737b214ac1f 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -155,30 +155,6 @@ namespace svt { namespace uno } } - //------------------------------------------------------------------------------------------------------------------ - sal_Bool WizardShell::prepareLeaveCurrentState( CommitPageReason i_eReason ) - { - if ( !WizardShell_Base::prepareLeaveCurrentState( i_eReason ) ) - return sal_False; - - if ( !m_xController.is() ) - return sal_True; - - try - { - return m_xController->confirmDeactivatePage( - impl_stateToPageId( getCurrentState() ), - convertCommitReasonToTravelType( i_eReason ) - ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return sal_True; - } - //------------------------------------------------------------------------------------------------------------------ sal_Bool WizardShell::leaveState( WizardState i_nState ) { diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index ffe4c1fc37f8..7cc656832d81 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -66,7 +66,6 @@ namespace svt { namespace uno // OWizardMachine overridables virtual TabPage* createPage( WizardState i_nState ); virtual void enterState( WizardState i_nState ); - virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); virtual sal_Bool leaveState( WizardState i_nState ); virtual String getStateDisplayName( WizardState i_nState ) const; virtual bool canAdvance() const; -- cgit From ab3f1411d1644ed1bb227e69f6f85a75a9c27aa2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 1 Jun 2010 13:53:53 +0200 Subject: unoawt: StartDrag: do not release the mouse if DnD isn't enabled at all, this will confuse the SelectionEngine --- svtools/source/contnr/svlbox.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index dd19879e73b7..fb71f64772ad 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -1775,10 +1775,14 @@ void SvLBox::StartDrag( sal_Int8, const Point& rPosPixel ) { DBG_CHKTHIS(SvLBox,0); + nOldDragMode = GetDragDropMode(); + if ( !nOldDragMode ) + return; + ReleaseMouse(); + SvLBoxEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos ); - nOldDragMode = GetDragDropMode(); - if( !pEntry || !nOldDragMode ) + if( !pEntry ) { DragFinished( DND_ACTION_NONE ); return; -- cgit From 9e2ed49397eda707bca5326d09ff58b10fa05147 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 1 Jun 2010 15:03:56 +0200 Subject: unoawt: UNO/SVT wizzards: allow to completely reset the DefaultButton - for pages which have on own default button --- svtools/inc/svtools/wizardmachine.hxx | 1 + svtools/source/dialogs/wizardmachine.cxx | 6 ++++-- svtools/source/uno/wizard/unowizard.cxx | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/svtools/inc/svtools/wizardmachine.hxx b/svtools/inc/svtools/wizardmachine.hxx index 05e796646253..02562ac4bb63 100644 --- a/svtools/inc/svtools/wizardmachine.hxx +++ b/svtools/inc/svtools/wizardmachine.hxx @@ -42,6 +42,7 @@ namespace svt //......................................................................... // wizard buttons +#define WZB_NONE 0x0000 #define WZB_NEXT 0x0001 #define WZB_PREVIOUS 0x0002 #define WZB_FINISH 0x0004 diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 5a5c094c1572..2053da80019d 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -355,8 +355,10 @@ namespace svt if (m_pCancel && (_nWizardButtonFlags & WZB_CANCEL)) pNewDefButton = m_pCancel; - if (pNewDefButton) - defaultButton(pNewDefButton); + if ( pNewDefButton ) + defaultButton( pNewDefButton ); + else + implResetDefault( this ); } //--------------------------------------------------------------------- diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index e310aceaca75..9440c0e69f26 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -83,6 +83,7 @@ namespace svt { namespace uno { switch ( i_nWizardButton ) { + case WizardButton::NONE: return WZB_NONE; case WizardButton::NEXT: return WZB_NEXT; case WizardButton::PREVIOUS: return WZB_PREVIOUS; case WizardButton::FINISH: return WZB_FINISH; @@ -90,7 +91,7 @@ namespace svt { namespace uno case WizardButton::HELP: return WZB_HELP; } OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); - return 0; + return WZB_NONE; } } -- cgit From ea7b8372ee365c47522f0a0b4b230977656dfbba Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 2 Jun 2010 10:06:43 +0200 Subject: CWS mba33issues01: #i82086#: replace Internet with Network --- svtools/source/misc/errtxt.src | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index 4e9a316308e0..22b364c266df 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -328,23 +328,23 @@ Resource RID_ERRHDL }; String ERRCODE_INET_CONNECT { - Text [ en-US ] = "Could not establish Internet connection to $(ARG1)." ; + Text [ en-US ] = "Could not establish network connection to $(ARG1)." ; }; String ERRCODE_INET_READ { - Text [ en-US ] = "Error reading data from the Internet.\nServer error message: $(ARG1)." ; + Text [ en-US ] = "Error reading data from the network.\nServer error message: $(ARG1)." ; }; String ERRCODE_INET_WRITE { - Text [ en-US ] = "Error transferring data to the Internet.\nServer error message: $(ARG1)." ; + Text [ en-US ] = "Error transferring data to the network.\nServer error message: $(ARG1)." ; }; String ERRCODE_INET_GENERAL { - Text [ en-US ] = "General Internet error has occurred." ; + Text [ en-US ] = "General network error has occurred." ; }; String ERRCODE_INET_OFFLINE { - Text [ en-US ] = "The requested Internet data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ; + Text [ en-US ] = "The requested network data is not available in the cache and cannot be transmitted as the Online mode has not be activated." ; }; String ERRCODE_SFXMSG_STYLEREPLACE { -- cgit From af7e9427541027ca153d9b16782c55addbbf28b3 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 2 Jun 2010 10:12:48 +0200 Subject: #i100925# removed superfluos translation entry for simsun family --- unotools/source/misc/fontdefs.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 878ed0b938ae..c1c222755599 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -37,6 +37,7 @@ struct ImplLocalizedFontName const sal_Unicode* mpLocalizedNames; }; +// TODO: where did the 0,0 delimiters come from? A single 0 should suffice... static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; @@ -181,7 +182,6 @@ static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; -static sal_Unicode const aTimesNewRoman[] = { 0x5B8B, 0x4F53 }; static ImplLocalizedFontName aImplLocalizedNamesList[] = { @@ -318,7 +318,6 @@ static ImplLocalizedFontName aImplLocalizedNamesList[] = { "hiraginokakugothicpron", aHiraginoKakuGothicProN }, { "hiraginomarugothicpro", aHiraginoMaruGothicPro }, { "hiraginomarugothicpron", aHiraginoMaruGothicProN }, -{ "timesnewroman", aTimesNewRoman }, { NULL, NULL }, }; @@ -518,8 +517,6 @@ void AddTokenFontName( String& rName, const String& rNewToken ) ImplAppendFontToken( rName, rNewToken ); } - - // ======================================================================= String GetSubsFontName( const String& rName, ULONG nFlags ) -- cgit From 4624195e6db83d5cd4504ecb15133ba02fb23f52 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 2 Jun 2010 12:16:56 +0200 Subject: fwk139: #i10000# adopt for solaris --- svtools/inc/svtools/toolboxcontroller.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index e1ba26607922..d4286b2d31b0 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -101,6 +101,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); // XEventListener + using cppu::OPropertySetHelper::disposing; virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); // XStatusListener -- cgit From 2fab32e831fc02e7efd4069aa0dfc7779d97a9cf Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Wed, 2 Jun 2010 13:05:02 +0200 Subject: mtclip01: #i112022# Allow extended clipboard creation --- vcl/source/window/window.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index b47aa50a2e72..4ffb52b0e2c9 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -8641,7 +8641,10 @@ Reference< XClipboard > Window::GetClipboard() if( xFactory.is() ) { - mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); + mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY ); + + if( !mpWindowImpl->mpFrameData->mxClipboard.is() ) + mpWindowImpl->mpFrameData->mxClipboard = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY ); #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized if( mpWindowImpl->mpFrameData->mxClipboard.is() ) @@ -8703,6 +8706,9 @@ Reference< XClipboard > Window::GetPrimarySelection() # else static Reference< XClipboard > s_xSelection; + if ( !s_xSelection.is() ) + s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY ); + if ( !s_xSelection.is() ) s_xSelection = Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY ); -- cgit From e9fd49ec0145ce5118cf720e6bcd49f721adcda4 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 2 Jun 2010 15:21:20 +0200 Subject: #i101378# transparent line drawing now supported from system layers --- vcl/aqua/inc/salgdi.h | 2 +- vcl/aqua/source/gdi/salgdi.cxx | 2 ++ vcl/inc/vcl/salgdi.hxx | 4 ++-- vcl/os2/inc/salgdi.h | 2 +- vcl/os2/source/gdi/salgdi.cxx | 1 + vcl/source/gdi/outdev.cxx | 16 ++++++++-------- vcl/source/gdi/outdev6.cxx | 31 ++++++++++++++++++++++--------- vcl/source/gdi/salgdilayout.cxx | 7 ++++--- vcl/unx/headless/svpgdi.cxx | 2 +- vcl/unx/headless/svpgdi.hxx | 2 +- vcl/unx/headless/svppspgraphics.cxx | 2 +- vcl/unx/headless/svppspgraphics.hxx | 2 +- vcl/unx/inc/pspgraphics.h | 2 +- vcl/unx/inc/salgdi.h | 2 +- vcl/unx/source/gdi/pspgraphics.cxx | 2 +- vcl/unx/source/gdi/salgdi.cxx | 8 ++++---- vcl/win/inc/salgdi.h | 2 +- vcl/win/source/gdi/salgdi_gdiplus.cxx | 5 +++-- 18 files changed, 56 insertions(+), 38 deletions(-) diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index d83067cb64b8..44e5aebfd8af 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -191,7 +191,7 @@ public: virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); // CopyArea --> No RasterOp, but ClipRegion virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 5b1e24befc9b..8a4744d1efcd 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -988,6 +988,7 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol // ----------------------------------------------------------------------- bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, + double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin ) { @@ -1032,6 +1033,7 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, CGContextAddPath( mrContext, xPath ); // draw path with antialiased line CGContextSetShouldAntialias( mrContext, true ); + CGContextSetAlpha( mrContext, 1.0 - fTransparency ); CGContextSetLineJoin( mrContext, aCGLineJoin ); CGContextSetLineWidth( mrContext, rLineWidths.getX() ); CGContextDrawPath( mrContext, kCGPathStroke ); diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 02e9efbc0f94..bec267d444ec 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -125,7 +125,7 @@ protected: virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ) = 0; virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) = 0; virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ) = 0; - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0; + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ) = 0; virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0; virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) = 0; virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ) = 0; @@ -373,7 +373,7 @@ public: PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ); bool DrawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency, const OutputDevice* ); - bool DrawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* ); + bool DrawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin, const OutputDevice* ); sal_Bool DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index ce486084a5b1..b024262b1cac 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -162,7 +162,7 @@ protected: virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index 5be40355f731..dff1557170fb 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -670,6 +670,7 @@ bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double / bool Os2SalGraphics::drawPolyLine( const basegfx::B2DPolygon& /*rPolygon*/, + double /*fTransparency*/, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eLineJoin*/) { diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 62be0130e068..029db78d0473 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -2311,7 +2311,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine); } - if(mpGraphics->DrawPolyLine(aB2DPolyLine, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) + if( mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) { return; } @@ -2406,7 +2406,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand( if(bTryAA) { - bDone = mpGraphics->DrawPolyLine(aCandidate, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLINEJOIN_NONE, this); + bDone = mpGraphics->DrawPolyLine( aCandidate, 0.0, basegfx::B2DVector(1.0,1.0), basegfx::B2DLINEJOIN_NONE, this); } if(!bDone) @@ -2595,7 +2595,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly ) aB2DPolyLine = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolyLine); } - if(mpGraphics->DrawPolyLine(aB2DPolyLine, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) + if(mpGraphics->DrawPolyLine( aB2DPolyLine, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this)) { return; } @@ -2643,7 +2643,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) && LINE_SOLID == rLineInfo.GetStyle()) { - DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin()); + DrawPolyLine( rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin()); return; } @@ -2775,7 +2775,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly ) aB2DPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aB2DPolygon); } - bSuccess = mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); } if(bSuccess) @@ -2867,7 +2867,7 @@ void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly ) for(sal_uInt32 a(0); bSuccess && a < aB2DPolyPolygon.count(); a++) { - bSuccess = mpGraphics->DrawPolyLine(aB2DPolyPolygon.getB2DPolygon(a), aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); } } @@ -2990,7 +2990,7 @@ void OutputDevice::ImpDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyPo for(sal_uInt32 a(0);bSuccess && a < aB2DPolyPolygon.count(); a++) { - bSuccess = mpGraphics->DrawPolyLine(aB2DPolyPolygon.getB2DPolygon(a), aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); + bSuccess = mpGraphics->DrawPolyLine( aB2DPolyPolygon.getB2DPolygon(a), 0.0, aB2DLineWidth, basegfx::B2DLINEJOIN_NONE, this); } } @@ -3037,7 +3037,7 @@ bool OutputDevice::ImpTryDrawPolyLineDirect( } // draw the polyline - return mpGraphics->DrawPolyLine(aB2DPolygon, aB2DLineWidth, eLineJoin, this); + return mpGraphics->DrawPolyLine( aB2DPolygon, 0.0, aB2DLineWidth, eLineJoin, this); } void OutputDevice::DrawPolyLine( diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index bef37284adbd..cd41a1c02f24 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -184,18 +184,31 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) - && ROP_OVERPAINT == GetRasterOp() - && IsFillColor()) + && ROP_OVERPAINT == GetRasterOp() ) { // b2dpolygon support not implemented yet on non-UNX platforms const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); basegfx::B2DPolyPolygon aB2DPolyPolygon(rB2DPolyPoly); - // transform the polygon and ensure closed - aB2DPolyPolygon.transform(aTransform); - aB2DPolyPolygon.setClosed(true); + // transform the polygon into device space and ensure it is closed + aB2DPolyPolygon.transform( aTransform ); + aB2DPolyPolygon.setClosed( true ); + + bool bDrawnOk = true; + if( IsFillColor() ) + bDrawnOk = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this ); + if( bDrawnOk && IsLineColor() ) + { + const basegfx::B2DVector aHairlineWidth(1,1); + const int nPolyCount = aB2DPolyPolygon.count(); + for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) + { + const ::basegfx::B2DPolygon aOnePoly = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); + mpGraphics->DrawPolyLine( aOnePoly, fTransparency, aHairlineWidth, ::basegfx::B2DLINEJOIN_NONE, this ); + } + } - if(mpGraphics->DrawPolyPolygon(aB2DPolyPolygon, fTransparency, this)) + if( bDrawnOk ) { #if 0 // MetaB2DPolyPolygonAction is not implemented yet: @@ -292,9 +305,9 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, aB2DPolyPolygon.transform( aTransform ); // draw the transparent polygon - bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, nTransparencePercent*0.01, this ); + const double fTransparency = 0.01 * nTransparencePercent; + bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this ); - // DrawTransparent() assumes that the border is NOT to be drawn transparently??? if( mbLineColor ) { // disable the fill color for now @@ -305,7 +318,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - mpGraphics->DrawPolyLine( rPolygon, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this ); + /*bDrawn =*/ mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this ); } // prepare to restore the fill color mbInitFillColor = mbFillColor; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 55d6f7bdd892..d2cf647ce0ca 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -405,6 +405,7 @@ void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, cons } bool SalGraphics::drawPolyLine( const basegfx::B2DPolygon& /*rPolyPolygon*/, + double /*fTransparency*/, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eLineJoin*/) { @@ -536,7 +537,7 @@ sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt3 return bRet; } -bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, +bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, double fTransparency, const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin, const OutputDevice* i_pOutDev ) { @@ -544,10 +545,10 @@ bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); - bRet = drawPolyLine( aMirror, i_rLineWidth, i_eLineJoin ); + bRet = drawPolyLine( aMirror, fTransparency, i_rLineWidth, i_eLineJoin ); } else - bRet = drawPolyLine( i_rPolygon, i_rLineWidth, i_eLineJoin ); + bRet = drawPolyLine( i_rPolygon, fTransparency, i_rLineWidth, i_eLineJoin ); return bRet; } diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index e65c9faf1432..68d8be7cb4eb 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -382,7 +382,7 @@ void SvpSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, dbgOut( m_aDevice ); } -bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) +bool SvpSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) { // TODO: implement and advertise OutDevSupport_B2DDraw support return false; diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index 132dafaa9adf..ca1af87f8862 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -121,7 +121,7 @@ public: virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ); virtual void drawRect( long nX, long nY, long nWidth, long nHeight ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 7f551051c1a7..6da09b38023c 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -323,7 +323,7 @@ void PspGraphics::drawPolyPolygon( sal_uInt32 nPoly, m_pPrinterGfx->DrawPolyPolygon (nPoly, pPoints, (const Point**)pPtAry); } -bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) +bool PspGraphics::drawPolyLine( const ::basegfx::B2DPolygon&, double /*fTransparency*/, const ::basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/ ) { // TODO: implement and advertise OutDevSupport_B2DDraw support return false; diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 82ba613615cb..063dff34c3c2 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -142,7 +142,7 @@ public: virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index 2eae73cdaa86..4b1ac12116a3 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -142,7 +142,7 @@ public: const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin); + virtual bool drawPolyLine( const basegfx::B2DPolygon&, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin); virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index 6ccea2c4a00c..42d9c5592317 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -294,7 +294,7 @@ public: const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); virtual bool drawFilledTrapezoids( const ::basegfx::B2DTrapezoid*, int nTrapCount, double fTransparency ); #if 1 // TODO: remove these obselete methods diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index d599e09e71f2..d3eb103b9dd6 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -403,7 +403,7 @@ bool PspGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fT return false; } -bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/) +bool PspGraphics::drawPolyLine( const basegfx::B2DPolygon&, double /*fTranspareny*/, const basegfx::B2DVector& /*rLineWidths*/, basegfx::B2DLineJoin /*eJoin*/) { // TODO: a PS printer can draw B2DPolyLines almost directly return false; diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 15e391256344..ae21c3aa9f7b 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1089,7 +1089,7 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // draw a poly-polygon -bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency) +bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency ) { // nothing to do for empty polypolygons const int nOrigPolyCount = rOrigPolyPoly.count(); @@ -1203,7 +1203,7 @@ bool X11SalGraphics::drawFilledTrapezoids( const ::basegfx::B2DTrapezoid* pB2DTr // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin) +bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin) { const bool bIsHairline = (rLineWidth.getX() == rLineWidth.getY()) && (rLineWidth.getX() <= 1.2); @@ -1239,7 +1239,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // draw tesselation result const int nTrapCount = aB2DTrapVector.size(); - const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, 0.0 ); + const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency ); // restore the original brush GC nBrushColor_ = aKeepBrushColor; @@ -1271,7 +1271,7 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) ); - bDrawOk = drawPolyPolygon( aOnePoly, 0.0 ); + bDrawOk = drawPolyPolygon( aOnePoly, fTransparency ); if( !bDrawOk ) break; } diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index 6b58e0c5375a..a88f597c196f 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -194,7 +194,7 @@ protected: virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ); virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); - virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, double fTransparency, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin ); virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index c621d81dce40..88efbb29d30a 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -189,14 +189,15 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly return true; } -bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin) +bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin ) { const sal_uInt32 nCount(rPolygon.count()); if(mbPen && nCount) { Gdiplus::Graphics aGraphics(mhDC); - Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); + const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); + Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aPath; bool bNoLineJoin(false); -- cgit From ddce8641531692de3174e290e9957372f5c0eebb Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 2 Jun 2010 15:41:00 +0200 Subject: consolidatereadme: #i111721# parse new readme format --- l10ntools/source/merge.cxx | 3 ++- l10ntools/source/xrmlex.l | 55 ++++++++++++++++++++++--------------------- l10ntools/source/xrmmerge.cxx | 23 ++++++++++++++---- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 3284b7026107..f5e7e097eb7d 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -335,7 +335,7 @@ MergeData *MergeDataFile::GetMergeData( ResData *pResData , bool bCaseSensitive sLID = pResData->sId; pResData->sGId = sGID; pResData->sId = sLID; - + //printf("MergeData:: Search gid=%s lid=%s filename=%s \n", pResData->sGId.GetBuffer(),pResData->sId.GetBuffer(),pResData->sFilename.GetBuffer() ); ByteString sKey = CreateKey( pResData->sResTyp , pResData->sGId , pResData->sId , pResData->sFilename , bCaseSensitive ); //printf("DBG: Searching [%s]\n",sKey.GetBuffer()); @@ -345,6 +345,7 @@ MergeData *MergeDataFile::GetMergeData( ResData *pResData , bool bCaseSensitive //printf("DBG: Found[%s]\n",sKey.GetBuffer()); return aMap[ sKey ]; } + //Dump(); pResData->sGId = sOldG; pResData->sId = sOldL; //printf("DBG: Found[%s]\n",sKey.GetBuffer()); diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l index c28aede4c6c1..4770a851c741 100644 --- a/l10ntools/source/xrmlex.l +++ b/l10ntools/source/xrmlex.l @@ -55,54 +55,55 @@ int bText=0; %% -"]*\> { - WorkOnTokenSet( XRM_README_START, yytext ); +"

]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { - WorkOnTokenSet( XRM_README_END, yytext ); +"

" { + WorkOnTokenSet( XRM_TEXT_END, yytext ); } -"]*\> { - WorkOnTokenSet( XRM_README_START, yytext ); +"

]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { - WorkOnTokenSet( XRM_README_END, yytext ); +"

" { + WorkOnTokenSet( XRM_TEXT_END, yytext ); } - -"]*\> { - WorkOnTokenSet( XRM_SECTION_START, yytext ); +"

]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { - WorkOnTokenSet( XRM_SECTION_END, yytext ); +"

" { + WorkOnTokenSet( XRM_TEXT_END, yytext ); } - -"]*\> { - WorkOnTokenSet( XRM_PARAGRAPH_START, yytext ); +"

]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { - WorkOnTokenSet( XRM_PARAGRAPH_END, yytext ); +"

" { + WorkOnTokenSet( XRM_TEXT_END, yytext ); } - -"]*\> { - WorkOnTokenSet( XRM_TEXT_START, yytext ); +"

]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { +"

" { WorkOnTokenSet( XRM_TEXT_END, yytext ); } - -"]*\> { - WorkOnTokenSet( XRM_LIST_START, yytext ); +"
]*xml:lang[^\>]*\> { + WorkOnTokenSet( XRM_TEXT_START , yytext ); } -"" { - WorkOnTokenSet( XRM_LIST_END, yytext ); +"
" { + WorkOnTokenSet( XRM_TEXT_END, yytext ); } + + + + + " OD 2010-06-04 #i111768# - apply patch from kstribley: + // range checking +// xText->deleteText(nPosition + offset, nPosition + offset + nchars); + sal_Int32 nDeletePos = nPosition + offset; + sal_Int32 nDeleteEnd = nDeletePos + nchars; + if (nDeletePos < 0) + nDeletePos = 0; + if (nDeleteEnd < 0) + nDeleteEnd = 0; + if (nDeleteEnd > xText->getCharacterCount()) + nDeleteEnd = xText->getCharacterCount(); + + xText->deleteText(nDeletePos, nDeleteEnd); + // <-- + return TRUE; } return FALSE; -- cgit From a557caaf5f70b6c18287776aaf73144c36564813 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Jun 2010 13:14:20 +0200 Subject: unoawt: make compile on unxsols4 --- svtools/source/uno/wizard/wizardshell.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 7cc656832d81..338b4f38dc4a 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -129,6 +129,7 @@ namespace svt { namespace uno using WizardShell_Base::skipUntil; using WizardShell_Base::skipBackwardUntil; using WizardShell_Base::getCurrentState; + using WizardShell_Base::activatePath; private: typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; -- cgit From 15f4e8c6b2110c4a39eb6ecb89b9a077354036e2 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Fri, 4 Jun 2010 14:41:50 +0200 Subject: cws tl78: warning free code --- comphelper/source/misc/docpasswordhelper.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 5238e33fead6..858d1ff19bca 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -1,4 +1,4 @@ -/************************************************************************* +/*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -103,7 +103,7 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( sal_uInt16 nLowResult = 0; const sal_Unicode* pStr = aUString.getStr(); - for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) + for ( sal_uInt32 nInd = 0; nInd < nLen; nInd++ ) { // NO Encoding during conversion! // The specification says that the low byte should be used in case it is not NULL -- cgit From 0a2185d979ff5a7002009ffb0fc9a0380c81553e Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 4 Jun 2010 15:02:11 +0200 Subject: gridcontrol04: fixes for #i111279#, #i111957#, #i112114# --- svtools/inc/svtools/table/abstracttablecontrol.hxx | 1 + svtools/inc/svtools/table/tablecontrol.hxx | 2 + svtools/inc/svtools/table/tabledatawindow.hxx | 3 + svtools/source/table/gridtablerenderer.cxx | 118 ++++++++++----------- svtools/source/table/tablecontrol.cxx | 7 ++ svtools/source/table/tablecontrol_impl.cxx | 38 +++++-- svtools/source/table/tablecontrol_impl.hxx | 1 + svtools/source/table/tabledatawindow.cxx | 25 +++-- svtools/source/uno/svtxgridcontrol.cxx | 20 +++- toolkit/source/controls/dialogcontrol.cxx | 4 +- toolkit/source/helper/property.cxx | 6 +- 11 files changed, 138 insertions(+), 87 deletions(-) diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx index 2b3951f6aaf3..9206f20ecbcb 100644 --- a/svtools/inc/svtools/table/abstracttablecontrol.hxx +++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx @@ -116,6 +116,7 @@ namespace svt { namespace table /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; virtual void setCursorAtCurrentCell(const Point& rPoint) = 0; + virtual bool isTooltipActive() = 0; virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0; virtual RowPos getCurrentRow(const Point& rPoint ) = 0; virtual void resizeColumn(const Point& rPoint ) = 0; diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 313b2b7b7735..8ebbbf5ab55d 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -79,6 +79,7 @@ namespace svt { namespace table ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText; Link m_aSelectHdl; bool m_bSelectionChanged; + bool m_bTooltip; public: ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; @@ -222,6 +223,7 @@ namespace svt { namespace table ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); void selectionChanged(bool _bChanged); + bool isTooltip(); protected: diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index c9f96483d943..b577d4e611e7 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -74,6 +74,9 @@ namespace svt { namespace table virtual void CaptureMouse(); virtual void ReleaseMouse(); virtual long Notify(NotifyEvent& rNEvt); + virtual void SetBackground(const Color& rColor); + virtual void SetControlBackground(const Color& rColor); + virtual Color GetControlBackground(); }; //........................................................................ } } // namespace svt::table diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index a3f954e0bef5..dd7088d93b40 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -221,44 +221,42 @@ namespace svt { namespace table void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive, OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData ) { - _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION); - _rDevice.IntersectClipRegion( _rArea ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); - else - _rDevice.SetLineColor(line); - } - //else set line color to the color of row background - else - { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR); + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); else _rDevice.SetLineColor(line); } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); + //else set line color to the color of row background else { - //if line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } - } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - { - // TODO: remove those temporary place holders - Rectangle aRect( _rArea ); - ++aRect.Left(); --aRect.Right(); - aRect.Top(); aRect.Bottom(); + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + + Rectangle aRect( _rArea ); + ++aRect.Left(); --aRect.Right(); + aRect.Top(); aRect.Bottom(); Point imagePos(Point(aRect.Left(), aRect.Top())); Size imageSize = _pCellData->GetSizePixel(); if(aRect.GetWidth() > imageSize.Width()) @@ -281,8 +279,7 @@ namespace svt { namespace table imageSize.Height() = aRect.GetHeight()-1; Image& image (*_pCellData); _rDevice.DrawImage(imagePos, imageSize, image, 0); - } - _rDevice.Pop(); + _rDevice.Pop(); (void)_bActive; // no special painting for the active cell at the moment @@ -293,42 +290,41 @@ namespace svt { namespace table OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText ) { _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); - Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); - Color line = m_pImpl->rModel.getLineColor(); - //if row is selected and line color isn't user specified, set it blue - if(_bSelected) - { - if(line == 0xFFFFFF) - _rDevice.SetLineColor(_rStyle.GetHighlightColor()); - else - _rDevice.SetLineColor(line); - } - //else set line color to the color of row background - else - { - if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + Color background1 = m_pImpl->rModel.getOddRowBackgroundColor(); + Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color line = m_pImpl->rModel.getLineColor(); + //if row is selected and line color isn't user specified, set it blue + if(_bSelected) { if(line == 0xFFFFFF) - _rDevice.SetLineColor(background2); + _rDevice.SetLineColor(_rStyle.GetHighlightColor()); else _rDevice.SetLineColor(line); } - else if(background1 != 0xFFFFFF && line == 0xFFFFFF) - _rDevice.SetLineColor(background1); + //else set line color to the color of row background else { - //if Line color is set, then it was user defined and should be visible - //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible - _rDevice.SetLineColor(line); + if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2) + { + if(line == 0xFFFFFF) + _rDevice.SetLineColor(background2); + else + _rDevice.SetLineColor(line); + } + else if(background1 != 0xFFFFFF && line == 0xFFFFFF) + _rDevice.SetLineColor(background1); + else + { + //if Line color is set, then it was user defined and should be visible + //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible + _rDevice.SetLineColor(line); + } } - } - _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); - { - // TODO: remove those temporary place holders - Rectangle aRect( _rArea ); - ++aRect.Left(); --aRect.Right(); - aRect.Top(); aRect.Bottom(); + _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() ); + + Rectangle aRect( _rArea ); + ++aRect.Left(); --aRect.Right(); + aRect.Top(); aRect.Bottom(); if(_bSelected) { _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); @@ -349,7 +345,7 @@ namespace svt { namespace table textRect.Left()+=4; textRect.Right()-=4; textRect.Bottom()-=2; _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); - } + _rDevice.Pop(); (void)_bActive; // no special painting for the active cell at the moment diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 418348c81b7d..87e295fab507 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -70,6 +70,7 @@ namespace svt { namespace table :Control( _pParent, _nStyle ) ,m_pImpl( new TableControl_Impl( *this ) ) ,m_bSelectionChanged(false) + ,m_bTooltip(false) { TableDataWindow* aTableData = m_pImpl->getDataWindow(); aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); @@ -546,6 +547,7 @@ void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUSt { m_aText = aText; m_nCols = nCols; + m_bTooltip = true; } // ----------------------------------------------------------------------- void TableControl::selectionChanged(bool _bChanged) @@ -553,6 +555,11 @@ void TableControl::selectionChanged(bool _bChanged) m_bSelectionChanged = _bChanged; } // ----------------------------------------------------------------------- +bool TableControl::isTooltip() +{ + return m_bTooltip; +} +// ----------------------------------------------------------------------- IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG ) { Select(); diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 1526dbdb778d..cfa86bbb5373 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -609,10 +609,10 @@ namespace svt { namespace table if(pColumn->getMinWidth() == 0 && bResizable) { pColumn->setMinWidth(1); - minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width(); + minColWithoutFixedSum+=m_rAntiImpl.PixelToLogic( Size( 1, 0 ), MAP_APPFONT ).Width(); } if(pColumn->getMaxWidth() == 0 && bResizable) - pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); + pColumn->setMaxWidth(m_rAntiImpl.PixelToLogic( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width()); if( colPrefWidth != 0) { if(m_bResizingGrid) @@ -884,6 +884,16 @@ namespace svt { namespace table // position it if ( m_pHScroll ) { + TableSize nVisibleUnits = lcl_getColumnsVisibleWithin( aDataCellPlayground, m_nLeftColumn, *this, false ); + int nRange = m_nColumnCount; + if( m_nLeftColumn + nVisibleUnits == nRange-1) + { + if(m_aColumnWidthsPixel[nRange-2] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth()) + { + m_pHScroll->SetVisibleSize( nVisibleUnits -1 ); + m_pHScroll->SetPageSize(nVisibleUnits -1); + } + } Rectangle aScrollbarArea( Point( 0, aDataCellPlayground.Bottom() + 1 ), Size( aDataCellPlayground.Right() + 1, nScrollbarMetrics ) @@ -1000,7 +1010,6 @@ namespace svt { namespace table *m_pDataWindow, aCell.getRect(), rStyle ); } } - // the area occupied by the row header, if any Rectangle aRowHeaderArea; if ( m_pModel->hasRowHeaders() ) @@ -1014,12 +1023,13 @@ namespace svt { namespace table //to avoid double lines when scrolling vertically if(m_nTopRow != 0) --aRowHeaderArea.Top(); + --aRowHeaderArea.Right(); pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle); // Note that strictly, aRowHeaderArea also contains the intersection between column // and row header area. However, below we go to paint this intersection, again, // so this hopefully doesn't hurt if we already paint it here. - if ( getModel()->hasColumnHeaders() ) + if ( m_pModel->hasColumnHeaders() ) { TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ), aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS ); @@ -1068,6 +1078,11 @@ namespace svt { namespace table --aRect.Top(); if(m_nLeftColumn != 0) --aRect.Left(); + else + { + if(m_pModel->hasRowHeaders()) + --aRect.Left(); + } // give the redenderer a chance to prepare the row pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow, *m_pDataWindow, aRect, rStyle ); @@ -1902,6 +1917,11 @@ namespace svt { namespace table return -1; } //------------------------------------------------------------------------------- + bool TableControl_Impl::isTooltipActive() + { + return m_rAntiImpl.isTooltip(); + } + //------------------------------------------------------------------------------- ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint ) { ::rtl::OUString aTooltipText; @@ -2027,8 +2047,8 @@ namespace svt { namespace table { m_pDataWindow->HideTracking(); PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn); - int maxWidth = pColumn->getMaxWidth(); - int minWidth = pColumn->getMinWidth(); + int maxWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMaxWidth(), 0 ), MAP_APPFONT ).Width(); + int minWidth = m_rAntiImpl.LogicToPixel( Size( pColumn->getMinWidth(), 0 ), MAP_APPFONT ).Width(); int resizeCol = m_nResizingColumn-m_nLeftColumn; //new position of mouse int actX = rPoint.X(); @@ -2038,7 +2058,7 @@ namespace svt { namespace table int leftX = 0; if(m_nResizingColumn > m_nLeftColumn) leftX = m_aVisibleColumnWidthsPixel[resizeCol-1]; - else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders()) + else if(m_nResizingColumn == m_nLeftColumn && m_pModel->hasRowHeaders()) leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width(); int actWidth = actX - leftX; int newActWidth = 0; @@ -2051,7 +2071,7 @@ namespace svt { namespace table pColumn->setPreferredWidth(newActWidth); } else - pColumn->setPreferredWidth(minWidth); + pColumn->setPreferredWidth(pColumn->getMinWidth()); if(m_nLeftColumn != 0) impl_updateLeftColumn(); } @@ -2063,7 +2083,7 @@ namespace svt { namespace table pColumn->setPreferredWidth(newActWidth); } else - pColumn->setPreferredWidth(maxWidth); + pColumn->setPreferredWidth(pColumn->getMaxWidth()); } m_nCurColumn = m_nResizingColumn; impl_ni_updateColumnWidths(); diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 0a487c77c76c..2b7cf50c849f 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -209,6 +209,7 @@ namespace svt { namespace table virtual void showCursor(); virtual bool dispatchAction( TableControlAction _eAction ); virtual SelectionEngine* getSelEngine(); + virtual bool isTooltipActive(); virtual rtl::OUString& setTooltip(const Point& rPoint ); virtual void resizeColumn(const Point& rPoint); virtual bool startResizeColumn(const Point& rPoint); diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e307071e2699..51311efd6ad1 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -55,12 +55,27 @@ namespace svt { namespace table m_rTableControl.doPaintContent( rUpdateRect ); } //-------------------------------------------------------------------- + void TableDataWindow::SetBackground( const Color& rColor ) + { + Window::SetBackground( rColor ); + } + //-------------------------------------------------------------------- + void TableDataWindow::SetControlBackground( const Color& rColor ) + { + Window::SetControlBackground( rColor ); + } + //-------------------------------------------------------------------- + Color TableDataWindow::GetControlBackground() + { + return Window::GetControlBackground(); + } + //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) { Point aPoint = rMEvt.GetPosPixel(); if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) ) { - if(m_rTableControl.getCurrentRow(aPoint)>=0 ) + if(m_rTableControl.getCurrentRow(aPoint)>=0 && m_rTableControl.isTooltipActive() ) { SetPointer(POINTER_ARROW); rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint); @@ -97,12 +112,9 @@ namespace svt { namespace table m_nRowAlreadySelected = nCurRow; m_aSelectHdl.Call( NULL ); } - else - m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } - else - m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); } + m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().LoseFocus(); } //-------------------------------------------------------------------- @@ -110,8 +122,7 @@ namespace svt { namespace table { if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) ) Window::MouseButtonUp( rMEvt ); - else - m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); + m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt); m_rTableControl.getAntiImpl().GetFocus(); } //-------------------------------------------------------------------- diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index b411181c2aab..8586d9fe8da1 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -180,7 +180,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_HEADER_BACKGROUND: { - sal_Int32 colorHeader = 0x000000; + sal_Int32 colorHeader = 0xFFFFFF; if( aValue >>= colorHeader ) { m_pTableModel->setHeaderBackgroundColor(colorHeader); @@ -189,7 +189,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_LINE_COLOR: { - sal_Int32 colorLine = 0x000000; + sal_Int32 colorLine = 0xFFFFFF; if( aValue >>= colorLine ) { m_pTableModel->setLineColor(colorLine); @@ -198,7 +198,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND: { - sal_Int32 colorEvenRow = 0x000000; + sal_Int32 colorEvenRow = 0xFFFFFF; if( aValue >>= colorEvenRow ) { m_pTableModel->setEvenRowBackgroundColor(colorEvenRow); @@ -207,7 +207,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_GRID_ROW_BACKGROUND: { - sal_Int32 colorBackground = 0x000000; + sal_Int32 colorBackground = 0xFFFFFF; if( aValue >>= colorBackground ) { m_pTableModel->setOddRowBackgroundColor(colorBackground); @@ -216,13 +216,23 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } case BASEPROPERTY_TEXTCOLOR: { - sal_Int32 colorText = 0xFFFFFF; + sal_Int32 colorText = 0x000000; if( aValue >>= colorText ) { m_pTableModel->setTextColor(colorText); } break; } + case BASEPROPERTY_BACKGROUNDCOLOR: + { + sal_Int32 color = 0xFFFFFF; + if( aValue >>= color ) + { + pTable->getDataWindow()->SetBackground( color ); + pTable->getDataWindow()->SetControlBackground( color ); + } + break; + } case BASEPROPERTY_VERTICALALIGN: { com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0)); diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index db9634fb44a1..731bb73e6fcd 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -492,7 +492,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th static Sequence< ::rtl::OUString >* pNamesSeq = NULL; if ( !pNamesSeq ) { - pNamesSeq = new Sequence< ::rtl::OUString >( 21 ); + pNamesSeq = new Sequence< ::rtl::OUString >( 22 ); ::rtl::OUString* pNames = pNamesSeq->getArray(); pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ); pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ); @@ -515,7 +515,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel ); pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel ); pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel ); - pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel ); + pNames[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel ); } return *pNamesSeq; diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 6711e4503511..132fd6719a2d 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -282,9 +282,9 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ), - DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ) }; pPropertyInfos = aImplPropertyInfos; -- cgit From 24446b73982dab6d2145cb0323a3bed756bdc118 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 4 Jun 2010 15:24:20 +0200 Subject: #i110654# fix some WingDings2->OpenSymbol emulation translations --- unotools/source/misc/fontcvt.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 1a31272a483c..a84586ab78cf 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -295,18 +295,18 @@ static const sal_Unicode aWingDings2Tab[224] = // F050 0xe52f, 0xe530, 0xe531, 0xe532, 0xe533, 0xe534, 0xe535, 0xe536, - 0xe537, 0xe538, 0xe539, 0xe53a, + 0xe537, 0x203D, 0x203D, 0x203D, 0xe53b, 0xe53c, 0xe53d, 0xe53e, // F060 0xe53f, 0xe540, 0xe541, 0xe542, 0xe543, 0xe544, 0xe545, 0xe546, - 0xe547, 0xe548, 0xe549, 0xe54a, - 0xe54b, 0xe54c, 0xe54d, 0xe54e, + 0xe547, 0x24EA, 0x2460, 0x2461, + 0x2462, 0x2463, 0x2464, 0x2465, // F070 - 0xe54e, 0xe54f, 0xe550, 0xe551, - 0xe552, 0xe553, 0xe554, 0xe555, - 0xe556, 0xe557, 0xe558, 0xe559, - 0xe55a, 0xe55b, 0xe55c, 0, + 0x2466, 0x2477, 0x2468, 0x2469, + 0xE453, 0x278A, 0x278B, 0x278C, + 0x278D, 0x278E, 0x278F, 0x2790, + 0x2791, 0x2792, 0x2793, 0, // F080 0x2609, 0x25cb, 0x263d, 0x263e, 0xe55d, 0xe55e, 0xe55f, 0xe560, @@ -343,7 +343,7 @@ static const sal_Unicode aWingDings2Tab[224] = 0xe5c1, 0xe5c2, 0xe5c3, 0xe5c4, 0xe5c5, 0xe5c6, 0xe5c7, 0xe5c8, // F0f0 - 0xe5c9, 0xe5ca, 0xe5cb, 0xe5cc, + 0xe5c9, 0x2022, 0xe5cb, 0xe5cc, 0xe5cd, 0xe5ce, 0xe5cf, 0xe5d0, 0x203b, 0x2042, 0, 0, 0, 0, 0, 0 -- cgit From a51dc52262038e9c72eea188cfe9a6812bbc2f8d Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 4 Jun 2010 16:52:01 +0200 Subject: masterfix: #i10000# transex3 -> l10ntools --- l10ntools/prj/build.lst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst index 63de11bfec4a..8387154897b3 100644 --- a/l10ntools/prj/build.lst +++ b/l10ntools/prj/build.lst @@ -3,9 +3,7 @@ tr l10ntools usr1 - all tr_mkout NULL tr l10ntools\inc nmake - all tr_inc NULL tr l10ntools\source nmake - all tr_src tr_inc NULL tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL -#tr l10ntools\java\l10nconv nmake - all tr_conv NULL -#tr l10ntools\java\receditor nmake - all tr_rece NULL -tr transex3\java\jpropex nmake - all tr_blah NULL +tr l10ntools\java\jpropex nmake - all tr_blah NULL tr l10ntools\source\help nmake - all tr_bla_help NULL tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL -- cgit From d50be7a83ace7a3181c91dbe63cf2588e1424a1c Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Fri, 4 Jun 2010 17:28:06 +0200 Subject: fwk139: Fix build problem with gcc --- svtools/source/uno/toolboxcontroller.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 4658da9bee3a..c0203c93c020 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -71,8 +71,8 @@ ToolboxController::ToolboxController( const Reference< XMultiServiceFactory >& rServiceManager, const Reference< XFrame >& xFrame, const ::rtl::OUString& aCommandURL ) : - OWeakObject() - ,OPropertyContainer(GetBroadcastHelper())//shizhoubo + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_xFrame(xFrame) @@ -98,8 +98,8 @@ ToolboxController::ToolboxController( } ToolboxController::ToolboxController() : - OWeakObject() - ,OPropertyContainer(GetBroadcastHelper())//shizhoubo + OPropertyContainer(GetBroadcastHelper()) + , OWeakObject() , m_bInitialized( sal_False ) , m_bDisposed( sal_False ) , m_aListenerContainer( m_aMutex ) @@ -779,17 +779,19 @@ sal_Bool SAL_CALL ToolboxController::convertFastPropertyValue( com::sun::star::u } -void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, - const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception) + +void SAL_CALL ToolboxController::setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const com::sun::star::uno::Any& aValue ) +throw( com::sun::star::uno::Exception) { OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, aValue); if (TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIABLE == nHandle) - { sal_Bool rValue; - aValue >>= rValue; - if (m_bInitialized) - this->setSupportVisiableProperty(rValue); + { + sal_Bool rValue(sal_False); + if (( aValue >>= rValue ) && m_bInitialized) + this->setSupportVisiableProperty( rValue ); } - } //end -- cgit From d0485ab58475807f4cd2afeb16013ce8ff37ec3e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 4 Jun 2010 18:09:07 +0200 Subject: vcl112: #i111992# prevent duplicate opening of menu by key event --- vcl/aqua/inc/salframeview.h | 1 + vcl/aqua/source/window/salframeview.mm | 5 +++++ vcl/aqua/source/window/salmenu.cxx | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h index 498c9679e97c..0174c1a68832 100755 --- a/vcl/aqua/inc/salframeview.h +++ b/vcl/aqua/inc/salframeview.h @@ -108,6 +108,7 @@ -(MacOSBOOL)sendKeyToFrameDirect: (USHORT)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod; -(MacOSBOOL)sendSingleCharacter:(NSEvent*)pEvent; -(MacOSBOOL)handleKeyDownException:(NSEvent*)pEvent; +-(void)clearLastEvent; /* text action methods */ diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 0dfa0fa356aa..25dadf0e592b 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -1510,6 +1510,11 @@ private: mbKeyHandled = true; } +-(void)clearLastEvent +{ + mpLastEvent = nil; +} + - (NSRect)firstRectForCharacterRange:(NSRange)theRange { SalExtTextInputPosEvent aPosEvent; diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index f39d7c675bc4..ed3086d8506f 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -370,6 +370,10 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.nY - pParentAquaSalFrame->maGeometry.nY + offset; pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false); + // #i111992# if this menu was opened due to a key event, prevent dispatching that yet again + if( [pParentNSView respondsToSelector: @selector(clearLastEvent)] ) + [pParentNSView performSelector:@selector(clearLastEvent)]; + // open popup menu NSPopUpButtonCell * pPopUpButtonCell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]; [pPopUpButtonCell setMenu: pCopyMenu]; -- cgit From 9e79321ec06504c36119b1342c296fcd14e2f70b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 4 Jun 2010 18:26:04 +0200 Subject: vcl112: #i111992# fix menubutton including image --- vcl/source/control/button.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 08759f37d7a6..5029aa2db26d 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1187,7 +1187,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags aSize.Width() -= ( 5 + nSymbolSize ); ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, - 1, nDrawFlags, nTextStyle ); + 1, nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 ); } else ImplCalcSymbolRect( aInRect ); -- cgit From 494270ff91d1617cb69262b409d56a591a1e7c07 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 7 Jun 2010 09:15:54 +0200 Subject: tl78: #i10000# fix warnings --- comphelper/source/misc/docpasswordhelper.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 858d1ff19bca..fc41eaec3194 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -120,7 +120,7 @@ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( nLowResult = ( ( ( nLowResult >> 14 ) & 0x0001 ) | ( ( nLowResult << 1 ) & 0x7FFF ) ) ^ nChar; } - nLowResult = ( ( ( nLowResult >> 14 ) & 0x001 ) | ( ( nLowResult << 1 ) & 0x7FF ) ) ^ nLen ^ 0xCE4B; + nLowResult = (sal_uInt16)( ( ( ( nLowResult >> 14 ) & 0x001 ) | ( ( nLowResult << 1 ) & 0x7FF ) ) ^ nLen ^ 0xCE4B ); nResult = ( nHighResult << 16 ) | nLowResult; } @@ -135,8 +135,8 @@ Sequence< sal_Int8 > DocPasswordHelper::GetWordHashAsSequence( sal_uInt32 nHash = GetWordHashAsUINT32( aUString ); Sequence< sal_Int8 > aResult( 4 ); aResult[0] = ( nHash >> 24 ); - aResult[1] = ( nHash & 0xFF0000 ); - aResult[2] = ( nHash & 0xFF00 ); + aResult[1] = ( ( nHash >> 16 ) & 0xFF ); + aResult[2] = ( ( nHash >> 8 ) & 0xFF ); aResult[3] = ( nHash & 0xFF ); return aResult; -- cgit From 996674302efa782dc956e173b222f810aa3a4c00 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 7 Jun 2010 09:49:05 +0200 Subject: cleanup (whitespace & exceptions). --- svtools/source/contnr/fileview.cxx | 76 ++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8538e344bdc1..1d80461b060f 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -100,7 +100,7 @@ using ::rtl::OUString; DECLARE_LIST( StringList_Impl, OUString* ) -#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap +#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap #define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reseted namespace @@ -204,7 +204,7 @@ private: Timer maResetQuickSearch; OUString maQuickSearchText; String msAccessibleDescText; - String msFolder; + Strin msFolder; String msFile; sal_uInt32 mnSearchIndex; sal_Bool mbResizeDisabled : 1; @@ -299,11 +299,11 @@ inline const OUString& HashedEntry::GetName() const class HashedEntryList : protected List {// provides a list of _unique_ Entries protected: - inline HashedEntry* First(); - inline HashedEntry* Next(); - inline void Append( HashedEntry* pNewEntry ); + inline HashedEntry* First(); + inline HashedEntry* Next(); + inline void Append( HashedEntry* pNewEntry ); public: - virtual ~HashedEntryList(); + virtual ~HashedEntryList(); const HashedEntry* Find( const OUString& rNameToSearchFor ); const HashedEntry* Find( const HashedEntry& rToSearchFor ); @@ -338,7 +338,7 @@ HashedEntryList::~HashedEntryList() const HashedEntry* HashedEntryList::Find( const OUString& rRefName ) { // simple linear search, which should be fast enough for this purpose - HashedEntry aRef( rRefName ); + HashedEntry aRef( rRefName ); HashedEntry* pIter = First(); while( pIter && *pIter != aRef ) pIter = Next(); @@ -419,12 +419,12 @@ class NameTranslationList : protected HashedEntryList { // contains a list of substitutes of strings for a given folder (as URL) // explanation of the circumstances see in remarks for Init(); protected: - INetURLObject maTransFile; // URL of file with translation entries - HashedEntry maHashedURL; // for future purposes when dealing with a set of cached - // NameTranslationLists + INetURLObject maTransFile; // URL of file with translation entries + HashedEntry maHashedURL; // for future purposes when dealing with a set of cached + // NameTranslationLists private: const String maTransFileName; - void Init(); // reads the translation file and fills the (internal) list + void Init(); // reads the translation file and fills the (internal) list public: NameTranslationList( const INetURLObject& rBaseURL ); @@ -436,12 +436,12 @@ public: using List::operator!=; inline sal_Bool operator !=( const HashedEntry& rRef ) const; - const OUString* Translate( const OUString& rName ) const; + const OUString* Translate( const OUString& rName ) const; // returns NULL, if rName can't be found - inline void Update(); // clears list and init + inline void Update(); // clears list and init - inline const String& GetTransTableFileName() const; + inline const String& GetTransTableFileName() const; // returns the name for the file, which contains the translation strings }; @@ -463,7 +463,7 @@ void NameTranslationList::Init() if( aTestContent.isDocument() ) {// ... also tests the existence of maTransFile by throwing an Exception - const sal_Char* pSection = "TRANSLATIONNAMES"; + const sal_Char* pSection = "TRANSLATIONNAMES"; String aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) ); Config aConfig( aFsysName ); @@ -475,7 +475,7 @@ void NameTranslationList::Init() Insert( new NameTranslationEntry( aConfig.GetKeyName( nCnt ), aConfig.ReadKey( nCnt ) ) ); } } - catch( Exception& ) {} + catch( Exception const & ) {} } NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ): @@ -527,7 +527,7 @@ public: // IContentTitleTranslation virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const; - void UpdateTranslationTable(); // reads the translation file again + void UpdateTranslationTable(); // reads the translation file again void SetActualFolder( const INetURLObject& rActualFolder ); const String* GetTransTableFileName() const; @@ -600,7 +600,7 @@ public: void OpenFolder_Impl(); // #83004# ------- - void ReplaceTabWithString( OUString& aValue ); + void ReplaceTabWithString( OUString& aValue ); void CreateDisplayText_Impl(); void CreateVector_Impl( const Sequence < OUString > &rList ); void SortFolderContent_Impl(); @@ -613,7 +613,7 @@ public: ULONG GetEntryPos( const OUString& rURL ); - inline void EnableContextMenu( sal_Bool bEnable ); + inline voi EnableContextMenu( sal_Bool bEnable ); inline void EnableDelete( sal_Bool bEnable ); void Resort_Impl( sal_Int16 nColumn, sal_Bool bAscending ); @@ -665,7 +665,7 @@ inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable ) if( mpView->IsDeleteOrContextMenuEnabled() ) { DBG_ASSERT( !mbReplaceNames, "SvtFileView_Impl::EnableNameReplacing(): state should be not possible!" ); - bRet = !bEnable; // only for enabling this is an unsuccessful result + bRet = !bEnable; // only for enabling this is an unsuccessful result } else { @@ -824,7 +824,7 @@ void ViewTabListBox_Impl::Resize() mbResizeDisabled = sal_True; Point aPos = GetPosPixel(); SetPosSizePixel( Point( 0, aBarSize.Height() ), - Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) ); + Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) ); mbResizeDisabled = sal_False; } } @@ -992,9 +992,9 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry, bRet = TRUE; } - catch( ::com::sun::star::ucb::ContentCreationException ) {} - catch( ::com::sun::star::ucb::CommandAbortedException ) {} - catch( ::com::sun::star::uno::Exception ) {} + //catch( ::com::sun::star::ucb::ContentCreationException const & ) {} + //catch( ::com::sun::star::ucb::CommandAbortedException const & ) {} + catch( Exception const & ) {} return bRet; } @@ -1095,12 +1095,12 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent ) ::ucbhelper::Content aCnt( rContent, mxCmdEnv ); aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) + catch( ::com::sun::star::ucb::CommandAbortedException const & ) { DBG_WARNING( "CommandAbortedException" ); bRet = sal_False; } - catch( ::com::sun::star::uno::Exception& ) + catch( Exception const & ) { DBG_WARNING( "Any other exception" ); bRet = sal_False; @@ -1314,7 +1314,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const } } } - catch( ::com::sun::star::uno::Exception ) + catch( Exception const & ) { // perhaps an unkown url protocol (e.g. "private:newdoc") } @@ -1366,7 +1366,7 @@ sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com: mpImp->FilterFolderContent_Impl( rFilter ); - mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!! + mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!! mpImp->CreateDisplayText_Impl(); mpImp->OpenFolder_Impl(); @@ -1999,7 +1999,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter ) { // normalize the content title (we always match case-insensitive) // 91872 - 11.09.2001 - frank.schoenheit@sun.com - sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title! + sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title! sal_Bool bDelete; if( bHideTransFile && sCompareString == sHideEntry ) @@ -2643,12 +2643,12 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ), - _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ), - _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ), - _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ), - _aYesButton ( this, SvtResId( BTN_YES ) ), - _aAllButton ( this, SvtResId( BTN_ALL ) ), - _aNoButton ( this, SvtResId( BTN_NO ) ), + _aEntryLabel ( this, SvtResId( TXT_ENTRY ) ), + _aEntry ( this, SvtResId( TXT_ENTRYNAME ) ), + _aQueryMsg ( this, SvtResId( TXT_QUERYMSG ) ), + _aYesButton ( this, SvtResId( BTN_YES ) ), + _aAllButton ( this, SvtResId( BTN_ALL ) ), + _aNoButton ( this, SvtResId( BTN_NO ) ), _aCancelButton( this, SvtResId( BTN_CANCEL ) ) { @@ -2671,12 +2671,6 @@ QueryDeleteDlg_Impl::QueryDeleteDlg_Impl // ----------------------------------------------------------------------- IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn ) - -/* [Beschreibung] - - Die Methode wertet das Resultat der Abfrage aus. -*/ - { if ( pBtn == &pThis->_aYesButton ) pThis->_eResult = QUERYDELETE_YES; -- cgit From ac433a52867211e4c8c8a1a306ed38ba575645e1 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 7 Jun 2010 10:56:29 +0200 Subject: #i112173# - context menu items reflect actual file properties. --- svtools/source/contnr/fileview.cxx | 102 ++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 12 deletions(-) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 1d80461b060f..73a0aac06f3f 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -54,6 +54,9 @@ #include #include #include +#include +#include +#include #include #include @@ -204,12 +207,13 @@ private: Timer maResetQuickSearch; OUString maQuickSearchText; String msAccessibleDescText; - Strin msFolder; + String msFolder; String msFile; sal_uInt32 mnSearchIndex; sal_Bool mbResizeDisabled : 1; sal_Bool mbAutoResize : 1; sal_Bool mbEnableDelete : 1; + sal_Bool mbEnableRename : 1; void DeleteEntries(); void DoQuickSearch( const xub_Unicode& rChar ); @@ -232,6 +236,7 @@ public: void EnableAutoResize() { mbAutoResize = sal_True; } void EnableDelete( sal_Bool bEnable ) { mbEnableDelete = bEnable; } + void EnableRename( sal_Bool bEnable ) { mbEnableRename = bEnable; } sal_Bool IsDeleteOrContextMenuEnabled() { return mbEnableDelete || IsContextMenuHandlingEnabled(); } Reference< XCommandEnvironment > GetCommandEnvironment() const { return mxCmdEnv; } @@ -613,7 +618,7 @@ public: ULONG GetEntryPos( const OUString& rURL ); - inline voi EnableContextMenu( sal_Bool bEnable ); + inline void EnableContextMenu( sal_Bool bEnable ); inline void EnableDelete( sal_Bool bEnable ); void Resort_Impl( sal_Int16 nColumn, sal_Bool bAscending ); @@ -661,6 +666,8 @@ inline void SvtFileView_Impl::EnableDelete( sal_Bool bEnable ) inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable ) { + mpView->EnableRename( bEnable ); + sal_Bool bRet; if( mpView->IsDeleteOrContextMenuEnabled() ) { @@ -744,7 +751,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin, mnSearchIndex ( 0 ), mbResizeDisabled ( sal_False ), mbAutoResize ( sal_False ), - mbEnableDelete ( sal_True ) + mbEnableDelete ( sal_True ), + mbEnableRename ( sal_True ) { Size aBoxSize = pParentWin->GetSizePixel(); @@ -870,20 +878,90 @@ void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt ) PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void ) { - PopupMenu* pRet; - sal_Int32 nSelectedEntries = GetSelectionCount(); + bool bEnableDelete = mbEnableDelete; + bool bEnableRename = mbEnableRename; + + if ( bEnableDelete || bEnableRename ) + { + sal_Int32 nSelectedEntries = GetSelectionCount(); + bEnableDelete &= nSelectedEntries > 0; + bEnableRename &= nSelectedEntries == 1; + } - if ( nSelectedEntries ) + if ( bEnableDelete || bEnableRename ) { - pRet = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ); - pRet->EnableItem( MID_FILEVIEW_DELETE, 0 < nSelectedEntries ); - pRet->EnableItem( MID_FILEVIEW_RENAME, 1 == nSelectedEntries ); + SvLBoxEntry* pEntry = FirstSelected(); + while ( pEntry ) + { + ::ucbhelper::Content aCnt; + try + { + OUString aURL( static_cast< SvtContentEntry * >( + pEntry->GetUserData() )->maURL ); + aCnt = ::ucbhelper::Content( aURL, mxCmdEnv ); + } + catch( Exception const & ) + { + bEnableDelete = bEnableRename = false; + } + + if ( bEnableDelete ) + { + try + { + Reference< XCommandInfo > aCommands = aCnt.getCommands(); + if ( aCommands.is() ) + bEnableDelete + = aCommands->hasCommandByName( + OUString::createFromAscii( "delete" ) ); + else + bEnableDelete = false; + } + catch( Exception const & ) + { + bEnableDelete = false; + } + } + + if ( bEnableRename ) + { + try + { + Reference< XPropertySetInfo > aProps = aCnt.getProperties(); + if ( aProps.is() ) + { + Property aProp + = aProps->getPropertyByName( + OUString::createFromAscii( "Title" ) ); + bEnableRename + = !( aProp.Attributes & PropertyAttribute::READONLY ); + } + else + bEnableRename = false; + } + catch( Exception const & ) + { + bEnableRename = false; + } + } + + pEntry = ( bEnableDelete || bEnableRename ) + ? NextSelected( pEntry ) + : 0; + } + } + + if ( bEnableDelete || bEnableRename ) + { + PopupMenu * pRet + = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) ); + pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete ); + pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename ); pRet->RemoveDisabledEntries( sal_True, sal_True ); + return pRet; } - else - pRet = NULL; - return pRet; + return NULL; } // ----------------------------------------------------------------------- -- cgit From 6f5305b0c6c1a2f4aba4e68eaef2d315e72b9936 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Jun 2010 14:55:41 +0200 Subject: #i112187# --- svtools/source/uno/svtxgridcontrol.cxx | 1 - svtools/source/uno/svtxgridcontrol.hxx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 264dfd6342f7..42656f9c033c 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -79,7 +79,6 @@ SVTXGridControl::SVTXGridControl() //-------------------------------------------------------------------- SVTXGridControl::~SVTXGridControl() { - DELETEZ(m_pTableModel); } ::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index bcb8badf72e5..b15507e4614f 100755 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -51,7 +51,7 @@ class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener> { private: - UnoControlTableModel* m_pTableModel; + ::boost::shared_ptr< UnoControlTableModel > m_pTableModel; ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel; ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel; bool m_bHasColumnHeaders; -- cgit From 92d45780abf4816e88b639f2e5cddef26069034d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 8 Jun 2010 11:58:26 +0200 Subject: unoawt: setVisible needs to lock the SolarMutex --- svtools/source/uno/svtxgridcontrol.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 42656f9c033c..99b36c390f23 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -421,6 +421,7 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) } void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) { + ::vos::OGuard aGuard( GetMutex() ); TableControl* pTable = (TableControl*)GetWindow(); if ( pTable ) { -- cgit From e9513a0b839abeb8c377b087a3e3c03a3cf0e450 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 8 Jun 2010 15:14:30 +0200 Subject: #i101378# auto-close only filled polygons --- vcl/source/gdi/outdev6.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index cd41a1c02f24..e7d90fa86b2b 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -300,13 +300,17 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, // get the polygon in device coordinates basegfx::B2DPolyPolygon aB2DPolyPolygon( rPolyPoly.getB2DPolyPolygon() ); - aB2DPolyPolygon.setClosed( true ); const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); aB2DPolyPolygon.transform( aTransform ); - // draw the transparent polygon const double fTransparency = 0.01 * nTransparencePercent; - bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this ); + if( mbFillColor ) + { + // make sure filled polygons are closed + aB2DPolyPolygon.setClosed( true ); + // draw the transparent polygon + bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this ); + } if( mbLineColor ) { -- cgit From d2f35644c9204218c613d1787fc92155a1b1aad0 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Tue, 8 Jun 2010 16:21:07 +0200 Subject: #i101378# filled polygons are auto-closed by subsystems --- vcl/source/gdi/outdev6.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index e7d90fa86b2b..47b150ddc4c5 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -306,9 +306,8 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, const double fTransparency = 0.01 * nTransparencePercent; if( mbFillColor ) { - // make sure filled polygons are closed - aB2DPolyPolygon.setClosed( true ); // draw the transparent polygon + // NOTE: filled polygons are assumed to be drawn as if they were always closed bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, fTransparency, this ); } @@ -322,7 +321,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon& rPolygon = aB2DPolyPolygon.getB2DPolygon( nPolyIdx ); - /*bDrawn =*/ mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this ); + bDrawn = mpGraphics->DrawPolyLine( rPolygon, fTransparency, aLineWidths, ::basegfx::B2DLINEJOIN_NONE, this ); } // prepare to restore the fill color mbInitFillColor = mbFillColor; -- cgit From a080fcbc00bbbb14e92f1850ef9c79d2c833b646 Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Tue, 8 Jun 2010 16:26:01 +0200 Subject: #i112173# - Handle keyinput for delete according to actual content properties. --- svtools/source/contnr/fileview.cxx | 67 ++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 73a0aac06f3f..fa4af2896994 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1006,12 +1006,31 @@ void ViewTabListBox_Impl::DeleteEntries() aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL; if ( !aURL.Len() ) - return; + continue; + + bool canDelete = true; + try + { + ::ucbhelper::Content aCnt( aURL, mxCmdEnv ); + Reference< XCommandInfo > aCommands = aCnt.getCommands(); + if ( aCommands.is() ) + canDelete + = aCommands->hasCommandByName( + OUString::createFromAscii( "delete" ) ); + else + canDelete = false; + } + catch( Exception const & ) + { + canDelete = false; + } - INetURLObject aObj( aURL ); + if (!canDelete) + continue; // process next entry if ( eResult != svtools::QUERYDELETE_ALL ) { + INetURLObject aObj( aURL ); svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) ); if ( sDialogPosition.Len() ) aDlg.SetWindowState( sDialogPosition ); @@ -1057,22 +1076,44 @@ BOOL ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry, try { + OUString aPropName = OUString::createFromAscii( "Title" ); + bool canRename = true; ::ucbhelper::Content aContent( aURL, mxCmdEnv ); - OUString aPropName = OUString::createFromAscii( "Title" ); - Any aValue; - aValue <<= OUString( rNewText ); - aContent.setPropertyValue( aPropName, aValue ); - mpParent->EntryRenamed( aURL, rNewText ); + try + { + Reference< XPropertySetInfo > aProps = aContent.getProperties(); + if ( aProps.is() ) + { + Property aProp = aProps->getPropertyByName( aPropName ); + canRename = !( aProp.Attributes & PropertyAttribute::READONLY ); + } + else + { + canRename = false; + } + } + catch ( Exception const & ) + { + canRename = false; + } + + if ( canRename ) + { + Any aValue; + aValue <<= OUString( rNewText ); + aContent.setPropertyValue( aPropName, aValue ); + mpParent->EntryRenamed( aURL, rNewText ); - pData->maURL = aURL; - pEntry->SetUserData( pData ); + pData->maURL = aURL; + pEntry->SetUserData( pData ); - bRet = TRUE; + bRet = TRUE; + } + } + catch( Exception const & ) + { } - //catch( ::com::sun::star::ucb::ContentCreationException const & ) {} - //catch( ::com::sun::star::ucb::CommandAbortedException const & ) {} - catch( Exception const & ) {} return bRet; } -- cgit From a812215af2cee88810d128e50d65448b99ef1cc0 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Tue, 8 Jun 2010 17:32:15 +0200 Subject: fwk139: Fix warning with gcc and public/non-plublic types --- comphelper/inc/comphelper/propertycontainerhelper.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comphelper/inc/comphelper/propertycontainerhelper.hxx b/comphelper/inc/comphelper/propertycontainerhelper.hxx index 247e1a678e02..82848203699c 100644 --- a/comphelper/inc/comphelper/propertycontainerhelper.hxx +++ b/comphelper/inc/comphelper/propertycontainerhelper.hxx @@ -42,7 +42,7 @@ namespace comphelper //......................................................................... // infos about one single property -struct COMPHELPER_DLLPRIVATE PropertyDescription +struct COMPHELPER_DLLPUBLIC PropertyDescription { // the possibilities where a property holding object may be located enum LocationType -- cgit From 15744fda13dfa45bc3d737bc72f2768edfc7c81a Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 8 Jun 2010 19:15:19 +0200 Subject: cws tl78: #i109634# additional dialog parameter --- vcl/inc/vcl/abstdlg.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/inc/vcl/abstdlg.hxx b/vcl/inc/vcl/abstdlg.hxx index 86bee942899e..2fa134af5078 100755 --- a/vcl/inc/vcl/abstdlg.hxx +++ b/vcl/inc/vcl/abstdlg.hxx @@ -86,7 +86,7 @@ public: virtual VclAbstractDialog* CreateVclDialog( Window* pParent, sal_uInt32 nResId ) = 0; // creates instance of PasswordToOpenModifyDialog from cui - virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen ) = 0; + virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0; }; #endif -- cgit From 2a28988178dd09dd437f726df8263d6659478c27 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 9 Jun 2010 11:55:10 +0200 Subject: #i111860# fix high contrast mode for toolbar menus --- svtools/source/control/toolbarmenu.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index f07ebd7fe8cd..fa393da3d5a8 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -481,6 +481,9 @@ void ToolbarMenu::implInit(const Reference< XFrame >& rFrame) { mpImpl = new ToolbarMenu_Impl( *this, rFrame ); + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + SetControlBackground( rStyleSettings.GetMenuColor() ); + initWindow(); Window* pWindow = GetTopMostParentSystemWindow( this ); @@ -638,8 +641,6 @@ void ToolbarMenu::initWindow() { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - SetControlBackground( GetSettings().GetStyleSettings().GetFaceGradientColor() ); - SetPointFont( rStyleSettings.GetMenuFont() ); SetBackground( Wallpaper( GetControlBackground() ) ); SetTextColor( rStyleSettings.GetMenuTextColor() ); -- cgit From 5f2e5e46dc915694b4ef945809f15d15b5e9d58f Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Wed, 9 Jun 2010 14:39:18 +0200 Subject: gridcontrol04: fix for #i112217# --- svtools/inc/svtools/table/tablecontrol.hxx | 2 +- svtools/source/table/gridtablerenderer.cxx | 27 +++++++++++++++++++-------- svtools/source/table/tablecontrol.cxx | 6 +++--- svtools/source/table/tablecontrol_impl.cxx | 1 + 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 8ebbbf5ab55d..cc7743b3a345 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -218,7 +218,7 @@ namespace svt { namespace table virtual sal_Bool isAccessibleAlive( ) const; virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); virtual void RemoveSelectedRow(RowPos _nRowPos); - virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos); + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const; ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip(); ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip(); void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols); diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index dd7088d93b40..8e5bd181a583 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -109,7 +109,10 @@ namespace svt { namespace table DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" ); if ( !!pColumn ) sHeaderText = pColumn->getName(); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + if(m_pImpl->rModel.getTextColor() != 0x000000) + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -146,6 +149,11 @@ namespace svt { namespace table Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor(); Color line = m_pImpl->rModel.getLineColor(); Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor(); + Color fieldColor = _rStyle.GetFieldColor(); + if(aRowBackground == 0xFFFFFF) + aRowBackground = fieldColor; + if(aRowBackground2 == 0xFFFFFF) + aRowBackground2 = fieldColor; //if row is selected background color becomes blue, and lines should be also blue //if they aren't user defined if(_bSelected) @@ -161,7 +169,7 @@ namespace svt { namespace table //and set line color to be the same else { - if(aRowBackground2 != 0xFFFFFF && _nRow%2) + if(aRowBackground2 != fieldColor && _nRow%2) { aRowBackground = aRowBackground2; if(line == 0xFFFFFF) @@ -170,7 +178,7 @@ namespace svt { namespace table _rDevice.SetLineColor(line); } //fill the rows with alternating background colors if second background color is specified - else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF) + else if(aRowBackground != fieldColor && line == 0xFFFFFF) _rDevice.SetLineColor(aRowBackground); else { @@ -195,7 +203,10 @@ namespace svt { namespace table _rDevice.Push( PUSH_LINECOLOR); _rDevice.SetLineColor(_rStyle.GetSeparatorColor()); _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() ); - _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + if(m_pImpl->rModel.getTextColor() != 0x000000) + _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -326,11 +337,11 @@ namespace svt { namespace table ++aRect.Left(); --aRect.Right(); aRect.Top(); aRect.Bottom(); if(_bSelected) - { _rDevice.SetTextColor(_rStyle.GetHighlightTextColor()); - } - else + else if(m_pImpl->rModel.getTextColor() != 0x000000) _rDevice.SetTextColor(m_pImpl->rModel.getTextColor()); + else + _rDevice.SetTextColor(_rStyle.GetFieldTextColor()); ULONG nHorFlag = TEXT_DRAW_LEFT; ULONG nVerFlag = TEXT_DRAW_TOP; if(m_pImpl->rModel.getVerticalAlign() == 1) @@ -344,7 +355,7 @@ namespace svt { namespace table Rectangle textRect(_rArea); textRect.Left()+=4; textRect.Right()-=4; textRect.Bottom()-=2; - _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); + _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP); _rDevice.Pop(); (void)_bActive; diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 87e295fab507..130667777760 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -264,7 +264,7 @@ namespace svt { namespace table aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); break; case TCTYPE_TABLECELL: - aRetText = GetRowName(_nRow); + aRetText = GetAccessibleCellText(_nRow, _nCol); break; case TCTYPE_ROWHEADERCELL: aRetText = GetRowName(_nRow); @@ -347,9 +347,9 @@ namespace svt { namespace table } // ----------------------------------------------------------------------------- -::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) +::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos) const { - ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); + const ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos); return m_pImpl->convertToString(cellContent); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index cfa86bbb5373..69ad3cff9db2 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1040,6 +1040,7 @@ namespace svt { namespace table --aInters.Top(); --aInters.Bottom(); } + --aInters.Right(); pRenderer->PaintHeaderArea( *m_pDataWindow, aInters, true, true, rStyle ); -- cgit From b2c57b3e110985a909c1136ab169f327bb536b2c Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Wed, 9 Jun 2010 15:06:54 +0200 Subject: gridcontrol04: fix for #i112217# file added --- svtools/inc/svtools/accessibletable.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx index 7098d2b0d4ef..acf76db27fd8 100755 --- a/svtools/inc/svtools/accessibletable.hxx +++ b/svtools/inc/svtools/accessibletable.hxx @@ -124,7 +124,7 @@ public: virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; virtual std::vector& GetSelectedRows() = 0; virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0; - virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0; + virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; }; // ---------------------------------------------------------------------------- -- cgit From 363b004b5a160f00268c0dc000f050c29089274d Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 9 Jun 2010 17:23:09 +0200 Subject: consolidatereadme: #i111721# parse new readme format --- l10ntools/source/xrmmerge.cxx | 50 ++++++++++--------------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 87ba9e598b83..2e46e4fcbd05 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -346,10 +346,10 @@ int XRMResParser::Execute( int nToken, char * pToken ) sLID = ""; sGID += "."; sGID += GetAttribute( rToken, "id" ); - if ( GetAttribute( rToken, "localized" ) == "false" ) +// if ( GetAttribute( rToken, "localized" ) == "false" ) // sLocalized += "0"; - sLocalized = false; - else +// sLocalized = false; +// else // sLocalized += "1"; sLocalized = true; break; @@ -368,14 +368,10 @@ int XRMResParser::Execute( int nToken, char * pToken ) } break; - case XRM_TEXT_START: -// if ( sLocalized.GetChar( sLocalized.Len() - 1 ) == '1' ) { - //printf("hello world\n"); - if ( sLocalized ) { - + case XRM_TEXT_START:{ ByteString sNewLID = GetAttribute( rToken, "id" ); if ( sNewLID != sLID ) { - EndOfText( sCurrentOpenTag, sCurrentCloseTag ); + //EndOfText( sCurrentOpenTag, sCurrentCloseTag ); sLID = sNewLID; } bText = TRUE; @@ -386,30 +382,14 @@ int XRMResParser::Execute( int nToken, char * pToken ) break; case XRM_TEXT_END: { -// if ( sLocalized.GetChar( sLocalized.Len() - 1 ) == '1' ) { - if( sLocalized ){ sCurrentCloseTag = rToken; ByteString sLang = GetAttribute( sCurrentOpenTag, "xml:lang" ); - if( sLang.EqualsIgnoreCaseAscii("de") ){ - ULONG nLen = 0; - while ( sCurrentText.Len() != nLen ) - { - nLen = sCurrentText.Len(); - sCurrentText.SearchAndReplaceAll( "\n\t", "\n" ); - sCurrentText.SearchAndReplaceAll( "\n ", "\n" ); - } - sCurrentText.SearchAndReplaceAll( "\n", " " ); - sCurrentCloseTag = rToken; - } WorkOnText( sCurrentOpenTag, sCurrentText ); Output( sCurrentText ); - - //fprintf( stdout, "%s %s\n", sGID.GetBuffer(), sLID.GetBuffer()); - //fprintf( stdout, "%s\n\n", sCurrentText.GetBuffer()); - + EndOfText( sCurrentOpenTag, sCurrentCloseTag );// <--- bText = FALSE; - } + rToken = ByteString(""); } break; @@ -430,8 +410,9 @@ int XRMResParser::Execute( int nToken, char * pToken ) } if ( !bText ) + { Output( rToken ); - + } return 0; } @@ -667,7 +648,6 @@ void XRMResMerge::WorkOnText( /*****************************************************************************/ { ByteString sLang( GetAttribute( rOpenTag, "xml:lang" )); - //ByteString gid("a"); if ( pMergeDataFile ) { if ( !pResData ) { @@ -676,16 +656,11 @@ void XRMResMerge::WorkOnText( pResData = new ResData( sPlatform, GetLID() , sFilename ); pResData->sId = GetLID(); -// pResData = new ResData( sPlatform, GetGID() , sFilename ); -// pResData->sId = GetLID(); pResData->sResTyp = "readmeitem"; } - //printf("xrmmerge:: Search gid=%s lid=%s filename=%s \n", pResData->sGId.GetBuffer(),pResData->sId.GetBuffer(),pResData->sFilename.GetBuffer() ); - //pMergeDataFile->Dump(); PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); if ( pEntrys ) { - //printf("found!!!\n"); ByteString sContent; if ( Export::isAllowed( sLang ) && ( pEntrys->GetText( @@ -716,6 +691,8 @@ void XRMResMerge::EndOfText( ) /*****************************************************************************/ { + + Output( rCloseTag ); if ( pMergeDataFile && pResData ) { PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData ); if ( pEntrys ) { @@ -723,12 +700,7 @@ void XRMResMerge::EndOfText( for( unsigned int n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; ByteString sContent; -//<<<<<<< xrmmerge.cxx if ( !sCur.EqualsIgnoreCaseAscii("en-US") && - // ( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && Export::isMergingGermanAllowed( sPrj ) )) && -//======= -// if ( Export::isAllowed( sCur ) && -//>>>>>>> 1.17 ( pEntrys->GetText( sContent, STRING_TYP_TEXT, sCur, TRUE )) && ( sContent != "-" ) && ( sContent.Len())) -- cgit From 4b7c3c1349c2c884f86dd76e3d6cb535ddf14daa Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 9 Jun 2010 23:44:52 +0200 Subject: locales33a: clean up some of the Valencian mess in case it escaped to document content --- i18npool/source/isolang/isolang.cxx | 3 ++- i18npool/source/isolang/mslangid.cxx | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index ff59fb02dcc4..6b9c2b0a1682 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -287,7 +287,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_BELARUSIAN, "be", "BY" }, { LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default) { LANGUAGE_CATALAN, "ca", "AD" }, // Andorra - { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content! + { LANGUAGE_CATALAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content! + { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "ES" }, // In case MS format files escaped into the wild, map them back. { LANGUAGE_FRENCH_CAMEROON, "fr", "CM" }, { LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" }, { LANGUAGE_FRENCH_HAITI, "fr", "HT" }, diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 8e9dddff872b..da9da0ff8646 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -102,6 +102,8 @@ LanguageType MsLangId::getRealLanguageWithoutConfig( LanguageType nLang ) nLang = getSystemUILanguage(); break; default: + /* TODO: would this be useful here? */ + //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang); ; // nothing } if (nLang == LANGUAGE_DONTKNOW) @@ -128,6 +130,8 @@ LanguageType MsLangId::getRealLanguage( LanguageType nLang ) nLang = nConfiguredSystemUILanguage; break; default: + /* TODO: would this be useful here? */ + //nLang = MsLangId::getReplacementForObsoleteLanguage( nLang); ; // nothing } if (nLang == LANGUAGE_DONTKNOW) @@ -451,6 +455,12 @@ LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang ) case LANGUAGE_SPANISH_DATED: nLang = LANGUAGE_SPANISH_MODERN; break; + + // Do not use ca-XV for document content. + /* TODO: remove in case we implement BCP47 language tags. */ + case LANGUAGE_USER_CATALAN_VALENCIAN: + nLang = LANGUAGE_CATALAN; + break; } return nLang; } -- cgit From 37de10498e52df84f4c1d85ea9555eb602671924 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 10 Jun 2010 10:39:26 +0200 Subject: consolidatereadme: remove quoting of strings --- l10ntools/source/xrmmerge.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 2e46e4fcbd05..03033b49ce0c 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -670,7 +670,7 @@ void XRMResMerge::WorkOnText( { rText = sContent; ConvertStringToXMLFormat( rText ); - Export::QuotHTMLXRM( rText ); + //Export::QuotHTMLXRM( rText ); } } } @@ -706,7 +706,7 @@ void XRMResMerge::EndOfText( ( sContent != "-" ) && ( sContent.Len())) { ByteString sText( sContent ); - Export::QuotHTMLXRM( sText ); + //Export::QuotHTMLXRM( sText ); ByteString sAdditionalLine( "\t" ); sAdditionalLine += rOpenTag; -- cgit From 2434dc6682de98a23cc4393e8ceb3100e2788f64 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Jun 2010 11:09:24 +0200 Subject: unoawt: ListBoxControl::updateFromModel: also set the SelectedItems property, after we just set a new item list via itemListChanged --- toolkit/source/controls/unocontrols.cxx | 6 ++++++ toolkit/source/helper/property.cxx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 3b037e3ca0d3..cfb71111e3dc 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -2427,6 +2427,12 @@ void UnoListBoxControl::updateFromModel() EventObject aEvent( getModel() ); xItemListListener->itemListChanged( aEvent ); + + // notify the change of the SelectedItems property, again. While our base class, in updateFromModel, + // already did this, our peer(s) can only legitimately set the selection after they have the string + // item list, which we just notified with the itemListChanged call. + const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) ); + ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) ); } void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal ) diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index b878112eed69..9369faf6a0b9 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -223,7 +223,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence, BOUND, MAYBEDEFAULT ), + DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ), -- cgit From d41165b830675e172743595a1c6f092a0c49034c Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 10 Jun 2010 11:14:01 +0200 Subject: consolidatereadme: more quoting --- l10ntools/source/xrmmerge.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 03033b49ce0c..bc512a364462 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -580,7 +580,7 @@ void XRMResExport::EndOfText( sCur = aLanguages[ n ]; ByteString sAct = pResData->sText[ sCur ]; - Export::UnquotHTML( sAct ); + //Export::UnquotHTML( sAct ); sAct.EraseAllChars( 0x0A ); ByteString sOutput( sPrj ); sOutput += "\t"; -- cgit From 3a29a9cb361f803fd5f22732570729cca7c7743c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Jun 2010 13:44:35 +0200 Subject: unoawt: some more properties for the throbber model ... at least EnableVisible will come handy --- toolkit/source/controls/tkthrobber.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx index 978d3183fe23..20edc3582780 100644 --- a/toolkit/source/controls/tkthrobber.cxx +++ b/toolkit/source/controls/tkthrobber.cxx @@ -46,8 +46,13 @@ namespace toolkit //-------------------------------------------------------------------- UnoThrobberControlModel::UnoThrobberControlModel() { - ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); + ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); } //-------------------------------------------------------------------- @@ -63,6 +68,8 @@ namespace toolkit { case BASEPROPERTY_DEFAULTCONTROL: return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) ); + case BASEPROPERTY_BORDER: + return uno::makeAny( (sal_Int16) 0 ); default: return UnoControlModel::ImplGetDefaultValue( nPropId ); } -- cgit From dec3c731f5a0b94a095dd3031a07117633449871 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 10 Jun 2010 15:52:54 +0200 Subject: consolidatereadme: non translation bugfix --- l10ntools/source/xrmmerge.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index bc512a364462..6e87cf8af8eb 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -369,6 +369,7 @@ int XRMResParser::Execute( int nToken, char * pToken ) break; case XRM_TEXT_START:{ + //printf("->XRM_TEXT_START\n"); ByteString sNewLID = GetAttribute( rToken, "id" ); if ( sNewLID != sLID ) { //EndOfText( sCurrentOpenTag, sCurrentCloseTag ); @@ -378,18 +379,21 @@ int XRMResParser::Execute( int nToken, char * pToken ) sCurrentText = ""; sCurrentOpenTag = rToken; Output( rToken ); + //printf("<-XRM_TEXT_START\n"); } break; case XRM_TEXT_END: { sCurrentCloseTag = rToken; - + //printf("->XRM_TEXT_END\n"); ByteString sLang = GetAttribute( sCurrentOpenTag, "xml:lang" ); WorkOnText( sCurrentOpenTag, sCurrentText ); Output( sCurrentText ); EndOfText( sCurrentOpenTag, sCurrentCloseTag );// <--- bText = FALSE; rToken = ByteString(""); + sCurrentText = ByteString(""); + //printf("<-XRM_TEXT_END"); } break; @@ -680,7 +684,8 @@ void XRMResMerge::WorkOnText( void XRMResMerge::Output( const ByteString& rOutput ) /*****************************************************************************/ { - if ( pOutputStream ) + //printf("W: %s\n",rOutput.GetBuffer()); + if ( pOutputStream && rOutput.Len() > 0 ) pOutputStream->Write( rOutput.GetBuffer(), rOutput.Len()); } -- cgit From dd1217b9876337aa84d5204ab4ab49569c72ba1f Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 10 Jun 2010 21:04:50 +0200 Subject: locales33a: #i111374# added Rusyn_Slovakia [rue-SK] locale data; contributed by --- .../source/localedata/data/localedata_euro.map | 17 + i18npool/source/localedata/data/makefile.mk | 4 +- i18npool/source/localedata/data/rue_SK.xml | 359 +++++++++++++++++++++ i18npool/source/localedata/localedata.cxx | 1 + 4 files changed, 380 insertions(+), 1 deletion(-) create mode 100644 i18npool/source/localedata/data/rue_SK.xml diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 130a3c5a249f..e0564b85ea25 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -55,6 +55,7 @@ getAllCalendars_pl_PL; getAllCalendars_pt_BR; getAllCalendars_pt_PT; getAllCalendars_ro_RO; +getAllCalendars_rue_SK; getAllCalendars_ru_RU; getAllCalendars_sc_IT; getAllCalendars_sh_ME; @@ -124,6 +125,7 @@ getAllCurrencies_pl_PL; getAllCurrencies_pt_BR; getAllCurrencies_pt_PT; getAllCurrencies_ro_RO; +getAllCurrencies_rue_SK; getAllCurrencies_ru_RU; getAllCurrencies_sc_IT; getAllCurrencies_sh_ME; @@ -193,6 +195,7 @@ getAllFormats0_pl_PL; getAllFormats0_pt_BR; getAllFormats0_pt_PT; getAllFormats0_ro_RO; +getAllFormats0_rue_SK; getAllFormats0_ru_RU; getAllFormats0_sc_IT; getAllFormats0_sh_ME; @@ -262,6 +265,7 @@ getBreakIteratorRules_pl_PL; getBreakIteratorRules_pt_BR; getBreakIteratorRules_pt_PT; getBreakIteratorRules_ro_RO; +getBreakIteratorRules_rue_SK; getBreakIteratorRules_ru_RU; getBreakIteratorRules_sc_IT; getBreakIteratorRules_sh_ME; @@ -331,6 +335,7 @@ getCollationOptions_pl_PL; getCollationOptions_pt_BR; getCollationOptions_pt_PT; getCollationOptions_ro_RO; +getCollationOptions_rue_SK; getCollationOptions_ru_RU; getCollationOptions_sc_IT; getCollationOptions_sh_ME; @@ -400,6 +405,7 @@ getCollatorImplementation_pl_PL; getCollatorImplementation_pt_BR; getCollatorImplementation_pt_PT; getCollatorImplementation_ro_RO; +getCollatorImplementation_rue_SK; getCollatorImplementation_ru_RU; getCollatorImplementation_sc_IT; getCollatorImplementation_sh_ME; @@ -469,6 +475,7 @@ getContinuousNumberingLevels_pl_PL; getContinuousNumberingLevels_pt_BR; getContinuousNumberingLevels_pt_PT; getContinuousNumberingLevels_ro_RO; +getContinuousNumberingLevels_rue_SK; getContinuousNumberingLevels_ru_RU; getContinuousNumberingLevels_sc_IT; getContinuousNumberingLevels_sh_ME; @@ -538,6 +545,7 @@ getFollowPageWords_pl_PL; getFollowPageWords_pt_BR; getFollowPageWords_pt_PT; getFollowPageWords_ro_RO; +getFollowPageWords_rue_SK; getFollowPageWords_ru_RU; getFollowPageWords_sc_IT; getFollowPageWords_sh_ME; @@ -607,6 +615,7 @@ getForbiddenCharacters_pl_PL; getForbiddenCharacters_pt_BR; getForbiddenCharacters_pt_PT; getForbiddenCharacters_ro_RO; +getForbiddenCharacters_rue_SK; getForbiddenCharacters_ru_RU; getForbiddenCharacters_sc_IT; getForbiddenCharacters_sh_ME; @@ -676,6 +685,7 @@ getIndexAlgorithm_pl_PL; getIndexAlgorithm_pt_BR; getIndexAlgorithm_pt_PT; getIndexAlgorithm_ro_RO; +getIndexAlgorithm_rue_SK; getIndexAlgorithm_ru_RU; getIndexAlgorithm_sc_IT; getIndexAlgorithm_sh_ME; @@ -745,6 +755,7 @@ getLCInfo_pl_PL; getLCInfo_pt_BR; getLCInfo_pt_PT; getLCInfo_ro_RO; +getLCInfo_rue_SK; getLCInfo_ru_RU; getLCInfo_sc_IT; getLCInfo_sh_ME; @@ -814,6 +825,7 @@ getLocaleItem_pl_PL; getLocaleItem_pt_BR; getLocaleItem_pt_PT; getLocaleItem_ro_RO; +getLocaleItem_rue_SK; getLocaleItem_ru_RU; getLocaleItem_sc_IT; getLocaleItem_sh_ME; @@ -883,6 +895,7 @@ getOutlineNumberingLevels_pl_PL; getOutlineNumberingLevels_pt_BR; getOutlineNumberingLevels_pt_PT; getOutlineNumberingLevels_ro_RO; +getOutlineNumberingLevels_rue_SK; getOutlineNumberingLevels_ru_RU; getOutlineNumberingLevels_sc_IT; getOutlineNumberingLevels_sh_ME; @@ -952,6 +965,7 @@ getReservedWords_pl_PL; getReservedWords_pt_BR; getReservedWords_pt_PT; getReservedWords_ro_RO; +getReservedWords_rue_SK; getReservedWords_ru_RU; getReservedWords_sc_IT; getReservedWords_sh_ME; @@ -1021,6 +1035,7 @@ getSearchOptions_pl_PL; getSearchOptions_pt_BR; getSearchOptions_pt_PT; getSearchOptions_ro_RO; +getSearchOptions_rue_SK; getSearchOptions_ru_RU; getSearchOptions_sc_IT; getSearchOptions_sh_ME; @@ -1090,6 +1105,7 @@ getTransliterations_pl_PL; getTransliterations_pt_BR; getTransliterations_pt_PT; getTransliterations_ro_RO; +getTransliterations_rue_SK; getTransliterations_ru_RU; getTransliterations_sc_IT; getTransliterations_sh_ME; @@ -1159,6 +1175,7 @@ getUnicodeScripts_pl_PL; getUnicodeScripts_pt_BR; getUnicodeScripts_pt_PT; getUnicodeScripts_ro_RO; +getUnicodeScripts_rue_SK; getUnicodeScripts_ru_RU; getUnicodeScripts_sc_IT; getUnicodeScripts_sh_ME; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 2591b70fb63d..a800382a68a3 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -200,6 +200,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_pt_BR.cxx \ $(MISC)$/localedata_pt_PT.cxx \ $(MISC)$/localedata_ro_RO.cxx \ + $(MISC)$/localedata_rue_SK.cxx \ $(MISC)$/localedata_ru_RU.cxx \ $(MISC)$/localedata_rw_RW.cxx \ $(MISC)$/localedata_sg_CF.cxx \ @@ -378,8 +379,9 @@ SHL3OBJS= \ $(SLO)$/localedata_pl_PL.obj \ $(SLO)$/localedata_pt_BR.obj \ $(SLO)$/localedata_pt_PT.obj \ - $(SLO)$/localedata_ru_RU.obj \ $(SLO)$/localedata_ro_RO.obj \ + $(SLO)$/localedata_rue_SK.obj \ + $(SLO)$/localedata_ru_RU.obj \ $(SLO)$/localedata_sc_IT.obj \ $(SLO)$/localedata_sh_ME.obj \ $(SLO)$/localedata_sh_RS.obj \ diff --git a/i18npool/source/localedata/data/rue_SK.xml b/i18npool/source/localedata/data/rue_SK.xml new file mode 100644 index 000000000000..86b22d5c5a2e --- /dev/null +++ b/i18npool/source/localedata/data/rue_SK.xml @@ -0,0 +1,359 @@ + + + + + + rue + Rusyn + + + SK + Slovakia + + + + + / + , + . + : + . + ; + , + , + + + + + “ + †+ ‘ + ’ + + дообіду + пообідї + metric + + + + General + + + 0 + + + 0.00 + + + #,##0 + + + #,##0.00 + + + #,###.00 + + + 0.00E+00 + + + 0.00E+000 + + + 0% + + + 0.00% + + + [CURRENCY]#,##0;-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;-[CURRENCY]#,##0.00 + + + [CURRENCY]#,##0;[RED]-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00 + + + CCC#,##0.00 + + + [CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.-- + + + D/MM/YY + + + NNNNDD, MMMM YYYY + + + DD/MM/YY + + + DD/MM/YYYY + + + D, MMM YY + + + D, MMM YYYY + + + D, MMM YYYY + + + D, MMMM YYYY + + + D, MMMM YY + + + NN, DD/MMM/YY + + + NN, D, MMM YY + + + NN, D, MMMM YYYY + + + NNNND, MMMM YYYY + + + MM/DD + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM/YY + + + MMM/DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS.00 + + + [HH]:MM:SS.00 + + + DD/MM/YY HH:MM + + + DD/MM/YYYY HH:MM:SS AM/PM + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + A-Z + 0 + 1 + 8 + ÑÑ‚Ñ€. + ÑÑ‚Ñ€. + + + + + + sun + нед + Ð½ÐµÐ´Ñ—Ð»Ñ + + + mon + пон + понедїлёк + + + tue + віт + віторок + + + wed + Ñер + Ñереда + + + thu + чет + четверь + + + fri + пÑÑ‚ + пÑÑ‚Ð½Ñ–Ñ†Ñ + + + sat + Ñуб + Ñубота + + + + + jan + Ñн + Ñнуар + + + feb + феб + фебруар + + + mar + мар + марец + + + apr + апр + апріль + + + may + май + май + + + jun + юн + юн + + + jul + юл + юл + + + aug + авґ + авґуÑÑ‚ + + + sep + Ñеп + Ñептембер + + + oct + окт + октобер + + + nov + нов + новембер + + + dec + дец + децембер + + + + + bc + п.н.е. + перед нашов еров + + + ad + н.е. + нашой еры + + + + mon + + 1 + + + + + EUR + € + EUR + евро + 2 + + + + + + + + + + Правда + Ðеправда + 1. четвертина + 2. четвертина + 3. четвертина + 4. четвертина + Ðад + Під + 1.чет. + 2.чет. + 3.чет. + 4.чет. + + + + + + + + + + + + + + + diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 920a63fe149a..bcc0791539ca 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -169,6 +169,7 @@ static const struct { { "ast_ES", lcl_DATA_EURO }, { "ltg_LV", lcl_DATA_EURO }, { "hsb_DE", lcl_DATA_EURO }, + { "rue_SK", lcl_DATA_EURO }, { "ja_JP", lcl_DATA_OTHERS }, { "ko_KR", lcl_DATA_OTHERS }, -- cgit From a8dd1c5054430bce8365eedd475c3b7f3404dc75 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 11 Jun 2010 00:38:55 +0200 Subject: locales33a: check for equalness of QuotationStart and DoubleQuotationStart or QuotationEnd and DoubleQuotationEnd --- i18npool/source/localedata/LocaleNode.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 4204b3636fcb..cc183336fbc5 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -493,6 +493,14 @@ void LCCTYPENode::generateCode (const OFileWriter &of) const if (aDoubleQuoteStart == aDoubleQuoteEnd) fprintf( stderr, "Warning: %s\n", "DoubleQuotationStart equals DoubleQuotationEnd. Not necessarily an error, but unusual."); + /* TODO: should equalness of single and double quotes be an error? Would + * need to adapt quite some locales' data. */ + if (aQuoteStart == aDoubleQuoteStart) + fprintf( stderr, "Warning: %s\n", + "QuotationStart equals DoubleQuotationStart. Not necessarily an error, but unusual."); + if (aQuoteEnd == aDoubleQuoteEnd) + fprintf( stderr, "Warning: %s\n", + "QuotationEnd equals DoubleQuotationEnd. Not necessarily an error, but unusual."); writeParameterCheckLen( of, "TimeAM", "timeAM", 1, -1); writeParameterCheckLen( of, "TimePM", "timePM", 1, -1); -- cgit From 9af8fd6fb1ff344b54db7bf4265a9d9d2fc6b025 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 11 Jun 2010 01:09:07 +0200 Subject: locales33a: #i101567# added Maithili_India [mai-IN] locale data; contributed by --- .../source/localedata/data/localedata_others.map | 17 + i18npool/source/localedata/data/mai_IN.xml | 357 +++++++++++++++++++++ i18npool/source/localedata/data/makefile.mk | 2 + i18npool/source/localedata/localedata.cxx | 1 + 4 files changed, 377 insertions(+) create mode 100644 i18npool/source/localedata/data/mai_IN.xml diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index fd9e13cfb779..bbb4e50f4337 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -37,6 +37,7 @@ getAllCalendars_ky_KG; getAllCalendars_lg_UG; getAllCalendars_ln_CD; getAllCalendars_lo_LA; +getAllCalendars_mai_IN; getAllCalendars_ml_IN; getAllCalendars_mn_MN; getAllCalendars_mr_IN; @@ -113,6 +114,7 @@ getAllCurrencies_ky_KG; getAllCurrencies_lg_UG; getAllCurrencies_ln_CD; getAllCurrencies_lo_LA; +getAllCurrencies_mai_IN; getAllCurrencies_ml_IN; getAllCurrencies_mn_MN; getAllCurrencies_mr_IN; @@ -189,6 +191,7 @@ getAllFormats0_ky_KG; getAllFormats0_lg_UG; getAllFormats0_ln_CD; getAllFormats0_lo_LA; +getAllFormats0_mai_IN; getAllFormats0_ml_IN; getAllFormats0_mn_MN; getAllFormats0_mr_IN; @@ -265,6 +268,7 @@ getBreakIteratorRules_ky_KG; getBreakIteratorRules_lg_UG; getBreakIteratorRules_ln_CD; getBreakIteratorRules_lo_LA; +getBreakIteratorRules_mai_IN; getBreakIteratorRules_ml_IN; getBreakIteratorRules_mn_MN; getBreakIteratorRules_mr_IN; @@ -341,6 +345,7 @@ getCollationOptions_ky_KG; getCollationOptions_lg_UG; getCollationOptions_ln_CD; getCollationOptions_lo_LA; +getCollationOptions_mai_IN; getCollationOptions_ml_IN; getCollationOptions_mn_MN; getCollationOptions_mr_IN; @@ -417,6 +422,7 @@ getCollatorImplementation_ky_KG; getCollatorImplementation_lg_UG; getCollatorImplementation_ln_CD; getCollatorImplementation_lo_LA; +getCollatorImplementation_mai_IN; getCollatorImplementation_ml_IN; getCollatorImplementation_mn_MN; getCollatorImplementation_mr_IN; @@ -493,6 +499,7 @@ getContinuousNumberingLevels_ky_KG; getContinuousNumberingLevels_lg_UG; getContinuousNumberingLevels_ln_CD; getContinuousNumberingLevels_lo_LA; +getContinuousNumberingLevels_mai_IN; getContinuousNumberingLevels_ml_IN; getContinuousNumberingLevels_mn_MN; getContinuousNumberingLevels_mr_IN; @@ -569,6 +576,7 @@ getFollowPageWords_ky_KG; getFollowPageWords_lg_UG; getFollowPageWords_ln_CD; getFollowPageWords_lo_LA; +getFollowPageWords_mai_IN; getFollowPageWords_ml_IN; getFollowPageWords_mn_MN; getFollowPageWords_mr_IN; @@ -645,6 +653,7 @@ getForbiddenCharacters_ky_KG; getForbiddenCharacters_lg_UG; getForbiddenCharacters_ln_CD; getForbiddenCharacters_lo_LA; +getForbiddenCharacters_mai_IN; getForbiddenCharacters_ml_IN; getForbiddenCharacters_mn_MN; getForbiddenCharacters_mr_IN; @@ -721,6 +730,7 @@ getIndexAlgorithm_ky_KG; getIndexAlgorithm_lg_UG; getIndexAlgorithm_ln_CD; getIndexAlgorithm_lo_LA; +getIndexAlgorithm_mai_IN; getIndexAlgorithm_ml_IN; getIndexAlgorithm_mn_MN; getIndexAlgorithm_mr_IN; @@ -797,6 +807,7 @@ getLCInfo_ky_KG; getLCInfo_lg_UG; getLCInfo_ln_CD; getLCInfo_lo_LA; +getLCInfo_mai_IN; getLCInfo_ml_IN; getLCInfo_mn_MN; getLCInfo_mr_IN; @@ -873,6 +884,7 @@ getLocaleItem_ky_KG; getLocaleItem_lg_UG; getLocaleItem_ln_CD; getLocaleItem_lo_LA; +getLocaleItem_mai_IN; getLocaleItem_ml_IN; getLocaleItem_mn_MN; getLocaleItem_mr_IN; @@ -949,6 +961,7 @@ getOutlineNumberingLevels_ky_KG; getOutlineNumberingLevels_lg_UG; getOutlineNumberingLevels_ln_CD; getOutlineNumberingLevels_lo_LA; +getOutlineNumberingLevels_mai_IN; getOutlineNumberingLevels_ml_IN; getOutlineNumberingLevels_mn_MN; getOutlineNumberingLevels_mr_IN; @@ -1025,6 +1038,7 @@ getReservedWords_ky_KG; getReservedWords_lg_UG; getReservedWords_ln_CD; getReservedWords_lo_LA; +getReservedWords_mai_IN; getReservedWords_ml_IN; getReservedWords_mn_MN; getReservedWords_mr_IN; @@ -1101,6 +1115,7 @@ getSearchOptions_ky_KG; getSearchOptions_lg_UG; getSearchOptions_ln_CD; getSearchOptions_lo_LA; +getSearchOptions_mai_IN; getSearchOptions_ml_IN; getSearchOptions_mn_MN; getSearchOptions_mr_IN; @@ -1177,6 +1192,7 @@ getTransliterations_ky_KG; getTransliterations_lg_UG; getTransliterations_ln_CD; getTransliterations_lo_LA; +getTransliterations_mai_IN; getTransliterations_ml_IN; getTransliterations_mn_MN; getTransliterations_mr_IN; @@ -1253,6 +1269,7 @@ getUnicodeScripts_ky_KG; getUnicodeScripts_lg_UG; getUnicodeScripts_ln_CD; getUnicodeScripts_lo_LA; +getUnicodeScripts_mai_IN; getUnicodeScripts_ml_IN; getUnicodeScripts_mn_MN; getUnicodeScripts_mr_IN; diff --git a/i18npool/source/localedata/data/mai_IN.xml b/i18npool/source/localedata/data/mai_IN.xml new file mode 100644 index 000000000000..07c3d39c6a9d --- /dev/null +++ b/i18npool/source/localedata/data/mai_IN.xml @@ -0,0 +1,357 @@ + + + + + + mai + Maithili + + + IN + India + + + + + . + , + . + : + . + ; + , + , + + + + + ‘ + ’ + “ + †+ + पूरà¥à¤µà¤¾à¤¹à¥à¤¨ + अपराहà¥à¤¨ + metric + + + + General + + + 0 + + + 0.00 + + + #,##0 + + + #,##0.00 + + + #,###.00 + + + 0.00E+00 + + + 0.00E+000 + + + 0% + + + 0.00% + + + [CURRENCY]#,##0;-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;-[CURRENCY]#,##0.00 + + + [CURRENCY]#,##0;[RED]-[CURRENCY]#,##0 + + + [CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00 + + + CCC#,##0.00 + + + [CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.-- + + + D.MM.YY + + + NNNNDD, MMMM YYYY + + + DD.MM.YY + + + DD.MM.YYYY + + + D, MMM YY + + + D, MMM YYYY + + + D, MMM YYYY + + + D, MMMM YYYY + + + D, MMMM YY + + + NN, DD.MMM.YY + + + NN, D, MMM YY + + + NN, D, MMMM YYYY + + + NNNND, MMMM YYYY + + + MM.DD + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM.YY + + + MMM.DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS.00 + + + [HH]:MM:SS.00 + + + DD.MM.YY HH:MM + + + DD.MM.YYYY HH:MM:SS AM/PM + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + अ-ह + 14 + आ.पृ. + आ.पृ. + + + + + + sun + रवि + रविवार + + + mon + सोम + सोमवार + + + tue + मंगल + मंगलवार + + + wed + बà¥à¤§ + बà¥à¤§à¤µà¤¾à¤° + + + thu + गà¥à¤°à¥ + गà¥à¤°à¥à¤µà¤¾à¤° + + + fri + शà¥à¤•à¥à¤° + शà¥à¤•à¥à¤°à¤µà¤¾à¤° + + + sat + शनि + शनिवार + + + + + jan + जन + जनवरी + + + feb + फर + फरवरी + + + mar + मारà¥à¤š + मारà¥à¤š + + + apr + अपà¥à¤°à¥ˆ + अपà¥à¤°à¥ˆà¤² + + + may + मई + मई + + + jun + जून + जून + + + jul + जà¥à¤²à¤¾ + जà¥à¤²à¤¾à¤ˆ + + + aug + अग + अगसà¥à¤¤ + + + sep + सित + सितमà¥à¤¬à¤° + + + oct + अकà¥à¤Ÿà¥‚ + अकà¥à¤Ÿà¥‚बर + + + nov + नव + नवमà¥à¤¬à¤° + + + dec + दिस + दिसमà¥à¤¬à¤° + + + + + bc + ई.पू. + ईसà¥à¤µà¥€ पूरà¥à¤µ + + + ad + ई. + ईसà¥à¤µà¥€ + + + + sun + + 1 + + + + + INR + रू. + INR + रà¥à¤ªà¤¯à¤¾ + 2 + + + + + + + + + + सही + गलत + पहिल तीन मास + दोसर तीन मास + तेसर तीन मास + चौथा तीन मास + उपà¥à¤ªà¤° + नीचà¥à¤šà¤¾à¤ + पहिल चौथाई + दोसर चौथाई + तेसर चौथाई + चौथा चौथाई + + + + + + + + + + + + + + + diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index a800382a68a3..5e09ef66adff 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -176,6 +176,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_lt_LT.cxx \ $(MISC)$/localedata_ltg_LV.cxx \ $(MISC)$/localedata_lv_LV.cxx \ + $(MISC)$/localedata_mai_IN.cxx \ $(MISC)$/localedata_mk_MK.cxx \ $(MISC)$/localedata_ml_IN.cxx \ $(MISC)$/localedata_mn_MN.cxx \ @@ -451,6 +452,7 @@ SHL4OBJS= \ $(SLO)$/localedata_lg_UG.obj \ $(SLO)$/localedata_ln_CD.obj \ $(SLO)$/localedata_lo_LA.obj \ + $(SLO)$/localedata_mai_IN.obj \ $(SLO)$/localedata_ml_IN.obj \ $(SLO)$/localedata_mn_MN.obj \ $(SLO)$/localedata_mr_IN.obj \ diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index bcc0791539ca..817a314da11f 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -249,6 +249,7 @@ static const struct { { "ug_CN", lcl_DATA_OTHERS }, { "om_ET", lcl_DATA_OTHERS }, { "plt_MG", lcl_DATA_OTHERS }, + { "mai_IN", lcl_DATA_OTHERS }, }; static const sal_Unicode under = sal_Unicode('_'); -- cgit From 93ea507dcc9db5dc0da4191997b7a80cd2249a01 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 11 Jun 2010 01:50:25 +0200 Subject: locales33a: #i111152# treat Indic aksaras with virama as one grapheme cluster for character iterator; patch from --- i18npool/source/breakiterator/data/char_in.txt | 112 +++++++++++++++++++------ 1 file changed, 86 insertions(+), 26 deletions(-) diff --git a/i18npool/source/breakiterator/data/char_in.txt b/i18npool/source/breakiterator/data/char_in.txt index 72c4a44720cd..5e1ed67596c0 100644 --- a/i18npool/source/breakiterator/data/char_in.txt +++ b/i18npool/source/breakiterator/data/char_in.txt @@ -1,48 +1,108 @@ # -# Copyright (C) 2002-2003, International Business Machines Corporation and others. +# Copyright (C) 2002-2009, International Business Machines Corporation and others. # All Rights Reserved. # # file: char.txt # # ICU Character Break Rules, also known as Grapheme Cluster Boundaries # See Unicode Standard Annex #29. -# These rules are based on TR29 Version 4.0.0 +# These rules are based on TR29 Revision 13, for Unicode Version 5.1 # # # Character Class Definitions. -# The names are those from TR29. # -$CR = \r; -$LF = \n; -$Control = [[:Zl:] [:Zp:] [:Cc:] [:Cf:]]; - -# add Japanese Half Width voicing marks to $Extend -$VoiceMarks = [\uff9e\uff9f]; -$cmcextend = [ \u0903 \u093e-\u0940 \u0949-\u094C \u09bf-\u09c0 \u09c7-\u09c8 \u09cb-\u09cc \u0bc1-\u0bc2 \u0bc6-\u0bc8 \u0bca-\u0bcc \u0c01-\u0c03 \u0c41-\u0c44]; -$Extend = [[:Grapheme_Extend = TRUE:] $VoiceMarks $cmcextend]; +$CR = [\p{Grapheme_Cluster_Break = CR}]; +$LF = [\p{Grapheme_Cluster_Break = LF}]; +$Control = [\p{Grapheme_Cluster_Break = Control}]; +$Prepend = [\p{Grapheme_Cluster_Break = Prepend}]; +$Extend = [\p{Grapheme_Cluster_Break = Extend}]; +$SpacingMark = [\p{Grapheme_Cluster_Break = SpacingMark}]; +$BengaliLetter = [\u0985-\u09B9 \u09CE \u09DC-\u09E1 \u09F0-\u09F1]; +$BengaliSignVirama = \u09CD; +$GujaratiLetter = [\u0A85-\u0A8C \u0A8F-\u0A90 \u0A93-\u0AB9 \u0AE0-\u0AE1]; +$GujaratiSignVirama = \u0ACD; +$DevanagariLetter = [\u0904-\u0939 \u0958-\u0961 \u0972-\u097F]; +$DevanagariSignVirama = \u094D; +$KannadaLetter = [\u0C85-\u0CB9 \u0CDE-\u0CE1]; +$KannadaSignVirama = \u0CCD; +$MalayalamLetter = [\u0D05-\u0D39 \u0D60-\u0D61 \u0D7A-\u0D7F]; +$MalayalamSignVirama = \u0D4D; +$OriyaLetter = [\u0B05-\u0B39 \u0B5C-\u0B61 \u0B71]; +$OriyaSignVirama = \u0B4D; +$GurmukhiLetter = [\u0A05-\u0A39 \u0A59-\u0A5E]; +$GurmukhiSignVirama = \u0A4D; +$TamilLetter = [\u0B85-\u0BB9]; +$TamilSignVirama = \u0BCD; +$TeluguLetter = [\u0C05-\u0C39 \u0C58-\u0C61]; +$TeluguSignVirama = \u0C4D; # # Korean Syllable Definitions # -$L = [:Hangul_Syllable_Type = L:]; -$V = [:Hangul_Syllable_Type = V:]; -$T = [:Hangul_Syllable_Type = T:]; +$L = [\p{Grapheme_Cluster_Break = L}]; +$V = [\p{Grapheme_Cluster_Break = V}]; +$T = [\p{Grapheme_Cluster_Break = T}]; -$LV = [:Hangul_Syllable_Type = LV:]; -$LVT = [:Hangul_Syllable_Type = LVT:]; +$LV = [\p{Grapheme_Cluster_Break = LV}]; +$LVT = [\p{Grapheme_Cluster_Break = LVT}]; -$HangulSyllable = $L+ | ($L* ($LV? $V+ | $LV | $LVT) $T*) | $T+; -# -# Forward Break Rules -# +## ------------------------------------------------- +!!chain; + +!!forward; + $CR $LF; -([^$Control] | $HangulSyllable) $Extend*; -.; +$BengaliLetter ($BengaliSignVirama $BengaliLetter?)+; +$GujaratiLetter ($GujaratiSignVirama $GujaratiLetter?)+; +$DevanagariLetter ($DevanagariSignVirama $DevanagariLetter?)+; +$KannadaLetter ($KannadaSignVirama $KannadaLetter?)+; +$MalayalamLetter ($MalayalamSignVirama $MalayalamLetter?)+; +$OriyaLetter ($OriyaSignVirama $OriyaLetter?)+; +$GurmukhiLetter ($GurmukhiSignVirama $GurmukhiLetter?)+; +$TamilLetter ($TamilSignVirama $TamilLetter?)+; +$TeluguLetter ($TeluguSignVirama $TeluguLetter?)+; + +$L ($L | $V | $LV | $LVT); +($LV | $V) ($V | $T); +($LVT | $T) $T; + +[^$Control $CR $LF] $Extend; + +[^$Control $CR $LF] $SpacingMark; +$Prepend [^$Control $CR $LF]; + + +## ------------------------------------------------- + +!!reverse; +$LF $CR; +($BengaliLetter? $BengaliSignVirama)+ $BengaliLetter; +($GujaratiLetter? $GujaratiSignVirama)+ $GujaratiLetter; +($DevanagariLetter? $DevanagariSignVirama)+ $DevanagariLetter; +($KannadaLetter? $KannadaSignVirama)+ $KannadaLetter; +($MalayalamLetter? $MalayalamSignVirama)+ $MalayalamLetter; +($OriyaLetter? $OriyaSignVirama)+ $OriyaLetter; +($GurmukhiLetter? $GurmukhiSignVirama)+ $GurmukhiLetter; +($TamilLetter? $TamilSignVirama)+ $TamilLetter; +($TeluguLetter? $TeluguSignVirama)+ $TeluguLetter; +($L | $V | $LV | $LVT) $L; +($V | $T) ($LV | $V); +$T ($LVT | $T); + +$Extend [^$Control $CR $LF]; +$SpacingMark [^$Control $CR $LF]; +[^$Control $CR $LF] $Prepend; + + +## ------------------------------------------------- + +!!safe_reverse; + + +## ------------------------------------------------- + +!!safe_forward; -# -# Reverse Rule, back up to the beginning of some preceding grapheme cluster. -# -! ($Extend | $V | $T )* ($LF $CR | ($LV | $LVT)?$L* | .); -- cgit From bc2c3e133189b533b696d7970171ecba1645c094 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 11 Jun 2010 02:18:33 +0200 Subject: locales33a: check ordering of time separators only if both are present --- i18npool/source/localedata/LocaleNode.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index cc183336fbc5..7a520047637d 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -697,7 +697,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const incErrorInt( "ThousandSeparator not present in FormatCode formatindex=\"%d\".", formatindex); } - if (nDec <= nGrp) + if (nDec >= 0 && nGrp >= 0 && nDec <= nGrp) incErrorInt( "Ordering of ThousandSeparator and DecimalSeparator not correct in formatindex=\"%d\".", formatindex); } @@ -732,7 +732,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const incErrorInt( "Time100SecSeparator+00 not present in FormatCode formatindex=\"%d\".", formatindex); } - if (n100s <= nTime) + if (n100s >= 0 && nTime >= 0 && n100s <= nTime) incErrorInt( "Ordering of Time100SecSeparator and TimeSeparator not correct in formatindex=\"%d\".", formatindex); } -- cgit From 240902a6c93951c79d306b2c644511c6fe6cd73c Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 11 Jun 2010 03:05:19 +0200 Subject: locales33a: #i110583# added Arabic_Algeria [ar-DZ] locale data; contributed by --- i18npool/source/localedata/data/ar_DZ.xml | 437 +++++++++++++++++++++ .../source/localedata/data/localedata_others.map | 17 + i18npool/source/localedata/data/makefile.mk | 2 + i18npool/source/localedata/localedata.cxx | 1 + 4 files changed, 457 insertions(+) create mode 100644 i18npool/source/localedata/data/ar_DZ.xml diff --git a/i18npool/source/localedata/data/ar_DZ.xml b/i18npool/source/localedata/data/ar_DZ.xml new file mode 100644 index 000000000000..68cf3ed441e8 --- /dev/null +++ b/i18npool/source/localedata/data/ar_DZ.xml @@ -0,0 +1,437 @@ + + + + + + ar + Arabic + + + DZ + Algeria + + + + + / +   + Ù« + : + Ù« + ; + ØŒ + ØŒ + ØŒ + + + + ‘ + ’ + " + " + + ص + Ù… + metric + + + + General + + + 0 + + + 0Ù«00 + + + # ##0 + + + # ##0Ù«00 + + + # ###Ù«00 + + + 0Ù«00E+000 + + + 0Ù«00E+00 + + + 0% + + + 0Ù«00% + + + [CURRENCY] # ##0;[CURRENCY] # ##0 - + + + [CURRENCY] # ##0Ù«00;[CURRENCY] # ##0Ù«00 - + + + [CURRENCY] # ##0;[RED][CURRENCY] # ##0 - + + + [CURRENCY] # ##0Ù«00;[RED][CURRENCY] # ##0Ù«00 - + + + # ##0Ù«00 CCC + + + [CURRENCY] # ##0Ù«--;[RED][CURRENCY] # ##0Ù«-- - + + + [~hijri]D/MM/YYYY + + + [~hijri]NNN DD MMMM YYYY + + + [NatNum1][~hijri]YYYY/MM/D + + + D/M/YYYY + + + [NatNum1][~hijri]NNN DD MMMM YYYY + + + DD MMMM YYYY + + + [NatNum1]DD MMMM YYYY + + + NNN DD MMMM YYYY + + + [NatNum1]NNN DD MMMM YYYY + + + DD MMMM YY + + + [NatNum1]DD MMMM YY + + + [~hijri]DD MMMM YYYY + + + [NatNum1][~hijri]DD MMMM YYYY + + + [NatNum1][~hijri]YYYY/MM/D + + + [NatNum1]YY/MM/DD + ISO 8601 + + + [NatNum1]YYYY/MM/DD + ISO 8601 + + + MM/YY + + + DD MMM + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + AM/PMMM:HH + + + AM/PMSS:MM:HH + + + [HH]:MM:SS + + + MM:SSÙ«00 + + + [HH]:MM:SSÙ«00 + + + [~hijri]AM/PMHH:MM YYYY/MM/D + + + [NatNum1][~hijri]AM/PMHH:MM YYYY/MM/D + + + AM/PMHH:MM YYYY/MM/D + + + [NatNum1]AM/PMHH:MM YYYY/MM/D + + + + + + + + + + sun + Ø­ + الأحد + + + mon + Ù† + الاثنين + + + tue + Ø« + الثلاثاء + + + wed + ر + الأربعاء + + + thu + Ø® + الخميس + + + fri + ج + الجمعة + + + sat + س + السبت + + + + + jan + جانÙÙŠ + جانÙÙŠ + + + feb + ÙÙŠÙري + ÙÙŠÙري + + + mar + مارس + مارس + + + apr + Ø£Ùريل + Ø£Ùريل + + + may + ماي + ماي + + + jun + جوان + جوان + + + jul + جويلية + جويلية + + + aug + أوت + أوت + + + sep + سبتمبر + سبتمبر + + + oct + أكتوبر + أكتوبر + + + nov + نوÙمبر + نوÙمبر + + + dec + ديسمبر + ديسمبر + + + + + bc + Ù‚.Ù… + قبل الميلاد + + + ad + Ù… + ميلادي + + + + sat + + 1 + + + + + sun + Ø­ + الأحد + + + mon + Ù† + الاثنين + + + tue + Ø« + الثلاثاء + + + wed + ر + الأربعاء + + + thu + Ø® + الخميس + + + fri + ج + الجمعة + + + sat + س + السبت + + + + + jan + محرم + محرم + + + feb + صÙر + صÙر + + + mar + ربيع الأول + ربيع الأول + + + apr + ربيع الآخر + ربيع الآخر + + + may + جمادى الأولى + جمادى الأولى + + + jun + جمادى الآخرة + جمادى الآخرة + + + jul + رجب + رجب + + + aug + شعبان + شعبان + + + sep + رمضان + رمضان + + + oct + شوال + شوال + + + nov + ذو القعدة + ذو القعدة + + + dec + ذو الحجة + ذو الحجة + + + + + BeforeHijra + ه†+ قبل الهجرة + + + AfterHijra + + هجري + + + + sat + + 1 + + + + + DZD + د.ج.†+ DZD + دينار جزائري + 2 + + + + + + + diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index bbb4e50f4337..e5de10cb68e5 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -4,6 +4,7 @@ getAllCalendars_af_NA; getAllCalendars_af_ZA; getAllCalendars_ak_GH; getAllCalendars_am_ET; +getAllCalendars_ar_DZ; getAllCalendars_ar_EG; getAllCalendars_ar_LB; getAllCalendars_ar_OM; @@ -81,6 +82,7 @@ getAllCurrencies_af_NA; getAllCurrencies_af_ZA; getAllCurrencies_ak_GH; getAllCurrencies_am_ET; +getAllCurrencies_ar_DZ; getAllCurrencies_ar_EG; getAllCurrencies_ar_LB; getAllCurrencies_ar_OM; @@ -158,6 +160,7 @@ getAllFormats0_af_NA; getAllFormats0_af_ZA; getAllFormats0_ak_GH; getAllFormats0_am_ET; +getAllFormats0_ar_DZ; getAllFormats0_ar_EG; getAllFormats0_ar_LB; getAllFormats0_ar_OM; @@ -235,6 +238,7 @@ getBreakIteratorRules_af_NA; getBreakIteratorRules_af_ZA; getBreakIteratorRules_ak_GH; getBreakIteratorRules_am_ET; +getBreakIteratorRules_ar_DZ; getBreakIteratorRules_ar_EG; getBreakIteratorRules_ar_LB; getBreakIteratorRules_ar_OM; @@ -312,6 +316,7 @@ getCollationOptions_af_NA; getCollationOptions_af_ZA; getCollationOptions_ak_GH; getCollationOptions_am_ET; +getCollationOptions_ar_DZ; getCollationOptions_ar_EG; getCollationOptions_ar_LB; getCollationOptions_ar_OM; @@ -389,6 +394,7 @@ getCollatorImplementation_af_NA; getCollatorImplementation_af_ZA; getCollatorImplementation_ak_GH; getCollatorImplementation_am_ET; +getCollatorImplementation_ar_DZ; getCollatorImplementation_ar_EG; getCollatorImplementation_ar_LB; getCollatorImplementation_ar_OM; @@ -466,6 +472,7 @@ getContinuousNumberingLevels_af_NA; getContinuousNumberingLevels_af_ZA; getContinuousNumberingLevels_ak_GH; getContinuousNumberingLevels_am_ET; +getContinuousNumberingLevels_ar_DZ; getContinuousNumberingLevels_ar_EG; getContinuousNumberingLevels_ar_LB; getContinuousNumberingLevels_ar_OM; @@ -543,6 +550,7 @@ getFollowPageWords_af_NA; getFollowPageWords_af_ZA; getFollowPageWords_ak_GH; getFollowPageWords_am_ET; +getFollowPageWords_ar_DZ; getFollowPageWords_ar_EG; getFollowPageWords_ar_LB; getFollowPageWords_ar_OM; @@ -620,6 +628,7 @@ getForbiddenCharacters_af_NA; getForbiddenCharacters_af_ZA; getForbiddenCharacters_ak_GH; getForbiddenCharacters_am_ET; +getForbiddenCharacters_ar_DZ; getForbiddenCharacters_ar_EG; getForbiddenCharacters_ar_LB; getForbiddenCharacters_ar_OM; @@ -697,6 +706,7 @@ getIndexAlgorithm_af_NA; getIndexAlgorithm_af_ZA; getIndexAlgorithm_ak_GH; getIndexAlgorithm_am_ET; +getIndexAlgorithm_ar_DZ; getIndexAlgorithm_ar_EG; getIndexAlgorithm_ar_LB; getIndexAlgorithm_ar_OM; @@ -774,6 +784,7 @@ getLCInfo_af_NA; getLCInfo_af_ZA; getLCInfo_ak_GH; getLCInfo_am_ET; +getLCInfo_ar_DZ; getLCInfo_ar_EG; getLCInfo_ar_LB; getLCInfo_ar_OM; @@ -851,6 +862,7 @@ getLocaleItem_af_NA; getLocaleItem_af_ZA; getLocaleItem_ak_GH; getLocaleItem_am_ET; +getLocaleItem_ar_DZ; getLocaleItem_ar_EG; getLocaleItem_ar_LB; getLocaleItem_ar_OM; @@ -928,6 +940,7 @@ getOutlineNumberingLevels_af_NA; getOutlineNumberingLevels_af_ZA; getOutlineNumberingLevels_ak_GH; getOutlineNumberingLevels_am_ET; +getOutlineNumberingLevels_ar_DZ; getOutlineNumberingLevels_ar_EG; getOutlineNumberingLevels_ar_LB; getOutlineNumberingLevels_ar_OM; @@ -1005,6 +1018,7 @@ getReservedWords_af_NA; getReservedWords_af_ZA; getReservedWords_ak_GH; getReservedWords_am_ET; +getReservedWords_ar_DZ; getReservedWords_ar_EG; getReservedWords_ar_LB; getReservedWords_ar_OM; @@ -1082,6 +1096,7 @@ getSearchOptions_af_NA; getSearchOptions_af_ZA; getSearchOptions_ak_GH; getSearchOptions_am_ET; +getSearchOptions_ar_DZ; getSearchOptions_ar_EG; getSearchOptions_ar_LB; getSearchOptions_ar_OM; @@ -1159,6 +1174,7 @@ getTransliterations_af_NA; getTransliterations_af_ZA; getTransliterations_ak_GH; getTransliterations_am_ET; +getTransliterations_ar_DZ; getTransliterations_ar_EG; getTransliterations_ar_LB; getTransliterations_ar_OM; @@ -1236,6 +1252,7 @@ getUnicodeScripts_af_NA; getUnicodeScripts_af_ZA; getUnicodeScripts_ak_GH; getUnicodeScripts_am_ET; +getUnicodeScripts_ar_DZ; getUnicodeScripts_ar_EG; getUnicodeScripts_ar_LB; getUnicodeScripts_ar_OM; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 5e09ef66adff..1ac16a31fe37 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -68,6 +68,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_af_ZA.cxx \ $(MISC)$/localedata_ak_GH.cxx \ $(MISC)$/localedata_am_ET.cxx \ + $(MISC)$/localedata_ar_DZ.cxx \ $(MISC)$/localedata_ar_EG.cxx \ $(MISC)$/localedata_ar_LB.cxx \ $(MISC)$/localedata_ar_SA.cxx \ @@ -419,6 +420,7 @@ SHL4OBJS= \ $(SLO)$/localedata_af_ZA.obj \ $(SLO)$/localedata_ak_GH.obj \ $(SLO)$/localedata_am_ET.obj \ + $(SLO)$/localedata_ar_DZ.obj \ $(SLO)$/localedata_ar_EG.obj \ $(SLO)$/localedata_ar_LB.obj \ $(SLO)$/localedata_ar_OM.obj \ diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 817a314da11f..34f4f6bbb520 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -180,6 +180,7 @@ static const struct { { "zh_MO", lcl_DATA_OTHERS }, { "ar_EG", lcl_DATA_OTHERS }, + { "ar_DZ", lcl_DATA_OTHERS }, { "ar_LB", lcl_DATA_OTHERS }, { "ar_SA", lcl_DATA_OTHERS }, { "ar_TN", lcl_DATA_OTHERS }, -- cgit From b75ce9cf2a1345f1eb59d8e2d28d0e0eb7b72422 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 11 Jun 2010 10:22:00 +0200 Subject: gridcontrol04: i111555: change file permissions for config script --- svtools/inc/svtools/table/tabledatawindow.hxx | 6 ++++-- svtools/source/table/tabledatawindow.cxx | 15 ++++++++++----- svtools/source/uno/svtxgridcontrol.cxx | 6 ++++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx index b577d4e611e7..9a6ece489119 100644 --- a/svtools/inc/svtools/table/tabledatawindow.hxx +++ b/svtools/inc/svtools/table/tabledatawindow.hxx @@ -74,9 +74,11 @@ namespace svt { namespace table virtual void CaptureMouse(); virtual void ReleaseMouse(); virtual long Notify(NotifyEvent& rNEvt); - virtual void SetBackground(const Color& rColor); virtual void SetControlBackground(const Color& rColor); - virtual Color GetControlBackground(); + virtual void SetControlBackground(); + + void SetBackground(const Wallpaper& rColor); + void SetBackground(); }; //........................................................................ } } // namespace svt::table diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 51311efd6ad1..71410fee4e2a 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -55,19 +55,24 @@ namespace svt { namespace table m_rTableControl.doPaintContent( rUpdateRect ); } //-------------------------------------------------------------------- - void TableDataWindow::SetBackground( const Color& rColor ) + void TableDataWindow::SetBackground( const Wallpaper& rColor ) { - Window::SetBackground( rColor ); + SetBackground( rColor ); } //-------------------------------------------------------------------- void TableDataWindow::SetControlBackground( const Color& rColor ) { - Window::SetControlBackground( rColor ); + SetControlBackground( rColor ); } //-------------------------------------------------------------------- - Color TableDataWindow::GetControlBackground() + void TableDataWindow::SetBackground() { - return Window::GetControlBackground(); + SetBackground(); + } + //-------------------------------------------------------------------- + void TableDataWindow::SetControlBackground() + { + SetControlBackground(); } //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 8586d9fe8da1..72da2274af3a 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -226,10 +226,12 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An case BASEPROPERTY_BACKGROUNDCOLOR: { sal_Int32 color = 0xFFFFFF; + Color color1 = pTable->GetSettings().GetStyleSettings().GetFieldColor(); if( aValue >>= color ) { - pTable->getDataWindow()->SetBackground( color ); - pTable->getDataWindow()->SetControlBackground( color ); + color1 = color; + pTable->getDataWindow()->SetBackground( color1 ); + pTable->getDataWindow()->SetControlBackground( color1 ); } break; } -- cgit From 4c6fe53ca705e6ef76041b08cb19008a4d5f24df Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 11 Jun 2010 12:03:49 +0200 Subject: consolidatereadme: don't extract empty strings --- l10ntools/source/xrmmerge.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 6e87cf8af8eb..b77f75ea04e5 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -605,7 +605,8 @@ void XRMResExport::EndOfText( sOutput.SearchAndReplaceAll( sSearch, "_" ); //if( !sCur.EqualsIgnoreCaseAscii("de") ||( sCur.EqualsIgnoreCaseAscii("de") && !Export::isMergingGermanAllowed( sPrj ) ) ) - pOutputStream->WriteLine( sOutput ); + if( sAct.Len() > 1 ) + pOutputStream->WriteLine( sOutput ); } } delete pResData; -- cgit From b69a01a9b4c47f12bb31015a5080d5285a5c0cba Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Jun 2010 13:01:41 +0200 Subject: unoawt: support XDialog2 for UNO dialogs --- toolkit/inc/toolkit/awt/vclxwindows.hxx | 8 ++++++-- toolkit/inc/toolkit/controls/dialogcontrol.hxx | 8 ++++++-- toolkit/source/awt/vclxwindows.cxx | 26 +++++++++++++++++++++----- toolkit/source/controls/dialogcontrol.cxx | 14 ++++++++++++++ 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index 8efe01b526ba..ca3267bffb5e 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -75,7 +75,7 @@ #include #include #include -#include +#include #include #include #include @@ -390,7 +390,7 @@ public: // ---------------------------------------------------- // class VCLXDialog // ---------------------------------------------------- -class VCLXDialog : public ::com::sun::star::awt::XDialog, +class VCLXDialog : public ::com::sun::star::awt::XDialog2, public VCLXTopWindow { public: @@ -406,6 +406,10 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog2 + virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx index b6a0e66b2430..0c5731d3f923 100644 --- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx +++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -186,7 +186,7 @@ protected: // ---------------------------------------------------- typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener , ::com::sun::star::awt::XTopWindow - , ::com::sun::star::awt::XDialog + , ::com::sun::star::awt::XDialog2 , ::com::sun::star::util::XChangesListener , ::com::sun::star::util::XModifyListener , ::com::sun::star::awt::XWindowListener @@ -272,6 +272,10 @@ public: void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog2 + virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpId( ::sal_Int32 Id ) throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 5649ed4248dd..bff8dde75b0c 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2323,16 +2323,36 @@ VCLXDialog::~VCLXDialog() ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) ); return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType )); } // ::com::sun::star::lang::XTypeProvider IMPL_XTYPEPROVIDER_START( VCLXDialog ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ), getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ), VCLXTopWindow::getTypes() IMPL_XTYPEPROVIDER_END +void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() ); + if ( pDialog ) + pDialog->EndDialog( i_result ); +} + +void SAL_CALL VCLXDialog::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetHelpId( i_id ); +} + void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -2379,11 +2399,7 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); - - Dialog* pDlg = (Dialog*) GetWindow(); - if ( pDlg ) - pDlg->EndDialog( 0 ); + endDialog(0); } void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index cf1bff991430..7d845096321a 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -1975,6 +1975,20 @@ void UnoDialogControl::ImplUpdateResourceResolver() } } +void SAL_CALL UnoDialogControl::endDialog( ::sal_Int32 i_result ) throw (RuntimeException) +{ + Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY ); + if ( xPeerDialog.is() ) + xPeerDialog->endDialog( i_result ); +} + +void SAL_CALL UnoDialogControl::setHelpId( ::sal_Int32 i_id ) throw (RuntimeException) +{ + Reference< XDialog2 > xPeerDialog( getPeer(), UNO_QUERY ); + if ( xPeerDialog.is() ) + xPeerDialog->setHelpId( i_id ); +} + void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); -- cgit From 0742e8e31b30b5ea203bbad44510c6d41b7e9793 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 11 Jun 2010 13:07:26 +0200 Subject: l10ntooling18: idx-1 > 0 -> idx >= 1 --- l10ntools/source/merge.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index b98bc53a6adb..e15a5c8a28fa 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -57,7 +57,7 @@ BOOL PFormEntrys::GetTransex3Text( ByteString &rReturn, ByteString test( rReturn ); for( USHORT idx = 0; idx < rReturn.Len(); idx++ ) { - if( rReturn.GetChar( idx ) == '\"' && ( idx-1 > 0 ) && rReturn.GetChar( idx-1 ) == '\\' ) + if( rReturn.GetChar( idx ) == '\"' && ( idx >= 1 ) && rReturn.GetChar( idx-1 ) == '\\' ) { rReturn.Erase( idx-1 , 1 ); } -- cgit From ef60d406e368f024bd2edaa12e3389cbdd9e361b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Jun 2010 15:14:17 +0200 Subject: unoawt: added UnoControlListBoxModel::ItemSeparatorPos, specifying the position where to draw a separator between two items --- toolkit/inc/toolkit/helper/property.hxx | 1 + toolkit/source/awt/vclxwindows.cxx | 11 +++++++++++ toolkit/source/controls/unocontrolmodel.cxx | 1 + toolkit/source/helper/property.cxx | 1 + 4 files changed, 14 insertions(+) diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index ed86c3fe4ded..f8a1a703799c 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -201,6 +201,7 @@ namespace rtl { #define BASEPROPERTY_GRID_LINE_COLOR 150 #define BASEPROPERTY_GRID_ROW_BACKGROUND 151 #define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152 +#define BASEPROPERTY_ITEM_SEPARATOR_POS 153 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index bff8dde75b0c..26e84905ee01 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -1547,6 +1547,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_LINECOUNT, BASEPROPERTY_MULTISELECTION, BASEPROPERTY_MULTISELECTION_SIMPLEMODE, + BASEPROPERTY_ITEM_SEPARATOR_POS, BASEPROPERTY_PRINTABLE, BASEPROPERTY_SELECTEDITEMS, BASEPROPERTY_STRINGITEMLIST, @@ -1916,6 +1917,13 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_ITEM_SEPARATOR_POS: + { + sal_Int16 nSeparatorPos(0); + if ( Value >>= nSeparatorPos ) + pListBox->SetSeparatorPos( nSeparatorPos ); + } + break; case BASEPROPERTY_READONLY: { sal_Bool b = sal_Bool(); @@ -1987,6 +1995,9 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_ITEM_SEPARATOR_POS: + aProp <<= sal_Int16( pListBox->GetSeparatorPos() ); + break; case BASEPROPERTY_READONLY: { aProp <<= (sal_Bool) pListBox->IsReadOnly(); diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index c5e1f70b15b8..91d202409e86 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -263,6 +263,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const aDefault <<= Reference< awt::XDevice >(); break; + case BASEPROPERTY_ITEM_SEPARATOR_POS: case BASEPROPERTY_VERTICALALIGN: case BASEPROPERTY_BORDERCOLOR: case BASEPROPERTY_SYMBOL_COLOR: diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 9369faf6a0b9..9a3dc7b9bfb3 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -191,6 +191,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT), DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT), DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ), -- cgit From 5d119d28d30185fc23d99534308ec8633d3ba63b Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 11 Jun 2010 16:18:04 +0200 Subject: #i110654# fixed typo --- unotools/source/misc/fontcvt.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index a84586ab78cf..2bb682e4915b 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -303,7 +303,7 @@ static const sal_Unicode aWingDings2Tab[224] = 0xe547, 0x24EA, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, // F070 - 0x2466, 0x2477, 0x2468, 0x2469, + 0x2466, 0x2467, 0x2468, 0x2469, 0xE453, 0x278A, 0x278B, 0x278C, 0x278D, 0x278E, 0x278F, 0x2790, 0x2791, 0x2792, 0x2793, 0, -- cgit From 582fd11a71e391a5d8896ef4b25183023b1d07c1 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Fri, 11 Jun 2010 17:09:46 +0200 Subject: gridcontrol04: fix for #i112290# and some build problems --- svtools/source/table/tabledatawindow.cxx | 8 ++++---- svtools/source/uno/svtxgridcontrol.cxx | 30 ++++++++++++++++-------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 71410fee4e2a..5e2cb44cd9a3 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -57,22 +57,22 @@ namespace svt { namespace table //-------------------------------------------------------------------- void TableDataWindow::SetBackground( const Wallpaper& rColor ) { - SetBackground( rColor ); + Window::SetBackground( rColor ); } //-------------------------------------------------------------------- void TableDataWindow::SetControlBackground( const Color& rColor ) { - SetControlBackground( rColor ); + Window::SetControlBackground( rColor ); } //-------------------------------------------------------------------- void TableDataWindow::SetBackground() { - SetBackground(); + Window::SetBackground(); } //-------------------------------------------------------------------- void TableDataWindow::SetControlBackground() { - SetControlBackground(); + Window::SetControlBackground(); } //-------------------------------------------------------------------- void TableDataWindow::MouseMove( const MouseEvent& rMEvt ) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 72da2274af3a..19a29abacc11 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -664,10 +664,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) { std::vector& selectedRows = pTable->GetSelectedRows(); - if(!selectedRows.empty()) - selectedRows.clear(); if(eSelMode == SINGLE_SELECTION) { + if(!selectedRows.empty()) + selectedRows.clear(); if(rangeOfRows.getLength() == 1) selectedRows.push_back(start); else @@ -676,7 +676,10 @@ void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< else { for(int i=0;iselectionChanged(true); pTable->InvalidateDataWindow(start, end, false); @@ -704,24 +707,23 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run SetSynthesizingVCLEvent( sal_False ); } } + void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException) { TableControl* pTable = (TableControl*)GetWindow(); std::vector& selectedRows = pTable->GetSelectedRows(); std::vector::iterator itStart = selectedRows.begin(); std::vector::iterator itEnd = selectedRows.end(); - sal_Int32 start = rangeOfRows[0]; - sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1]; - if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount())) + for(int i = 0; i < rangeOfRows.getLength(); i++ ) { - std::vector::iterator iter = std::find(itStart, itEnd, start); - selectedRows.erase(iter, iter+(end-start)+1); - pTable->selectionChanged(true); - pTable->InvalidateDataWindow(start, end, false); - SetSynthesizingVCLEvent( sal_True ); - pTable->Select(); - SetSynthesizingVCLEvent( sal_False ); + std::vector::iterator iter = std::find(itStart, itEnd, rangeOfRows[i]); + selectedRows.erase(iter); } + pTable->selectionChanged(true); + pTable->Invalidate(); + SetSynthesizingVCLEvent( sal_True ); + pTable->Select(); + SetSynthesizingVCLEvent( sal_False ); } void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) @@ -860,7 +862,7 @@ void SVTXGridControl::ImplCallItemListeners() aEvent.Range = diff; } //selected row changed - else if(diff == 0) + else if(diff == 0 && actSelRowCount != 0) { aEvent.Row = selRows[actSelRowCount-1]; aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2); -- cgit From 1184876fc2d6662101facfc1db7464a0d01e2428 Mon Sep 17 00:00:00 2001 From: Ruediger Timm Date: Fri, 11 Jun 2010 20:43:02 +0200 Subject: masterfix #i10000#: Add precompiled header include (patch provided by gh). --- svtools/source/toolpanel/toolpanel.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx index 35446d1ffe2b..f7b999494563 100644 --- a/svtools/source/toolpanel/toolpanel.cxx +++ b/svtools/source/toolpanel/toolpanel.cxx @@ -24,6 +24,8 @@ * ************************************************************************/ +#include "precompiled_svtools.hxx" + #include "svtools/toolpanel/toolpanel.hxx" //........................................................................ -- cgit From 3d3a3e5e07f647ef7c631772f5cde899d9bb9b57 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 12 Jun 2010 20:29:06 +0200 Subject: CWS mba33issues01: put code to load libraries on demand into class SvLibrary --- tools/inc/tools/svlibrary.hxx | 41 ++++++++++++ tools/prj/d.lst | 1 + tools/source/generic/makefile.mk | 3 +- tools/source/generic/svlibrary.cxx | 129 +++++++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 tools/inc/tools/svlibrary.hxx create mode 100644 tools/source/generic/svlibrary.cxx diff --git a/tools/inc/tools/svlibrary.hxx b/tools/inc/tools/svlibrary.hxx new file mode 100644 index 000000000000..2d85b9764802 --- /dev/null +++ b/tools/inc/tools/svlibrary.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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 _SVLIBRARY_HXX +#define _SVLIBRARY_HXX + +#include "tools/toolsdllapi.h" + +#include +#include + +class TOOLS_DLLPUBLIC SvLibrary +{ +public: + static bool LoadModule( osl::Module&, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode = SAL_LOADMODULE_DEFAULT ); +}; + +#endif \ No newline at end of file diff --git a/tools/prj/d.lst b/tools/prj/d.lst index 6b4a99a3a676..e0291c2f8ad0 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -37,6 +37,7 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\postextstl.h %_DEST%\inc%_EXT%\tools\postextstl.h ..\inc\tools\preextstl.h %_DEST%\inc%_EXT%\tools\preextstl.h +..\inc\tools\svlibrary.hxx %_DEST%\inc%_EXT%\tools\svlibrary.hxx ..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx ..\inc\tools\wintypes.hxx %_DEST%\inc%_EXT%\tools\wintypes.hxx ..\inc\tools\mapunit.hxx %_DEST%\inc%_EXT%\tools\mapunit.hxx diff --git a/tools/source/generic/makefile.mk b/tools/source/generic/makefile.mk index 5cdaa02065ae..07bab82f32b0 100644 --- a/tools/source/generic/makefile.mk +++ b/tools/source/generic/makefile.mk @@ -37,9 +37,10 @@ TARGET=gen # --- Files -------------------------------------------------------- -EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj +EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj $(SLO)$/svlibrary.obj SLOFILES= $(SLO)$/toolsin.obj \ + $(SLO)$/svlibrary.obj \ $(SLO)$/b3dtrans.obj \ $(SLO)$/link.obj \ $(SLO)$/bigint.obj \ diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx new file mode 100644 index 000000000000..365d61ca4244 --- /dev/null +++ b/tools/source/generic/svlibrary.cxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_tools.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace com::sun::star; + +static uno::Sequence< rtl::OUString > GetMultiPaths_Impl() +{ + uno::Sequence< rtl::OUString > aRes; + uno::Sequence< rtl::OUString > aInternalPaths; + uno::Sequence< rtl::OUString > aUserPaths; + + bool bSuccess = true; + uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); + if (xMgr.is()) + { + try + { + String aInternal; + aInternal.AppendAscii("Libraries"); + String aUser; + aUser.AppendAscii("Libraries"); + aInternal .AppendAscii( "_internal" ); + aUser .AppendAscii( "_user" ); + + uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( + rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW ); + xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; + xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; + } + catch (uno::Exception &) + { + bSuccess = false; + } + } + if (bSuccess) + { + sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength(); + aRes.realloc( nMaxEntries ); + rtl::OUString *pRes = aRes.getArray(); + sal_Int32 nCount = 0; // number of actually added entries + for (int i = 0; i < 2; ++i) + { + const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths; + const rtl::OUString *pPathSeq = rPathSeq.getConstArray(); + for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k) + { + const bool bAddUser = (&rPathSeq == &aUserPaths); + const bool bAddInternal = (&rPathSeq == &aInternalPaths); + if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0) + pRes[ nCount++ ] = pPathSeq[k]; + } + } + aRes.realloc( nCount ); + } + + return aRes; +} + +bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode ) +{ + static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl(); + bool bLoaded = false; + + for (sal_Int32 n=0; n xComponentContext = comphelper::getProcessComponentContext(); + uno::Reference< util::XMacroExpander > xMacroExpander; + xComponentContext->getValueByName( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) ) + >>= xMacroExpander; + + aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 ); + aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aMod = xMacroExpander->expandMacros( aMod ); + } + + aMod += ::rtl::OUString( sal_Unicode('/') ); + aMod += rLibName; + bLoaded = rModule.load( aMod, mode ); + if ( bLoaded ) + break; + } + + if (!bLoaded ) + bLoaded = rModule.loadRelative( baseModule, rLibName, mode ); + + return bLoaded; +} -- cgit From f456a5cd95093b62a5ed0b956173c5ed55151ca3 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 12 Jun 2010 21:26:57 +0200 Subject: CWS mba33issues01: typo --- tools/source/generic/svlibrary.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/source/generic/svlibrary.cxx b/tools/source/generic/svlibrary.cxx index 365d61ca4244..6ebfd0086b5c 100644 --- a/tools/source/generic/svlibrary.cxx +++ b/tools/source/generic/svlibrary.cxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include -- cgit From 355b32c362ddba7e7af31961fbda61ba5f83b9d3 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 14 Jun 2010 16:28:00 +0200 Subject: calctabcolor: #i5560# add: paint in HC mode --- svtools/source/control/tabbar.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 7a927f57e7e2..2ad81da40716 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1141,7 +1141,7 @@ void TabBar::Paint( const Rectangle& ) } else { - if ( !pItem->IsDefaultTabBgColor() ) + if ( !pItem->IsDefaultTabBgColor() && !rStyleSettings.GetHighContrastMode() ) { SetFillColor( pItem->maTabBgColor ); SetTextColor( pItem->maTabTextColor ); @@ -1198,7 +1198,7 @@ void TabBar::Paint( const Rectangle& ) if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { SetLineColor( rStyleSettings.GetLightColor() ); } else { - if ( !pItem->IsDefaultTabBgColor() ) + if ( !pItem->IsDefaultTabBgColor() && ! rStyleSettings.GetHighContrastMode() ) { SetLineColor( pItem->maTabBgColor ); } else { @@ -1232,7 +1232,7 @@ void TabBar::Paint( const Rectangle& ) if ( !pItem->IsDefaultTabBgColor() ) { - if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { + if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) || rStyleSettings.GetHighContrastMode() ) { SetLineColor( pItem->maTabBgColor ); DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); if ( !pItem->mbEnable ) -- cgit From 53b64badd63099eecf393c2a9afc27d816014940 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Mon, 14 Jun 2010 18:35:49 +0200 Subject: CWS mba33issues01: missing EOF --- tools/inc/tools/svlibrary.hxx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/inc/tools/svlibrary.hxx b/tools/inc/tools/svlibrary.hxx index 2d85b9764802..fa8ff7c8068b 100644 --- a/tools/inc/tools/svlibrary.hxx +++ b/tools/inc/tools/svlibrary.hxx @@ -29,13 +29,14 @@ #include "tools/toolsdllapi.h" -#include -#include - -class TOOLS_DLLPUBLIC SvLibrary -{ -public: +#include +#include + +class TOOLS_DLLPUBLIC SvLibrary +{ +public: static bool LoadModule( osl::Module&, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode = SAL_LOADMODULE_DEFAULT ); }; -#endif \ No newline at end of file +#endif + -- cgit From 8dc6a85055c80820f601cef82e54923c5e61aad6 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 14 Jun 2010 18:57:10 +0200 Subject: ause121: #i112091# inputfile detection --- l10ntools/java/jpropex/java/JPropEx.java | 94 ++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 12 deletions(-) diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index d0f72d627aaf..f59113ffb1f8 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -43,7 +43,10 @@ public class JPropEx private boolean isQuiet = false; private final String resourceType = "javaproperties"; private final String sourceLanguage = "en-US"; - //private SdfData data; + + static final int JAVA_TYPE = 0; + static final int JAVA_ENUS_TYPE = 1; + static final int EXTENSION_TYPE = 2; public JPropEx() { @@ -178,6 +181,7 @@ public class JPropEx private void mergeFile( String filename , SdfData data , boolean isSingleFile ) { + int type = detectFormat( filename ); java.util.Properties sourceProp = loadProp( filename ); Vector langs = getLanguages( data ); HashMap props = new HashMap(); @@ -209,7 +213,7 @@ public class JPropEx mergedEntity = data.get( curEntity ); if( mergedEntity == null ) { - // if case there is not translation the fallback to the en-US source string + // in case there is no translation then fallback to the en-US source string ( (java.util.Properties) props.get( curLang )).setProperty( curEntity.getLid() , sourceString ); } else @@ -225,10 +229,10 @@ public class JPropEx for( Iterator i = props.keySet().iterator() ; i.hasNext() ; ) { lang = (String) i.next(); - writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile ); + writeSinglePropertiesFile( filename , (java.util.Properties) props.get( lang ) , lang , isSingleFile , type ); } } - private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile ) + private void writeSinglePropertiesFile( String filename , java.util.Properties prop , String lang , boolean isSingleFile , int type ) { // Prepare path to file int filenameIdx = filename.lastIndexOf( "/" ) > 0 ? filename.lastIndexOf( "/" )+1 : 0 ; @@ -240,24 +244,21 @@ public class JPropEx if( pathPrefixArg != null && pathPrefixArg.length()>0 && pathPostfixArg != null && pathPostfixArg.length()>0 ) { path = new StringBuffer().append( pathPrefixArg ).append( "/" ).append( lcLang ).append( "/" ).append( pathPostfixArg ).append( "/" ).toString(); - name = new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) - .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); + name += formatFilename( filename , filenameIdx , lang , type ); } //use of -i else if( !isSingleFile && outputFileArg != null && outputFileArg.length()>0 ) { - name = outputFileArg; - name += new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) - .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); //name = outputFileArg; + path = outputFileArg; + name += formatFilename( filename , filenameIdx , lang , type ); } //use of -i @ else if( isSingleFile && outputFileArg != null && outputFileArg.length()>0 ) { - name = outputFileArg; - name += new StringBuffer().append( inputFileArg.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) - .append( "_" ).append( lcLang.replaceAll("-","_") ).append( ".properties" ).toString(); //name = outputFileArg; + path = outputFileArg; + name += formatFilename( filename , filenameIdx , lang , type ); } else { @@ -298,6 +299,75 @@ public class JPropEx } } + // we have different types of properties in the source code + // each needs a different file nameing scheme + private int detectFormat( String filename ) + { + if( filename.endsWith( "_en_US.properties" ) ) + return EXTENSION_TYPE; + else if( filename.endsWith("_en_us.properties" ) ) + return JAVA_ENUS_TYPE; + else if( filename.endsWith( ".properties" ) ) + return JAVA_TYPE; + + // Can not detect, exit + System.err.println("ERROR: Invalid file name. Only allowed (case sensitive!) *_en_US.properties , *_en_us.properties or *.properties\n"); + System.exit(-1); + return JAVA_TYPE; // dummy + } + + private String formatFilename( String filename , int filenameIdx , String lang , int type ) + { + + if( !lang.equals( "en-US" ) ) + { + // Parse iso code + int pos = lang.indexOf("-"); + String langpart1 = new String(); + String langpart2 = new String(); + if( pos == -1 ) + { + langpart1 = lang; + } + else if( pos > 0 ) + { + langpart1 = lang.substring( 0 , pos ); + langpart2 = lang.substring( pos+1 , lang.length() ); + } + // change filename according to the type + switch( type ) + { + // -> de_DE + case EXTENSION_TYPE: + lang = langpart1.toLowerCase(); + if( langpart2.length() > 0 ) // -> en_US + lang += "_" + langpart2.toUpperCase(); + else // -> de_DE + lang += "_" + langpart1.toUpperCase(); + return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_US.properties" ) ) ) + .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); + // -> de + case JAVA_ENUS_TYPE: + lang = langpart1.toLowerCase(); + if( langpart2.length() > 0 ) + lang += "_" + langpart2.toLowerCase(); + return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( "_en_us.properties" ) ) ) + .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); + // -> de + case JAVA_TYPE: + lang = langpart1.toLowerCase(); + if( langpart2.length() > 0 ) + lang += "_" + langpart2.toLowerCase(); + return new StringBuffer().append( filename.substring( filenameIdx , filename.lastIndexOf( ".properties" ) ) ) + .append( "_" ).append( lang.replaceAll("-","_") ).append( ".properties" ).toString(); + default: + System.err.println("ERROR: Something is really broken here, l10ntools/java/jprop/java/JPropEx.java :: formatFilename()"); + System.exit( -1 ); + break; + } + } + return filename; // don't change en-US source file name + } private SdfData getSdfData() { SdfData data = new SdfData( inputSdfFileArg ); -- cgit From 6cac753f31a6458f1c2cef6fa1174c8bd3d74ba5 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 14 Jun 2010 18:57:53 +0200 Subject: ause121: #i112091# don't stop on missing sdf file --- l10ntools/java/jpropex/java/SdfData.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/l10ntools/java/jpropex/java/SdfData.java b/l10ntools/java/jpropex/java/SdfData.java index 80b8ea890f26..6f79909df1b2 100644 --- a/l10ntools/java/jpropex/java/SdfData.java +++ b/l10ntools/java/jpropex/java/SdfData.java @@ -84,8 +84,7 @@ public class SdfData } catch( IOException e ) { - System.out.println("Error: reading file " + filename); - System.exit( -1 ); + System.out.println("Warning: can not read file " + filename); } } public void write( String filename ) -- cgit From a522451c35d959e2302ee85bb7f4d4f794511382 Mon Sep 17 00:00:00 2001 From: tono Date: Tue, 15 Jun 2010 22:35:25 +0900 Subject: i#111956: MinGW port fix: dependency to shared library: pure porting fix --- i18npool/source/localedata/data/makefile.mk | 6 +++--- svtools/util/makefile.mk | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 37f38b9f6e2d..c268b5137a62 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -285,7 +285,7 @@ SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME=$(SHL2TARGET) SHL2STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) @@ -327,7 +327,7 @@ SHL3DEF=$(MISC)$/$(SHL3TARGET).def DEF3NAME=$(SHL3TARGET) SHL3STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL3DEPN=$(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL3DEPN=$(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -418,7 +418,7 @@ SHL4DEF=$(MISC)$/$(SHL4TARGET).def DEF4NAME=$(SHL4TARGET) SHL4STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") SHL4DEPN=$(SHL1TARGETN) .ELSE SHL4DEPN=$(SHL1IMPLIBN) diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 9239b36cc6dc..85a252ea516b 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -153,7 +153,7 @@ DEF1DES =SvTools APP2TARGET = g2g APP2BASE = 0x10000000 -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" +.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) .ELSE APP2DEPN = $(SHL1IMPLIBN) $(SHL2IMPLIBN) -- cgit From 03a87109c292e5a2090ab49beb362a87f6020ae8 Mon Sep 17 00:00:00 2001 From: Mihaela Kedikova Date: Tue, 15 Jun 2010 17:18:56 +0200 Subject: gridcontrol04: improvement for #i112114# --- svtools/source/table/tablecontrol_impl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 69ad3cff9db2..10aca00881e3 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -888,7 +888,7 @@ namespace svt { namespace table int nRange = m_nColumnCount; if( m_nLeftColumn + nVisibleUnits == nRange-1) { - if(m_aColumnWidthsPixel[nRange-2] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth()) + if(m_aAccColumnWidthsPixel[nRange-2] - m_aAccColumnWidthsPixel[m_nLeftColumn] + m_aColumnWidthsPixel[nRange-1]>aDataCellPlayground.GetWidth()) { m_pHScroll->SetVisibleSize( nVisibleUnits -1 ); m_pHScroll->SetPageSize(nVisibleUnits -1); -- cgit From 2b998bf51d2c4d9c0705f33c4922454c1447d8ed Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 15 Jun 2010 20:02:53 +0200 Subject: mib16: contributed bugfixes and various new symbols in VBA compatibility implementation --- .../inc/toolkit/awt/vclxsystemdependentwindow.hxx | 4 ++-- toolkit/inc/toolkit/controls/unocontrolmodel.hxx | 22 +++++++++++----------- .../inc/toolkit/helper/unopropertyarrayhelper.hxx | 3 ++- toolkit/prj/d.lst | 2 ++ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx index 5448bfaff320..73bd100c2bb7 100644 --- a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx @@ -40,8 +40,8 @@ // class VCLXSystemDependendtWindow // ---------------------------------------------------- -class VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer, - public VCLXWindow +class TOOLKIT_DLLPUBLIC VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer, + public VCLXWindow { public: VCLXSystemDependentWindow(); diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx index 2de5e36aa02c..75bef3f9a48f 100644 --- a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx +++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx @@ -53,17 +53,17 @@ class ImplPropertyTable; // class UnoControlModel // ---------------------------------------------------- -class UnoControlModel : public ::com::sun::star::awt::XControlModel, - public ::com::sun::star::beans::XPropertyState, - public ::com::sun::star::io::XPersistObject, - public ::com::sun::star::lang::XComponent, - public ::com::sun::star::lang::XServiceInfo, - public ::com::sun::star::lang::XTypeProvider, - public ::com::sun::star::lang::XUnoTunnel, - public ::com::sun::star::util::XCloneable, - public MutexAndBroadcastHelper, - public ::cppu::OPropertySetHelper, - public ::cppu::OWeakAggObject +class TOOLKIT_DLLPUBLIC UnoControlModel : public ::com::sun::star::awt::XControlModel, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::io::XPersistObject, + public ::com::sun::star::lang::XComponent, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::util::XCloneable, + public MutexAndBroadcastHelper, + public ::cppu::OPropertySetHelper, + public ::cppu::OWeakAggObject { private: ImplPropertyTable* mpData; diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx index 2a42d05b72fd..5b5cb3021fc9 100644 --- a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx +++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx @@ -28,6 +28,7 @@ #ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ #define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_ +#include #include #include @@ -37,7 +38,7 @@ // ---------------------------------------------------- // class UnoPropertyArrayHelper // ---------------------------------------------------- -class UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper +class TOOLKIT_DLLPUBLIC UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper { private: Table maIDs; diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst index 0c62a083b330..375485c96e4d 100644 --- a/toolkit/prj/d.lst +++ b/toolkit/prj/d.lst @@ -24,6 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\controls ..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx ..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx ..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx +..\inc\toolkit\awt\vclxsystemdependentwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxsystemdependentwindow.hxx ..\source\awt\vclxdialog.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdialog.hxx ..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx ..\inc\toolkit\awt\vclxmenu.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxmenu.hxx @@ -47,6 +48,7 @@ mkdir: %_DEST%\inc%_EXT%\toolkit\controls ..\inc\toolkit\helper\formpdfexport.hxx %_DEST%\inc%_EXT%\toolkit\helper/formpdfexport.hxx ..\inc\toolkit\helper\accessiblefactory.hxx %_DEST%\inc%_EXT%\toolkit\helper\accessiblefactory.hxx ..\inc\toolkit\helper\fixedhyperbase.hxx %_DEST%\inc%_EXT%\toolkit\helper\fixedhyperbase.hxx +..\inc\toolkit\helper\unopropertyarrayhelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\unopropertyarrayhelper.hxx ..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\unohlp.hxx ..\inc\toolkit\dllapi.h %_DEST%\inc%_EXT%\toolkit\dllapi.h -- cgit From 5dc7559f03bdfc0770b2131e7574bed7027920df Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 15 Jun 2010 21:01:57 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- comphelper/inc/comphelper/docpasswordhelper.hxx | 39 +++++++++ comphelper/source/misc/docpasswordhelper.cxx | 101 ++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx index 1a734ebf5518..2317e740a01b 100644 --- a/comphelper/inc/comphelper/docpasswordhelper.hxx +++ b/comphelper/inc/comphelper/docpasswordhelper.hxx @@ -33,6 +33,7 @@ #include "comphelper/docpasswordrequest.hxx" namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } } +namespace com { namespace sun { namespace star { namespace beans { class PropertyValue; } } } } namespace comphelper { @@ -84,6 +85,44 @@ class COMPHELPER_DLLPUBLIC DocPasswordHelper public: // ------------------------------------------------------------------------ + /** This helper function generates the information related + to "Password to modify" provided by user. The result + sequence contains the hash and the algorithm-related + info. + + @param aString + The string for which the info should be generated + + @return + The sequence containing the hash and the algorithm-related info + */ + + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GenerateNewModifyPasswordInfo( const ::rtl::OUString& aPassword ); + + // ------------------------------------------------------------------------ + + /** This helper function allows to check whether + the "Password to modify" provided by user is the correct one. + + @param aString + The string containing the provided password + + @param aInfo + The sequence containing the hash and the algorithm-info + + @return + if the password is correct one + otherwise + */ + + static sal_Bool IsModifyPasswordCorrect( + const ::rtl::OUString& aPassword, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo ); + + + // ------------------------------------------------------------------------ + /** This helper function generates the hash code based on the algorithm specified by MS for "Password to modify" feature of Word. diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index fc41eaec3194..37941352ae28 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -32,6 +32,10 @@ #include #include "comphelper/mediadescriptor.hxx" +#include +#include +#include + using ::rtl::OUString; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; @@ -43,14 +47,111 @@ using ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER; using ::com::sun::star::task::XInteractionHandler; using ::com::sun::star::task::XInteractionRequest; +using namespace ::com::sun::star; + namespace comphelper { // ============================================================================ +static uno::Sequence< sal_Int8 > GeneratePBKDF2Hash( const ::rtl::OUString& aPassword, const uno::Sequence< sal_Int8 >& aSalt, sal_Int32 nCount, sal_Int32 nHashLength ) +{ + uno::Sequence< sal_Int8 > aResult; + + if ( aPassword.getLength() && aSalt.getLength() && nCount && nHashLength ) + { + ::rtl::OString aBytePass = ::rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_UTF8 ); + aResult.realloc( 16 ); + rtl_digest_PBKDF2( reinterpret_cast < sal_uInt8 * > ( aResult.getArray() ), + aResult.getLength(), + reinterpret_cast < const sal_uInt8 * > ( aBytePass.getStr() ), + aBytePass.getLength(), + reinterpret_cast < const sal_uInt8 * > ( aSalt.getConstArray() ), + aSalt.getLength(), + nCount ); + } + + return aResult; +} + +// ============================================================================ + IDocPasswordVerifier::~IDocPasswordVerifier() { } +// ============================================================================ +uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswordInfo( const ::rtl::OUString& aPassword ) +{ + uno::Sequence< beans::PropertyValue > aResult; + + uno::Sequence< sal_Int8 > aSalt( 16 ); + sal_Int32 nCount = 1024; + + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + rtl_random_getBytes ( aRandomPool, aSalt.getArray(), 16 ); + + uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash( aPassword, aSalt, nCount, 16 ); + if ( aNewHash.getLength() ) + { + aResult.realloc( 4 ); + aResult[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "algorithm-name" ) ); + aResult[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PBKDF2" ) ); + aResult[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "salt" ) ); + aResult[1].Value <<= aSalt; + aResult[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "iteration-count" ) ); + aResult[2].Value <<= nCount; + aResult[3].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hash" ) ); + aResult[3].Value <<= aNewHash; + } + + // Clean up random pool memory + rtl_random_destroyPool ( aRandomPool ); + + return aResult; +} + +// ============================================================================ +sal_Bool DocPasswordHelper::IsModifyPasswordCorrect( const ::rtl::OUString& aPassword, const uno::Sequence< beans::PropertyValue >& aInfo ) +{ + sal_Bool bResult = sal_False; + if ( aPassword.getLength() && aInfo.getLength() ) + { + ::rtl::OUString sAlgorithm; + uno::Sequence< sal_Int8 > aSalt; + uno::Sequence< sal_Int8 > aHash; + sal_Int32 nCount = 0; + + for ( sal_Int32 nInd = 0; nInd < aInfo.getLength(); nInd++ ) + { + if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "algorithm-name" ) ) ) ) + aInfo[nInd].Value >>= sAlgorithm; + else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "salt" ) ) ) ) + aInfo[nInd].Value >>= aSalt; + else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "iteration-count" ) ) ) ) + aInfo[nInd].Value >>= nCount; + else if ( aInfo[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hash" ) ) ) ) + aInfo[nInd].Value >>= aHash; + } + + if ( sAlgorithm.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PBKDF2" ) ) ) + && aSalt.getLength() && nCount > 0 && aHash.getLength() ) + { + uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash( aPassword, aSalt, nCount, aHash.getLength() ); + for ( sal_Int32 nInd = 0; nInd < aNewHash.getLength() && nInd < aHash.getLength() && aNewHash[nInd] == aHash[nInd]; nInd ++ ) + { + if ( nInd == aNewHash.getLength() - 1 && nInd == aHash.getLength() - 1 ) + bResult = sal_True; + } + } + } + + return bResult; +} + // ============================================================================ sal_uInt32 DocPasswordHelper::GetWordHashAsUINT32( const ::rtl::OUString& aUString ) -- cgit From e514952e7ce29bc16e45e423070c69982224bc86 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 15 Jun 2010 21:46:35 +0200 Subject: tl78v2: #i112427# Support password to modify in calc and writer ODF documents --- comphelper/inc/comphelper/docpasswordhelper.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx index 2317e740a01b..dbbb68372a07 100644 --- a/comphelper/inc/comphelper/docpasswordhelper.hxx +++ b/comphelper/inc/comphelper/docpasswordhelper.hxx @@ -33,7 +33,7 @@ #include "comphelper/docpasswordrequest.hxx" namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } } -namespace com { namespace sun { namespace star { namespace beans { class PropertyValue; } } } } +namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } } namespace comphelper { -- cgit From 41436227fd2108d59e52cdd217d73604613ce02e Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Wed, 16 Jun 2010 09:47:53 +0200 Subject: masterfix: #i10000# resolve merge problems --- svtools/inc/svtools/toolboxcontroller.hxx | 1 + svtools/source/uno/toolboxcontroller.cxx | 39 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/svtools/inc/svtools/toolboxcontroller.hxx b/svtools/inc/svtools/toolboxcontroller.hxx index f636178881d0..7a49b294759c 100644 --- a/svtools/inc/svtools/toolboxcontroller.hxx +++ b/svtools/inc/svtools/toolboxcontroller.hxx @@ -133,6 +133,7 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL void enable( bool bEnable ); protected: + bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ); void setSupportVisiableProperty(sal_Bool bValue); //shizhoubo struct Listener { diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 36c1374ba9fb..0af47339dc58 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -808,6 +808,45 @@ throw( com::sun::star::uno::Exception) this->setSupportVisiableProperty( rValue ); } } + +void ToolboxController::enable( bool bEnable ) +{ + ToolBox* pToolBox = 0; + sal_uInt16 nItemId = 0; + if( getToolboxId( nItemId, &pToolBox ) ) + { + pToolBox->EnableItem( nItemId, bEnable ? TRUE : FALSE ); + } +} + +bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) +{ + if( (m_pImpl->m_nToolBoxId != SAL_MAX_UINT16) && (ppToolBox == 0) ) + return m_pImpl->m_nToolBoxId; + + ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); + + if( (m_pImpl->m_nToolBoxId == SAL_MAX_UINT16) && pToolBox ) + { + const sal_uInt16 nCount = pToolBox->GetItemCount(); + for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) + { + const sal_uInt16 nItemId = pToolBox->GetItemId( nPos ); + if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) ) + { + m_pImpl->m_nToolBoxId = nItemId; + break; + } + } + } + + if( ppToolBox ) + *ppToolBox = pToolBox; + + rItemId = m_pImpl->m_nToolBoxId; + + return (rItemId != SAL_MAX_UINT16) && (( ppToolBox == 0) || (*ppToolBox != 0) ); +} //end } // svt -- cgit From 61fbee4835116520e376476e7034dc09d0caa27d Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 16 Jun 2010 11:20:09 +0200 Subject: fwk143: #i102271# Check parent before changing window lists --- vcl/source/window/window.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 092ff0fe1a9d..f8bd3b2b19a7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -6247,6 +6247,9 @@ void Window::SetParent( Window* pNewParent ) if( pNewParent == this ) return; + if ( mpWindowImpl->mpParent == pNewParent ) + return; + // check if the taskpanelist would change and move the window pointer accordingly SystemWindow *pSysWin = ImplGetLastSystemWindow(this); SystemWindow *pNewSysWin = NULL; @@ -6296,9 +6299,6 @@ void Window::SetParent( Window* pNewParent ) return; } - if ( mpWindowImpl->mpParent == pNewParent ) - return; - if ( mpWindowImpl->mbFrame ) mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame ); -- cgit From 990ef886211196e7c1de0881fd78fc02bebf9073 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Wed, 16 Jun 2010 11:28:50 +0200 Subject: masterfix: #i10000# getModuleName() missing --- svtools/source/uno/toolboxcontroller.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 0af47339dc58..bac34d2baf1c 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -745,6 +745,12 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const { return m_pImpl->m_xParentWindow; } + +const rtl::OUString& ToolboxController::getModuleName() const +{ + return m_pImpl->m_sModuleName; +} + // //------------------------------------------------------------------------- // XPropertySet by shizhoubo -- cgit From 7f0993d43019a0ccb7f89c11fc23704c063b902f Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 16 Jun 2010 12:49:04 +0200 Subject: masterfix: #i10000# dispatchCommand,DispatchInfo missing --- svtools/source/uno/toolboxcontroller.cxx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index bac34d2baf1c..92ae93f5080d 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -751,6 +751,25 @@ const rtl::OUString& ToolboxController::getModuleName() const return m_pImpl->m_sModuleName; } +void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs ) +{ + try + { + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY_THROW ); + URL aURL; + aURL.Complete = sCommandURL; + getURLTransformer()->parseStrict( aURL ); + + Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW ); + + Application::PostUserEvent( STATIC_LINK(0, ToolboxController_Impl, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) ); + + } + catch( Exception& ) + { + } +} + // //------------------------------------------------------------------------- // XPropertySet by shizhoubo @@ -815,6 +834,15 @@ throw( com::sun::star::uno::Exception) } } +//-------------------------------------------------------------------- + +IMPL_STATIC_LINK_NOINSTANCE( ToolboxController_Impl, ExecuteHdl_Impl, DispatchInfo*, pDispatchInfo ) +{ + pDispatchInfo->mxDispatch->dispatch( pDispatchInfo->maURL, pDispatchInfo->maArgs ); + delete pDispatchInfo; + return 0; +} + void ToolboxController::enable( bool bEnable ) { ToolBox* pToolBox = 0; -- cgit From 6010ece515dbb597d1b452c45c517e3180b03816 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Jun 2010 14:28:15 +0200 Subject: jpropenable: #i112445# enable java properties --- l10ntools/source/localize.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 2bbec4257c76..9f6887f88246 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -66,7 +66,7 @@ const char *ExeTable[][5] = { { "xcs", "cfgex", "-UTF8 -e -f", "negative", "iso" }, { "xrm", "xrmex", "-UTF8 -e", "negative", "iso" }, { "xhp", "helpex", " -e", "negative", "noiso" }, - //{ "properties", "jpropex", " -e", "negative", "noiso" }, + { "properties", "jpropex", " -e", "negative", "noiso" }, { "NULL", "NULL", "NULL", "NULL", "NULL" } }; -- cgit From 3df12d0ea3b61122a400e3562c38cb9595b50195 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Jun 2010 14:33:49 +0200 Subject: jpropenable: #i112445# remove debug output --- l10ntools/java/jpropex/java/NoLocalizeFilter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/l10ntools/java/jpropex/java/NoLocalizeFilter.java b/l10ntools/java/jpropex/java/NoLocalizeFilter.java index 3bfa53df2296..989ee64bfc86 100644 --- a/l10ntools/java/jpropex/java/NoLocalizeFilter.java +++ b/l10ntools/java/jpropex/java/NoLocalizeFilter.java @@ -44,9 +44,7 @@ public class NoLocalizeFilter extends FilterInputStream String search = new String( b ); Matcher m = p.matcher( search ); if( m.find() ) - //if( search.contains("x-no-translate" ) ) // TODO: fixme! { - System.out.println("found x-no-translate"); in.close(); close(); System.exit( 0 ); -- cgit From 24acea304bfbd5dd45bb2a52a9711bc112db50e8 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Jun 2010 16:14:11 +0200 Subject: jpropenable: #i112445# remove debug output --- l10ntools/java/jpropex/java/JPropEx.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index d0f72d627aaf..97b6059133aa 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -284,7 +284,7 @@ public class JPropEx } path += name; // Write the properties file - System.out.println("DBG: Writing to "+path); + //System.out.println("DBG: Writing to "+path); try{ BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream( path ) ); if( prop == null ) -- cgit From 1ea16853f4ebedb310dba31309dd66070a9a3e7b Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Wed, 16 Jun 2010 19:57:33 +0200 Subject: CWS systemlibc: #i69033#: some fixes for Windows --- tools/bootstrp/makefile.mk | 3 +++ tools/bootstrp/rscdep.cxx | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk index b592cb900630..0869a2dd12f0 100644 --- a/tools/bootstrp/makefile.mk +++ b/tools/bootstrp/makefile.mk @@ -83,6 +83,9 @@ APP2TARGET= rscdep APP2OBJS= $(OBJ)$/rscdep.obj APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) +.IF "$(OS)"=="WNT" +APP2STDLIBS+=gnu_getopt.lib +.ENDIF APP2RPATH= NONE APP2RPATH= NONE APP2RPATH= NONE diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index ebe1e2f412e2..0d39794b8476 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -45,6 +45,12 @@ #include "cppdep.hxx" +#ifdef WNT +#define __STDC__ 1 +#define __GNU_LIBRARY__ +#include +#endif + class RscHrcDep : public CppDep { public: -- cgit From ba53ef2077b89a00987b9f06cc2bd31d88c9d916 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 17 Jun 2010 10:13:12 +0200 Subject: CWS systemlibc: #i69033#: some fixes for mingw --- tools/bootstrp/makefile.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk index 0869a2dd12f0..8338d35d1021 100644 --- a/tools/bootstrp/makefile.mk +++ b/tools/bootstrp/makefile.mk @@ -83,9 +83,11 @@ APP2TARGET= rscdep APP2OBJS= $(OBJ)$/rscdep.obj APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) +.IF "$(HAVE_GETOPT)" != "YES" .IF "$(OS)"=="WNT" APP2STDLIBS+=gnu_getopt.lib .ENDIF +.ENDIF APP2RPATH= NONE APP2RPATH= NONE APP2RPATH= NONE -- cgit From da4a9fc94efc66b5acc95bbd6a6bb376ad01eea6 Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Thu, 17 Jun 2010 11:30:15 +0200 Subject: CWS systemlibc: #i69033#: one more fix for mingw --- tools/bootstrp/makefile.mk | 4 ++++ tools/bootstrp/rscdep.cxx | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk index 8338d35d1021..41188d2117d0 100644 --- a/tools/bootstrp/makefile.mk +++ b/tools/bootstrp/makefile.mk @@ -38,6 +38,10 @@ LIBTARGET=NO CDEFS+=-D_TOOLS_STRINGLIST +.IF "$(HAVE_GETOPT)" == "YES" +CDEFS += -DHAVE_GETOPT +.ENDIF + # --- Files -------------------------------------------------------- OBJFILES= \ diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 0d39794b8476..37edfc6a8c18 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -45,10 +45,14 @@ #include "cppdep.hxx" -#ifdef WNT +#if defined WNT +#if !defined HAVE_GETOPT #define __STDC__ 1 #define __GNU_LIBRARY__ #include +#else +#include +#endif #endif class RscHrcDep : public CppDep -- cgit From 895a967293a07cbeb775220d7e109a51ffa1448d Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Thu, 17 Jun 2010 16:58:13 +0200 Subject: fwk143: #i102271# Revert changes due to bad side-effects --- vcl/source/window/dockwin.cxx | 2 +- vcl/source/window/window.cxx | 29 +++-------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 63451299756a..c8e382bad982 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -912,7 +912,7 @@ void DockingWindow::SetFloatingMode( BOOL bFloatMode ) mpWindowImpl->mpBorderWindow = mpOldBorderWin; SetParent( pRealParent ); mpWindowImpl->mpRealParent = pRealParent; - mpFloatWin->doLazyDelete(); + delete static_cast(mpFloatWin); mpFloatWin = NULL; SetPosPixel( maDockPos ); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f8bd3b2b19a7..b47aa50a2e72 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -6247,9 +6247,6 @@ void Window::SetParent( Window* pNewParent ) if( pNewParent == this ) return; - if ( mpWindowImpl->mpParent == pNewParent ) - return; - // check if the taskpanelist would change and move the window pointer accordingly SystemWindow *pSysWin = ImplGetLastSystemWindow(this); SystemWindow *pNewSysWin = NULL; @@ -6263,23 +6260,6 @@ void Window::SetParent( Window* pNewParent ) pSysWin->GetTaskPaneList()->RemoveWindow( this ); } } - - // de-register as "top window child" at our parent, if necessary - if ( mpWindowImpl->mbFrame ) - { - BOOL bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 ); - if ( mpWindowImpl->mpRealParent && bIsTopWindow ) - { - ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData(); - - ::std::list< Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(), - pParentWinData->maTopWindowChildren.end(), this ); - DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" ); - if ( myPos != pParentWinData->maTopWindowChildren.end() ) - pParentWinData->maTopWindowChildren.erase( myPos ); - } - } - // remove ownerdraw decorated windows from list in the top-most frame window if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) { @@ -6299,6 +6279,9 @@ void Window::SetParent( Window* pNewParent ) return; } + if ( mpWindowImpl->mpParent == pNewParent ) + return; + if ( mpWindowImpl->mbFrame ) mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame ); @@ -6415,12 +6398,6 @@ void Window::SetParent( Window* pNewParent ) if( bChangeTaskPaneList ) pNewSysWin->GetTaskPaneList()->AddWindow( this ); - if ( mpWindowImpl->mbFrame && pNewParent && IsTopWindow() ) - { - ImplWinData* pParentWinData = pNewParent->ImplGetWinData(); - pParentWinData->maTopWindowChildren.push_back( this ); - } - if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame ) ImplGetOwnerDrawList().push_back( this ); -- cgit From ecf638255c3857b7f2a265c90c460d9ea74b4701 Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 18 Jun 2010 13:43:12 +0200 Subject: masterfix: #i10000# remove DOS lineends --- comphelper/source/misc/mediadescriptor.cxx | 1736 ++++++++++++++-------------- 1 file changed, 868 insertions(+), 868 deletions(-) diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index a4f43ecf23db..9e02afe8c56c 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -1,868 +1,868 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied 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_comphelper.hxx" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -//_______________________________________________ -// namespace - -namespace comphelper{ - -namespace css = ::com::sun::star; - -//_______________________________________________ -// definitions - -/*----------------------------------------------- - 10.03.2004 07:35 ------------------------------------------------*/ -const ::rtl::OUString& MediaDescriptor::PROP_ABORTED() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Aborted")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_ASTEMPLATE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_CHARACTERSET() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("CharacterSet")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_COMPONENTDATA() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ComponentData")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_DEEPDETECTION() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DeepDetection")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_DETECTSERVICE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DetectService")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTSERVICE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_EXTENSION() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Extension")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FILENAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FileName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FILTERNAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FilterName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FILTEROPTIONS() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FilterOptions")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FORMAT() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Format")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FRAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_HIDDEN() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Hidden")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_INPUTSTREAM() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("InputStream")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_INTERACTIONHANDLER() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_JUMPMARK() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("JumpMark")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_MACROEXECUTIONMODE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_MEDIATYPE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("MediaType")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_MINIMIZED() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Minimized")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_NOAUTOSAVE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_OPENNEWVIEW() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("OpenNewView")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_OUTPUTSTREAM() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("OutputStream")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_PATTERN() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Pattern")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_POSSIZE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PosSize")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_POSTDATA() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PostData")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_POSTSTRING() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PostString")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_PREVIEW() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Preview")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_READONLY() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_REFERRER() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Referer")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_SILENT() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Silent")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_STATUSINDICATOR() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_STREAM() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Stream")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_STREAMFOROUTPUT() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("StreamForOutput")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_TEMPLATENAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TemplateName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_TEMPLATEREGIONNAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TemplateRegionName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_TYPENAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TypeName")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_UCBCONTENT() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("UCBContent")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_UPDATEDOCMODE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("UpdateDocMode")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_URL() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("URL")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_VERSION() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Version")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_VIEWID() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewId")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_REPAIRPACKAGE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTTITLE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_MODEL() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Model")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_PASSWORD() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Password")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_TITLE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Title")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_SALVAGEDFILE() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("SalvagedFile")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_VIEWONLY() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewOnly")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTBASEURL() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentBaseURL")); - return sProp; -} - -const ::rtl::OUString& MediaDescriptor::PROP_VIEWCONTROLLERNAME() -{ - static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewControllerName")); - return sProp; -} -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ -MediaDescriptor::MediaDescriptor() - : SequenceAsHashMap() -{ -} - -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ -MediaDescriptor::MediaDescriptor(const css::uno::Any& aSource) - : SequenceAsHashMap(aSource) -{ -} - -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ -MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource) - : SequenceAsHashMap(lSource) -{ -} - -/*----------------------------------------------- - 10.03.2004 08:09 ------------------------------------------------*/ -MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::NamedValue >& lSource) - : SequenceAsHashMap(lSource) -{ -} - -/*----------------------------------------------- - 18.11.2004 13:37 ------------------------------------------------*/ -sal_Bool MediaDescriptor::isStreamReadOnly() const -{ - static ::rtl::OUString CONTENTSCHEME_FILE = ::rtl::OUString::createFromAscii("file"); - static ::rtl::OUString CONTENTPROP_ISREADONLY = ::rtl::OUString::createFromAscii("IsReadOnly"); - static sal_Bool READONLY_FALLBACK = sal_False; - - sal_Bool bReadOnly = READONLY_FALLBACK; - - // check for explicit readonly state - const_iterator pIt = find(MediaDescriptor::PROP_READONLY()); - if (pIt != end()) - { - pIt->second >>= bReadOnly; - return bReadOnly; - } - - // streams based on post data are readonly by definition - pIt = find(MediaDescriptor::PROP_POSTDATA()); - if (pIt != end()) - return sal_True; - - // A XStream capsulate XInputStream and XOutputStream ... - // If it exists - the file must be open in read/write mode! - pIt = find(MediaDescriptor::PROP_STREAM()); - if (pIt != end()) - return sal_False; - - // Only file system content provider is able to provide XStream - // so for this content impossibility to create XStream triggers - // switch to readonly mode. - try - { - css::uno::Reference< css::ucb::XContent > xContent = getUnpackedValueOrDefault(MediaDescriptor::PROP_UCBCONTENT(), css::uno::Reference< css::ucb::XContent >()); - if (xContent.is()) - { - css::uno::Reference< css::ucb::XContentIdentifier > xId(xContent->getIdentifier(), css::uno::UNO_QUERY); - ::rtl::OUString aScheme; - if (xId.is()) - aScheme = xId->getContentProviderScheme(); - - if (aScheme.equalsIgnoreAsciiCase(CONTENTSCHEME_FILE)) - bReadOnly = sal_True; - else - { - ::ucbhelper::Content aContent(xContent, css::uno::Reference< css::ucb::XCommandEnvironment >()); - aContent.getPropertyValue(CONTENTPROP_ISREADONLY) >>= bReadOnly; - } - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - return bReadOnly; -} - -// ---------------------------------------------------------------------------- - -css::uno::Any MediaDescriptor::getComponentDataEntry( const ::rtl::OUString& rName ) const -{ - SequenceAsHashMap aCompDataMap( getUnpackedValueOrDefault( PROP_COMPONENTDATA(), ComponentDataSequence() ) ); - SequenceAsHashMap::iterator aIt = aCompDataMap.find( rName ); - return (aIt == aCompDataMap.end()) ? css::uno::Any() : aIt->second; -} - -void MediaDescriptor::setComponentDataEntry( const ::rtl::OUString& rName, const css::uno::Any& rValue ) -{ - if( rValue.hasValue() ) - { - // get or craete the 'ComponentData' property entry - css::uno::Any& rCompDataAny = operator[]( PROP_COMPONENTDATA() ); - // check type, insert the value - OSL_ENSURE( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >(), - "MediaDescriptor::setComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); - if( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >() ) - { - // insert or overwrite the passed value - SequenceAsHashMap aCompDataMap( rCompDataAny ); - aCompDataMap[ rName ] = rValue; - // write back the sequence (sal_False = use NamedValue instead of PropertyValue) - rCompDataAny = aCompDataMap.getAsConstAny( sal_False ); - } - } - else - { - // if an empty Any is passed, clear the entry - clearComponentDataEntry( rName ); - } -} - -void MediaDescriptor::clearComponentDataEntry( const ::rtl::OUString& rName ) -{ - SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA() ); - if( aPropertyIter != end() ) - { - OSL_ENSURE( aPropertyIter->second.has< ComponentDataSequence >(), - "MediaDescriptor::clearComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); - if( aPropertyIter->second.has< ComponentDataSequence >() ) - { - // remove the value with the passed name - SequenceAsHashMap aCompDataMap( aPropertyIter->second ); - aCompDataMap.erase( rName ); - // write back the sequence, or remove it completely if it is empty - if( aCompDataMap.empty() ) - erase( aPropertyIter ); - else - aPropertyIter->second = aCompDataMap.getAsConstAny( sal_False ); - } - } -} - -/*----------------------------------------------- - 10.03.2004 09:02 ------------------------------------------------*/ -sal_Bool MediaDescriptor::addInputStream() -{ - return impl_addInputStream( sal_True ); -} - -/*-----------------------------------------------*/ -sal_Bool MediaDescriptor::addInputStreamOwnLock() -{ - // Own lock file implementation - - sal_Bool bUseLock = sal_True; // the system file locking is used per default - try - { - - css::uno::Reference< css::uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( - ::comphelper::getProcessServiceFactory(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), - ::comphelper::ConfigurationHelper::E_STANDARD ); - if ( !xCommonConfig.is() ) - throw css::uno::RuntimeException(); - - ::comphelper::ConfigurationHelper::readRelativeKey( - xCommonConfig, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseLock; - } - catch( const css::uno::Exception& ) - { - } - - return impl_addInputStream( bUseLock ); -} - -/*-----------------------------------------------*/ -sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) -{ - // check for an already existing stream item first - const_iterator pIt = find(MediaDescriptor::PROP_INPUTSTREAM()); - if (pIt != end()) - return sal_True; - - try - { - // No stream available - create a new one - // a) data comes as PostData ... - pIt = find(MediaDescriptor::PROP_POSTDATA()); - if (pIt != end()) - { - const css::uno::Any& rPostData = pIt->second; - css::uno::Reference< css::io::XInputStream > xPostData; - rPostData >>= xPostData; - - return impl_openStreamWithPostData( xPostData ); - } - - // b) ... or we must get it from the given URL - ::rtl::OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString()); - if (!sURL.getLength()) - throw css::uno::Exception( - ::rtl::OUString::createFromAscii("Found no URL."), - css::uno::Reference< css::uno::XInterface >()); - - // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble - ::rtl::OUString sNormalizedURL = impl_normalizeURL( sURL ); - return impl_openStreamWithURL( sNormalizedURL, bLockFile ); - } -#if OSL_DEBUG_LEVEL>0 - catch(const css::uno::Exception& ex) - { - ::rtl::OUStringBuffer sMsg(256); - sMsg.appendAscii("Invalid MediaDescriptor detected:\n"); - sMsg.append (ex.Message ); - OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); - } -#else - catch(const css::uno::Exception&) - {} -#endif - - return sal_False; -} - -/*----------------------------------------------- - 25.03.2004 12:38 ------------------------------------------------*/ -sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference< css::io::XInputStream >& _rxPostData ) - throw(::com::sun::star::uno::RuntimeException) -{ - if ( !_rxPostData.is() ) - throw css::lang::IllegalArgumentException( - ::rtl::OUString::createFromAscii("Found invalid PostData."), - css::uno::Reference< css::uno::XInterface >(), 1); - - // PostData can't be used in read/write mode! - (*this)[MediaDescriptor::PROP_READONLY()] <<= sal_True; - - // prepare the environment - css::uno::Reference< css::task::XInteractionHandler > xInteraction = getUnpackedValueOrDefault( - MediaDescriptor::PROP_INTERACTIONHANDLER(), - css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::ucb::XProgressHandler > xProgress; - ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); - css::uno::Reference< css::ucb::XCommandEnvironment > xCommandEnv(static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), css::uno::UNO_QUERY); - - // media type - ::rtl::OUString sMediaType = getUnpackedValueOrDefault(MediaDescriptor::PROP_MEDIATYPE(), ::rtl::OUString()); - if (!sMediaType.getLength()) - { - sMediaType = ::rtl::OUString::createFromAscii("application/x-www-form-urlencoded"); - (*this)[MediaDescriptor::PROP_MEDIATYPE()] <<= sMediaType; - } - - // url - ::rtl::OUString sURL( getUnpackedValueOrDefault( PROP_URL(), ::rtl::OUString() ) ); - - css::uno::Reference< css::io::XInputStream > xResultStream; - try - { - // seek PostData stream to the beginning - css::uno::Reference< css::io::XSeekable > xSeek( _rxPostData, css::uno::UNO_QUERY ); - if ( xSeek.is() ) - xSeek->seek( 0 ); - - // a content for the URL - ::ucbhelper::Content aContent( sURL, xCommandEnv ); - - // use post command - css::ucb::PostCommandArgument2 aPostArgument; - aPostArgument.Source = _rxPostData; - css::uno::Reference< css::io::XActiveDataSink > xSink( new ucbhelper::ActiveDataSink ); - aPostArgument.Sink = xSink; - aPostArgument.MediaType = sMediaType; - aPostArgument.Referer = getUnpackedValueOrDefault( PROP_REFERRER(), ::rtl::OUString() ); - - ::rtl::OUString sCommandName( RTL_CONSTASCII_USTRINGPARAM( "post" ) ); - aContent.executeCommand( sCommandName, css::uno::makeAny( aPostArgument ) ); - - // get result - xResultStream = xSink->getInputStream(); - } - catch( const css::uno::Exception& ) - { - } - - // success? - if ( !xResultStream.is() ) - { - OSL_ENSURE( false, "no valid reply to the HTTP-Post" ); - return sal_False; - } - - (*this)[MediaDescriptor::PROP_INPUTSTREAM()] <<= xResultStream; - return sal_True; -} - -/*-----------------------------------------------*/ - -/*----------------------------------------------- - 25.03.2004 12:29 ------------------------------------------------*/ -sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, sal_Bool bLockFile ) - throw(::com::sun::star::uno::RuntimeException) -{ - // prepare the environment - css::uno::Reference< css::task::XInteractionHandler > xOrgInteraction = getUnpackedValueOrDefault( - MediaDescriptor::PROP_INTERACTIONHANDLER(), - css::uno::Reference< css::task::XInteractionHandler >()); - - StillReadWriteInteraction* pInteraction = new StillReadWriteInteraction(xOrgInteraction); - css::uno::Reference< css::task::XInteractionHandler > xInteraction(static_cast< css::task::XInteractionHandler* >(pInteraction), css::uno::UNO_QUERY); - - css::uno::Reference< css::ucb::XProgressHandler > xProgress; - ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); - css::uno::Reference< css::ucb::XCommandEnvironment > xCommandEnv(static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), css::uno::UNO_QUERY); - - // try to create the content - // no content -> no stream => return immediatly with FALSE - ::ucbhelper::Content aContent; - css::uno::Reference< css::ucb::XContent > xContent; - try - { - aContent = ::ucbhelper::Content(sURL, xCommandEnv); - xContent = aContent.get(); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::ucb::ContentCreationException&) - { return sal_False; } // TODO error handling - catch(const css::uno::Exception&) - { return sal_False; } // TODO error handling - - // try to open the file in read/write mode - // (if its allowed to do so). - // But handle errors in a "hidden mode". Because - // we try it readonly later - if read/write isnt an option. - css::uno::Reference< css::io::XStream > xStream ; - css::uno::Reference< css::io::XInputStream > xInputStream; - - sal_Bool bReadOnly = sal_False; - sal_Bool bModeRequestedExplicitly = sal_False; - const_iterator pIt = find(MediaDescriptor::PROP_READONLY()); - if (pIt != end()) - { - pIt->second >>= bReadOnly; - bModeRequestedExplicitly = sal_True; - } - - if ( !bReadOnly && bLockFile ) - { - try - { - // TODO: use "special" still interaction to supress error messages - xStream = aContent.openWriteableStream(); - if (xStream.is()) - xInputStream = xStream->getInputStream(); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { - // ignore exception, if reason was problem reasoned on - // open it in WRITEABLE mode! Then we try it READONLY - // later a second time. - // All other errors must be handled as real error an - // break this method. - if (!pInteraction->wasWriteError() || bModeRequestedExplicitly) - return sal_False; - xStream.clear(); - xInputStream.clear(); - } - } - - // If opening of the stream in read/write mode wasnt allowed - // or failed by an error - we must try it in readonly mode. - if (!xInputStream.is()) - { - rtl::OUString aScheme; - - try - { - css::uno::Reference< css::ucb::XContentIdentifier > xContId( - aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); - - if ( xContId.is() ) - aScheme = xContId->getContentProviderScheme(); - - // Only file system content provider is able to provide XStream - // so for this content impossibility to create XStream triggers - // switch to readonly mode in case of opening with locking on - if( bLockFile && aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) - bReadOnly = sal_True; - else - { - sal_Bool bRequestReadOnly = bReadOnly; - aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bReadOnly; - if ( bReadOnly && !bRequestReadOnly && bModeRequestedExplicitly ) - return sal_False; // the document is explicitly requested with WRITEABLE mode - } - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { /* no error handling if IsReadOnly property does not exist for UCP */ } - - if ( bReadOnly ) - (*this)[MediaDescriptor::PROP_READONLY()] <<= bReadOnly; - - pInteraction->resetInterceptions(); - pInteraction->resetErrorStates(); - try - { - // all the contents except file-URLs should be opened as usual - if ( bLockFile || !aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) - xInputStream = aContent.openStream(); - else - xInputStream = aContent.openStreamNoLock(); - } - catch(const css::uno::RuntimeException&) - { throw; } - catch(const css::uno::Exception&) - { return sal_False; } - } - - // add streams to the descriptor - if (xContent.is()) - (*this)[MediaDescriptor::PROP_UCBCONTENT()] <<= xContent; - if (xStream.is()) - (*this)[MediaDescriptor::PROP_STREAM()] <<= xStream; - if (xInputStream.is()) - (*this)[MediaDescriptor::PROP_INPUTSTREAM()] <<= xInputStream; - - // At least we need an input stream. The r/w stream is optional ... - return xInputStream.is(); -} - -/*----------------------------------------------- - 10.09.2004 10:51 ------------------------------------------------*/ -::rtl::OUString MediaDescriptor::impl_normalizeURL(const ::rtl::OUString& sURL) -{ - /* Remove Jumpmarks (fragments) of an URL only here. - They are not part of any URL and as a result may be - no ucb content can be created then. - On the other side arguments must exists ... because - they are part of an URL. - - Do not use the URLTransformer service here. Because - it parses the URL in another way. It's main part isnt enough - and it's complete part contains the jumpmark (fragment) parameter ... - */ - static ::rtl::OUString SERVICENAME_URIREFERENCEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.uri.UriReferenceFactory"); - - try - { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::uri::XUriReferenceFactory > xUriFactory(xSMGR->createInstance(SERVICENAME_URIREFERENCEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::uri::XUriReference > xUriRef = xUriFactory->parse(sURL); - if (xUriRef.is()) - { - xUriRef->clearFragment(); - return xUriRef->getUriReference(); - } - } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - {} - - // If an error ocurred ... return the original URL. - // It's a try .-) - return sURL; -} - -} // namespace comphelper - +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied 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_comphelper.hxx" +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +//_______________________________________________ +// namespace + +namespace comphelper{ + +namespace css = ::com::sun::star; + +//_______________________________________________ +// definitions + +/*----------------------------------------------- + 10.03.2004 07:35 +-----------------------------------------------*/ +const ::rtl::OUString& MediaDescriptor::PROP_ABORTED() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Aborted")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_ASTEMPLATE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_CHARACTERSET() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("CharacterSet")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_COMPONENTDATA() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ComponentData")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_DEEPDETECTION() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DeepDetection")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_DETECTSERVICE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DetectService")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTSERVICE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentService")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_EXTENSION() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Extension")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FILENAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FileName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FILTERNAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FilterName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FILTEROPTIONS() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FilterOptions")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FORMAT() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Format")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FRAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_HIDDEN() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Hidden")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_INPUTSTREAM() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("InputStream")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_INTERACTIONHANDLER() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_JUMPMARK() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("JumpMark")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_MACROEXECUTIONMODE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("MacroExecutionMode")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_MEDIATYPE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("MediaType")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_MINIMIZED() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Minimized")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_NOAUTOSAVE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("NoAutoSave")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_OPENNEWVIEW() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("OpenNewView")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_OUTPUTSTREAM() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("OutputStream")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_PATTERN() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Pattern")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_POSSIZE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PosSize")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_POSTDATA() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PostData")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_POSTSTRING() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("PostString")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_PREVIEW() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Preview")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_READONLY() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_REFERRER() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Referer")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_SILENT() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Silent")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_STATUSINDICATOR() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_STREAM() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Stream")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_STREAMFOROUTPUT() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("StreamForOutput")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_TEMPLATENAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TemplateName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_TEMPLATEREGIONNAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TemplateRegionName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_TYPENAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TypeName")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_UCBCONTENT() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("UCBContent")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_UPDATEDOCMODE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("UpdateDocMode")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_URL() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("URL")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_VERSION() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Version")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_VIEWID() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewId")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_REPAIRPACKAGE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTTITLE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_MODEL() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Model")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_PASSWORD() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Password")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_TITLE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Title")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_SALVAGEDFILE() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("SalvagedFile")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_VIEWONLY() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewOnly")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTBASEURL() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("DocumentBaseURL")); + return sProp; +} + +const ::rtl::OUString& MediaDescriptor::PROP_VIEWCONTROLLERNAME() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("ViewControllerName")); + return sProp; +} +/*----------------------------------------------- + 10.03.2004 08:09 +-----------------------------------------------*/ +MediaDescriptor::MediaDescriptor() + : SequenceAsHashMap() +{ +} + +/*----------------------------------------------- + 10.03.2004 08:09 +-----------------------------------------------*/ +MediaDescriptor::MediaDescriptor(const css::uno::Any& aSource) + : SequenceAsHashMap(aSource) +{ +} + +/*----------------------------------------------- + 10.03.2004 08:09 +-----------------------------------------------*/ +MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue >& lSource) + : SequenceAsHashMap(lSource) +{ +} + +/*----------------------------------------------- + 10.03.2004 08:09 +-----------------------------------------------*/ +MediaDescriptor::MediaDescriptor(const css::uno::Sequence< css::beans::NamedValue >& lSource) + : SequenceAsHashMap(lSource) +{ +} + +/*----------------------------------------------- + 18.11.2004 13:37 +-----------------------------------------------*/ +sal_Bool MediaDescriptor::isStreamReadOnly() const +{ + static ::rtl::OUString CONTENTSCHEME_FILE = ::rtl::OUString::createFromAscii("file"); + static ::rtl::OUString CONTENTPROP_ISREADONLY = ::rtl::OUString::createFromAscii("IsReadOnly"); + static sal_Bool READONLY_FALLBACK = sal_False; + + sal_Bool bReadOnly = READONLY_FALLBACK; + + // check for explicit readonly state + const_iterator pIt = find(MediaDescriptor::PROP_READONLY()); + if (pIt != end()) + { + pIt->second >>= bReadOnly; + return bReadOnly; + } + + // streams based on post data are readonly by definition + pIt = find(MediaDescriptor::PROP_POSTDATA()); + if (pIt != end()) + return sal_True; + + // A XStream capsulate XInputStream and XOutputStream ... + // If it exists - the file must be open in read/write mode! + pIt = find(MediaDescriptor::PROP_STREAM()); + if (pIt != end()) + return sal_False; + + // Only file system content provider is able to provide XStream + // so for this content impossibility to create XStream triggers + // switch to readonly mode. + try + { + css::uno::Reference< css::ucb::XContent > xContent = getUnpackedValueOrDefault(MediaDescriptor::PROP_UCBCONTENT(), css::uno::Reference< css::ucb::XContent >()); + if (xContent.is()) + { + css::uno::Reference< css::ucb::XContentIdentifier > xId(xContent->getIdentifier(), css::uno::UNO_QUERY); + ::rtl::OUString aScheme; + if (xId.is()) + aScheme = xId->getContentProviderScheme(); + + if (aScheme.equalsIgnoreAsciiCase(CONTENTSCHEME_FILE)) + bReadOnly = sal_True; + else + { + ::ucbhelper::Content aContent(xContent, css::uno::Reference< css::ucb::XCommandEnvironment >()); + aContent.getPropertyValue(CONTENTPROP_ISREADONLY) >>= bReadOnly; + } + } + } + catch(const css::uno::RuntimeException& exRun) + { throw exRun; } + catch(const css::uno::Exception&) + {} + + return bReadOnly; +} + +// ---------------------------------------------------------------------------- + +css::uno::Any MediaDescriptor::getComponentDataEntry( const ::rtl::OUString& rName ) const +{ + SequenceAsHashMap aCompDataMap( getUnpackedValueOrDefault( PROP_COMPONENTDATA(), ComponentDataSequence() ) ); + SequenceAsHashMap::iterator aIt = aCompDataMap.find( rName ); + return (aIt == aCompDataMap.end()) ? css::uno::Any() : aIt->second; +} + +void MediaDescriptor::setComponentDataEntry( const ::rtl::OUString& rName, const css::uno::Any& rValue ) +{ + if( rValue.hasValue() ) + { + // get or craete the 'ComponentData' property entry + css::uno::Any& rCompDataAny = operator[]( PROP_COMPONENTDATA() ); + // check type, insert the value + OSL_ENSURE( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >(), + "MediaDescriptor::setComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); + if( !rCompDataAny.hasValue() || rCompDataAny.has< ComponentDataSequence >() ) + { + // insert or overwrite the passed value + SequenceAsHashMap aCompDataMap( rCompDataAny ); + aCompDataMap[ rName ] = rValue; + // write back the sequence (sal_False = use NamedValue instead of PropertyValue) + rCompDataAny = aCompDataMap.getAsConstAny( sal_False ); + } + } + else + { + // if an empty Any is passed, clear the entry + clearComponentDataEntry( rName ); + } +} + +void MediaDescriptor::clearComponentDataEntry( const ::rtl::OUString& rName ) +{ + SequenceAsHashMap::iterator aPropertyIter = find( PROP_COMPONENTDATA() ); + if( aPropertyIter != end() ) + { + OSL_ENSURE( aPropertyIter->second.has< ComponentDataSequence >(), + "MediaDescriptor::clearComponentDataEntry - incompatible 'ComponentData' property in media descriptor" ); + if( aPropertyIter->second.has< ComponentDataSequence >() ) + { + // remove the value with the passed name + SequenceAsHashMap aCompDataMap( aPropertyIter->second ); + aCompDataMap.erase( rName ); + // write back the sequence, or remove it completely if it is empty + if( aCompDataMap.empty() ) + erase( aPropertyIter ); + else + aPropertyIter->second = aCompDataMap.getAsConstAny( sal_False ); + } + } +} + +/*----------------------------------------------- + 10.03.2004 09:02 +-----------------------------------------------*/ +sal_Bool MediaDescriptor::addInputStream() +{ + return impl_addInputStream( sal_True ); +} + +/*-----------------------------------------------*/ +sal_Bool MediaDescriptor::addInputStreamOwnLock() +{ + // Own lock file implementation + + sal_Bool bUseLock = sal_True; // the system file locking is used per default + try + { + + css::uno::Reference< css::uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( + ::comphelper::getProcessServiceFactory(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), + ::comphelper::ConfigurationHelper::E_STANDARD ); + if ( !xCommonConfig.is() ) + throw css::uno::RuntimeException(); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCommonConfig, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseLock; + } + catch( const css::uno::Exception& ) + { + } + + return impl_addInputStream( bUseLock ); +} + +/*-----------------------------------------------*/ +sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) +{ + // check for an already existing stream item first + const_iterator pIt = find(MediaDescriptor::PROP_INPUTSTREAM()); + if (pIt != end()) + return sal_True; + + try + { + // No stream available - create a new one + // a) data comes as PostData ... + pIt = find(MediaDescriptor::PROP_POSTDATA()); + if (pIt != end()) + { + const css::uno::Any& rPostData = pIt->second; + css::uno::Reference< css::io::XInputStream > xPostData; + rPostData >>= xPostData; + + return impl_openStreamWithPostData( xPostData ); + } + + // b) ... or we must get it from the given URL + ::rtl::OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString()); + if (!sURL.getLength()) + throw css::uno::Exception( + ::rtl::OUString::createFromAscii("Found no URL."), + css::uno::Reference< css::uno::XInterface >()); + + // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble + ::rtl::OUString sNormalizedURL = impl_normalizeURL( sURL ); + return impl_openStreamWithURL( sNormalizedURL, bLockFile ); + } +#if OSL_DEBUG_LEVEL>0 + catch(const css::uno::Exception& ex) + { + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Invalid MediaDescriptor detected:\n"); + sMsg.append (ex.Message ); + OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); + } +#else + catch(const css::uno::Exception&) + {} +#endif + + return sal_False; +} + +/*----------------------------------------------- + 25.03.2004 12:38 +-----------------------------------------------*/ +sal_Bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference< css::io::XInputStream >& _rxPostData ) + throw(::com::sun::star::uno::RuntimeException) +{ + if ( !_rxPostData.is() ) + throw css::lang::IllegalArgumentException( + ::rtl::OUString::createFromAscii("Found invalid PostData."), + css::uno::Reference< css::uno::XInterface >(), 1); + + // PostData can't be used in read/write mode! + (*this)[MediaDescriptor::PROP_READONLY()] <<= sal_True; + + // prepare the environment + css::uno::Reference< css::task::XInteractionHandler > xInteraction = getUnpackedValueOrDefault( + MediaDescriptor::PROP_INTERACTIONHANDLER(), + css::uno::Reference< css::task::XInteractionHandler >()); + css::uno::Reference< css::ucb::XProgressHandler > xProgress; + ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); + css::uno::Reference< css::ucb::XCommandEnvironment > xCommandEnv(static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), css::uno::UNO_QUERY); + + // media type + ::rtl::OUString sMediaType = getUnpackedValueOrDefault(MediaDescriptor::PROP_MEDIATYPE(), ::rtl::OUString()); + if (!sMediaType.getLength()) + { + sMediaType = ::rtl::OUString::createFromAscii("application/x-www-form-urlencoded"); + (*this)[MediaDescriptor::PROP_MEDIATYPE()] <<= sMediaType; + } + + // url + ::rtl::OUString sURL( getUnpackedValueOrDefault( PROP_URL(), ::rtl::OUString() ) ); + + css::uno::Reference< css::io::XInputStream > xResultStream; + try + { + // seek PostData stream to the beginning + css::uno::Reference< css::io::XSeekable > xSeek( _rxPostData, css::uno::UNO_QUERY ); + if ( xSeek.is() ) + xSeek->seek( 0 ); + + // a content for the URL + ::ucbhelper::Content aContent( sURL, xCommandEnv ); + + // use post command + css::ucb::PostCommandArgument2 aPostArgument; + aPostArgument.Source = _rxPostData; + css::uno::Reference< css::io::XActiveDataSink > xSink( new ucbhelper::ActiveDataSink ); + aPostArgument.Sink = xSink; + aPostArgument.MediaType = sMediaType; + aPostArgument.Referer = getUnpackedValueOrDefault( PROP_REFERRER(), ::rtl::OUString() ); + + ::rtl::OUString sCommandName( RTL_CONSTASCII_USTRINGPARAM( "post" ) ); + aContent.executeCommand( sCommandName, css::uno::makeAny( aPostArgument ) ); + + // get result + xResultStream = xSink->getInputStream(); + } + catch( const css::uno::Exception& ) + { + } + + // success? + if ( !xResultStream.is() ) + { + OSL_ENSURE( false, "no valid reply to the HTTP-Post" ); + return sal_False; + } + + (*this)[MediaDescriptor::PROP_INPUTSTREAM()] <<= xResultStream; + return sal_True; +} + +/*-----------------------------------------------*/ + +/*----------------------------------------------- + 25.03.2004 12:29 +-----------------------------------------------*/ +sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, sal_Bool bLockFile ) + throw(::com::sun::star::uno::RuntimeException) +{ + // prepare the environment + css::uno::Reference< css::task::XInteractionHandler > xOrgInteraction = getUnpackedValueOrDefault( + MediaDescriptor::PROP_INTERACTIONHANDLER(), + css::uno::Reference< css::task::XInteractionHandler >()); + + StillReadWriteInteraction* pInteraction = new StillReadWriteInteraction(xOrgInteraction); + css::uno::Reference< css::task::XInteractionHandler > xInteraction(static_cast< css::task::XInteractionHandler* >(pInteraction), css::uno::UNO_QUERY); + + css::uno::Reference< css::ucb::XProgressHandler > xProgress; + ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment(xInteraction, xProgress); + css::uno::Reference< css::ucb::XCommandEnvironment > xCommandEnv(static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), css::uno::UNO_QUERY); + + // try to create the content + // no content -> no stream => return immediatly with FALSE + ::ucbhelper::Content aContent; + css::uno::Reference< css::ucb::XContent > xContent; + try + { + aContent = ::ucbhelper::Content(sURL, xCommandEnv); + xContent = aContent.get(); + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::ucb::ContentCreationException&) + { return sal_False; } // TODO error handling + catch(const css::uno::Exception&) + { return sal_False; } // TODO error handling + + // try to open the file in read/write mode + // (if its allowed to do so). + // But handle errors in a "hidden mode". Because + // we try it readonly later - if read/write isnt an option. + css::uno::Reference< css::io::XStream > xStream ; + css::uno::Reference< css::io::XInputStream > xInputStream; + + sal_Bool bReadOnly = sal_False; + sal_Bool bModeRequestedExplicitly = sal_False; + const_iterator pIt = find(MediaDescriptor::PROP_READONLY()); + if (pIt != end()) + { + pIt->second >>= bReadOnly; + bModeRequestedExplicitly = sal_True; + } + + if ( !bReadOnly && bLockFile ) + { + try + { + // TODO: use "special" still interaction to supress error messages + xStream = aContent.openWriteableStream(); + if (xStream.is()) + xInputStream = xStream->getInputStream(); + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { + // ignore exception, if reason was problem reasoned on + // open it in WRITEABLE mode! Then we try it READONLY + // later a second time. + // All other errors must be handled as real error an + // break this method. + if (!pInteraction->wasWriteError() || bModeRequestedExplicitly) + return sal_False; + xStream.clear(); + xInputStream.clear(); + } + } + + // If opening of the stream in read/write mode wasnt allowed + // or failed by an error - we must try it in readonly mode. + if (!xInputStream.is()) + { + rtl::OUString aScheme; + + try + { + css::uno::Reference< css::ucb::XContentIdentifier > xContId( + aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); + + if ( xContId.is() ) + aScheme = xContId->getContentProviderScheme(); + + // Only file system content provider is able to provide XStream + // so for this content impossibility to create XStream triggers + // switch to readonly mode in case of opening with locking on + if( bLockFile && aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) + bReadOnly = sal_True; + else + { + sal_Bool bRequestReadOnly = bReadOnly; + aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bReadOnly; + if ( bReadOnly && !bRequestReadOnly && bModeRequestedExplicitly ) + return sal_False; // the document is explicitly requested with WRITEABLE mode + } + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { /* no error handling if IsReadOnly property does not exist for UCP */ } + + if ( bReadOnly ) + (*this)[MediaDescriptor::PROP_READONLY()] <<= bReadOnly; + + pInteraction->resetInterceptions(); + pInteraction->resetErrorStates(); + try + { + // all the contents except file-URLs should be opened as usual + if ( bLockFile || !aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) + xInputStream = aContent.openStream(); + else + xInputStream = aContent.openStreamNoLock(); + } + catch(const css::uno::RuntimeException&) + { throw; } + catch(const css::uno::Exception&) + { return sal_False; } + } + + // add streams to the descriptor + if (xContent.is()) + (*this)[MediaDescriptor::PROP_UCBCONTENT()] <<= xContent; + if (xStream.is()) + (*this)[MediaDescriptor::PROP_STREAM()] <<= xStream; + if (xInputStream.is()) + (*this)[MediaDescriptor::PROP_INPUTSTREAM()] <<= xInputStream; + + // At least we need an input stream. The r/w stream is optional ... + return xInputStream.is(); +} + +/*----------------------------------------------- + 10.09.2004 10:51 +-----------------------------------------------*/ +::rtl::OUString MediaDescriptor::impl_normalizeURL(const ::rtl::OUString& sURL) +{ + /* Remove Jumpmarks (fragments) of an URL only here. + They are not part of any URL and as a result may be + no ucb content can be created then. + On the other side arguments must exists ... because + they are part of an URL. + + Do not use the URLTransformer service here. Because + it parses the URL in another way. It's main part isnt enough + and it's complete part contains the jumpmark (fragment) parameter ... + */ + static ::rtl::OUString SERVICENAME_URIREFERENCEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.uri.UriReferenceFactory"); + + try + { + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::uri::XUriReferenceFactory > xUriFactory(xSMGR->createInstance(SERVICENAME_URIREFERENCEFACTORY), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uri::XUriReference > xUriRef = xUriFactory->parse(sURL); + if (xUriRef.is()) + { + xUriRef->clearFragment(); + return xUriRef->getUriReference(); + } + } + catch(const css::uno::RuntimeException& exRun) + { throw exRun; } + catch(const css::uno::Exception&) + {} + + // If an error ocurred ... return the original URL. + // It's a try .-) + return sURL; +} + +} // namespace comphelper + -- cgit From 8412bc28b62534dd39eaa33b837c910d4cae08bf Mon Sep 17 00:00:00 2001 From: tono Date: Fri, 18 Jun 2010 22:43:04 +0900 Subject: Backed out changeset: d80a58fd55d9 --- i18npool/source/localedata/data/makefile.mk | 6 +++--- svtools/util/makefile.mk | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index c268b5137a62..37f38b9f6e2d 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -285,7 +285,7 @@ SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME=$(SHL2TARGET) SHL2STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) .ELSE SHL2DEPN=$(SHL1IMPLIBN) @@ -327,7 +327,7 @@ SHL3DEF=$(MISC)$/$(SHL3TARGET).def DEF3NAME=$(SHL3TARGET) SHL3STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL3DEPN=$(SHL1TARGETN) $(SHL2TARGETN) .ELSE SHL3DEPN=$(SHL1IMPLIBN) $(SHL2IMPLIBN) @@ -418,7 +418,7 @@ SHL4DEF=$(MISC)$/$(SHL4TARGET).def DEF4NAME=$(SHL4TARGET) SHL4STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL4DEPN=$(SHL1TARGETN) .ELSE SHL4DEPN=$(SHL1IMPLIBN) diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 85a252ea516b..9239b36cc6dc 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -153,7 +153,7 @@ DEF1DES =SvTools APP2TARGET = g2g APP2BASE = 0x10000000 -.IF "$(GUI)"=="UNX" || ("$(COM)"=="GCC" && "$(GUI)"=="WNT") +.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) .ELSE APP2DEPN = $(SHL1IMPLIBN) $(SHL2IMPLIBN) -- cgit From 8f6c75651a820fae86fc1e9976bfc67722579d2d Mon Sep 17 00:00:00 2001 From: tono Date: Fri, 18 Jun 2010 22:49:15 +0900 Subject: Backed out changeset: f63af3433bcb --- i18npool/source/localedata/data/makefile.mk | 12 ------------ svtools/util/makefile.mk | 4 ---- 2 files changed, 16 deletions(-) diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 37f38b9f6e2d..2591b70fb63d 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -285,11 +285,7 @@ SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME=$(SHL2TARGET) SHL2STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL2DEPN=$(SHL1TARGETN) -.ELSE -SHL2DEPN=$(SHL1IMPLIBN) -.ENDIF SHL2OBJS= \ $(SLO)$/localedata_es_AR.obj \ $(SLO)$/localedata_es_BO.obj \ @@ -327,11 +323,7 @@ SHL3DEF=$(MISC)$/$(SHL3TARGET).def DEF3NAME=$(SHL3TARGET) SHL3STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL3DEPN=$(SHL1TARGETN) $(SHL2TARGETN) -.ELSE -SHL3DEPN=$(SHL1IMPLIBN) $(SHL2IMPLIBN) -.ENDIF SHL3OBJS= \ $(SLO)$/localedata_ast_ES.obj \ $(SLO)$/localedata_be_BY.obj \ @@ -418,11 +410,7 @@ SHL4DEF=$(MISC)$/$(SHL4TARGET).def DEF4NAME=$(SHL4TARGET) SHL4STDLIBS= $(LINK_LOCALEDATA_EN_LIB) -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" SHL4DEPN=$(SHL1TARGETN) -.ELSE -SHL4DEPN=$(SHL1IMPLIBN) -.ENDIF SHL4OBJS= \ $(SLO)$/localedata_af_NA.obj \ $(SLO)$/localedata_af_ZA.obj \ diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 9239b36cc6dc..ab05facdb065 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -153,11 +153,7 @@ DEF1DES =SvTools APP2TARGET = g2g APP2BASE = 0x10000000 -.IF ("$(GUI)"=="UNX" || "$(COM)"=="GCC") && "$(GUI)"!="OS2" APP2DEPN = $(SHL1TARGETN) $(SHL2TARGETN) -.ELSE -APP2DEPN = $(SHL1IMPLIBN) $(SHL2IMPLIBN) -.ENDIF APP2OBJS = $(OBJ)$/g2g.obj -- cgit From 784db557e79325df96134c4b9bf997cc70092dd6 Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 23 Jun 2010 15:07:29 +0200 Subject: masterfix: #i112573# [vcl] fonconfig.cxx fails to build with debug=t --- vcl/unx/source/fontmanager/fontconfig.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 816c8fb0b4c4..3e24cd7c8e45 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -851,7 +851,7 @@ bool PrintFontManager::addFontconfigDir( const rtl::OString& rDirName ) bool bDirOk = (rWrapper.FcConfigAppFontAddDir( rWrapper.FcConfigGetCurrent(), (FcChar8*)pDirName ) == FcTrue); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bRet ); + fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk ); #endif if( bDirOk ) -- cgit From 499aa97a8da9870976b791d64f26ad42ad4a9943 Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 23 Jun 2010 15:10:17 +0200 Subject: masterfix: #i112512# [l10ntools] transex3 crashes if /tmp not defined --- l10ntools/source/export2.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 8a384b415b6f..fc8f823b7deb 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -703,11 +703,6 @@ void Export::getRandomName( ByteString& sRandStr ) DirEntry Export::GetTempFile() /*****************************************************************************/ { -#if defined(WNT) || defined(OS2) - String sTempDir( Export::GetEnv( "TEMP" ), RTL_TEXTENCODING_ASCII_US ); -#else - String sTempDir( String::CreateFromAscii( "/tmp" )); -#endif rtl::OUString* sTempFilename = new rtl::OUString(); // Create a temp file -- cgit From eaa2d3539a80b3834124d865ae0cc7669e369cdd Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 24 Jun 2010 08:21:51 +0200 Subject: mastefix: #i10000# Merge problem BASEPROPERTY_BACKGROUNDCOLOR --- svtools/source/uno/svtxgridcontrol.cxx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 480987d50fac..f5bc837f60b0 100755 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -234,18 +234,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An } break; } - case BASEPROPERTY_BACKGROUNDCOLOR: - { - sal_Int32 color = 0xFFFFFF; - Color color1 = pTable->GetSettings().GetStyleSettings().GetFieldColor(); - if( aValue >>= color ) - { - color1 = color; - pTable->getDataWindow()->SetBackground( color1 ); - pTable->getDataWindow()->SetControlBackground( color1 ); - } - break; - } case BASEPROPERTY_VERTICALALIGN: { com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0)); -- cgit From 8a629e8660951674a7c0bba36f507819359583a4 Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 25 Jun 2010 09:18:05 +0200 Subject: masterfix: #i10000#,#i112674# prevent restarting on Mac --- comphelper/source/misc/officerestartmanager.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index 1a98ddfce8da..974b8d65e7ae 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -87,9 +87,9 @@ void SAL_CALL OOfficeRestartManager::requestRestart( const uno::Reference< task: // if the restart already running there is no need to trigger it again if ( m_bRestartRequested ) return; - +#ifndef MACOSX m_bRestartRequested = sal_True; - +#endif // the office is still not initialized, no need to terminate, changing the state is enough if ( !m_bOfficeInitialized ) return; -- cgit From be588658ea127a6a05390435126f1d739a477b58 Mon Sep 17 00:00:00 2001 From: obo Date: Mon, 28 Jun 2010 09:31:38 +0200 Subject: masterfix: #i10000# build breaks in shell,crashrep --- i18npool/source/isolang/isolang.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 7088acf57682..357be80a69ea 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -287,9 +287,9 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_BELARUSIAN, "be", "BY" }, { LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default) { LANGUAGE_CATALAN, "ca", "AD" }, // Andorra - { LANGUAGE_CATALAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content! + { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content! { LANGUAGE_CATALAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; UI localization quirk only, do not use in document content! - { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "ES" }, // In case MS format files escaped into the wild, map them back. +// { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "ES" }, // In case MS format files escaped into the wild, map them back. { LANGUAGE_FRENCH_CAMEROON, "fr", "CM" }, { LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" }, { LANGUAGE_FRENCH_HAITI, "fr", "HT" }, -- cgit