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 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 c5d786f792f00741cc19e09232271edbbff58664 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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