summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-20 10:24:14 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-20 10:24:14 +0000
commit8d7ea5352457d197f4a19346e648c7316f801c64 (patch)
tree79e965bfa997ad2bf6b748939ba4f7ee1600e295
parentc9d75d148062f24fa7bf52a5f09ec4a21aa6a09c (diff)
#i99305#,#i99132# remove DOS lineends, remove solenv/unxmacxp/inc/poll.h
-rw-r--r--connectivity/source/commontools/ParamterSubstitution.cxx232
-rw-r--r--desktop/os2/source/applauncher/launcher.cxx236
-rw-r--r--formula/inc/AddressConvention.hxx84
-rw-r--r--formula/inc/helpids.hrc130
-rw-r--r--formula/prj/d.lst74
-rw-r--r--formula/source/core/api/FormulaOpCodeMapperObj.cxx258
-rw-r--r--formula/source/core/inc/core_resource.hrc96
-rw-r--r--formula/source/core/inc/core_resource.hxx228
-rw-r--r--formula/source/core/resource/core_resource.cxx222
-rw-r--r--formula/source/ui/dlg/parawin.cxx1206
-rw-r--r--formula/source/ui/inc/ForResId.hrc154
-rw-r--r--formula/util/hidother.src114
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx3328
-rw-r--r--framework/source/uifactory/windowcontentfactorymanager.cxx1100
-rw-r--r--sfx2/inc/sfx2/dockwin.hxx290
-rwxr-xr-xxmlhelp/source/com/sun/star/help/HelpComponent.java276
-rw-r--r--xmlhelp/source/com/sun/star/help/HelpSearch.java702
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx214
-rw-r--r--xmlhelp/source/cxxhelp/inc/qe/Query.hxx356
-rw-r--r--xmlhelp/source/cxxhelp/qe/DocGenerator.cxx128
20 files changed, 4714 insertions, 4714 deletions
diff --git a/connectivity/source/commontools/ParamterSubstitution.cxx b/connectivity/source/commontools/ParamterSubstitution.cxx
index 7289cd7ec725..f3823a4f211f 100644
--- a/connectivity/source/commontools/ParamterSubstitution.cxx
+++ b/connectivity/source/commontools/ParamterSubstitution.cxx
@@ -1,61 +1,61 @@
-/*************************************************************************
- *
- * 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: FDatabaseMetaDataResultSet.cxx,v $
- * $Revision: 1.24 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include "precompiled_connectivity.hxx"
-#include "ParameterSubstitution.hxx"
-#include "connectivity/sqlparse.hxx"
-#include <comphelper/sequenceashashmap.hxx>
-
-namespace connectivity
-{
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star;
-
- ParameterSubstitution::ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) : m_xContext(_rxContext)
- {
- }
- void SAL_CALL ParameterSubstitution::initialize( const uno::Sequence< uno::Any >& _aArguments ) throw (uno::Exception, uno::RuntimeException)
- {
- ::osl::MutexGuard aGuard(m_aMutex);
- comphelper::SequenceAsHashMap aArgs(_aArguments);
- uno::Reference< sdbc::XConnection > xConnection;
- xConnection = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),xConnection);
- m_xConnection = xConnection;
- }
- //------------------------------------------------------------------------------
- rtl::OUString ParameterSubstitution::getImplementationName_Static( ) throw(RuntimeException)
- {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.ParameterSubstitution"));
- }
- //------------------------------------------------------------------------------
+/*************************************************************************
+ *
+ * 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: FDatabaseMetaDataResultSet.cxx,v $
+ * $Revision: 1.24 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_connectivity.hxx"
+#include "ParameterSubstitution.hxx"
+#include "connectivity/sqlparse.hxx"
+#include <comphelper/sequenceashashmap.hxx>
+
+namespace connectivity
+{
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::sdbc;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ ParameterSubstitution::ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) : m_xContext(_rxContext)
+ {
+ }
+ void SAL_CALL ParameterSubstitution::initialize( const uno::Sequence< uno::Any >& _aArguments ) throw (uno::Exception, uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ comphelper::SequenceAsHashMap aArgs(_aArguments);
+ uno::Reference< sdbc::XConnection > xConnection;
+ xConnection = aArgs.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),xConnection);
+ m_xConnection = xConnection;
+ }
+ //------------------------------------------------------------------------------
+ rtl::OUString ParameterSubstitution::getImplementationName_Static( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.helper.ParameterSubstitution"));
+ }
+ //------------------------------------------------------------------------------
::rtl::OUString SAL_CALL ParameterSubstitution::getImplementationName( ) throw(RuntimeException)
{
return getImplementationName_Static();
@@ -75,61 +75,61 @@ namespace connectivity
Sequence< ::rtl::OUString > SAL_CALL ParameterSubstitution::getSupportedServiceNames( ) throw(RuntimeException)
{
return getSupportedServiceNames_Static();
- }
- //------------------------------------------------------------------
- Sequence< ::rtl::OUString > ParameterSubstitution::getSupportedServiceNames_Static( ) throw (RuntimeException)
- {
- Sequence< ::rtl::OUString > aSNS( 1 );
- aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.ParameterSubstitution");
- return aSNS;
- }
-
- //------------------------------------------------------------------
- Reference< XInterface > ParameterSubstitution::create(const Reference< XComponentContext >& _xContext)
- {
- return *(new ParameterSubstitution(_xContext));
- }
- //------------------------------------------------------------------
- ::rtl::OUString SAL_CALL ParameterSubstitution::substituteVariables( const ::rtl::OUString& _sText, ::sal_Bool /*bSubstRequired*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
- {
- ::rtl::OUString sRet = _sText;
- uno::Reference< sdbc::XConnection > xConnection = m_xConnection;
- if ( xConnection.is() )
- {
- try
- {
- uno::Reference< XMultiServiceFactory> xFac(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW);
- OSQLParser aParser( xFac );
- ::rtl::OUString sErrorMessage;
- ::rtl::OUString sNewSql;
- OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sText);
- if(pNode)
- { // special handling for parameters
- OSQLParseNode::substituteParameterNames(pNode);
- pNode->parseNodeToStr( sNewSql, xConnection );
- delete pNode;
- sRet = sNewSql;
- }
- }
- catch(const Exception&)
- {
- }
- }
- return sRet;
- }
- //------------------------------------------------------------------
- ::rtl::OUString SAL_CALL ParameterSubstitution::reSubstituteVariables( const ::rtl::OUString& _sText ) throw (::com::sun::star::uno::RuntimeException)
- {
- return _sText;
- }
- //------------------------------------------------------------------
- ::rtl::OUString SAL_CALL ParameterSubstitution::getSubstituteVariableValue( const ::rtl::OUString& /*variable*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
- {
- throw container::NoSuchElementException();
- }
- //------------------------------------------------------------------
-
-
-// ==================================
-} // connectivity
-// ==================================
+ }
+ //------------------------------------------------------------------
+ Sequence< ::rtl::OUString > ParameterSubstitution::getSupportedServiceNames_Static( ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.ParameterSubstitution");
+ return aSNS;
+ }
+
+ //------------------------------------------------------------------
+ Reference< XInterface > ParameterSubstitution::create(const Reference< XComponentContext >& _xContext)
+ {
+ return *(new ParameterSubstitution(_xContext));
+ }
+ //------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ParameterSubstitution::substituteVariables( const ::rtl::OUString& _sText, ::sal_Bool /*bSubstRequired*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
+ {
+ ::rtl::OUString sRet = _sText;
+ uno::Reference< sdbc::XConnection > xConnection = m_xConnection;
+ if ( xConnection.is() )
+ {
+ try
+ {
+ uno::Reference< XMultiServiceFactory> xFac(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW);
+ OSQLParser aParser( xFac );
+ ::rtl::OUString sErrorMessage;
+ ::rtl::OUString sNewSql;
+ OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sText);
+ if(pNode)
+ { // special handling for parameters
+ OSQLParseNode::substituteParameterNames(pNode);
+ pNode->parseNodeToStr( sNewSql, xConnection );
+ delete pNode;
+ sRet = sNewSql;
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+ return sRet;
+ }
+ //------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ParameterSubstitution::reSubstituteVariables( const ::rtl::OUString& _sText ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return _sText;
+ }
+ //------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL ParameterSubstitution::getSubstituteVariableValue( const ::rtl::OUString& /*variable*/ ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
+ {
+ throw container::NoSuchElementException();
+ }
+ //------------------------------------------------------------------
+
+
+// ==================================
+} // connectivity
+// ==================================
diff --git a/desktop/os2/source/applauncher/launcher.cxx b/desktop/os2/source/applauncher/launcher.cxx
index 24bb85aa5457..3caaaf75cd71 100644
--- a/desktop/os2/source/applauncher/launcher.cxx
+++ b/desktop/os2/source/applauncher/launcher.cxx
@@ -1,118 +1,118 @@
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "launcher.hxx"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <malloc.h>
-#include <process.h>
-
-int main( int argc, char* argv[])
-{
- PPIB pib;
- APIRET rc;
- RESULTCODES result = {0};
- char szFail[ _MAX_PATH];
-
- HAB hab = WinInitialize( 0);
- HMQ hmq = WinCreateMsgQueue( hab, 0);
- ERRORID erridErrorCode = 0;
- erridErrorCode = WinGetLastError(hab);
-
- // Calculate application name
- CHAR szLibpath[_MAX_PATH*2];
- CHAR szApplicationName[_MAX_PATH];
- CHAR szDrive[_MAX_PATH];
- CHAR szDir[_MAX_PATH];
- CHAR szFileName[_MAX_PATH];
- CHAR szExt[_MAX_PATH];
-
- // get executable fullpath
- DosGetInfoBlocks(NULL, &pib);
- DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName);
-
- // adjust libpath
- _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
- char* basedir = strstr( szDir, "\\PROGRAM\\");
- if (basedir) *basedir = 0;
- sprintf( szLibpath, "%s%s\\URE\\BIN;%s%s\\BASIS\\PROGRAM;%BeginLIBPATH%",
- szDrive, szDir, szDrive, szDir);
- DosSetExtLIBPATH( (PCSZ)szLibpath, BEGIN_LIBPATH);
- // make sure we load DLL from our path only, so multiple instances/versions
- // can be loaded.
- DosSetExtLIBPATH( (PCSZ)"T", LIBPATHSTRICT);
-
- // adjust exe name
- _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
- _makepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, (".bin") );
-
- // copy command line parameters
- int i, len;
- len = strlen(szApplicationName) + 1 + strlen( APPLICATION_SWITCH) + 1 + 1;
- for( i=1; i<argc; i++)
- len += strlen( argv[i]) + 1;
-
- char* pszCommandLine, *pszArgs;
- pszCommandLine = (char*) calloc( 1, len);
- strcpy( pszCommandLine, szApplicationName);
- pszArgs = pszCommandLine + strlen(szApplicationName) + 1;
- strcat( pszArgs, APPLICATION_SWITCH);
- strcat( pszArgs, " ");
- for( i=1; i<argc; i++) {
- // add quotes if argument has spaces!
- if (strchr( argv[i], ' '))
- strcat( pszArgs, "\"");
- strcat( pszArgs, argv[i]);
- if (strchr( argv[i], ' '))
- strcat( pszArgs, "\"");
- strcat( pszArgs, " ");
- }
- pszArgs[ strlen( pszArgs) + 0] = 0;
-
- // execute
- rc = DosExecPgm(szFail, sizeof(szFail),
- EXEC_SYNC, (PCSZ)pszCommandLine, (PCSZ)NULL, &result,
- (PCSZ)szApplicationName);
- if (rc) {
- char szMessage[ _MAX_PATH*2];
- sprintf( szMessage, "Execution failed! Contact technical support.\n\nReturn code: %d\nFailing module:%s\n", rc, szFail);
- rc = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
- (PSZ)szMessage,
- (PSZ)"Unable to start OpenOffice.org!",
- 0, MB_ERROR | MB_OK);
- WinDestroyMsgQueue( hmq);
- WinTerminate( hab);
- exit(1);
- }
-
- WinDestroyMsgQueue( hmq);
- WinTerminate( hab);
-
- exit( result.codeResult);
-}
+/*************************************************************************
+ *
+ * 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
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "launcher.hxx"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+#include <process.h>
+
+int main( int argc, char* argv[])
+{
+ PPIB pib;
+ APIRET rc;
+ RESULTCODES result = {0};
+ char szFail[ _MAX_PATH];
+
+ HAB hab = WinInitialize( 0);
+ HMQ hmq = WinCreateMsgQueue( hab, 0);
+ ERRORID erridErrorCode = 0;
+ erridErrorCode = WinGetLastError(hab);
+
+ // Calculate application name
+ CHAR szLibpath[_MAX_PATH*2];
+ CHAR szApplicationName[_MAX_PATH];
+ CHAR szDrive[_MAX_PATH];
+ CHAR szDir[_MAX_PATH];
+ CHAR szFileName[_MAX_PATH];
+ CHAR szExt[_MAX_PATH];
+
+ // get executable fullpath
+ DosGetInfoBlocks(NULL, &pib);
+ DosQueryModuleName(pib->pib_hmte, sizeof(szApplicationName), szApplicationName);
+
+ // adjust libpath
+ _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
+ char* basedir = strstr( szDir, "\\PROGRAM\\");
+ if (basedir) *basedir = 0;
+ sprintf( szLibpath, "%s%s\\URE\\BIN;%s%s\\BASIS\\PROGRAM;%BeginLIBPATH%",
+ szDrive, szDir, szDrive, szDir);
+ DosSetExtLIBPATH( (PCSZ)szLibpath, BEGIN_LIBPATH);
+ // make sure we load DLL from our path only, so multiple instances/versions
+ // can be loaded.
+ DosSetExtLIBPATH( (PCSZ)"T", LIBPATHSTRICT);
+
+ // adjust exe name
+ _splitpath( szApplicationName, szDrive, szDir, szFileName, szExt );
+ _makepath( szApplicationName, szDrive, szDir, OFFICE_IMAGE_NAME, (".bin") );
+
+ // copy command line parameters
+ int i, len;
+ len = strlen(szApplicationName) + 1 + strlen( APPLICATION_SWITCH) + 1 + 1;
+ for( i=1; i<argc; i++)
+ len += strlen( argv[i]) + 1;
+
+ char* pszCommandLine, *pszArgs;
+ pszCommandLine = (char*) calloc( 1, len);
+ strcpy( pszCommandLine, szApplicationName);
+ pszArgs = pszCommandLine + strlen(szApplicationName) + 1;
+ strcat( pszArgs, APPLICATION_SWITCH);
+ strcat( pszArgs, " ");
+ for( i=1; i<argc; i++) {
+ // add quotes if argument has spaces!
+ if (strchr( argv[i], ' '))
+ strcat( pszArgs, "\"");
+ strcat( pszArgs, argv[i]);
+ if (strchr( argv[i], ' '))
+ strcat( pszArgs, "\"");
+ strcat( pszArgs, " ");
+ }
+ pszArgs[ strlen( pszArgs) + 0] = 0;
+
+ // execute
+ rc = DosExecPgm(szFail, sizeof(szFail),
+ EXEC_SYNC, (PCSZ)pszCommandLine, (PCSZ)NULL, &result,
+ (PCSZ)szApplicationName);
+ if (rc) {
+ char szMessage[ _MAX_PATH*2];
+ sprintf( szMessage, "Execution failed! Contact technical support.\n\nReturn code: %d\nFailing module:%s\n", rc, szFail);
+ rc = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
+ (PSZ)szMessage,
+ (PSZ)"Unable to start OpenOffice.org!",
+ 0, MB_ERROR | MB_OK);
+ WinDestroyMsgQueue( hmq);
+ WinTerminate( hab);
+ exit(1);
+ }
+
+ WinDestroyMsgQueue( hmq);
+ WinTerminate( hab);
+
+ exit( result.codeResult);
+}
diff --git a/formula/inc/AddressConvention.hxx b/formula/inc/AddressConvention.hxx
index d65a3be79524..d4d50e83dbfa 100644
--- a/formula/inc/AddressConvention.hxx
+++ b/formula/inc/AddressConvention.hxx
@@ -1,42 +1,42 @@
-/*************************************************************************
- *
- * 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: tokenuno.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
-#define FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
-
-#include "formula/formuladllapi.h"
-namespace formula
-{
-// =============================================================================
-// =============================================================================
-} // formula
-// =============================================================================
-
-#endif // FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
+/*************************************************************************
+ *
+ * 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: tokenuno.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
+#define FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+namespace formula
+{
+// =============================================================================
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_ADDRESSCONVENTION_HXX_INCLUDED
diff --git a/formula/inc/helpids.hrc b/formula/inc/helpids.hrc
index e971f2054eaf..bcbe9b2db85d 100644
--- a/formula/inc/helpids.hrc
+++ b/formula/inc/helpids.hrc
@@ -1,65 +1,65 @@
-/*************************************************************************
- *
- * 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: helpids.hrc,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef FORMULA_HELPID_HRC
-#define FORMULA_HELPID_HRC
-
-#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc> // HID_FORMULA_START
-#endif
-
-#define HID_FORMULADLG_FORMULA (HID_FORMULA_START + 0)
-#define HID_FORMULA_FAP_FORMULA (HID_FORMULA_START + 1)
-#define HID_FORMULA_FAP_STRUCT (HID_FORMULA_START + 2)
-#define HID_FORMULA_FAP_PAGE (HID_FORMULA_START + 3)
-#define HID_FORMULA_FAP_EDIT1 (HID_FORMULA_START + 4)
-#define HID_FORMULA_FAP_EDIT2 (HID_FORMULA_START + 5)
-#define HID_FORMULA_FAP_EDIT3 (HID_FORMULA_START + 6)
-#define HID_FORMULA_FAP_EDIT4 (HID_FORMULA_START + 7)
-#define HID_FORMULA_FAP_BTN_FX1 (HID_FORMULA_START + 8)
-#define HID_FORMULA_FAP_BTN_FX2 (HID_FORMULA_START + 9)
-#define HID_FORMULA_FAP_BTN_FX3 (HID_FORMULA_START +10)
-#define HID_FORMULA_FAP_BTN_FX4 (HID_FORMULA_START +11)
-#define HID_FORMULA_FAP_BTN_REF1 (HID_FORMULA_START +12)
-#define HID_FORMULA_FAP_BTN_REF2 (HID_FORMULA_START +13)
-#define HID_FORMULA_FAP_BTN_REF3 (HID_FORMULA_START +14)
-#define HID_FORMULA_FAP_BTN_REF4 (HID_FORMULA_START +15)
-#define HID_FORMULA_LB_CATEGORY (HID_FORMULA_START +16)
-#define HID_FORMULA_LB_FUNCTION (HID_FORMULA_START +17)
-#define HID_FORMULATAB_FUNCTION (HID_FORMULA_START +18)
-#define HID_FORMULATAB_STRUCT (HID_FORMULA_START +19)
-
-
-#if HID_FORMULATAB_STRUCT > HID_FORMULA_END
-#error Help-Id Ueberlauf in #file, #line
-#endif
-// don't forget to update the file util/hidother.src
-
-#endif //FORMULA_HELPID_HRC
-
+/*************************************************************************
+ *
+ * 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: helpids.hrc,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef FORMULA_HELPID_HRC
+#define FORMULA_HELPID_HRC
+
+#ifndef _SOLAR_HRC
+#include <svtools/solar.hrc> // HID_FORMULA_START
+#endif
+
+#define HID_FORMULADLG_FORMULA (HID_FORMULA_START + 0)
+#define HID_FORMULA_FAP_FORMULA (HID_FORMULA_START + 1)
+#define HID_FORMULA_FAP_STRUCT (HID_FORMULA_START + 2)
+#define HID_FORMULA_FAP_PAGE (HID_FORMULA_START + 3)
+#define HID_FORMULA_FAP_EDIT1 (HID_FORMULA_START + 4)
+#define HID_FORMULA_FAP_EDIT2 (HID_FORMULA_START + 5)
+#define HID_FORMULA_FAP_EDIT3 (HID_FORMULA_START + 6)
+#define HID_FORMULA_FAP_EDIT4 (HID_FORMULA_START + 7)
+#define HID_FORMULA_FAP_BTN_FX1 (HID_FORMULA_START + 8)
+#define HID_FORMULA_FAP_BTN_FX2 (HID_FORMULA_START + 9)
+#define HID_FORMULA_FAP_BTN_FX3 (HID_FORMULA_START +10)
+#define HID_FORMULA_FAP_BTN_FX4 (HID_FORMULA_START +11)
+#define HID_FORMULA_FAP_BTN_REF1 (HID_FORMULA_START +12)
+#define HID_FORMULA_FAP_BTN_REF2 (HID_FORMULA_START +13)
+#define HID_FORMULA_FAP_BTN_REF3 (HID_FORMULA_START +14)
+#define HID_FORMULA_FAP_BTN_REF4 (HID_FORMULA_START +15)
+#define HID_FORMULA_LB_CATEGORY (HID_FORMULA_START +16)
+#define HID_FORMULA_LB_FUNCTION (HID_FORMULA_START +17)
+#define HID_FORMULATAB_FUNCTION (HID_FORMULA_START +18)
+#define HID_FORMULATAB_STRUCT (HID_FORMULA_START +19)
+
+
+#if HID_FORMULATAB_STRUCT > HID_FORMULA_END
+#error Help-Id Ueberlauf in #file, #line
+#endif
+// don't forget to update the file util/hidother.src
+
+#endif //FORMULA_HELPID_HRC
+
diff --git a/formula/prj/d.lst b/formula/prj/d.lst
index b37802fb922d..3ad1e394844f 100644
--- a/formula/prj/d.lst
+++ b/formula/prj/d.lst
@@ -1,37 +1,37 @@
-
-..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
-
-dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
-
-# Libraries
-..\%__SRC%\bin\for*.dll %_DEST%\bin%_EXT%\for*.dll
-..\%__SRC%\lib\libfor*.so %_DEST%\lib%_EXT%\libfor*.so
-..\%__SRC%\lib\ifor*.lib %_DEST%\lib%_EXT%\ifor*.lib
-..\%__SRC%\lib\libfor*.dylib %_DEST%\lib%_EXT%\libfor*.dylib
-
-# Resources
-..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
-
-mkdir: %_DEST%\inc%_EXT%\formula
-..\inc\formula\formdata.hxx %_DEST%\inc%_EXT%\formula\formdata.hxx
-..\inc\formula\formula.hxx %_DEST%\inc%_EXT%\formula\formula.hxx
-..\inc\formula\formulahelper.hxx %_DEST%\inc%_EXT%\formula\formulahelper.hxx
-..\inc\formula\funcutl.hxx %_DEST%\inc%_EXT%\formula\funcutl.hxx
-..\inc\formula\IControlReferenceHandler.hxx %_DEST%\inc%_EXT%\formula\IControlReferenceHandler.hxx
-..\inc\formula\IFunctionDescription.hxx %_DEST%\inc%_EXT%\formula\IFunctionDescription.hxx
-..\inc\formula\ExternalReferenceHelper.hxx %_DEST%\inc%_EXT%\formula\ExternalReferenceHelper.hxx
-..\inc\formula\formuladllapi.h %_DEST%\inc%_EXT%\formula\formuladllapi.h
-..\inc\formula\opcode.hxx %_DEST%\inc%_EXT%\formula\opcode.hxx
-..\inc\formula\grammar.hxx %_DEST%\inc%_EXT%\formula\grammar.hxx
-..\inc\formula\FormulaCompiler.hxx %_DEST%\inc%_EXT%\formula\FormulaCompiler.hxx
-..\inc\formula\FormulaOpCodeMapperObj.hxx %_DEST%\inc%_EXT%\formula\FormulaOpCodeMapperObj.hxx
-..\inc\formula\compiler.hrc %_DEST%\inc%_EXT%\formula\compiler.hrc
-..\inc\formula\token.hxx %_DEST%\inc%_EXT%\formula\token.hxx
-..\inc\formula\tokenarray.hxx %_DEST%\inc%_EXT%\formula\tokenarray.hxx
-..\inc\formula\errorcodes.hxx %_DEST%\inc%_EXT%\formula\errorcodes.hxx
-..\inc\formula\intruref.hxx %_DEST%\inc%_EXT%\formula\intruref.hxx
-
-
-
-
-
+
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+
+dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
+
+# Libraries
+..\%__SRC%\bin\for*.dll %_DEST%\bin%_EXT%\for*.dll
+..\%__SRC%\lib\libfor*.so %_DEST%\lib%_EXT%\libfor*.so
+..\%__SRC%\lib\ifor*.lib %_DEST%\lib%_EXT%\ifor*.lib
+..\%__SRC%\lib\libfor*.dylib %_DEST%\lib%_EXT%\libfor*.dylib
+
+# Resources
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+
+mkdir: %_DEST%\inc%_EXT%\formula
+..\inc\formula\formdata.hxx %_DEST%\inc%_EXT%\formula\formdata.hxx
+..\inc\formula\formula.hxx %_DEST%\inc%_EXT%\formula\formula.hxx
+..\inc\formula\formulahelper.hxx %_DEST%\inc%_EXT%\formula\formulahelper.hxx
+..\inc\formula\funcutl.hxx %_DEST%\inc%_EXT%\formula\funcutl.hxx
+..\inc\formula\IControlReferenceHandler.hxx %_DEST%\inc%_EXT%\formula\IControlReferenceHandler.hxx
+..\inc\formula\IFunctionDescription.hxx %_DEST%\inc%_EXT%\formula\IFunctionDescription.hxx
+..\inc\formula\ExternalReferenceHelper.hxx %_DEST%\inc%_EXT%\formula\ExternalReferenceHelper.hxx
+..\inc\formula\formuladllapi.h %_DEST%\inc%_EXT%\formula\formuladllapi.h
+..\inc\formula\opcode.hxx %_DEST%\inc%_EXT%\formula\opcode.hxx
+..\inc\formula\grammar.hxx %_DEST%\inc%_EXT%\formula\grammar.hxx
+..\inc\formula\FormulaCompiler.hxx %_DEST%\inc%_EXT%\formula\FormulaCompiler.hxx
+..\inc\formula\FormulaOpCodeMapperObj.hxx %_DEST%\inc%_EXT%\formula\FormulaOpCodeMapperObj.hxx
+..\inc\formula\compiler.hrc %_DEST%\inc%_EXT%\formula\compiler.hrc
+..\inc\formula\token.hxx %_DEST%\inc%_EXT%\formula\token.hxx
+..\inc\formula\tokenarray.hxx %_DEST%\inc%_EXT%\formula\tokenarray.hxx
+..\inc\formula\errorcodes.hxx %_DEST%\inc%_EXT%\formula\errorcodes.hxx
+..\inc\formula\intruref.hxx %_DEST%\inc%_EXT%\formula\intruref.hxx
+
+
+
+
+
diff --git a/formula/source/core/api/FormulaOpCodeMapperObj.cxx b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
index 29f0a2d2789a..3c79e4c6513b 100644
--- a/formula/source/core/api/FormulaOpCodeMapperObj.cxx
+++ b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
@@ -1,129 +1,129 @@
-/*************************************************************************
- *
- * 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: tokenuno.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include "precompiled_formula.hxx"
-#include "formula/FormulaOpCodeMapperObj.hxx"
-#include "formula/opcode.hxx"
-#include <comphelper/sequence.hxx>
-
-// =============================================================================
-namespace formula
-{
-// =============================================================================
-
- using namespace ::com::sun::star;
-
- // -----------------------------------------------------------------------------
-// --------------------------------------------------------------------------------
-sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
-{
- return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName, sal_True ).getLength() != 0;
-}
-//------------------------------------------------------------------------
-FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler)
-: m_pCompiler(_pCompiler)
-{
-}
-
-FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
-{
-}
-
-
-::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
- throw (::com::sun::star::uno::RuntimeException)
-{
- return ocExternal;
-}
-
-
-::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown()
- throw (::com::sun::star::uno::RuntimeException)
-{
- return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
-}
-
-
-::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
-SAL_CALL FormulaOpCodeMapperObj::getMappings(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
- sal_Int32 nLanguage )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
-{
- FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
- if (!xMap)
- throw lang::IllegalArgumentException();
- return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames);
-}
-
-
-::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
-SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
- sal_Int32 nLanguage, sal_Int32 nGroups )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
-{
- FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
- if (!xMap)
- throw lang::IllegalArgumentException();
- return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups);
-}
-//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException)
-{
- return getImplementationName_Static();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static()
-{
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "simple.formula.FormulaOpCodeMapperObj" ) );
-}
-// --------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-uno::Sequence< rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
-{
- uno::Sequence< rtl::OUString > aSeq( 1 );
- aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FormulaOpCodeMapper" ));
- return aSeq;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create(
- uno::Reference< uno::XComponentContext > const & /*_xContext*/)
-{
- return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler>(new FormulaCompiler())));
-}
-// -----------------------------------------------------------------------------
-
-// =============================================================================
-} // formula
-// =============================================================================
+/*************************************************************************
+ *
+ * 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: tokenuno.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_formula.hxx"
+#include "formula/FormulaOpCodeMapperObj.hxx"
+#include "formula/opcode.hxx"
+#include <comphelper/sequence.hxx>
+
+// =============================================================================
+namespace formula
+{
+// =============================================================================
+
+ using namespace ::com::sun::star;
+
+ // -----------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException)
+{
+ return ::comphelper::findValue( getSupportedServiceNames_Static(), _rServiceName, sal_True ).getLength() != 0;
+}
+//------------------------------------------------------------------------
+FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler)
+: m_pCompiler(_pCompiler)
+{
+}
+
+FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
+{
+}
+
+
+::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ocExternal;
+}
+
+
+::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
+}
+
+
+::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
+SAL_CALL FormulaOpCodeMapperObj::getMappings(
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
+ sal_Int32 nLanguage )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
+ if (!xMap)
+ throw lang::IllegalArgumentException();
+ return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames);
+}
+
+
+::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
+SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
+ sal_Int32 nLanguage, sal_Int32 nGroups )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
+ if (!xMap)
+ throw lang::IllegalArgumentException();
+ return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups);
+}
+//--------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return getImplementationName_Static();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "simple.formula.FormulaOpCodeMapperObj" ) );
+}
+// --------------------------------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+uno::Sequence< rtl::OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSeq( 1 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.FormulaOpCodeMapper" ));
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create(
+ uno::Reference< uno::XComponentContext > const & /*_xContext*/)
+{
+ return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler>(new FormulaCompiler())));
+}
+// -----------------------------------------------------------------------------
+
+// =============================================================================
+} // formula
+// =============================================================================
diff --git a/formula/source/core/inc/core_resource.hrc b/formula/source/core/inc/core_resource.hrc
index 4a64fddaba4b..769067d57839 100644
--- a/formula/source/core/inc/core_resource.hrc
+++ b/formula/source/core/inc/core_resource.hrc
@@ -1,48 +1,48 @@
-/*************************************************************************
- *
- * 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: core_resource.hrc,v $
- * $Revision: 1.16.68.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _FORMULA_CORE_RESOURCE_HRC_
-#define _FORMULA_CORE_RESOURCE_HRC_
-
-#include <svtools/solar.hrc>
-
-//------------------------------------------------------------------------------
-#define RID_CORE_STRINGS_START RID_FORMULA_START
-#define RID_CORE_OTHER_START RID_FORMULA_START
-
-//------------------------------------------------------------------------------
-//- String-IDs
-#define RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF (RID_CORE_OTHER_START + 0)
-#define RID_STRLIST_FUNCTION_NAMES_ENGLISH (RID_CORE_OTHER_START + 1)
-#define RID_STRLIST_FUNCTION_NAMES (RID_CORE_OTHER_START + 2)
-
-
-#endif // _FORMULA_CORE_RESOURCE_HRC_
-
+/*************************************************************************
+ *
+ * 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: core_resource.hrc,v $
+ * $Revision: 1.16.68.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FORMULA_CORE_RESOURCE_HRC_
+#define _FORMULA_CORE_RESOURCE_HRC_
+
+#include <svtools/solar.hrc>
+
+//------------------------------------------------------------------------------
+#define RID_CORE_STRINGS_START RID_FORMULA_START
+#define RID_CORE_OTHER_START RID_FORMULA_START
+
+//------------------------------------------------------------------------------
+//- String-IDs
+#define RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF (RID_CORE_OTHER_START + 0)
+#define RID_STRLIST_FUNCTION_NAMES_ENGLISH (RID_CORE_OTHER_START + 1)
+#define RID_STRLIST_FUNCTION_NAMES (RID_CORE_OTHER_START + 2)
+
+
+#endif // _FORMULA_CORE_RESOURCE_HRC_
+
diff --git a/formula/source/core/inc/core_resource.hxx b/formula/source/core/inc/core_resource.hxx
index f079fbf95100..c8b78a5bdbd8 100644
--- a/formula/source/core/inc/core_resource.hxx
+++ b/formula/source/core/inc/core_resource.hxx
@@ -1,114 +1,114 @@
-/*************************************************************************
- *
- * 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: core_resource.hxx,v $
- * $Revision: 1.5.68.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _FORMULA_CORE_RESOURCE_HXX_
-#define _FORMULA_CORE_RESOURCE_HXX_
-
-#ifndef _RTL_USTRING_HXX_
-#include <rtl/ustring.hxx>
-#endif
-#include <osl/mutex.hxx>
-
-class ResMgr;
-//.........................................................................
-namespace formula
-{
-
-#define FORMULA_RES( id ) ResourceManager::loadString( id )
-#define FORMULA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
-
-#define FORMULACORE_RESSTRING( id ) FORMULA_RES( id )
- // (compatibility)
-
- //==================================================================
- //= ResourceManager
- //= handling ressources within the FORMULA-Core library
- //==================================================================
- class ResourceManager
- {
- friend class OModuleClient;
- static ::osl::Mutex s_aMutex; /// access safety
- static sal_Int32 s_nClients; /// number of registered clients
- static ResMgr* m_pImpl;
-
- private:
- // no instantiation allowed
- ResourceManager() { }
- ~ResourceManager() { }
-
- protected:
- static void ensureImplExists();
- /// register a client for the module
- static void registerClient();
- /// revoke a client for the module
- static void revokeClient();
-
- public:
- /** loads the string with the specified resource id
- */
- static ::rtl::OUString loadString(sal_uInt16 _nResId);
-
- /** loads a string from the resource file, substituting a placeholder with a given string
-
- @param _nResId
- the resource ID of the string to loAD
- @param _pPlaceholderAscii
- the ASCII representation of the placeholder string
- @param _rReplace
- the string which should substutite the placeholder
- */
- static ::rtl::OUString loadString(
- sal_uInt16 _nResId,
- const sal_Char* _pPlaceholderAscii,
- const ::rtl::OUString& _rReplace
- );
-
- static ResMgr* getResManager();
- };
-
- //=========================================================================
- //= OModuleClient
- //=========================================================================
- /** base class for objects which uses any global module-specific ressources
- */
- class OModuleClient
- {
- public:
- OModuleClient() { ResourceManager::registerClient(); }
- ~OModuleClient() { ResourceManager::revokeClient(); }
- };
-
-
-//.........................................................................
-} // formula
-//.........................................................................
-
-#endif // _FORMULA_CORE_RESOURCE_HXX_
-
+/*************************************************************************
+ *
+ * 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: core_resource.hxx,v $
+ * $Revision: 1.5.68.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FORMULA_CORE_RESOURCE_HXX_
+#define _FORMULA_CORE_RESOURCE_HXX_
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#include <osl/mutex.hxx>
+
+class ResMgr;
+//.........................................................................
+namespace formula
+{
+
+#define FORMULA_RES( id ) ResourceManager::loadString( id )
+#define FORMULA_RES_PARAM( id, ascii, replace ) ResourceManager::loadString( id, ascii, replace )
+
+#define FORMULACORE_RESSTRING( id ) FORMULA_RES( id )
+ // (compatibility)
+
+ //==================================================================
+ //= ResourceManager
+ //= handling ressources within the FORMULA-Core library
+ //==================================================================
+ class ResourceManager
+ {
+ friend class OModuleClient;
+ static ::osl::Mutex s_aMutex; /// access safety
+ static sal_Int32 s_nClients; /// number of registered clients
+ static ResMgr* m_pImpl;
+
+ private:
+ // no instantiation allowed
+ ResourceManager() { }
+ ~ResourceManager() { }
+
+ protected:
+ static void ensureImplExists();
+ /// register a client for the module
+ static void registerClient();
+ /// revoke a client for the module
+ static void revokeClient();
+
+ public:
+ /** loads the string with the specified resource id
+ */
+ static ::rtl::OUString loadString(sal_uInt16 _nResId);
+
+ /** loads a string from the resource file, substituting a placeholder with a given string
+
+ @param _nResId
+ the resource ID of the string to loAD
+ @param _pPlaceholderAscii
+ the ASCII representation of the placeholder string
+ @param _rReplace
+ the string which should substutite the placeholder
+ */
+ static ::rtl::OUString loadString(
+ sal_uInt16 _nResId,
+ const sal_Char* _pPlaceholderAscii,
+ const ::rtl::OUString& _rReplace
+ );
+
+ static ResMgr* getResManager();
+ };
+
+ //=========================================================================
+ //= OModuleClient
+ //=========================================================================
+ /** base class for objects which uses any global module-specific ressources
+ */
+ class OModuleClient
+ {
+ public:
+ OModuleClient() { ResourceManager::registerClient(); }
+ ~OModuleClient() { ResourceManager::revokeClient(); }
+ };
+
+
+//.........................................................................
+} // formula
+//.........................................................................
+
+#endif // _FORMULA_CORE_RESOURCE_HXX_
+
diff --git a/formula/source/core/resource/core_resource.cxx b/formula/source/core/resource/core_resource.cxx
index 8d2933375b17..de36c962a83e 100644
--- a/formula/source/core/resource/core_resource.cxx
+++ b/formula/source/core/resource/core_resource.cxx
@@ -1,111 +1,111 @@
-/*************************************************************************
- *
- * 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: core_resource.cxx,v $
- * $Revision: 1.11.68.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_formula.hxx"
-
-#include "core_resource.hxx"
-
-#include <tools/resmgr.hxx>
-
-// ---- needed as long as we have no contexts for components ---
-#include <vcl/svapp.hxx>
-#include <svtools/solar.hrc>
-
-//.........................................................................
-namespace formula
-{
-
- //==================================================================
- //= ResourceManager
- //==================================================================
- ::osl::Mutex ResourceManager::s_aMutex;
- sal_Int32 ResourceManager::s_nClients = 0;
- ResMgr* ResourceManager::m_pImpl = NULL;
-
- //------------------------------------------------------------------
- void ResourceManager::ensureImplExists()
- {
- if (m_pImpl)
- return;
-
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
-
- ByteString sFileName("for");
-
- m_pImpl = ResMgr::CreateResMgr(sFileName.GetBuffer(), aLocale);
- }
-
- //------------------------------------------------------------------
- ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
- {
- ::rtl::OUString sReturn;
-
- ensureImplExists();
- if (m_pImpl)
- sReturn = String(ResId(_nResId,*m_pImpl));
-
- return sReturn;
- }
-
- //------------------------------------------------------------------
- ::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const ::rtl::OUString& _rReplace )
- {
- String sString( loadString( _nResId ) );
- sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace );
- return sString;
- }
- //-------------------------------------------------------------------------
- void ResourceManager::registerClient()
- {
- ::osl::MutexGuard aGuard(s_aMutex);
- ++s_nClients;
- }
-
- //-------------------------------------------------------------------------
- void ResourceManager::revokeClient()
- {
- ::osl::MutexGuard aGuard(s_aMutex);
- if (!--s_nClients && m_pImpl)
- {
- delete m_pImpl;
- m_pImpl = NULL;
- }
- }
- ResMgr* ResourceManager::getResManager()
- {
- ensureImplExists();
- return m_pImpl;
- }
-
-//.........................................................................
-} // formula
-//.........................................................................
-
+/*************************************************************************
+ *
+ * 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: core_resource.cxx,v $
+ * $Revision: 1.11.68.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_formula.hxx"
+
+#include "core_resource.hxx"
+
+#include <tools/resmgr.hxx>
+
+// ---- needed as long as we have no contexts for components ---
+#include <vcl/svapp.hxx>
+#include <svtools/solar.hrc>
+
+//.........................................................................
+namespace formula
+{
+
+ //==================================================================
+ //= ResourceManager
+ //==================================================================
+ ::osl::Mutex ResourceManager::s_aMutex;
+ sal_Int32 ResourceManager::s_nClients = 0;
+ ResMgr* ResourceManager::m_pImpl = NULL;
+
+ //------------------------------------------------------------------
+ void ResourceManager::ensureImplExists()
+ {
+ if (m_pImpl)
+ return;
+
+ ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+
+ ByteString sFileName("for");
+
+ m_pImpl = ResMgr::CreateResMgr(sFileName.GetBuffer(), aLocale);
+ }
+
+ //------------------------------------------------------------------
+ ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
+ {
+ ::rtl::OUString sReturn;
+
+ ensureImplExists();
+ if (m_pImpl)
+ sReturn = String(ResId(_nResId,*m_pImpl));
+
+ return sReturn;
+ }
+
+ //------------------------------------------------------------------
+ ::rtl::OUString ResourceManager::loadString( sal_uInt16 _nResId, const sal_Char* _pPlaceholderAscii, const ::rtl::OUString& _rReplace )
+ {
+ String sString( loadString( _nResId ) );
+ sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace );
+ return sString;
+ }
+ //-------------------------------------------------------------------------
+ void ResourceManager::registerClient()
+ {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ ++s_nClients;
+ }
+
+ //-------------------------------------------------------------------------
+ void ResourceManager::revokeClient()
+ {
+ ::osl::MutexGuard aGuard(s_aMutex);
+ if (!--s_nClients && m_pImpl)
+ {
+ delete m_pImpl;
+ m_pImpl = NULL;
+ }
+ }
+ ResMgr* ResourceManager::getResManager()
+ {
+ ensureImplExists();
+ return m_pImpl;
+ }
+
+//.........................................................................
+} // formula
+//.........................................................................
+
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index d4e76cf09762..3437bc47302b 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -1,603 +1,603 @@
-/*************************************************************************
- *
- * 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: parawin.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_formula.hxx"
-
-
-
-//----------------------------------------------------------------------------
-
-#include <svtools/zforlist.hxx>
-#include <svtools/stritem.hxx>
-
-#include "parawin.hxx"
-#include "parawin.hrc"
-#include "helpids.hrc"
-#include "formula/formdata.hxx"
-#include "formula/IFunctionDescription.hxx"
-#include "ModuleHelper.hxx"
-#include "ForResId.hrc"
-
-#define VAR_ARGS 30
-namespace formula
-{
-//============================================================================
-
-ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos):
- TabPage (pParent,ModuleRes(RID_FORMULATAB_PARAMETER)),
- pFuncDesc ( NULL ),
- pMyParent (_pDlg),
- aFtEditDesc ( this, ModuleRes( FT_EDITDESC ) ),
- aFtArgName ( this, ModuleRes( FT_PARNAME ) ),
- aFtArgDesc ( this, ModuleRes( FT_PARDESC ) ),
-
- aFtArg1 ( this, ModuleRes( FT_ARG1 ) ),
- aFtArg2 ( this, ModuleRes( FT_ARG2 ) ),
- aFtArg3 ( this, ModuleRes( FT_ARG3 ) ),
- aFtArg4 ( this, ModuleRes( FT_ARG4 ) ),
-
- aBtnFx1 ( this, ModuleRes( BTN_FX1 ) ),
- aBtnFx2 ( this, ModuleRes( BTN_FX2 ) ),
- aBtnFx3 ( this, ModuleRes( BTN_FX3 ) ),
- aBtnFx4 ( this, ModuleRes( BTN_FX4 ) ),
-
- aEdArg1 ( this, ModuleRes( ED_ARG1 ) ),
- aEdArg2 ( this, ModuleRes( ED_ARG2 ) ),
- aEdArg3 ( this, ModuleRes( ED_ARG3 ) ),
- aEdArg4 ( this, ModuleRes( ED_ARG4 ) ),
-
- aRefBtn1 ( this, ModuleRes( RB_ARG1 ) ),
- aRefBtn2 ( this, ModuleRes( RB_ARG2 ) ),
- aRefBtn3 ( this, ModuleRes( RB_ARG3 ) ),
- aRefBtn4 ( this, ModuleRes( RB_ARG4 ) ),
-
- aSlider ( this, ModuleRes( WND_SLIDER ) ),
- m_sOptional ( ModuleRes( STR_OPTIONAL ) ),
- m_sRequired ( ModuleRes( STR_REQUIRED ) ),
- bRefMode (FALSE)
-{
- Image aFxHC( ModuleRes( IMG_FX_H ) );
- FreeResource();
- aDefaultString=aFtEditDesc.GetText();
-
- SetPosPixel(aPos);
- nEdFocus=NOT_FOUND;
- nActiveLine=0;
- Size aSize = aSlider.GetSizePixel();
- aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
- aSlider.SetSizePixel( aSize );
- aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
- aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
-
- aBtnFx1.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx2.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx3.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
- aBtnFx4.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
-
- InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1);
- InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2);
- InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3);
- InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4);
- ClearAll();
-}
-
-void ParaWin::UpdateArgDesc( USHORT nArg )
-{
- if (nArg==NOT_FOUND) return;
-
- if ( nArgs > 4 )
- nArg = sal::static_int_cast<USHORT>( nArg + GetSliderPos() );
- //@ nArg += (USHORT)aSlider.GetThumbPos();
-
- if ( (nArgs > 0) && (nArg<nArgs) )
- {
- String aArgDesc;
- String aArgName;
-
- SetArgumentDesc( String() );
- SetArgumentText( String() );
-
- if ( nArgs < VAR_ARGS )
- {
- USHORT nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
- aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
- aArgName = pFuncDesc->getParameterName(nRealArg);
- aArgName += ' ';
- aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
- }
- else
- {
- USHORT nFix = nArgs - VAR_ARGS;
- USHORT nPos = ( nArg < nFix ? nArg : nFix );
- USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
- aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
- aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
- aArgName = pFuncDesc->getParameterName(nRealArg);
- if ( nArg >= nFix )
- aArgName += String::CreateFromInt32(nArg-nFix+1);
- aArgName += ' ';
-
- aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
- }
-
- SetArgumentDesc(aArgDesc);
- SetArgumentText(aArgName);
- }
-}
-
-void ParaWin::UpdateArgInput( USHORT nOffset, USHORT i )
-{
- USHORT nArg = nOffset + i;
- if ( nArgs < VAR_ARGS)
- {
- if(nArg<nArgs)
- {
- USHORT nRealArg = aVisibleArgMapping[nArg];
- SetArgNameFont (i,(pFuncDesc->isParameterOptional(nRealArg))
- ? aFntLight : aFntBold );
- SetArgName (i,pFuncDesc->getParameterName(nRealArg));
- }
- }
- else
- {
- USHORT nFix = nArgs - VAR_ARGS;
- USHORT nPos = ( nArg < nFix ? nArg : nFix );
- USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
- aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
- SetArgNameFont( i,
- (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ?
- aFntLight : aFntBold );
- if ( nArg >= nFix )
- {
- String aArgName( pFuncDesc->getParameterName(nRealArg) );
- aArgName += String::CreateFromInt32(nArg-nFix+1);
- SetArgName( i, aArgName );
- }
- else
- SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
- }
- if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]);
- //@ aArgInput[i].SetArgVal( *(pArgArr[nOffset+i]) );
-
-}
-
-ParaWin::~ParaWin()
-{
- // #i66422# if the focus changes during destruction of the controls,
- // don't call the focus handlers
- Link aEmptyLink;
- aBtnFx1.SetGetFocusHdl( aEmptyLink );
- aBtnFx2.SetGetFocusHdl( aEmptyLink );
- aBtnFx3.SetGetFocusHdl( aEmptyLink );
- aBtnFx4.SetGetFocusHdl( aEmptyLink );
-}
-
-USHORT ParaWin::GetActiveLine()
-{
- return nActiveLine;
-}
-
-void ParaWin::SetActiveLine(USHORT no)
-{
- if(no<nArgs)
- {
- long nOffset = GetSliderPos();
- nActiveLine=no;
- long nNewEdPos=(long)nActiveLine-nOffset;
- if(nNewEdPos<0 || nNewEdPos>3)
- {
- nOffset+=nNewEdPos;
- SetSliderPos((USHORT) nOffset);
- nOffset=GetSliderPos();
- }
- nEdFocus=no-(USHORT)nOffset;
- UpdateArgDesc( nEdFocus );
- }
-}
-
-RefEdit* ParaWin::GetActiveEdit()
-{
- if(nArgs>0 && nEdFocus!=NOT_FOUND)
- {
- return aArgInput[nEdFocus].GetArgEdPtr();
- }
- else
- {
- return NULL;
- }
-}
-
-
-String ParaWin::GetArgument(USHORT no)
-{
- String aStr;
- if(no<aParaArray.size())
- {
- aStr=aParaArray[no];
- if(no==nActiveLine && aStr.Len()==0)
- aStr+=' ';
- }
- return aStr;
-}
-
-String ParaWin::GetActiveArgName()
-{
- String aStr;
- if(nArgs>0 && nEdFocus!=NOT_FOUND)
- {
- aStr=aArgInput[nEdFocus].GetArgName();
- }
- return aStr;
-}
-
-
-void ParaWin::SetArgument(USHORT no, const String& aString)
-{
- if(no<aParaArray.size())
- {
- aParaArray[no] = aString;
- aParaArray[no].EraseLeadingChars();
- }
-}
-
-void ParaWin::DelParaArray()
-{
- ::std::vector<String>().swap(aParaArray);
-}
-
-void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont)
-{
- aFntBold=aBoldFont;
- aFntLight=aLightFont;
-}
-
-void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
-{
- pFuncDesc=pFDesc;
-
- SetArgumentDesc( String() );
- SetArgumentText( String() );
- SetEditDesc( String() );
- nArgs = 0;
- if ( pFuncDesc!=NULL)
- {
- if ( pFuncDesc->getDescription().getLength() )
- {
- SetEditDesc(pFuncDesc->getDescription());
- }
- else
- {
- SetEditDesc(aDefaultString);
- }
- long nHelpId = pFuncDesc->getHelpId();
- nArgs = pFuncDesc->getSuppressedArgumentCount();
- pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping);
- aSlider.Hide();
- SetHelpId( nHelpId );
- aEdArg1.SetHelpId( nHelpId );
- aEdArg2.SetHelpId( nHelpId );
- aEdArg3.SetHelpId( nHelpId );
- aEdArg4.SetHelpId( nHelpId );
-
- // Unique-IDs muessen gleich bleiben fuer Automatisierung
- SetUniqueId( HID_FORMULA_FAP_PAGE );
- aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 );
- aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 );
- aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 );
- aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 );
- SetActiveLine(0);
- }
- else
- {
- nActiveLine=0;
- }
-
-}
-
-void ParaWin::SetArgumentText(const String& aText)
-{
- aFtArgName.SetText(aText);
-}
-
-void ParaWin::SetArgumentDesc(const String& aText)
-{
- aFtArgDesc.SetText(aText);
-}
-
-void ParaWin::SetEditDesc(const String& aText)
-{
- aFtEditDesc.SetText(aText);
-}
-
-void ParaWin::SetArgName(USHORT no,const String& aText)
-{
- aArgInput[no].SetArgName(aText);
-}
-
-void ParaWin::SetArgNameFont(USHORT no,const Font& aFont)
-{
- aArgInput[no].SetArgNameFont(aFont);
-}
-
-void ParaWin::SetArgVal(USHORT no,const String& aText)
-{
- aArgInput[no].SetArgVal(aText);
-}
-
-void ParaWin::HideParaLine(USHORT no)
-{
- aArgInput[no].Hide();
-}
-
-void ParaWin::ShowParaLine(USHORT no)
-{
- aArgInput[no].Show();
-}
-
-void ParaWin::SetEdFocus(USHORT no)
-{
- UpdateArgDesc(no);
- if(no<4 && no<aParaArray.size())
- aArgInput[no].GetArgEdPtr()->GrabFocus();
-}
-
-
-void ParaWin::InitArgInput( USHORT nPos, FixedText& rFtArg, ImageButton& rBtnFx,
- ArgEdit& rEdArg, RefButton& rRefBtn)
-{
-
- rRefBtn.SetReferences(pMyParent,&rEdArg);
- rEdArg.SetRefDialog(pMyParent);
-
- aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
-
- aArgInput[nPos].Hide();
-
- aArgInput[nPos].SetFxClickHdl ( LINK( this, ParaWin, GetFxHdl ) );
- aArgInput[nPos].SetFxFocusHdl ( LINK( this, ParaWin, GetFxFocusHdl ) );
- aArgInput[nPos].SetEdFocusHdl ( LINK( this, ParaWin, GetEdFocusHdl ) );
- aArgInput[nPos].SetEdModifyHdl ( LINK( this, ParaWin, ModifyHdl ) );
-}
-
-void ParaWin::ClearAll()
-{
- SetFunctionDesc(NULL);
- SetArgumentOffset(0);
-}
-
-void ParaWin::SetArgumentOffset(USHORT nOffset)
-{
- DelParaArray();
- aSlider.SetThumbPos(0);
-
- aParaArray.resize(nArgs);
-
- if ( nArgs > 0 )
- {
- for ( int i=0; i<4 && i<nArgs; i++ )
- {
- String aString;
- aArgInput[i].SetArgVal(aString);
- aArgInput[i].GetArgEdPtr()->Init(
- (i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
- (i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(),
- aSlider, nArgs );
- }
- }
-
- if ( nArgs < 5 )
- {
- aSlider.Hide();
- }
- else
- {
- //aSlider.SetEndScrollHdl( LINK( this, ScFormulaDlg, ScrollHdl ) );
- aSlider.SetPageSize( 4 );
- aSlider.SetVisibleSize( 4 );
- aSlider.SetLineSize( 1 );
- aSlider.SetRange( Range( 0, nArgs ) );
- aSlider.SetThumbPos( nOffset );
- aSlider.Show();
- }
-
- UpdateParas();
-}
-
-void ParaWin::UpdateParas()
-{
- USHORT i;
- USHORT nOffset = GetSliderPos();
-
- if ( nArgs > 0 )
- {
- for ( i=0; (i<nArgs) && (i<4); i++ )
- {
- UpdateArgInput( nOffset, i );
- ShowParaLine(i);
- }
- }
-
- for ( i=nArgs; i<4; i++ ) HideParaLine(i);
-}
-
-
-USHORT ParaWin::GetSliderPos()
-{
- return (USHORT) aSlider.GetThumbPos();
-}
-
-void ParaWin::SetSliderPos(USHORT nSliderPos)
-{
- USHORT nOffset = GetSliderPos();
-
- if(aSlider.IsVisible() && nOffset!=nSliderPos)
- {
- aSlider.SetThumbPos(nSliderPos);
- for ( USHORT i=0; i<4; i++ )
- {
- UpdateArgInput( nSliderPos, i );
- }
- }
-}
-
-void ParaWin::SliderMoved()
-{
- USHORT nOffset = GetSliderPos();
-
- for ( USHORT i=0; i<4; i++ )
- {
- UpdateArgInput( nOffset, i );
- }
- if(nEdFocus!=NOT_FOUND)
- {
- UpdateArgDesc( nEdFocus );
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- nActiveLine=nEdFocus+nOffset;
- ArgumentModified();
- }
- aScrollLink.Call(this);
-}
-
-void ParaWin::ArgumentModified()
-{
- aArgModifiedLink.Call(this);
-}
-
-void ParaWin::FxClick()
-{
- aFxLink.Call(this);
-}
-
-
-IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- nActiveLine=nEdFocus+nOffset;
- FxClick();
- }
- return 0;
-}
-
-IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- UpdateArgDesc( nEdFocus );
- nActiveLine=nEdFocus+nOffset;
- }
- return 0;
-}
-
-
-
-IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
-
- if(nEdFocus!=NOT_FOUND)
- {
- aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
- UpdateArgDesc( nEdFocus );
- nActiveLine=nEdFocus+nOffset;
- ArgumentModified();
- }
-
- return 0;
-}
-
-
-IMPL_LINK( ParaWin, ScrollHdl, ScrollBar*, EMPTYARG )
-{
- SliderMoved();
-
- return 0;
-}
-
-IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr )
-{
- USHORT nOffset = GetSliderPos();
- nEdFocus=NOT_FOUND;
- for ( USHORT nPos=0; nPos<5;nPos++)
- {
- if(pPtr == &aArgInput[nPos])
- {
- nEdFocus=nPos;
- break;
- }
- }
- if(nEdFocus!=NOT_FOUND)
- {
- aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal();
- UpdateArgDesc( nEdFocus);
- nActiveLine=nEdFocus+nOffset;
- }
-
- ArgumentModified();
- return 0;
-}
-
-
-
-} // formula
+/*************************************************************************
+ *
+ * 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: parawin.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_formula.hxx"
+
+
+
+//----------------------------------------------------------------------------
+
+#include <svtools/zforlist.hxx>
+#include <svtools/stritem.hxx>
+
+#include "parawin.hxx"
+#include "parawin.hrc"
+#include "helpids.hrc"
+#include "formula/formdata.hxx"
+#include "formula/IFunctionDescription.hxx"
+#include "ModuleHelper.hxx"
+#include "ForResId.hrc"
+
+#define VAR_ARGS 30
+namespace formula
+{
+//============================================================================
+
+ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos):
+ TabPage (pParent,ModuleRes(RID_FORMULATAB_PARAMETER)),
+ pFuncDesc ( NULL ),
+ pMyParent (_pDlg),
+ aFtEditDesc ( this, ModuleRes( FT_EDITDESC ) ),
+ aFtArgName ( this, ModuleRes( FT_PARNAME ) ),
+ aFtArgDesc ( this, ModuleRes( FT_PARDESC ) ),
+
+ aFtArg1 ( this, ModuleRes( FT_ARG1 ) ),
+ aFtArg2 ( this, ModuleRes( FT_ARG2 ) ),
+ aFtArg3 ( this, ModuleRes( FT_ARG3 ) ),
+ aFtArg4 ( this, ModuleRes( FT_ARG4 ) ),
+
+ aBtnFx1 ( this, ModuleRes( BTN_FX1 ) ),
+ aBtnFx2 ( this, ModuleRes( BTN_FX2 ) ),
+ aBtnFx3 ( this, ModuleRes( BTN_FX3 ) ),
+ aBtnFx4 ( this, ModuleRes( BTN_FX4 ) ),
+
+ aEdArg1 ( this, ModuleRes( ED_ARG1 ) ),
+ aEdArg2 ( this, ModuleRes( ED_ARG2 ) ),
+ aEdArg3 ( this, ModuleRes( ED_ARG3 ) ),
+ aEdArg4 ( this, ModuleRes( ED_ARG4 ) ),
+
+ aRefBtn1 ( this, ModuleRes( RB_ARG1 ) ),
+ aRefBtn2 ( this, ModuleRes( RB_ARG2 ) ),
+ aRefBtn3 ( this, ModuleRes( RB_ARG3 ) ),
+ aRefBtn4 ( this, ModuleRes( RB_ARG4 ) ),
+
+ aSlider ( this, ModuleRes( WND_SLIDER ) ),
+ m_sOptional ( ModuleRes( STR_OPTIONAL ) ),
+ m_sRequired ( ModuleRes( STR_REQUIRED ) ),
+ bRefMode (FALSE)
+{
+ Image aFxHC( ModuleRes( IMG_FX_H ) );
+ FreeResource();
+ aDefaultString=aFtEditDesc.GetText();
+
+ SetPosPixel(aPos);
+ nEdFocus=NOT_FOUND;
+ nActiveLine=0;
+ Size aSize = aSlider.GetSizePixel();
+ aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
+ aSlider.SetSizePixel( aSize );
+ aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
+ aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
+
+ aBtnFx1.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
+ aBtnFx2.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
+ aBtnFx3.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
+ aBtnFx4.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
+
+ InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1);
+ InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2);
+ InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3);
+ InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4);
+ ClearAll();
+}
+
+void ParaWin::UpdateArgDesc( USHORT nArg )
+{
+ if (nArg==NOT_FOUND) return;
+
+ if ( nArgs > 4 )
+ nArg = sal::static_int_cast<USHORT>( nArg + GetSliderPos() );
+ //@ nArg += (USHORT)aSlider.GetThumbPos();
+
+ if ( (nArgs > 0) && (nArg<nArgs) )
+ {
+ String aArgDesc;
+ String aArgName;
+
+ SetArgumentDesc( String() );
+ SetArgumentText( String() );
+
+ if ( nArgs < VAR_ARGS )
+ {
+ USHORT nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
+ aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
+ aArgName = pFuncDesc->getParameterName(nRealArg);
+ aArgName += ' ';
+ aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
+ }
+ else
+ {
+ USHORT nFix = nArgs - VAR_ARGS;
+ USHORT nPos = ( nArg < nFix ? nArg : nFix );
+ USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
+ aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
+ aArgDesc = pFuncDesc->getParameterDescription(nRealArg);
+ aArgName = pFuncDesc->getParameterName(nRealArg);
+ if ( nArg >= nFix )
+ aArgName += String::CreateFromInt32(nArg-nFix+1);
+ aArgName += ' ';
+
+ aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
+ }
+
+ SetArgumentDesc(aArgDesc);
+ SetArgumentText(aArgName);
+ }
+}
+
+void ParaWin::UpdateArgInput( USHORT nOffset, USHORT i )
+{
+ USHORT nArg = nOffset + i;
+ if ( nArgs < VAR_ARGS)
+ {
+ if(nArg<nArgs)
+ {
+ USHORT nRealArg = aVisibleArgMapping[nArg];
+ SetArgNameFont (i,(pFuncDesc->isParameterOptional(nRealArg))
+ ? aFntLight : aFntBold );
+ SetArgName (i,pFuncDesc->getParameterName(nRealArg));
+ }
+ }
+ else
+ {
+ USHORT nFix = nArgs - VAR_ARGS;
+ USHORT nPos = ( nArg < nFix ? nArg : nFix );
+ USHORT nRealArg = (nPos < aVisibleArgMapping.size() ?
+ aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
+ SetArgNameFont( i,
+ (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ?
+ aFntLight : aFntBold );
+ if ( nArg >= nFix )
+ {
+ String aArgName( pFuncDesc->getParameterName(nRealArg) );
+ aArgName += String::CreateFromInt32(nArg-nFix+1);
+ SetArgName( i, aArgName );
+ }
+ else
+ SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
+ }
+ if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]);
+ //@ aArgInput[i].SetArgVal( *(pArgArr[nOffset+i]) );
+
+}
+
+ParaWin::~ParaWin()
+{
+ // #i66422# if the focus changes during destruction of the controls,
+ // don't call the focus handlers
+ Link aEmptyLink;
+ aBtnFx1.SetGetFocusHdl( aEmptyLink );
+ aBtnFx2.SetGetFocusHdl( aEmptyLink );
+ aBtnFx3.SetGetFocusHdl( aEmptyLink );
+ aBtnFx4.SetGetFocusHdl( aEmptyLink );
+}
+
+USHORT ParaWin::GetActiveLine()
+{
+ return nActiveLine;
+}
+
+void ParaWin::SetActiveLine(USHORT no)
+{
+ if(no<nArgs)
+ {
+ long nOffset = GetSliderPos();
+ nActiveLine=no;
+ long nNewEdPos=(long)nActiveLine-nOffset;
+ if(nNewEdPos<0 || nNewEdPos>3)
+ {
+ nOffset+=nNewEdPos;
+ SetSliderPos((USHORT) nOffset);
+ nOffset=GetSliderPos();
+ }
+ nEdFocus=no-(USHORT)nOffset;
+ UpdateArgDesc( nEdFocus );
+ }
+}
+
+RefEdit* ParaWin::GetActiveEdit()
+{
+ if(nArgs>0 && nEdFocus!=NOT_FOUND)
+ {
+ return aArgInput[nEdFocus].GetArgEdPtr();
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+
+String ParaWin::GetArgument(USHORT no)
+{
+ String aStr;
+ if(no<aParaArray.size())
+ {
+ aStr=aParaArray[no];
+ if(no==nActiveLine && aStr.Len()==0)
+ aStr+=' ';
+ }
+ return aStr;
+}
+
+String ParaWin::GetActiveArgName()
+{
+ String aStr;
+ if(nArgs>0 && nEdFocus!=NOT_FOUND)
+ {
+ aStr=aArgInput[nEdFocus].GetArgName();
+ }
+ return aStr;
+}
+
+
+void ParaWin::SetArgument(USHORT no, const String& aString)
+{
+ if(no<aParaArray.size())
+ {
+ aParaArray[no] = aString;
+ aParaArray[no].EraseLeadingChars();
+ }
+}
+
+void ParaWin::DelParaArray()
+{
+ ::std::vector<String>().swap(aParaArray);
+}
+
+void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont)
+{
+ aFntBold=aBoldFont;
+ aFntLight=aLightFont;
+}
+
+void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
+{
+ pFuncDesc=pFDesc;
+
+ SetArgumentDesc( String() );
+ SetArgumentText( String() );
+ SetEditDesc( String() );
+ nArgs = 0;
+ if ( pFuncDesc!=NULL)
+ {
+ if ( pFuncDesc->getDescription().getLength() )
+ {
+ SetEditDesc(pFuncDesc->getDescription());
+ }
+ else
+ {
+ SetEditDesc(aDefaultString);
+ }
+ long nHelpId = pFuncDesc->getHelpId();
+ nArgs = pFuncDesc->getSuppressedArgumentCount();
+ pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping);
+ aSlider.Hide();
+ SetHelpId( nHelpId );
+ aEdArg1.SetHelpId( nHelpId );
+ aEdArg2.SetHelpId( nHelpId );
+ aEdArg3.SetHelpId( nHelpId );
+ aEdArg4.SetHelpId( nHelpId );
+
+ // Unique-IDs muessen gleich bleiben fuer Automatisierung
+ SetUniqueId( HID_FORMULA_FAP_PAGE );
+ aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 );
+ aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 );
+ aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 );
+ aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 );
+ SetActiveLine(0);
+ }
+ else
+ {
+ nActiveLine=0;
+ }
+
+}
+
+void ParaWin::SetArgumentText(const String& aText)
+{
+ aFtArgName.SetText(aText);
+}
+
+void ParaWin::SetArgumentDesc(const String& aText)
+{
+ aFtArgDesc.SetText(aText);
+}
+
+void ParaWin::SetEditDesc(const String& aText)
+{
+ aFtEditDesc.SetText(aText);
+}
+
+void ParaWin::SetArgName(USHORT no,const String& aText)
+{
+ aArgInput[no].SetArgName(aText);
+}
+
+void ParaWin::SetArgNameFont(USHORT no,const Font& aFont)
+{
+ aArgInput[no].SetArgNameFont(aFont);
+}
+
+void ParaWin::SetArgVal(USHORT no,const String& aText)
+{
+ aArgInput[no].SetArgVal(aText);
+}
+
+void ParaWin::HideParaLine(USHORT no)
+{
+ aArgInput[no].Hide();
+}
+
+void ParaWin::ShowParaLine(USHORT no)
+{
+ aArgInput[no].Show();
+}
+
+void ParaWin::SetEdFocus(USHORT no)
+{
+ UpdateArgDesc(no);
+ if(no<4 && no<aParaArray.size())
+ aArgInput[no].GetArgEdPtr()->GrabFocus();
+}
+
+
+void ParaWin::InitArgInput( USHORT nPos, FixedText& rFtArg, ImageButton& rBtnFx,
+ ArgEdit& rEdArg, RefButton& rRefBtn)
+{
+
+ rRefBtn.SetReferences(pMyParent,&rEdArg);
+ rEdArg.SetRefDialog(pMyParent);
+
+ aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
+
+ aArgInput[nPos].Hide();
+
+ aArgInput[nPos].SetFxClickHdl ( LINK( this, ParaWin, GetFxHdl ) );
+ aArgInput[nPos].SetFxFocusHdl ( LINK( this, ParaWin, GetFxFocusHdl ) );
+ aArgInput[nPos].SetEdFocusHdl ( LINK( this, ParaWin, GetEdFocusHdl ) );
+ aArgInput[nPos].SetEdModifyHdl ( LINK( this, ParaWin, ModifyHdl ) );
+}
+
+void ParaWin::ClearAll()
+{
+ SetFunctionDesc(NULL);
+ SetArgumentOffset(0);
+}
+
+void ParaWin::SetArgumentOffset(USHORT nOffset)
+{
+ DelParaArray();
+ aSlider.SetThumbPos(0);
+
+ aParaArray.resize(nArgs);
+
+ if ( nArgs > 0 )
+ {
+ for ( int i=0; i<4 && i<nArgs; i++ )
+ {
+ String aString;
+ aArgInput[i].SetArgVal(aString);
+ aArgInput[i].GetArgEdPtr()->Init(
+ (i==0) ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
+ (i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(),
+ aSlider, nArgs );
+ }
+ }
+
+ if ( nArgs < 5 )
+ {
+ aSlider.Hide();
+ }
+ else
+ {
+ //aSlider.SetEndScrollHdl( LINK( this, ScFormulaDlg, ScrollHdl ) );
+ aSlider.SetPageSize( 4 );
+ aSlider.SetVisibleSize( 4 );
+ aSlider.SetLineSize( 1 );
+ aSlider.SetRange( Range( 0, nArgs ) );
+ aSlider.SetThumbPos( nOffset );
+ aSlider.Show();
+ }
+
+ UpdateParas();
+}
+
+void ParaWin::UpdateParas()
+{
+ USHORT i;
+ USHORT nOffset = GetSliderPos();
+
+ if ( nArgs > 0 )
+ {
+ for ( i=0; (i<nArgs) && (i<4); i++ )
+ {
+ UpdateArgInput( nOffset, i );
+ ShowParaLine(i);
+ }
+ }
+
+ for ( i=nArgs; i<4; i++ ) HideParaLine(i);
+}
+
+
+USHORT ParaWin::GetSliderPos()
+{
+ return (USHORT) aSlider.GetThumbPos();
+}
+
+void ParaWin::SetSliderPos(USHORT nSliderPos)
+{
+ USHORT nOffset = GetSliderPos();
+
+ if(aSlider.IsVisible() && nOffset!=nSliderPos)
+ {
+ aSlider.SetThumbPos(nSliderPos);
+ for ( USHORT i=0; i<4; i++ )
+ {
+ UpdateArgInput( nSliderPos, i );
+ }
+ }
+}
+
+void ParaWin::SliderMoved()
+{
+ USHORT nOffset = GetSliderPos();
+
+ for ( USHORT i=0; i<4; i++ )
+ {
+ UpdateArgInput( nOffset, i );
+ }
+ if(nEdFocus!=NOT_FOUND)
+ {
+ UpdateArgDesc( nEdFocus );
+ aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
+ nActiveLine=nEdFocus+nOffset;
+ ArgumentModified();
+ }
+ aScrollLink.Call(this);
+}
+
+void ParaWin::ArgumentModified()
+{
+ aArgModifiedLink.Call(this);
+}
+
+void ParaWin::FxClick()
+{
+ aFxLink.Call(this);
+}
+
+
+IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr )
+{
+ USHORT nOffset = GetSliderPos();
+ nEdFocus=NOT_FOUND;
+ for ( USHORT nPos=0; nPos<5;nPos++)
+ {
+ if(pPtr == &aArgInput[nPos])
+ {
+ nEdFocus=nPos;
+ break;
+ }
+ }
+
+ if(nEdFocus!=NOT_FOUND)
+ {
+ aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
+ nActiveLine=nEdFocus+nOffset;
+ FxClick();
+ }
+ return 0;
+}
+
+IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr )
+{
+ USHORT nOffset = GetSliderPos();
+ nEdFocus=NOT_FOUND;
+ for ( USHORT nPos=0; nPos<5;nPos++)
+ {
+ if(pPtr == &aArgInput[nPos])
+ {
+ nEdFocus=nPos;
+ break;
+ }
+ }
+
+ if(nEdFocus!=NOT_FOUND)
+ {
+ aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
+ UpdateArgDesc( nEdFocus );
+ nActiveLine=nEdFocus+nOffset;
+ }
+ return 0;
+}
+
+
+
+IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr )
+{
+ USHORT nOffset = GetSliderPos();
+ nEdFocus=NOT_FOUND;
+ for ( USHORT nPos=0; nPos<5;nPos++)
+ {
+ if(pPtr == &aArgInput[nPos])
+ {
+ nEdFocus=nPos;
+ break;
+ }
+ }
+
+ if(nEdFocus!=NOT_FOUND)
+ {
+ aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
+ UpdateArgDesc( nEdFocus );
+ nActiveLine=nEdFocus+nOffset;
+ ArgumentModified();
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK( ParaWin, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ SliderMoved();
+
+ return 0;
+}
+
+IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr )
+{
+ USHORT nOffset = GetSliderPos();
+ nEdFocus=NOT_FOUND;
+ for ( USHORT nPos=0; nPos<5;nPos++)
+ {
+ if(pPtr == &aArgInput[nPos])
+ {
+ nEdFocus=nPos;
+ break;
+ }
+ }
+ if(nEdFocus!=NOT_FOUND)
+ {
+ aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal();
+ UpdateArgDesc( nEdFocus);
+ nActiveLine=nEdFocus+nOffset;
+ }
+
+ ArgumentModified();
+ return 0;
+}
+
+
+
+} // formula
diff --git a/formula/source/ui/inc/ForResId.hrc b/formula/source/ui/inc/ForResId.hrc
index 99ce947a0560..43444bb9a112 100644
--- a/formula/source/ui/inc/ForResId.hrc
+++ b/formula/source/ui/inc/ForResId.hrc
@@ -1,77 +1,77 @@
-/*************************************************************************
- *
- * 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: RptResId.hrc,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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef FORMULA_FORRESID_HRC
-#define FORMULA_FORRESID_HRC
-
-// include -----------------------------------------------------------
-
-#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
-#endif
-
-#define RID_DIALOG_START RID_FORMULA_START
-#define RID_PAGE_START RID_FORMULA_START
-#define RID_ERRORBOX_START RID_FORMULA_START
-#define RID_QUERYBOX_START RID_FORMULA_START
-#define RID_TOOLBOX_START RID_FORMULA_START
-#define RID_BITMAP_START RID_FORMULA_START
-#define RID_IMAGE_START RID_FORMULA_START
-#define RID_IMAGELIST_START RID_FORMULA_START
-#define RID_MENU_START RID_FORMULA_START
-#define RID_STRING_START RID_FORMULA_START
-#define RID_UNTYPED_START RID_FORMULA_START
-#define RID_WARN_START RID_FORMULA_START
-#define RID_CONTROL_START RID_FORMULA_START
-#define RID_MISC_START RID_FORMULA_START
-
-// Dialog Control Id's -----------------------------------------------------------
-
-// strings
-
-// bitmap
-#define RID_BMP_REFBTN1 (RID_BITMAP_START + 0)
-#define RID_BMP_REFBTN1_H (RID_BITMAP_START + 1)
-#define RID_BMP_REFBTN2 (RID_BITMAP_START + 2)
-#define RID_BMP_REFBTN2_H (RID_BITMAP_START + 3)
-
-
-// pages
-#define RID_FORMULATAB_STRUCT (RID_PAGE_START + 0)
-#define RID_FORMULATAB_FUNCTION (RID_PAGE_START + 1)
-#define RID_FORMULADLG_FORMULA (RID_PAGE_START + 2)
-#define RID_FORMULATAB_PARAMETER (RID_PAGE_START + 3)
-#define RID_FORMULADLG_FORMULA_MODAL (RID_PAGE_START + 4)
-
-// misc
-
-// -----------------------------------------------------------------------
-
-#endif // FORMULA_FORRESID_HRC
+/*************************************************************************
+ *
+ * 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: RptResId.hrc,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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef FORMULA_FORRESID_HRC
+#define FORMULA_FORRESID_HRC
+
+// include -----------------------------------------------------------
+
+#ifndef _SOLAR_HRC
+#include <svtools/solar.hrc>
+#endif
+
+#define RID_DIALOG_START RID_FORMULA_START
+#define RID_PAGE_START RID_FORMULA_START
+#define RID_ERRORBOX_START RID_FORMULA_START
+#define RID_QUERYBOX_START RID_FORMULA_START
+#define RID_TOOLBOX_START RID_FORMULA_START
+#define RID_BITMAP_START RID_FORMULA_START
+#define RID_IMAGE_START RID_FORMULA_START
+#define RID_IMAGELIST_START RID_FORMULA_START
+#define RID_MENU_START RID_FORMULA_START
+#define RID_STRING_START RID_FORMULA_START
+#define RID_UNTYPED_START RID_FORMULA_START
+#define RID_WARN_START RID_FORMULA_START
+#define RID_CONTROL_START RID_FORMULA_START
+#define RID_MISC_START RID_FORMULA_START
+
+// Dialog Control Id's -----------------------------------------------------------
+
+// strings
+
+// bitmap
+#define RID_BMP_REFBTN1 (RID_BITMAP_START + 0)
+#define RID_BMP_REFBTN1_H (RID_BITMAP_START + 1)
+#define RID_BMP_REFBTN2 (RID_BITMAP_START + 2)
+#define RID_BMP_REFBTN2_H (RID_BITMAP_START + 3)
+
+
+// pages
+#define RID_FORMULATAB_STRUCT (RID_PAGE_START + 0)
+#define RID_FORMULATAB_FUNCTION (RID_PAGE_START + 1)
+#define RID_FORMULADLG_FORMULA (RID_PAGE_START + 2)
+#define RID_FORMULATAB_PARAMETER (RID_PAGE_START + 3)
+#define RID_FORMULADLG_FORMULA_MODAL (RID_PAGE_START + 4)
+
+// misc
+
+// -----------------------------------------------------------------------
+
+#endif // FORMULA_FORRESID_HRC
diff --git a/formula/util/hidother.src b/formula/util/hidother.src
index e29c9e9341c7..0a4ac39bd04d 100644
--- a/formula/util/hidother.src
+++ b/formula/util/hidother.src
@@ -1,57 +1,57 @@
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: hidother.src,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#include "../inc/helpids.hrc"
-
-#ifndef _SBASLTID_HRC
-#include <svx/svxids.hrc>
-#endif
-
-hidspecial HID_FORMULADLG_FORMULA { HelpId = HID_FORMULADLG_FORMULA; };
-hidspecial HID_FORMULA_FAP_FORMULA { HelpId = HID_FORMULA_FAP_FORMULA; };
-hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
-hidspecial HID_FORMULA_FAP_PAGE { HelpId = HID_FORMULA_FAP_PAGE; };
-hidspecial HID_FORMULA_FAP_EDIT1 { HelpId = HID_FORMULA_FAP_EDIT1; };
-hidspecial HID_FORMULA_FAP_EDIT2 { HelpId = HID_FORMULA_FAP_EDIT2; };
-hidspecial HID_FORMULA_FAP_EDIT3 { HelpId = HID_FORMULA_FAP_EDIT3; };
-hidspecial HID_FORMULA_FAP_EDIT4 { HelpId = HID_FORMULA_FAP_EDIT4; };
-hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
-hidspecial HID_FORMULA_FAP_BTN_FX1 { HelpId = HID_FORMULA_FAP_BTN_FX1; };
-hidspecial HID_FORMULA_FAP_BTN_FX2 { HelpId = HID_FORMULA_FAP_BTN_FX2; };
-hidspecial HID_FORMULA_FAP_BTN_FX3 { HelpId = HID_FORMULA_FAP_BTN_FX3; };
-hidspecial HID_FORMULA_FAP_BTN_FX4 { HelpId = HID_FORMULA_FAP_BTN_FX4; };
-hidspecial HID_FORMULA_FAP_BTN_REF1 { HelpId = HID_FORMULA_FAP_BTN_REF1; };
-hidspecial HID_FORMULA_FAP_BTN_REF2 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
-hidspecial HID_FORMULA_FAP_BTN_REF3 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
-hidspecial HID_FORMULA_FAP_BTN_REF4 { HelpId = HID_FORMULA_FAP_BTN_REF4; };
-hidspecial HID_FORMULA_LB_CATEGORY { HelpId = HID_FORMULA_LB_CATEGORY; };
-hidspecial HID_FORMULA_LB_FUNCTION { HelpId = HID_FORMULA_LB_FUNCTION; };
-hidspecial HID_FORMULATAB_FUNCTION { HelpId = HID_FORMULATAB_FUNCTION; };
-hidspecial HID_FORMULATAB_STRUCT { HelpId = HID_FORMULATAB_STRUCT; };
+/*************************************************************************
+*
+ * 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: hidother.src,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "../inc/helpids.hrc"
+
+#ifndef _SBASLTID_HRC
+#include <svx/svxids.hrc>
+#endif
+
+hidspecial HID_FORMULADLG_FORMULA { HelpId = HID_FORMULADLG_FORMULA; };
+hidspecial HID_FORMULA_FAP_FORMULA { HelpId = HID_FORMULA_FAP_FORMULA; };
+hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
+hidspecial HID_FORMULA_FAP_PAGE { HelpId = HID_FORMULA_FAP_PAGE; };
+hidspecial HID_FORMULA_FAP_EDIT1 { HelpId = HID_FORMULA_FAP_EDIT1; };
+hidspecial HID_FORMULA_FAP_EDIT2 { HelpId = HID_FORMULA_FAP_EDIT2; };
+hidspecial HID_FORMULA_FAP_EDIT3 { HelpId = HID_FORMULA_FAP_EDIT3; };
+hidspecial HID_FORMULA_FAP_EDIT4 { HelpId = HID_FORMULA_FAP_EDIT4; };
+hidspecial HID_FORMULA_FAP_STRUCT { HelpId = HID_FORMULA_FAP_STRUCT; };
+hidspecial HID_FORMULA_FAP_BTN_FX1 { HelpId = HID_FORMULA_FAP_BTN_FX1; };
+hidspecial HID_FORMULA_FAP_BTN_FX2 { HelpId = HID_FORMULA_FAP_BTN_FX2; };
+hidspecial HID_FORMULA_FAP_BTN_FX3 { HelpId = HID_FORMULA_FAP_BTN_FX3; };
+hidspecial HID_FORMULA_FAP_BTN_FX4 { HelpId = HID_FORMULA_FAP_BTN_FX4; };
+hidspecial HID_FORMULA_FAP_BTN_REF1 { HelpId = HID_FORMULA_FAP_BTN_REF1; };
+hidspecial HID_FORMULA_FAP_BTN_REF2 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
+hidspecial HID_FORMULA_FAP_BTN_REF3 { HelpId = HID_FORMULA_FAP_BTN_REF3; };
+hidspecial HID_FORMULA_FAP_BTN_REF4 { HelpId = HID_FORMULA_FAP_BTN_REF4; };
+hidspecial HID_FORMULA_LB_CATEGORY { HelpId = HID_FORMULA_LB_CATEGORY; };
+hidspecial HID_FORMULA_LB_FUNCTION { HelpId = HID_FORMULA_LB_FUNCTION; };
+hidspecial HID_FORMULATAB_FUNCTION { HelpId = HID_FORMULATAB_FUNCTION; };
+hidspecial HID_FORMULATAB_STRUCT { HelpId = HID_FORMULATAB_STRUCT; };
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index efc41a6e35b8..b0e477d17d1f 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -1,1664 +1,1664 @@
-/*************************************************************************
- *
- * 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: acceleratorconfiguration.cxx,v $
- * $Revision: 1.7.204.12 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_framework.hxx"
-#include <accelerators/acceleratorconfiguration.hxx>
-
-//_______________________________________________
-// own includes
-#include <pattern/configuration.hxx>
-#include <accelerators/presethandler.hxx>
-
-#include <xml/saxnamespacefilter.hxx>
-#include <xml/acceleratorconfigurationreader.hxx>
-#include <xml/acceleratorconfigurationwriter.hxx>
-
-#include <threadhelp/readguard.hxx>
-#include <threadhelp/writeguard.hxx>
-
-#include <acceleratorconst.h>
-#include <services.h>
-
-//_______________________________________________
-// interface includes
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-//_______________________________________________
-// other includes
-#include <vcl/svapp.hxx>
-
-#ifndef __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_
-#include <accelerators/keymapping.hxx>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
-#include <com/sun/star/container/XNamed.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_
-#include <com/sun/star/awt/KeyEvent.hpp>
-#endif
-
-#ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
-#include <com/sun/star/awt/KeyModifier.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_
-#include <com/sun/star/util/XChangesNotifier.hpp>
-#endif
-
-#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
-#include <comphelper/configurationhelper.hxx>
-#endif
-
-#ifndef UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
-#include <unotools/configpathes.hxx>
-#endif
-
-#ifndef _RTL_LOGFILE_HXX_
-#include <rtl/logfile.hxx>
-#endif
-
-#include <svtools/acceleratorexecute.hxx>
-
-//_______________________________________________
-// const
-
-namespace framework
-{
-
-#ifdef fpc
- #error "Who exports this define? I use it as namespace alias ..."
-#else
- namespace fpc = ::framework::pattern::configuration;
-#endif
-
-//-----------------------------------------------
-// XInterface, XTypeProvider
-DEFINE_XINTERFACE_6(XMLBasedAcceleratorConfiguration ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
- DIRECT_INTERFACE(css::form::XReset ),
- DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
- DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
- DIRECT_INTERFACE(css::ui::XUIConfiguration ))
-
-DEFINE_XTYPEPROVIDER_6(XMLBasedAcceleratorConfiguration ,
- css::lang::XTypeProvider ,
- css::ui::XAcceleratorConfiguration ,
- css::form::XReset ,
- css::ui::XUIConfigurationPersistence,
- css::ui::XUIConfigurationStorage ,
- css::ui::XUIConfiguration )
-
-//-----------------------------------------------
-XMLBasedAcceleratorConfiguration::XMLBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xSMGR (xSMGR )
- , m_aPresetHandler(xSMGR )
- , m_pWriteCache (0 )
-{
-}
-
-//-----------------------------------------------
-XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()
-{
- LOG_ASSERT(!m_pWriteCache, "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()\nChanges not flushed. Ignore it ...")
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getAllKeyEvents()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- AcceleratorCache::TKeyList lKeys = rCache.getAllKeys();
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::rtl::OUString SAL_CALL XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- if (!rCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
- return rCache.getCommandByKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
- const ::rtl::OUString& sCommand )
- throw(css::lang::IllegalArgumentException,
- css::uno::RuntimeException )
-{
- if (
- (aKeyEvent.KeyCode == 0) &&
- (aKeyEvent.KeyChar == 0) &&
- (aKeyEvent.KeyFunc == 0) &&
- (aKeyEvent.Modifiers == 0)
- )
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
- rCache.setKeyCommandPair(aKeyEvent, sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
-throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // true => force using of a writeable cache
- if (!rCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
- rCache.removeKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG();
- if (!rCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(sCommand);
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
- throw(css::lang::IllegalArgumentException ,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Int32 i = 0;
- sal_Int32 c = lCommandList.getLength();
- css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
- AcceleratorCache& rCache = impl_getCFG();
-
- for (i=0; i<c; ++i)
- {
- const ::rtl::OUString& rCommand = lCommandList[i];
- if (!rCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- (sal_Int16)i);
-
- if (!rCache.hasCommand(rCommand))
- continue;
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
- continue;
-
- css::uno::Any& rAny = lPreferredOnes[i];
- rAny <<= *(lKeys.begin());
- }
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- return lPreferredOnes;
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
- if (!rCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
- static_cast< ::cppu::OWeakObject* >(this));
- rCache.removeCommand(sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::reload()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- css::uno::Reference< css::io::XStream > xStreamNoLang;
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- try
- {
- xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), sal_True);
- }
- catch(const css::io::IOException&) {} // does not have to exist
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XInputStream > xIn;
- if (xStream.is())
- xIn = xStream->getInputStream();
- if (!xIn.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for reading."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- // impl_ts_load() does not clear the cache
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
- m_aReadCache = AcceleratorCache();
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- impl_ts_load(xIn);
-
- // Load also the general language independent default accelerators
- // (ignoring the already defined accelerators)
- if (xStreamNoLang.is())
- {
- xIn = xStreamNoLang->getInputStream();
- if (xIn.is())
- impl_ts_load(xIn);
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::store()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
-
- if (!xOut.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- impl_ts_save(xOut);
-
- xOut.clear();
- xStream.clear();
-
- m_aPresetHandler.commitUserChanges();
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback(
- xStorage,
- PresetHandler::TARGET_CURRENT(),
- css::embed::ElementModes::READWRITE,
- sal_False); // False => no fallback from read/write to readonly!
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
-
- if (!xOut.is())
- throw css::io::IOException(
- ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- impl_ts_save(xOut);
-
- // TODO inform listener about success, so it can flush the root and sub storage of this stream!
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isModified()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- return (m_pWriteCache != 0);
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XOutputStream > xOut;
- if (xStream.is())
- xOut = xStream->getOutputStream();
- return !(xOut.is());
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::hasStorage()
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::reset()
-throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
- m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT());
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- reload();
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XMLBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XMLBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-// IStorageListener
-void XMLBasedAcceleratorConfiguration::changesOccured(const ::rtl::OUString& /*sPath*/)
-{
- reload();
-}
-
-//-----------------------------------------------
-void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- if (m_pWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pWriteCache;
- m_pWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
- if (xSeek.is())
- xSeek->seek(0);
-
- // add accelerators to the cache (the cache is not cleared)
- // SAFE -> ----------------------------------
- aWriteLock.lock();
-
- // create the parser queue
- // Note: Use special filter object between parser and reader
- // to get filtered xml with right namespaces ...
- // Use further a temp cache for reading!
- AcceleratorConfigurationReader* pReader = new AcceleratorConfigurationReader(m_aReadCache);
- css::uno::Reference< css::xml::sax::XDocumentHandler > xReader (static_cast< ::cppu::OWeakObject* >(pReader), css::uno::UNO_QUERY_THROW);
- SaxNamespaceFilter* pFilter = new SaxNamespaceFilter(xReader);
- css::uno::Reference< css::xml::sax::XDocumentHandler > xFilter (static_cast< ::cppu::OWeakObject* >(pFilter), css::uno::UNO_QUERY_THROW);
-
- // connect parser, filter and stream
- css::uno::Reference< css::xml::sax::XParser > xParser(xSMGR->createInstance(SERVICENAME_SAXPARSER), css::uno::UNO_QUERY_THROW);
- xParser->setDocumentHandler(xFilter);
-
- css::xml::sax::InputSource aSource;
- aSource.aInputStream = xStream;
-
- // TODO think about error handling
- xParser->parseStream(aSource);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache aCache;
- sal_Bool bChanged = (m_pWriteCache != 0);
- if (bChanged)
- aCache.takeOver(*m_pWriteCache);
- else
- aCache.takeOver(m_aReadCache);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::io::XTruncate > xClearable(xStream, css::uno::UNO_QUERY_THROW);
- xClearable->truncate();
-
- // TODO can be removed if seek(0) is done by truncate() automaticly!
- css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
- if (xSeek.is())
- xSeek->seek(0);
-
- // combine writer/cache/stream etcpp.
- css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW);
- xDataSource->setOutputStream(xStream);
-
- // write into the stream
- AcceleratorConfigurationWriter aWriter(aCache, xWriter);
- aWriter.flush();
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- // take over all changes into the readonly cache ...
- // and forget the copy-on-write copied cache
- if (bChanged)
- {
- m_aReadCache.takeOver(*m_pWriteCache);
- // live with reentrance .-)
- AcceleratorCache* pTemp = m_pWriteCache;
- m_pWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteAccessRequested)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pWriteCache )
- )
- {
- m_pWriteCache = new AcceleratorCache(m_aReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pWriteCache)
- return *m_pWriteCache;
- else
- return m_aReadCache;
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::comphelper::Locale XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
-{
- static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
- static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
- static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- ::rtl::OUString sISOLocale;
- xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
-
- if (!sISOLocale.getLength())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
-}
-
-/*******************************************************************************
-*
-* XCU based accelerator configuration
-*
-*******************************************************************************/
-
-//-----------------------------------------------
-// XInterface, XTypeProvider
-DEFINE_XINTERFACE_7(XCUBasedAcceleratorConfiguration ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
- DIRECT_INTERFACE(css::util::XChangesListener ),
- DIRECT_INTERFACE(css::form::XReset ),
- DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
- DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
- DIRECT_INTERFACE(css::ui::XUIConfiguration ))
-
- DEFINE_XTYPEPROVIDER_7(XCUBasedAcceleratorConfiguration ,
- css::lang::XTypeProvider ,
- css::ui::XAcceleratorConfiguration ,
- css::util::XChangesListener ,
- css::form::XReset ,
- css::ui::XUIConfigurationPersistence,
- css::ui::XUIConfigurationStorage ,
- css::ui::XUIConfiguration )
-
-//-----------------------------------------------
-XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
- : ThreadHelpBase (&Application::GetSolarMutex())
- , m_xSMGR (xSMGR )
- , m_pPrimaryWriteCache(0 )
- , m_pSecondaryWriteCache(0 )
-{
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
-}
-
-//-----------------------------------------------
-XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration()
-{
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents()
- throw(css::uno::RuntimeException)
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set
-
- AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(sal_False).getAllKeys(); //get keys from SecondaryKeys set
- AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt )
- lKeys.push_back(*pIt);
-
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::rtl::OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
-
- if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasKey(aKeyEvent))
- return rPrimaryCache.getCommandByKey(aKeyEvent);
- else
- return rSecondaryCache.getCommandByKey(aKeyEvent);
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
- const ::rtl::OUString& sCommand )
- throw(css::lang::IllegalArgumentException,
- css::uno::RuntimeException )
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::setKeyEvent" );
-
- if (
- (aKeyEvent.KeyCode == 0) &&
- (aKeyEvent.KeyChar == 0) &&
- (aKeyEvent.KeyFunc == 0) &&
- (aKeyEvent.Modifiers == 0)
- )
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // TRUE => force getting of a writeable cache!
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // TRUE => force getting of a writeable cache!
-
- if ( rPrimaryCache.hasKey(aKeyEvent) )
- {
- ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if ( sCommand != sOriginalCommand )
- {
- if (rSecondaryCache.hasCommand(sOriginalCommand))
- {
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
- rSecondaryCache.removeKey(lSecondaryKeys[0]);
- rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
- }
-
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- else if ( rSecondaryCache.hasKey(aKeyEvent) )
- {
- ::rtl::OUString sOriginalCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
- if (sCommand != sOriginalCommand)
- {
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rSecondaryCache.removeKey(aKeyEvent);
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- else
- {
- if (rPrimaryCache.hasCommand(sCommand))
- {
- AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
- rPrimaryCache.removeKey(lPrimaryKeys[0]);
- rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
- }
-
- rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::setKeyEvent" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
- throw(css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
-
- if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasKey(aKeyEvent))
- {
- ::rtl::OUString sDelCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if (sDelCommand.getLength() > 0)
- {
- ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
- if (rSecondaryCache.hasCommand(sOriginalCommand))
- {
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
- rSecondaryCache.removeKey(lSecondaryKeys[0]);
- rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
- }
-
- rPrimaryCache.removeKey(aKeyEvent);
- }
-
- }
- else
- {
- ::rtl::OUString sDelCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
- if (sDelCommand.getLength() > 0)
- rSecondaryCache.removeKey(aKeyEvent);
- }
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 1);
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
-
- if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString(),
- static_cast< ::cppu::OWeakObject* >(this));
-
- AcceleratorCache::TKeyList lKeys = rPrimaryCache.getKeysByCommand(sCommand);
-
- AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sCommand);
- AcceleratorCache::TKeyList::const_iterator pIt;
- for (pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt)
- lKeys.push_back(*pIt);
-
- return lKeys.getAsConstList();
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys)
-{
- AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lKeys.begin ();
- pIt != lKeys.end ();
- ++pIt )
- {
- const css::awt::KeyEvent& rAWTKey = *pIt;
- const KeyCode aVCLKey = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey);
- const String sName = aVCLKey.GetName();
-
- if (sName.Len () > 0)
- return pIt;
- }
-
- return lKeys.end ();
-}
-
-//-----------------------------------------------
-css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
- throw(css::lang::IllegalArgumentException ,
- css::uno::RuntimeException )
-{
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Int32 i = 0;
- sal_Int32 c = lCommandList.getLength();
- css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
- AcceleratorCache& rCache = impl_getCFG(sal_True);
-
- for (i=0; i<c; ++i)
- {
- const ::rtl::OUString& rCommand = lCommandList[i];
- if (!rCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- (sal_Int16)i);
-
- if (!rCache.hasCommand(rCommand))
- continue;
-
- AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
- if (lKeys.size()<1)
- continue;
-
- AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys);
- if (pPreferredKey != lKeys.end ())
- {
- css::uno::Any& rAny = lPreferredOnes[i];
- rAny <<= *(pPreferredKey);
- }
- }
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- return lPreferredOnes;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
- throw(css::lang::IllegalArgumentException ,
- css::container::NoSuchElementException,
- css::uno::RuntimeException )
-{
- if (!sCommand.getLength())
- throw css::lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
- static_cast< ::cppu::OWeakObject* >(this),
- 0);
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
- AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
-
- if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
- throw css::container::NoSuchElementException(
- ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
- static_cast< ::cppu::OWeakObject* >(this));
-
- if (rPrimaryCache.hasCommand(sCommand))
- rPrimaryCache.removeCommand(sCommand);
- if (rSecondaryCache.hasCommand(sCommand))
- rSecondaryCache.removeCommand(sCommand);
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::reload()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::reload()" );
-
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- sal_Bool bPreferred;
- css::uno::Reference< css::container::XNameAccess > xAccess;
-
- bPreferred = sal_True;
- m_aPrimaryReadCache = AcceleratorCache();
- if (m_pPrimaryWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pPrimaryWriteCache;
- m_pPrimaryWriteCache = 0;
- delete pTemp;
- }
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- impl_ts_load(bPreferred, xAccess); // load the preferred keys
-
- bPreferred = sal_False;
- m_aSecondaryReadCache = AcceleratorCache();
- if (m_pSecondaryWriteCache)
- {
- // be aware of reentrance problems - use temp variable for calling delete ... :-)
- AcceleratorCache* pTemp = m_pSecondaryWriteCache;
- m_pSecondaryWriteCache = 0;
- delete pTemp;
- }
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
- impl_ts_load(bPreferred, xAccess); // load the secondary keys
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::reload()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::store()
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::store()" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
-
- sal_Bool bPreferred;
- css::uno::Reference< css::container::XNameAccess > xAccess;
-
- bPreferred = sal_True;
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- impl_ts_save(bPreferred, xAccess);
-
- bPreferred = sal_False;
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
- impl_ts_save(bPreferred, xAccess);
-
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::store()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::Exception ,
- css::uno::RuntimeException)
-{
- // todo implement me
- // use m_aCache + old AcceleratorXMLWriter to store data directly on storage given as parameter ...
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isModified()
- throw(css::uno::RuntimeException)
-{
- return sal_False;
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isReadOnly()
- throw(css::uno::RuntimeException)
-{
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
-}
-
-//-----------------------------------------------
-::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::hasStorage()
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
- return sal_False;
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::reset()
- throw(css::uno::RuntimeException)
-{
- css::uno::Reference< css::container::XNamed > xNamed(m_xCfg, css::uno::UNO_QUERY);
- ::rtl::OUString sConfig = xNamed->getName();
- if ( sConfig.equalsAscii("Global") )
- {
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
- XCUBasedAcceleratorConfiguration::reload();
- }
- else if ( sConfig.equalsAscii("Modules") )
- {
- m_xCfg = css::uno::Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
- css::uno::UNO_QUERY );
- XCUBasedAcceleratorConfiguration::reload();
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
- throw(css::uno::RuntimeException)
-{
- LOG_WARNING("XCUBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util::ChangesEvent& aEvent)
- throw(css::uno::RuntimeException)
-{
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::changesOccurred()" );
-
- css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess;
- aEvent.Base >>= xHAccess;
- if (! xHAccess.is ())
- return;
-
- const sal_Int32 c = aEvent.Changes.getLength();
- sal_Int32 i = 0;
-
- for (i=0; i<c; ++i)
- {
- const css::util::ElementChange& aChange = aEvent.Changes[i];
-
- // Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will
- // be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-)
- // So we try to split the path into 3 parts (module isnt important here, because we already know it ... because
- // these instance is bound to a specific module configuration ... or it''s the global configuration where no module is given at all.
-
- ::rtl::OUString sOrgPath ;
- ::rtl::OUString sPath ;
- ::rtl::OUString sKey;
-
- aChange.Accessor >>= sOrgPath;
- sPath = sOrgPath;
- ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
-
- ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
-
- if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
- {
- ::rtl::OUString sModule;
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
- }
- else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
- {
- ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
- ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']");
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
- }
- }
-
- RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::changesOccurred()" );
-}
-
-//-----------------------------------------------
-void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::EventObject& /*aSource*/)
- throw(css::uno::RuntimeException)
-{
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
-{
- AcceleratorCache aReadCache = AcceleratorCache();
- css::uno::Reference< css::container::XNameAccess > xAccess;
- if (m_sGlobalOrModules.equalsAscii("Global"))
- xCfg->getByName(CFG_ENTRY_GLOBAL) >>= xAccess;
- else if (m_sGlobalOrModules.equalsAscii("Modules"))
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xCfg->getByName(CFG_ENTRY_MODULES) >>= xModules;
- xModules->getByName(m_sModuleCFG) >>= xAccess;
- }
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameAccess > xCommand;
- if (xAccess.is())
- {
- css::uno::Sequence< ::rtl::OUString > lKeys = xAccess->getElementNames();
- sal_Int32 nKeys = lKeys.getLength();
- for ( sal_Int32 i=0; i<nKeys; ++i )
- {
- ::rtl::OUString sKey = lKeys[i];
- xAccess->getByName(sKey) >>= xKey;
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
-
- css::uno::Sequence< ::rtl::OUString > lLocales = xCommand->getElementNames();
- sal_Int32 nLocales = lLocales.getLength();
- ::std::vector< ::rtl::OUString > aLocales;
- for ( sal_Int32 j=0; j<nLocales; ++j )
- aLocales.push_back(lLocales[j]);
-
- ::std::vector< ::rtl::OUString >::const_iterator pFound;
- for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
- {
- if ( *pFound == impl_ts_getLocale().toISO() )
- break;
- }
-
- if ( pFound == aLocales.end() )
- {
- ::rtl::OUString sDefaultLocale = ::rtl::OUString::createFromAscii("en-US");
- for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
- {
- if ( *pFound == sDefaultLocale )
- break;
- }
-
- if ( pFound == aLocales.end() )
- continue;
- }
-
- ::rtl::OUString sLocale = *pFound;
- ::rtl::OUString sCommand;
- xCommand->getByName(sLocale) >>= sCommand;
- if (sCommand.getLength()<1)
- continue;
-
- KeyMapping aKeyMapping;
- css::awt::KeyEvent aKeyEvent;
-
- sal_Int32 nIndex = 0;
- ::rtl::OUString sKeyCommand = sKey.getToken(0, '_', nIndex);
- ::rtl::OUString sPrefix = ::rtl::OUString::createFromAscii("KEY_");
- aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(sPrefix + sKeyCommand);
-
- css::uno::Sequence< ::rtl::OUString > sToken(4);
- const sal_Int32 nToken = 4;
- sal_Bool bValid = sal_True;
- sal_Int32 k;
- for (k=0; k<nToken; ++k)
- {
- if (nIndex < 0)
- break;
-
- sToken[k] = sKey.getToken(0, '_', nIndex);
- ::rtl::OUString sTest = sToken[k];
- if (sToken[k].getLength() < 1)
- {
- bValid = sal_False;
- break;
- }
-
- if (sToken[k].equalsAscii("SHIFT"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
- else if (sToken[k].equalsAscii("MOD1"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
- else if (sToken[k].equalsAscii("MOD2"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- else
- {
- bValid = sal_False;
- break;
- }
- }
-
- if ( !aReadCache.hasKey(aKeyEvent) && bValid && k<nToken)
- aReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- }
-
- if (bPreferred)
- m_aPrimaryReadCache.takeOver(aReadCache);
- else
- m_aSecondaryReadCache.takeOver(aReadCache);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& /*xCfg*/)
-{
- if (bPreferred)
- {
- AcceleratorCache::TKeyList::const_iterator pIt;
- AcceleratorCache::TKeyList lPrimaryReadKeys = m_aPrimaryReadCache.getAllKeys();
- AcceleratorCache::TKeyList lPrimaryWriteKeys = m_pPrimaryWriteCache->getAllKeys();
-
- for ( pIt = lPrimaryReadKeys.begin(); pIt != lPrimaryReadKeys.end(); ++pIt )
- {
- if (!m_pPrimaryWriteCache->hasKey(*pIt))
- removeKeyFromConfiguration(*pIt, sal_True);
- }
-
- for ( pIt = lPrimaryWriteKeys.begin(); pIt != lPrimaryWriteKeys.end(); ++pIt )
- {
- ::rtl::OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(*pIt);
- if (!m_aPrimaryReadCache.hasKey(*pIt))
- {
- insertKeyToConfiguration(*pIt, sCommand, sal_True);
- }
- else
- {
- ::rtl::OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(*pIt);
- if (sReadCommand != sCommand)
- insertKeyToConfiguration(*pIt, sCommand, sal_True);
- }
- }
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (m_pPrimaryWriteCache)
- {
- m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
- AcceleratorCache* pTemp = m_pPrimaryWriteCache;
- m_pPrimaryWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
- }
-
- else
- {
- AcceleratorCache::TKeyList::const_iterator pIt;
- AcceleratorCache::TKeyList lSecondaryReadKeys = m_aSecondaryReadCache.getAllKeys();
- AcceleratorCache::TKeyList lSecondaryWriteKeys = m_pSecondaryWriteCache->getAllKeys();
-
- for ( pIt = lSecondaryReadKeys.begin(); pIt != lSecondaryReadKeys.end(); ++pIt)
- {
- if (!m_pSecondaryWriteCache->hasKey(*pIt))
- removeKeyFromConfiguration(*pIt, sal_False);
- }
-
-
- for ( pIt = lSecondaryWriteKeys.begin(); pIt != lSecondaryWriteKeys.end(); ++pIt )
- {
- ::rtl::OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(*pIt);
- if (!m_aSecondaryReadCache.hasKey(*pIt))
- {
- insertKeyToConfiguration(*pIt, sCommand, sal_False);
- }
- else
- {
- ::rtl::OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(*pIt);
- if (sReadCommand != sCommand)
- insertKeyToConfiguration(*pIt, sCommand, sal_False);
- }
- }
-
- // take over all changes into the original container
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (m_pSecondaryWriteCache)
- {
- m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
- AcceleratorCache* pTemp = m_pSecondaryWriteCache;
- m_pSecondaryWriteCache = 0;
- delete pTemp;
- }
-
- aWriteLock.unlock();
- // <- SAFE ----------------------------------
- }
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
- css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
- css::uno::Reference< css::uno::XInterface > xInst;
-
- if ( bPreferred )
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- else
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
-
- if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
- {
- css::uno::Reference< css::container::XNameContainer > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(m_sModuleCFG) )
- {
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xModules, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- xModules->insertByName(m_sModuleCFG, css::uno::makeAny(xInst));
- }
- xModules->getByName(m_sModuleCFG) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameContainer > xCommand;
- if ( !xContainer->hasByName(sKey) )
- {
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xContainer, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- xContainer->insertByName(sKey, css::uno::makeAny(xInst));
- }
- xContainer->getByName(sKey) >>= xKey;
-
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
- if ( !xCommand->hasByName(sLocale) )
- xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
- else
- xCommand->replaceByName(sLocale, css::uno::makeAny(sCommand));
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
-
- if ( bPreferred )
- m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
- else
- m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
-
- if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(m_sModuleCFG) )
- return;
- xModules->getByName(m_sModuleCFG) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
-
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
- sKey += ::rtl::OUString::createFromAscii("_SHIFT");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
- sKey += ::rtl::OUString::createFromAscii("_MOD1");
- if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
- sKey += ::rtl::OUString::createFromAscii("_MOD2");
-
- xContainer->removeByName(sKey);
-}
-
-//-----------------------------------------------
-void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey )
-{
- css::uno::Reference< css::container::XNameAccess > xAccess;
- css::uno::Reference< css::container::XNameContainer > xContainer;
-
- m_xCfg->getByName(sPrimarySecondary) >>= xAccess;
- if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
- xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
- else
- {
- css::uno::Reference< css::container::XNameAccess > xModules;
- xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
- if ( !xModules->hasByName(sModule) )
- return;
- xModules->getByName(sModule) >>= xContainer;
- }
-
- KeyMapping aKeyMapping;
- css::awt::KeyEvent aKeyEvent;
- ::rtl::OUString sKeyIdentifier;
-
- sal_Int32 nIndex = 0;
- sKeyIdentifier = sKey.getToken(0, '_', nIndex);
- aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(::rtl::OUString::createFromAscii("KEY_")+sKeyIdentifier);
-
- css::uno::Sequence< ::rtl::OUString > sToken(3);
- const sal_Int32 nToken = 3;
- for (sal_Int32 i=0; i<nToken; ++i)
- {
- if ( nIndex < 0 )
- break;
-
- sToken[i] = sKey.getToken(0, '_', nIndex);
- if (sToken[i].equalsAscii("SHIFT"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
- else if (sToken[i].equalsAscii("MOD1"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
- else if (sToken[i].equalsAscii("MOD2"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- }
-
- css::uno::Reference< css::container::XNameAccess > xKey;
- css::uno::Reference< css::container::XNameAccess > xCommand;
- ::rtl::OUString sCommand;
-
- if (xContainer->hasByName(sKey))
- {
- ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
- xContainer->getByName(sKey) >>= xKey;
- xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- xCommand->getByName(sLocale) >>= sCommand;
- }
-
- if (sPrimarySecondary.equals(CFG_ENTRY_PRIMARY))
- {
- if (sCommand.getLength() ==0)
- m_aPrimaryReadCache.removeKey(aKeyEvent);
- else
- m_aPrimaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
- else if (sPrimarySecondary.equals(CFG_ENTRY_SECONDARY))
- {
- if (sCommand.getLength() ==0)
- m_aSecondaryReadCache.removeKey(aKeyEvent);
- else
- m_aSecondaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
- }
-}
-
-//-----------------------------------------------
-AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested)
-{
- // SAFE -> ----------------------------------
- WriteGuard aWriteLock(m_aLock);
-
- if (bPreferred)
- {
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pPrimaryWriteCache )
- )
- {
- m_pPrimaryWriteCache = new AcceleratorCache(m_aPrimaryReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pPrimaryWriteCache)
- return *m_pPrimaryWriteCache;
- else
- return m_aPrimaryReadCache;
- }
-
- else
- {
- //create copy of our readonly-cache, if write access is forced ... but
- //not still possible!
- if (
- (bWriteAccessRequested) &&
- (!m_pSecondaryWriteCache )
- )
- {
- m_pSecondaryWriteCache = new AcceleratorCache(m_aSecondaryReadCache);
- }
-
- // in case, we have a writeable cache, we use it for reading too!
- // Otherwhise the API user cant find its own changes ...
- if (m_pSecondaryWriteCache)
- return *m_pSecondaryWriteCache;
- else
- return m_aSecondaryReadCache;
- }
-
- // <- SAFE ----------------------------------
-}
-
-//-----------------------------------------------
-::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
-{
- static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
- static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
- static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
-
- // SAFE -> ----------------------------------
- ReadGuard aReadLock(m_aLock);
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
- aReadLock.unlock();
- // <- SAFE ----------------------------------
-
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
- css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
- ::rtl::OUString sISOLocale;
- xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
-
- if (!sISOLocale.getLength())
- return ::comphelper::Locale::EN_US();
- return ::comphelper::Locale(sISOLocale);
-}
-
-} // namespace framework
+/*************************************************************************
+ *
+ * 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: acceleratorconfiguration.cxx,v $
+ * $Revision: 1.7.204.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_framework.hxx"
+#include <accelerators/acceleratorconfiguration.hxx>
+
+//_______________________________________________
+// own includes
+#include <pattern/configuration.hxx>
+#include <accelerators/presethandler.hxx>
+
+#include <xml/saxnamespacefilter.hxx>
+#include <xml/acceleratorconfigurationreader.hxx>
+#include <xml/acceleratorconfigurationwriter.hxx>
+
+#include <threadhelp/readguard.hxx>
+#include <threadhelp/writeguard.hxx>
+
+#include <acceleratorconst.h>
+#include <services.h>
+
+//_______________________________________________
+// interface includes
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+//_______________________________________________
+// other includes
+#include <vcl/svapp.hxx>
+
+#ifndef __FRAMEWORK_ACCELERATORS_KEYMAPPING_HXX_
+#include <accelerators/keymapping.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
+#include <com/sun/star/container/XNamed.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#endif
+
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#include <comphelper/configurationhelper.hxx>
+#endif
+
+#ifndef UNOTOOLS_CONFIGPATHES_HXX_INCLUDED
+#include <unotools/configpathes.hxx>
+#endif
+
+#ifndef _RTL_LOGFILE_HXX_
+#include <rtl/logfile.hxx>
+#endif
+
+#include <svtools/acceleratorexecute.hxx>
+
+//_______________________________________________
+// const
+
+namespace framework
+{
+
+#ifdef fpc
+ #error "Who exports this define? I use it as namespace alias ..."
+#else
+ namespace fpc = ::framework::pattern::configuration;
+#endif
+
+//-----------------------------------------------
+// XInterface, XTypeProvider
+DEFINE_XINTERFACE_6(XMLBasedAcceleratorConfiguration ,
+ OWeakObject ,
+ DIRECT_INTERFACE(css::lang::XTypeProvider ),
+ DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
+ DIRECT_INTERFACE(css::form::XReset ),
+ DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
+ DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
+ DIRECT_INTERFACE(css::ui::XUIConfiguration ))
+
+DEFINE_XTYPEPROVIDER_6(XMLBasedAcceleratorConfiguration ,
+ css::lang::XTypeProvider ,
+ css::ui::XAcceleratorConfiguration ,
+ css::form::XReset ,
+ css::ui::XUIConfigurationPersistence,
+ css::ui::XUIConfigurationStorage ,
+ css::ui::XUIConfiguration )
+
+//-----------------------------------------------
+XMLBasedAcceleratorConfiguration::XMLBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
+ : ThreadHelpBase (&Application::GetSolarMutex())
+ , m_xSMGR (xSMGR )
+ , m_aPresetHandler(xSMGR )
+ , m_pWriteCache (0 )
+{
+}
+
+//-----------------------------------------------
+XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()
+{
+ LOG_ASSERT(!m_pWriteCache, "XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration()\nChanges not flushed. Ignore it ...")
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getAllKeyEvents()
+ throw(css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG();
+ AcceleratorCache::TKeyList lKeys = rCache.getAllKeys();
+ return lKeys.getAsConstList();
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+::rtl::OUString SAL_CALL XMLBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG();
+ if (!rCache.hasKey(aKeyEvent))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+ return rCache.getCommandByKey(aKeyEvent);
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
+ const ::rtl::OUString& sCommand )
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException )
+{
+ if (
+ (aKeyEvent.KeyCode == 0) &&
+ (aKeyEvent.KeyChar == 0) &&
+ (aKeyEvent.KeyFunc == 0) &&
+ (aKeyEvent.Modifiers == 0)
+ )
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 0);
+
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 1);
+
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
+ rCache.setKeyCommandPair(aKeyEvent, sCommand);
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG(sal_True); // true => force using of a writeable cache
+ if (!rCache.hasKey(aKeyEvent))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+ rCache.removeKey(aKeyEvent);
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XMLBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 1);
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG();
+ if (!rCache.hasCommand(sCommand))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(sCommand);
+ return lKeys.getAsConstList();
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
+ throw(css::lang::IllegalArgumentException ,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ sal_Int32 i = 0;
+ sal_Int32 c = lCommandList.getLength();
+ css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
+ AcceleratorCache& rCache = impl_getCFG();
+
+ for (i=0; i<c; ++i)
+ {
+ const ::rtl::OUString& rCommand = lCommandList[i];
+ if (!rCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ (sal_Int16)i);
+
+ if (!rCache.hasCommand(rCommand))
+ continue;
+
+ AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
+ if (lKeys.size()<1)
+ continue;
+
+ css::uno::Any& rAny = lPreferredOnes[i];
+ rAny <<= *(lKeys.begin());
+ }
+
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ return lPreferredOnes;
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 0);
+
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rCache = impl_getCFG(sal_True); // TRUE => force getting of a writeable cache!
+ if (!rCache.hasCommand(sCommand))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
+ static_cast< ::cppu::OWeakObject* >(this));
+ rCache.removeCommand(sCommand);
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::reload()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ css::uno::Reference< css::io::XStream > xStreamNoLang;
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
+ try
+ {
+ xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), sal_True);
+ }
+ catch(const css::io::IOException&) {} // does not have to exist
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::io::XInputStream > xIn;
+ if (xStream.is())
+ xIn = xStream->getInputStream();
+ if (!xIn.is())
+ throw css::io::IOException(
+ ::rtl::OUString::createFromAscii("Could not open accelerator configuration for reading."),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ // impl_ts_load() does not clear the cache
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+ m_aReadCache = AcceleratorCache();
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+
+ impl_ts_load(xIn);
+
+ // Load also the general language independent default accelerators
+ // (ignoring the already defined accelerators)
+ if (xStreamNoLang.is())
+ {
+ xIn = xStreamNoLang->getInputStream();
+ if (xIn.is())
+ impl_ts_load(xIn);
+ }
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::store()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::io::XOutputStream > xOut;
+ if (xStream.is())
+ xOut = xStream->getOutputStream();
+
+ if (!xOut.is())
+ throw css::io::IOException(
+ ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ impl_ts_save(xOut);
+
+ xOut.clear();
+ xStream.clear();
+
+ m_aPresetHandler.commitUserChanges();
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback(
+ xStorage,
+ PresetHandler::TARGET_CURRENT(),
+ css::embed::ElementModes::READWRITE,
+ sal_False); // False => no fallback from read/write to readonly!
+ css::uno::Reference< css::io::XOutputStream > xOut;
+ if (xStream.is())
+ xOut = xStream->getOutputStream();
+
+ if (!xOut.is())
+ throw css::io::IOException(
+ ::rtl::OUString::createFromAscii("Could not open accelerator configuration for saving."),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ impl_ts_save(xOut);
+
+ // TODO inform listener about success, so it can flush the root and sub storage of this stream!
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isModified()
+ throw(css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ return (m_pWriteCache != 0);
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly()
+ throw(css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::io::XStream > xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), sal_True); // TRUE => open or create!
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::io::XOutputStream > xOut;
+ if (xStream.is())
+ xOut = xStream->getOutputStream();
+ return !(xOut.is());
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::hasStorage()
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
+ return sal_False;
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::reset()
+throw(css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+ m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT());
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+
+ reload();
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XMLBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XMLBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+// IStorageListener
+void XMLBasedAcceleratorConfiguration::changesOccured(const ::rtl::OUString& /*sPath*/)
+{
+ reload();
+}
+
+//-----------------------------------------------
+void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< css::io::XInputStream >& xStream)
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ if (m_pWriteCache)
+ {
+ // be aware of reentrance problems - use temp variable for calling delete ... :-)
+ AcceleratorCache* pTemp = m_pWriteCache;
+ m_pWriteCache = 0;
+ delete pTemp;
+ }
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
+ if (xSeek.is())
+ xSeek->seek(0);
+
+ // add accelerators to the cache (the cache is not cleared)
+ // SAFE -> ----------------------------------
+ aWriteLock.lock();
+
+ // create the parser queue
+ // Note: Use special filter object between parser and reader
+ // to get filtered xml with right namespaces ...
+ // Use further a temp cache for reading!
+ AcceleratorConfigurationReader* pReader = new AcceleratorConfigurationReader(m_aReadCache);
+ css::uno::Reference< css::xml::sax::XDocumentHandler > xReader (static_cast< ::cppu::OWeakObject* >(pReader), css::uno::UNO_QUERY_THROW);
+ SaxNamespaceFilter* pFilter = new SaxNamespaceFilter(xReader);
+ css::uno::Reference< css::xml::sax::XDocumentHandler > xFilter (static_cast< ::cppu::OWeakObject* >(pFilter), css::uno::UNO_QUERY_THROW);
+
+ // connect parser, filter and stream
+ css::uno::Reference< css::xml::sax::XParser > xParser(xSMGR->createInstance(SERVICENAME_SAXPARSER), css::uno::UNO_QUERY_THROW);
+ xParser->setDocumentHandler(xFilter);
+
+ css::xml::sax::InputSource aSource;
+ aSource.aInputStream = xStream;
+
+ // TODO think about error handling
+ xParser->parseStream(aSource);
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< css::io::XOutputStream >& xStream)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache aCache;
+ sal_Bool bChanged = (m_pWriteCache != 0);
+ if (bChanged)
+ aCache.takeOver(*m_pWriteCache);
+ else
+ aCache.takeOver(m_aReadCache);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::io::XTruncate > xClearable(xStream, css::uno::UNO_QUERY_THROW);
+ xClearable->truncate();
+
+ // TODO can be removed if seek(0) is done by truncate() automaticly!
+ css::uno::Reference< css::io::XSeekable > xSeek(xStream, css::uno::UNO_QUERY);
+ if (xSeek.is())
+ xSeek->seek(0);
+
+ // combine writer/cache/stream etcpp.
+ css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW);
+ xDataSource->setOutputStream(xStream);
+
+ // write into the stream
+ AcceleratorConfigurationWriter aWriter(aCache, xWriter);
+ aWriter.flush();
+
+ // take over all changes into the original container
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ // take over all changes into the readonly cache ...
+ // and forget the copy-on-write copied cache
+ if (bChanged)
+ {
+ m_aReadCache.takeOver(*m_pWriteCache);
+ // live with reentrance .-)
+ AcceleratorCache* pTemp = m_pWriteCache;
+ m_pWriteCache = 0;
+ delete pTemp;
+ }
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteAccessRequested)
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ //create copy of our readonly-cache, if write access is forced ... but
+ //not still possible!
+ if (
+ (bWriteAccessRequested) &&
+ (!m_pWriteCache )
+ )
+ {
+ m_pWriteCache = new AcceleratorCache(m_aReadCache);
+ }
+
+ // in case, we have a writeable cache, we use it for reading too!
+ // Otherwhise the API user cant find its own changes ...
+ if (m_pWriteCache)
+ return *m_pWriteCache;
+ else
+ return m_aReadCache;
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+::comphelper::Locale XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
+{
+ static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
+ static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
+ static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
+ css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
+ ::rtl::OUString sISOLocale;
+ xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
+
+ if (!sISOLocale.getLength())
+ return ::comphelper::Locale::EN_US();
+ return ::comphelper::Locale(sISOLocale);
+}
+
+/*******************************************************************************
+*
+* XCU based accelerator configuration
+*
+*******************************************************************************/
+
+//-----------------------------------------------
+// XInterface, XTypeProvider
+DEFINE_XINTERFACE_7(XCUBasedAcceleratorConfiguration ,
+ OWeakObject ,
+ DIRECT_INTERFACE(css::lang::XTypeProvider ),
+ DIRECT_INTERFACE(css::ui::XAcceleratorConfiguration ),
+ DIRECT_INTERFACE(css::util::XChangesListener ),
+ DIRECT_INTERFACE(css::form::XReset ),
+ DIRECT_INTERFACE(css::ui::XUIConfigurationPersistence),
+ DIRECT_INTERFACE(css::ui::XUIConfigurationStorage ),
+ DIRECT_INTERFACE(css::ui::XUIConfiguration ))
+
+ DEFINE_XTYPEPROVIDER_7(XCUBasedAcceleratorConfiguration ,
+ css::lang::XTypeProvider ,
+ css::ui::XAcceleratorConfiguration ,
+ css::util::XChangesListener ,
+ css::form::XReset ,
+ css::ui::XUIConfigurationPersistence,
+ css::ui::XUIConfigurationStorage ,
+ css::ui::XUIConfiguration )
+
+//-----------------------------------------------
+XCUBasedAcceleratorConfiguration::XCUBasedAcceleratorConfiguration(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR)
+ : ThreadHelpBase (&Application::GetSolarMutex())
+ , m_xSMGR (xSMGR )
+ , m_pPrimaryWriteCache(0 )
+ , m_pSecondaryWriteCache(0 )
+{
+ m_xCfg = css::uno::Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_ACCELERATORS, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
+ css::uno::UNO_QUERY );
+}
+
+//-----------------------------------------------
+XCUBasedAcceleratorConfiguration::~XCUBasedAcceleratorConfiguration()
+{
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getAllKeyEvents()
+ throw(css::uno::RuntimeException)
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache::TKeyList lKeys = impl_getCFG(sal_True).getAllKeys(); //get keys from PrimaryKeys set
+
+ AcceleratorCache::TKeyList lSecondaryKeys = impl_getCFG(sal_False).getAllKeys(); //get keys from SecondaryKeys set
+ AcceleratorCache::TKeyList::const_iterator pIt;
+ for ( pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt )
+ lKeys.push_back(*pIt);
+
+ return lKeys.getAsConstList();
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+::rtl::OUString SAL_CALL XCUBasedAcceleratorConfiguration::getCommandByKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
+ AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
+
+ if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ if (rPrimaryCache.hasKey(aKeyEvent))
+ return rPrimaryCache.getCommandByKey(aKeyEvent);
+ else
+ return rSecondaryCache.getCommandByKey(aKeyEvent);
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::setKeyEvent(const css::awt::KeyEvent& aKeyEvent,
+ const ::rtl::OUString& sCommand )
+ throw(css::lang::IllegalArgumentException,
+ css::uno::RuntimeException )
+{
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::setKeyEvent" );
+
+ if (
+ (aKeyEvent.KeyCode == 0) &&
+ (aKeyEvent.KeyChar == 0) &&
+ (aKeyEvent.KeyFunc == 0) &&
+ (aKeyEvent.Modifiers == 0)
+ )
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Such key event seams not to be supported by any operating system."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 0);
+
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 1);
+
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True ); // TRUE => force getting of a writeable cache!
+ AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True); // TRUE => force getting of a writeable cache!
+
+ if ( rPrimaryCache.hasKey(aKeyEvent) )
+ {
+ ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
+ if ( sCommand != sOriginalCommand )
+ {
+ if (rSecondaryCache.hasCommand(sOriginalCommand))
+ {
+ AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
+ rSecondaryCache.removeKey(lSecondaryKeys[0]);
+ rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
+ }
+
+ if (rPrimaryCache.hasCommand(sCommand))
+ {
+ AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
+ rPrimaryCache.removeKey(lPrimaryKeys[0]);
+ rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
+ }
+
+ rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+ }
+
+ else if ( rSecondaryCache.hasKey(aKeyEvent) )
+ {
+ ::rtl::OUString sOriginalCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
+ if (sCommand != sOriginalCommand)
+ {
+ if (rPrimaryCache.hasCommand(sCommand))
+ {
+ AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
+ rPrimaryCache.removeKey(lPrimaryKeys[0]);
+ rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
+ }
+
+ rSecondaryCache.removeKey(aKeyEvent);
+ rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+ }
+
+ else
+ {
+ if (rPrimaryCache.hasCommand(sCommand))
+ {
+ AcceleratorCache::TKeyList lPrimaryKeys = rPrimaryCache.getKeysByCommand(sCommand);
+ rPrimaryCache.removeKey(lPrimaryKeys[0]);
+ rSecondaryCache.setKeyCommandPair(lPrimaryKeys[0], sCommand);
+ }
+
+ rPrimaryCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::setKeyEvent" );
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::KeyEvent& aKeyEvent)
+ throw(css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
+ AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
+
+ if (!rPrimaryCache.hasKey(aKeyEvent) && !rSecondaryCache.hasKey(aKeyEvent))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ if (rPrimaryCache.hasKey(aKeyEvent))
+ {
+ ::rtl::OUString sDelCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
+ if (sDelCommand.getLength() > 0)
+ {
+ ::rtl::OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
+ if (rSecondaryCache.hasCommand(sOriginalCommand))
+ {
+ AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sOriginalCommand);
+ rSecondaryCache.removeKey(lSecondaryKeys[0]);
+ rPrimaryCache.setKeyCommandPair(lSecondaryKeys[0], sOriginalCommand);
+ }
+
+ rPrimaryCache.removeKey(aKeyEvent);
+ }
+
+ }
+ else
+ {
+ ::rtl::OUString sDelCommand = rSecondaryCache.getCommandByKey(aKeyEvent);
+ if (sDelCommand.getLength() > 0)
+ rSecondaryCache.removeKey(aKeyEvent);
+ }
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfiguration::getKeyEventsByCommand(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 1);
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True );
+ AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False);
+
+ if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString(),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ AcceleratorCache::TKeyList lKeys = rPrimaryCache.getKeysByCommand(sCommand);
+
+ AcceleratorCache::TKeyList lSecondaryKeys = rSecondaryCache.getKeysByCommand(sCommand);
+ AcceleratorCache::TKeyList::const_iterator pIt;
+ for (pIt = lSecondaryKeys.begin(); pIt != lSecondaryKeys.end(); ++pIt)
+ lKeys.push_back(*pIt);
+
+ return lKeys.getAsConstList();
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys)
+{
+ AcceleratorCache::TKeyList::const_iterator pIt;
+ for ( pIt = lKeys.begin ();
+ pIt != lKeys.end ();
+ ++pIt )
+ {
+ const css::awt::KeyEvent& rAWTKey = *pIt;
+ const KeyCode aVCLKey = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey);
+ const String sName = aVCLKey.GetName();
+
+ if (sName.Len () > 0)
+ return pIt;
+ }
+
+ return lKeys.end ();
+}
+
+//-----------------------------------------------
+css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< ::rtl::OUString >& lCommandList)
+ throw(css::lang::IllegalArgumentException ,
+ css::uno::RuntimeException )
+{
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ sal_Int32 i = 0;
+ sal_Int32 c = lCommandList.getLength();
+ css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // dont pack list!
+ AcceleratorCache& rCache = impl_getCFG(sal_True);
+
+ for (i=0; i<c; ++i)
+ {
+ const ::rtl::OUString& rCommand = lCommandList[i];
+ if (!rCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ (sal_Int16)i);
+
+ if (!rCache.hasCommand(rCommand))
+ continue;
+
+ AcceleratorCache::TKeyList lKeys = rCache.getKeysByCommand(rCommand);
+ if (lKeys.size()<1)
+ continue;
+
+ AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys);
+ if (pPreferredKey != lKeys.end ())
+ {
+ css::uno::Any& rAny = lPreferredOnes[i];
+ rAny <<= *(pPreferredKey);
+ }
+ }
+
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ return lPreferredOnes;
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::removeCommandFromAllKeyEvents(const ::rtl::OUString& sCommand)
+ throw(css::lang::IllegalArgumentException ,
+ css::container::NoSuchElementException,
+ css::uno::RuntimeException )
+{
+ if (!sCommand.getLength())
+ throw css::lang::IllegalArgumentException(
+ ::rtl::OUString::createFromAscii("Empty command strings are not allowed here."),
+ static_cast< ::cppu::OWeakObject* >(this),
+ 0);
+
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ AcceleratorCache& rPrimaryCache = impl_getCFG(sal_True, sal_True );
+ AcceleratorCache& rSecondaryCache = impl_getCFG(sal_False, sal_True);
+
+ if (!rPrimaryCache.hasCommand(sCommand) && !rSecondaryCache.hasCommand(sCommand))
+ throw css::container::NoSuchElementException(
+ ::rtl::OUString::createFromAscii("Command does not exists inside this container."),
+ static_cast< ::cppu::OWeakObject* >(this));
+
+ if (rPrimaryCache.hasCommand(sCommand))
+ rPrimaryCache.removeCommand(sCommand);
+ if (rSecondaryCache.hasCommand(sCommand))
+ rSecondaryCache.removeCommand(sCommand);
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::reload()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::reload()" );
+
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ sal_Bool bPreferred;
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+
+ bPreferred = sal_True;
+ m_aPrimaryReadCache = AcceleratorCache();
+ if (m_pPrimaryWriteCache)
+ {
+ // be aware of reentrance problems - use temp variable for calling delete ... :-)
+ AcceleratorCache* pTemp = m_pPrimaryWriteCache;
+ m_pPrimaryWriteCache = 0;
+ delete pTemp;
+ }
+ m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
+ impl_ts_load(bPreferred, xAccess); // load the preferred keys
+
+ bPreferred = sal_False;
+ m_aSecondaryReadCache = AcceleratorCache();
+ if (m_pSecondaryWriteCache)
+ {
+ // be aware of reentrance problems - use temp variable for calling delete ... :-)
+ AcceleratorCache* pTemp = m_pSecondaryWriteCache;
+ m_pSecondaryWriteCache = 0;
+ delete pTemp;
+ }
+ m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
+ impl_ts_load(bPreferred, xAccess); // load the secondary keys
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::reload()" );
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::store()
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::store()" );
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+
+ sal_Bool bPreferred;
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+
+ bPreferred = sal_True;
+ m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
+ impl_ts_save(bPreferred, xAccess);
+
+ bPreferred = sal_False;
+ m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
+ impl_ts_save(bPreferred, xAccess);
+
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::store()" );
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
+ throw(css::uno::Exception ,
+ css::uno::RuntimeException)
+{
+ // todo implement me
+ // use m_aCache + old AcceleratorXMLWriter to store data directly on storage given as parameter ...
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isModified()
+ throw(css::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::isReadOnly()
+ throw(css::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::setStorage(const css::uno::Reference< css::embed::XStorage >& /*xStorage*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::setStorage()", "TODO implement this HACK .-)")
+}
+
+//-----------------------------------------------
+::sal_Bool SAL_CALL XCUBasedAcceleratorConfiguration::hasStorage()
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::hasStorage()", "TODO implement this HACK .-)")
+ return sal_False;
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::addConfigurationListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::removeConfigurationListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::reset()
+ throw(css::uno::RuntimeException)
+{
+ css::uno::Reference< css::container::XNamed > xNamed(m_xCfg, css::uno::UNO_QUERY);
+ ::rtl::OUString sConfig = xNamed->getName();
+ if ( sConfig.equalsAscii("Global") )
+ {
+ m_xCfg = css::uno::Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_GLOBAL, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
+ css::uno::UNO_QUERY );
+ XCUBasedAcceleratorConfiguration::reload();
+ }
+ else if ( sConfig.equalsAscii("Modules") )
+ {
+ m_xCfg = css::uno::Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig( m_xSMGR, CFG_ENTRY_MODULES, ::comphelper::ConfigurationHelper::E_ALL_LOCALES ),
+ css::uno::UNO_QUERY );
+ XCUBasedAcceleratorConfiguration::reload();
+ }
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::addResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::addResetListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::removeResetListener(const css::uno::Reference< css::form::XResetListener >& /*xListener*/)
+ throw(css::uno::RuntimeException)
+{
+ LOG_WARNING("XCUBasedAcceleratorConfiguration::removeResetListener()", "TODO implement me")
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util::ChangesEvent& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog1, " start XCUBasedAcceleratorConfiguration::changesOccurred()" );
+
+ css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess;
+ aEvent.Base >>= xHAccess;
+ if (! xHAccess.is ())
+ return;
+
+ const sal_Int32 c = aEvent.Changes.getLength();
+ sal_Int32 i = 0;
+
+ for (i=0; i<c; ++i)
+ {
+ const css::util::ElementChange& aChange = aEvent.Changes[i];
+
+ // Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will
+ // be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-)
+ // So we try to split the path into 3 parts (module isnt important here, because we already know it ... because
+ // these instance is bound to a specific module configuration ... or it''s the global configuration where no module is given at all.
+
+ ::rtl::OUString sOrgPath ;
+ ::rtl::OUString sPath ;
+ ::rtl::OUString sKey;
+
+ aChange.Accessor >>= sOrgPath;
+ sPath = sOrgPath;
+ ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
+ sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
+
+ ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
+ sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
+
+ if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
+ {
+ ::rtl::OUString sModule;
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath);
+ reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+ }
+ else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
+ {
+ ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
+ ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']");
+ sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath);
+ reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+ }
+ }
+
+ RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, " end XCUBasedAcceleratorConfiguration::changesOccurred()" );
+}
+
+//-----------------------------------------------
+void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::EventObject& /*aSource*/)
+ throw(css::uno::RuntimeException)
+{
+}
+
+//-----------------------------------------------
+void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
+{
+ AcceleratorCache aReadCache = AcceleratorCache();
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+ if (m_sGlobalOrModules.equalsAscii("Global"))
+ xCfg->getByName(CFG_ENTRY_GLOBAL) >>= xAccess;
+ else if (m_sGlobalOrModules.equalsAscii("Modules"))
+ {
+ css::uno::Reference< css::container::XNameAccess > xModules;
+ xCfg->getByName(CFG_ENTRY_MODULES) >>= xModules;
+ xModules->getByName(m_sModuleCFG) >>= xAccess;
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xKey;
+ css::uno::Reference< css::container::XNameAccess > xCommand;
+ if (xAccess.is())
+ {
+ css::uno::Sequence< ::rtl::OUString > lKeys = xAccess->getElementNames();
+ sal_Int32 nKeys = lKeys.getLength();
+ for ( sal_Int32 i=0; i<nKeys; ++i )
+ {
+ ::rtl::OUString sKey = lKeys[i];
+ xAccess->getByName(sKey) >>= xKey;
+ xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
+
+ css::uno::Sequence< ::rtl::OUString > lLocales = xCommand->getElementNames();
+ sal_Int32 nLocales = lLocales.getLength();
+ ::std::vector< ::rtl::OUString > aLocales;
+ for ( sal_Int32 j=0; j<nLocales; ++j )
+ aLocales.push_back(lLocales[j]);
+
+ ::std::vector< ::rtl::OUString >::const_iterator pFound;
+ for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
+ {
+ if ( *pFound == impl_ts_getLocale().toISO() )
+ break;
+ }
+
+ if ( pFound == aLocales.end() )
+ {
+ ::rtl::OUString sDefaultLocale = ::rtl::OUString::createFromAscii("en-US");
+ for ( pFound = aLocales.begin(); pFound != aLocales.end(); ++pFound )
+ {
+ if ( *pFound == sDefaultLocale )
+ break;
+ }
+
+ if ( pFound == aLocales.end() )
+ continue;
+ }
+
+ ::rtl::OUString sLocale = *pFound;
+ ::rtl::OUString sCommand;
+ xCommand->getByName(sLocale) >>= sCommand;
+ if (sCommand.getLength()<1)
+ continue;
+
+ KeyMapping aKeyMapping;
+ css::awt::KeyEvent aKeyEvent;
+
+ sal_Int32 nIndex = 0;
+ ::rtl::OUString sKeyCommand = sKey.getToken(0, '_', nIndex);
+ ::rtl::OUString sPrefix = ::rtl::OUString::createFromAscii("KEY_");
+ aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(sPrefix + sKeyCommand);
+
+ css::uno::Sequence< ::rtl::OUString > sToken(4);
+ const sal_Int32 nToken = 4;
+ sal_Bool bValid = sal_True;
+ sal_Int32 k;
+ for (k=0; k<nToken; ++k)
+ {
+ if (nIndex < 0)
+ break;
+
+ sToken[k] = sKey.getToken(0, '_', nIndex);
+ ::rtl::OUString sTest = sToken[k];
+ if (sToken[k].getLength() < 1)
+ {
+ bValid = sal_False;
+ break;
+ }
+
+ if (sToken[k].equalsAscii("SHIFT"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
+ else if (sToken[k].equalsAscii("MOD1"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
+ else if (sToken[k].equalsAscii("MOD2"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
+ else
+ {
+ bValid = sal_False;
+ break;
+ }
+ }
+
+ if ( !aReadCache.hasKey(aKeyEvent) && bValid && k<nToken)
+ aReadCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+ }
+
+ if (bPreferred)
+ m_aPrimaryReadCache.takeOver(aReadCache);
+ else
+ m_aSecondaryReadCache.takeOver(aReadCache);
+}
+
+//-----------------------------------------------
+void XCUBasedAcceleratorConfiguration::impl_ts_save(sal_Bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& /*xCfg*/)
+{
+ if (bPreferred)
+ {
+ AcceleratorCache::TKeyList::const_iterator pIt;
+ AcceleratorCache::TKeyList lPrimaryReadKeys = m_aPrimaryReadCache.getAllKeys();
+ AcceleratorCache::TKeyList lPrimaryWriteKeys = m_pPrimaryWriteCache->getAllKeys();
+
+ for ( pIt = lPrimaryReadKeys.begin(); pIt != lPrimaryReadKeys.end(); ++pIt )
+ {
+ if (!m_pPrimaryWriteCache->hasKey(*pIt))
+ removeKeyFromConfiguration(*pIt, sal_True);
+ }
+
+ for ( pIt = lPrimaryWriteKeys.begin(); pIt != lPrimaryWriteKeys.end(); ++pIt )
+ {
+ ::rtl::OUString sCommand = m_pPrimaryWriteCache->getCommandByKey(*pIt);
+ if (!m_aPrimaryReadCache.hasKey(*pIt))
+ {
+ insertKeyToConfiguration(*pIt, sCommand, sal_True);
+ }
+ else
+ {
+ ::rtl::OUString sReadCommand = m_aPrimaryReadCache.getCommandByKey(*pIt);
+ if (sReadCommand != sCommand)
+ insertKeyToConfiguration(*pIt, sCommand, sal_True);
+ }
+ }
+
+ // take over all changes into the original container
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ if (m_pPrimaryWriteCache)
+ {
+ m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
+ AcceleratorCache* pTemp = m_pPrimaryWriteCache;
+ m_pPrimaryWriteCache = 0;
+ delete pTemp;
+ }
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+ }
+
+ else
+ {
+ AcceleratorCache::TKeyList::const_iterator pIt;
+ AcceleratorCache::TKeyList lSecondaryReadKeys = m_aSecondaryReadCache.getAllKeys();
+ AcceleratorCache::TKeyList lSecondaryWriteKeys = m_pSecondaryWriteCache->getAllKeys();
+
+ for ( pIt = lSecondaryReadKeys.begin(); pIt != lSecondaryReadKeys.end(); ++pIt)
+ {
+ if (!m_pSecondaryWriteCache->hasKey(*pIt))
+ removeKeyFromConfiguration(*pIt, sal_False);
+ }
+
+
+ for ( pIt = lSecondaryWriteKeys.begin(); pIt != lSecondaryWriteKeys.end(); ++pIt )
+ {
+ ::rtl::OUString sCommand = m_pSecondaryWriteCache->getCommandByKey(*pIt);
+ if (!m_aSecondaryReadCache.hasKey(*pIt))
+ {
+ insertKeyToConfiguration(*pIt, sCommand, sal_False);
+ }
+ else
+ {
+ ::rtl::OUString sReadCommand = m_aSecondaryReadCache.getCommandByKey(*pIt);
+ if (sReadCommand != sCommand)
+ insertKeyToConfiguration(*pIt, sCommand, sal_False);
+ }
+ }
+
+ // take over all changes into the original container
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ if (m_pSecondaryWriteCache)
+ {
+ m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
+ AcceleratorCache* pTemp = m_pSecondaryWriteCache;
+ m_pSecondaryWriteCache = 0;
+ delete pTemp;
+ }
+
+ aWriteLock.unlock();
+ // <- SAFE ----------------------------------
+ }
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+}
+
+//-----------------------------------------------
+void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt::KeyEvent& aKeyEvent, const ::rtl::OUString& sCommand, const sal_Bool bPreferred )
+{
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+ css::uno::Reference< css::container::XNameContainer > xContainer;
+ css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
+ css::uno::Reference< css::uno::XInterface > xInst;
+
+ if ( bPreferred )
+ m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
+ else
+ m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
+
+ if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
+ xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
+ else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
+ {
+ css::uno::Reference< css::container::XNameContainer > xModules;
+ xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
+ if ( !xModules->hasByName(m_sModuleCFG) )
+ {
+ xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xModules, css::uno::UNO_QUERY);
+ xInst = xFac->createInstance();
+ xModules->insertByName(m_sModuleCFG, css::uno::makeAny(xInst));
+ }
+ xModules->getByName(m_sModuleCFG) >>= xContainer;
+ }
+
+ KeyMapping aKeyMapping;
+ const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
+ ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
+
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
+ sKey += ::rtl::OUString::createFromAscii("_SHIFT");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
+ sKey += ::rtl::OUString::createFromAscii("_MOD1");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
+ sKey += ::rtl::OUString::createFromAscii("_MOD2");
+
+ css::uno::Reference< css::container::XNameAccess > xKey;
+ css::uno::Reference< css::container::XNameContainer > xCommand;
+ if ( !xContainer->hasByName(sKey) )
+ {
+ xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xContainer, css::uno::UNO_QUERY);
+ xInst = xFac->createInstance();
+ xContainer->insertByName(sKey, css::uno::makeAny(xInst));
+ }
+ xContainer->getByName(sKey) >>= xKey;
+
+ xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
+ ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
+ if ( !xCommand->hasByName(sLocale) )
+ xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
+ else
+ xCommand->replaceByName(sLocale, css::uno::makeAny(sCommand));
+}
+
+//-----------------------------------------------
+void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::awt::KeyEvent& aKeyEvent, const sal_Bool bPreferred )
+{
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+ css::uno::Reference< css::container::XNameContainer > xContainer;
+
+ if ( bPreferred )
+ m_xCfg->getByName(CFG_ENTRY_PRIMARY) >>= xAccess;
+ else
+ m_xCfg->getByName(CFG_ENTRY_SECONDARY) >>= xAccess;
+
+ if ( m_sGlobalOrModules.equals(CFG_ENTRY_GLOBAL) )
+ xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
+ else if ( m_sGlobalOrModules.equals(CFG_ENTRY_MODULES) )
+ {
+ css::uno::Reference< css::container::XNameAccess > xModules;
+ xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
+ if ( !xModules->hasByName(m_sModuleCFG) )
+ return;
+ xModules->getByName(m_sModuleCFG) >>= xContainer;
+ }
+
+ KeyMapping aKeyMapping;
+ const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
+ ::rtl::OUString sKey = (aKeyMapping.mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex);
+
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
+ sKey += ::rtl::OUString::createFromAscii("_SHIFT");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
+ sKey += ::rtl::OUString::createFromAscii("_MOD1");
+ if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
+ sKey += ::rtl::OUString::createFromAscii("_MOD2");
+
+ xContainer->removeByName(sKey);
+}
+
+//-----------------------------------------------
+void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPrimarySecondary, const ::rtl::OUString& sGlobalModules, const ::rtl::OUString& sModule, const ::rtl::OUString& sKey )
+{
+ css::uno::Reference< css::container::XNameAccess > xAccess;
+ css::uno::Reference< css::container::XNameContainer > xContainer;
+
+ m_xCfg->getByName(sPrimarySecondary) >>= xAccess;
+ if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
+ xAccess->getByName(CFG_ENTRY_GLOBAL) >>= xContainer;
+ else
+ {
+ css::uno::Reference< css::container::XNameAccess > xModules;
+ xAccess->getByName(CFG_ENTRY_MODULES) >>= xModules;
+ if ( !xModules->hasByName(sModule) )
+ return;
+ xModules->getByName(sModule) >>= xContainer;
+ }
+
+ KeyMapping aKeyMapping;
+ css::awt::KeyEvent aKeyEvent;
+ ::rtl::OUString sKeyIdentifier;
+
+ sal_Int32 nIndex = 0;
+ sKeyIdentifier = sKey.getToken(0, '_', nIndex);
+ aKeyEvent.KeyCode = aKeyMapping.mapIdentifierToCode(::rtl::OUString::createFromAscii("KEY_")+sKeyIdentifier);
+
+ css::uno::Sequence< ::rtl::OUString > sToken(3);
+ const sal_Int32 nToken = 3;
+ for (sal_Int32 i=0; i<nToken; ++i)
+ {
+ if ( nIndex < 0 )
+ break;
+
+ sToken[i] = sKey.getToken(0, '_', nIndex);
+ if (sToken[i].equalsAscii("SHIFT"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
+ else if (sToken[i].equalsAscii("MOD1"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
+ else if (sToken[i].equalsAscii("MOD2"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xKey;
+ css::uno::Reference< css::container::XNameAccess > xCommand;
+ ::rtl::OUString sCommand;
+
+ if (xContainer->hasByName(sKey))
+ {
+ ::rtl::OUString sLocale = impl_ts_getLocale().toISO();
+ xContainer->getByName(sKey) >>= xKey;
+ xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
+ xCommand->getByName(sLocale) >>= sCommand;
+ }
+
+ if (sPrimarySecondary.equals(CFG_ENTRY_PRIMARY))
+ {
+ if (sCommand.getLength() ==0)
+ m_aPrimaryReadCache.removeKey(aKeyEvent);
+ else
+ m_aPrimaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+ else if (sPrimarySecondary.equals(CFG_ENTRY_SECONDARY))
+ {
+ if (sCommand.getLength() ==0)
+ m_aSecondaryReadCache.removeKey(aKeyEvent);
+ else
+ m_aSecondaryReadCache.setKeyCommandPair(aKeyEvent, sCommand);
+ }
+}
+
+//-----------------------------------------------
+AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPreferred, sal_Bool bWriteAccessRequested)
+{
+ // SAFE -> ----------------------------------
+ WriteGuard aWriteLock(m_aLock);
+
+ if (bPreferred)
+ {
+ //create copy of our readonly-cache, if write access is forced ... but
+ //not still possible!
+ if (
+ (bWriteAccessRequested) &&
+ (!m_pPrimaryWriteCache )
+ )
+ {
+ m_pPrimaryWriteCache = new AcceleratorCache(m_aPrimaryReadCache);
+ }
+
+ // in case, we have a writeable cache, we use it for reading too!
+ // Otherwhise the API user cant find its own changes ...
+ if (m_pPrimaryWriteCache)
+ return *m_pPrimaryWriteCache;
+ else
+ return m_aPrimaryReadCache;
+ }
+
+ else
+ {
+ //create copy of our readonly-cache, if write access is forced ... but
+ //not still possible!
+ if (
+ (bWriteAccessRequested) &&
+ (!m_pSecondaryWriteCache )
+ )
+ {
+ m_pSecondaryWriteCache = new AcceleratorCache(m_aSecondaryReadCache);
+ }
+
+ // in case, we have a writeable cache, we use it for reading too!
+ // Otherwhise the API user cant find its own changes ...
+ if (m_pSecondaryWriteCache)
+ return *m_pSecondaryWriteCache;
+ else
+ return m_aSecondaryReadCache;
+ }
+
+ // <- SAFE ----------------------------------
+}
+
+//-----------------------------------------------
+::comphelper::Locale XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
+{
+ static ::rtl::OUString LOCALE_PACKAGE = ::rtl::OUString::createFromAscii("/org.openoffice.Setup");
+ static ::rtl::OUString LOCALE_PATH = ::rtl::OUString::createFromAscii("L10N" );
+ static ::rtl::OUString LOCALE_KEY = ::rtl::OUString::createFromAscii("ooLocale" );
+
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR;
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+
+ css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR, LOCALE_PACKAGE, LOCALE_PATH, fpc::ConfigurationHelper::E_READONLY);
+ css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
+ ::rtl::OUString sISOLocale;
+ xProp->getPropertyValue(LOCALE_KEY) >>= sISOLocale;
+
+ if (!sISOLocale.getLength())
+ return ::comphelper::Locale::EN_US();
+ return ::comphelper::Locale(sISOLocale);
+}
+
+} // namespace framework
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index f60e445036d7..3a615768b074 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -1,550 +1,550 @@
-/*************************************************************************
- *
- * 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: uielementfactorymanager.cxx,v $
- * $Revision: 1.10.12.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_framework.hxx"
-
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
-#include <uifactory/windowcontentfactorymanager.hxx>
-#include <threadhelp/resetableguard.hxx>
-#include "services.h"
-
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-
-//_________________________________________________________________________________________________________________
-// includes of other projects
-//_________________________________________________________________________________________________________________
-#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/weak.hxx>
-#include <tools/urlobj.hxx>
-#include <vcl/svapp.hxx>
-
-//_________________________________________________________________________________________________________________
-// Defines
-//_________________________________________________________________________________________________________________
-//
-
-using namespace ::com::sun::star;
-
-//_________________________________________________________________________________________________________________
-// Namespace
-//_________________________________________________________________________________________________________________
-//
-
-namespace framework
-{
-
-// global function needed by both implementations
-static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName )
-{
- rtl::OUStringBuffer aKey( aType );
- aKey.appendAscii( "^" );
- aKey.append( aName );
- aKey.appendAscii( "^" );
- aKey.append( aModuleName );
- return aKey.makeStringAndClear();
-}
-
-
-//*****************************************************************************************************************
-// Configuration access class for UIElementFactoryManager implementation
-//*****************************************************************************************************************
-
-class ConfigurationAccess_WindowContentFactoryManager : // interfaces
- public lang::XTypeProvider ,
- public container::XContainerListener ,
- // baseclasses
- // Order is neccessary for right initialization!
- private ThreadHelpBase ,
- public ::cppu::OWeakObject
-{
- public:
- FWK_DECLARE_XINTERFACE
- FWK_DECLARE_XTYPEPROVIDER
-
- ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager );
- virtual ~ConfigurationAccess_WindowContentFactoryManager();
-
- void readConfigurationData();
-
- rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
-
- // container.XContainerListener
- virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
- virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
-
- // lang.XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException);
-
- private:
- class FactoryMap : public std::hash_map< rtl::OUString,
- rtl::OUString,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
- {
- inline void free()
- {
- FactoryMap().swap( *this );
- }
- };
-
- sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
-
- rtl::OUString m_aPropType;
- rtl::OUString m_aPropName;
- rtl::OUString m_aPropModule;
- rtl::OUString m_aPropFactory;
- FactoryMap m_aFactoryMap;
- uno::Reference< lang::XMultiServiceFactory > m_xServiceManager;
- uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider;
- uno::Reference< container::XNameAccess > m_xConfigAccess;
- bool m_bConfigAccessInitialized;
- bool m_bConfigDirty;
-};
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE ( lang::XTypeProvider ),
- DIRECT_INTERFACE ( container::XContainerListener ),
- DERIVED_INTERFACE( lang::XEventListener, XContainerListener )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager ,
- lang::XTypeProvider ,
- container::XContainerListener ,
- lang::XEventListener
- )
-
-ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
- ThreadHelpBase(),
- m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
- m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
- m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
- m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
- m_xServiceManager( rServiceManager ),
- m_bConfigAccessInitialized( false ),
- m_bConfigDirty( true )
-{
- m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- uno::UNO_QUERY );
-}
-
-ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- if ( xContainer.is() )
- xContainer->removeContainerListener( this );
-}
-
-rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- // Make sure that we read the configuration data at least once.
- // May be more dependent on the dirty flag!
- readConfigurationData();
-
- FactoryMap::const_iterator pIter =
- m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- else
- {
- // Support factories which uses a defined prefix for their element names.
- sal_Int32 nIndex = rName.indexOf( '_' );
- if ( nIndex > 0 )
- {
- rtl::OUString aName = rName.copy( 0, nIndex );
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
-
- pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
- if ( pIter != m_aFactoryMap.end() )
- return pIter->second;
- }
- }
-
- return rtl::OUString();
-}
-
-// container.XContainerListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException)
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
- m_bConfigDirty = true;
-}
-
-// lang.XEventListener
-void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException)
-{
- // SAFE
- // remove our reference to the config access
- ResetableGuard aLock( m_aLock );
- m_xConfigAccess.clear();
-}
-
-void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData()
-{
- // SAFE
- ResetableGuard aLock( m_aLock );
-
- bool bConfigAccessInitialized(m_bConfigAccessInitialized);
- if ( !m_bConfigAccessInitialized )
- {
- uno::Sequence< uno::Any > aArgs( 1 );
- beans::PropertyValue aPropValue;
-
- aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" ));
- aArgs[0] <<= aPropValue;
-
- try
- {
- m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- uno::UNO_QUERY );
- }
- catch ( lang::WrappedTargetException& )
- {
- }
-
- m_bConfigAccessInitialized = sal_True;
- }
-
- if ( m_xConfigAccess.is() && m_bConfigDirty )
- {
- uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
-
- uno::Any a;
- rtl::OUString aType;
- rtl::OUString aName;
- rtl::OUString aModule;
- rtl::OUString aService;
- rtl::OUString aHashKey;
-
- uno::Reference< beans::XPropertySet > xPropertySet;
-
- m_aFactoryMap.clear();
- for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
- {
- // Create hash key from type, name and module as they are together a primary key to
- // the UNO service that implements the user interface element factory.
- aHashKey = getHashKeyFromStrings( aType, aName, aModule );
- m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService ));
- }
- }
-
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- m_bConfigDirty = false;
-
- aLock.unlock();
- // UNSAFE
-
- if ( xContainer.is() && !bConfigAccessInitialized)
- xContainer->addContainerListener( this );
- }
-}
-
-sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
-{
- uno::Reference< beans::XPropertySet > xPropertySet;
- uno::Reference< container::XNameAccess > xNameAccess;
- aElement >>= xPropertySet;
- aElement >>= xNameAccess;
-
- if ( xPropertySet.is() )
- {
- try
- {
- xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
- xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
- xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
- }
- catch ( beans::UnknownPropertyException& )
- {
- return sal_False;
- }
- catch ( lang::WrappedTargetException& )
- {
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider, XServiceInfo
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_3 ( WindowContentFactoryManager ,
- OWeakObject ,
- DIRECT_INTERFACE( lang::XTypeProvider ),
- DIRECT_INTERFACE( lang::XServiceInfo ),
- DIRECT_INTERFACE( lang::XSingleComponentFactory )
- )
-
-DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager ,
- lang::XTypeProvider ,
- lang::XServiceInfo ,
- lang::XSingleComponentFactory
- )
-
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
- ::cppu::OWeakObject ,
- SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
- IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
- )
-
-DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} )
-
-WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
- ThreadHelpBase( &Application::GetSolarMutex() ),
- m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
-{
- m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager );
- m_pConfigAccess->acquire();
- m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY );
-}
-
-WindowContentFactoryManager::~WindowContentFactoryManager()
-{
- ResetableGuard aLock( m_aLock );
-
- // reduce reference count
- m_pConfigAccess->release();
-}
-
-void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName )
-{
- const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
- const char RESOURCEURL_PREFIX[] = "private:resource/";
-
- if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
- ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
- {
- rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
- sal_Int32 nToken = 0;
- sal_Int32 nPart = 0;
- do
- {
- ::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken);
- if ( sToken.getLength() )
- {
- if ( nPart == 0 )
- aType = sToken;
- else if ( nPart == 1 )
- aName = sToken;
- else
- break;
- nPart++;
- }
- }
- while( nToken >=0 );
- }
-}
-
-// XSingleComponentFactory
-uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext(
- const uno::Reference< uno::XComponentContext >& /*xContext*/ )
-throw (uno::Exception, uno::RuntimeException)
-{
-/*
- // Currently this method cannot be implemented for generic use. There is no way for external
- code to get a handle to the dialog model.
-
- uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY );
-
- const ::rtl::OUString sToolkitService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"));
- uno::Reference< awt::XToolkit > xToolkit( xServiceManager->createInstance( sToolkitService ), uno::UNO_QUERY_THROW );
-
- const ::rtl::OUString sDialogModelService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModel"));
- uno::Reference< awt::XControlModel > xDialogModel( xServiceManager->createInstance( sDialogModelService ), uno::UNO_QUERY_THROW );
-
- const ::rtl::OUString sDecoration(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
- uno::Reference< beans::XPropertySet > xPropSet( xDialogModel, uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue( sDecoration, uno::makeAny(false));
-
- const ::rtl::OUString sDialogService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialog"));
- uno::Reference< awt::XControl > xDialogControl( xServiceManager->createInstance( sDialogService ), uno::UNO_QUERY_THROW );
-
- xDialogControl->setModel( xDialogModel );
-
- uno::Reference< awt::XWindowPeer > xWindowParentPeer( xToolkit->getDesktopWindow(), uno::UNO_QUERY );
- xDialogControl->createPeer( xToolkit, xWindowParentPeer );
- uno::Reference< uno::XInterface > xWindow( xDialogControl->getPeer(), uno::UNO_QUERY );
-*/
- uno::Reference< uno::XInterface > xWindow;
- return xWindow;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithArgumentsAndContext(
- const uno::Sequence< uno::Any >& Arguments, const uno::Reference< uno::XComponentContext >& Context )
-throw (uno::Exception, uno::RuntimeException)
-{
- uno::Reference< uno::XInterface > xWindow;
- uno::Reference< frame::XFrame > xFrame;
- ::rtl::OUString aResourceURL;
-
- for (sal_Int32 i=0; i < Arguments.getLength(); i++ )
- {
- beans::PropertyValue aPropValue;
- if ( Arguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name.equalsAscii( "Frame" ))
- aPropValue.Value >>= xFrame;
- else if ( aPropValue.Name.equalsAscii( "ResourceURL" ))
- aPropValue.Value >>= aResourceURL;
- }
- }
-
- uno::Reference< frame::XModuleManager > xModuleManager;
- // SAFE
- {
- ResetableGuard aLock( m_aLock );
- xModuleManager = m_xModuleManager;
- }
- // UNSAFE
-
- // Determine the module identifier
- ::rtl::OUString aType;
- ::rtl::OUString aName;
- ::rtl::OUString aModuleId;
- try
- {
- if ( xFrame.is() && xModuleManager.is() )
- aModuleId = xModuleManager->identify( uno::Reference< uno::XInterface >( xFrame, uno::UNO_QUERY ) );
- }
- catch ( frame::UnknownModuleException& )
- {
- }
-
- RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
- if ( aType.getLength() > 0 &&
- aName.getLength() > 0 &&
- aModuleId.getLength() > 0 )
- {
- ::rtl::OUString aImplementationName;
- uno::Reference< uno::XInterface > xHolder( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
-
- // Detetmine the implementation name of the window content factory dependent on the
- // module identifier, user interface element type and name
- // SAFE
- ResetableGuard aLock( m_aLock );
- aImplementationName = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId );
- if ( aImplementationName.getLength() > 0 )
- {
- aLock.unlock();
- // UNSAFE
-
- uno::Reference< lang::XMultiServiceFactory > xServiceManager( Context->getServiceManager(), uno::UNO_QUERY );
- if ( xServiceManager.is() )
- {
- uno::Reference< lang::XSingleComponentFactory > xFactory(
- xServiceManager->createInstance( aImplementationName ), uno::UNO_QUERY );
- if ( xFactory.is() )
- {
- // Be careful: We call external code. Therefore here we have to catch all exceptions
- try
- {
- xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context );
- }
- catch ( uno::RuntimeException& )
- {
- }
- catch ( uno::Exception& )
- {
- }
- }
- }
- }
- }
-
- // UNSAFE
- if ( !xWindow.is())
- {
- // Fallback: Use internal factory code to create a toolkit dialog as a content window
- xWindow = createInstanceWithContext(Context);
- }
-
- return xWindow;
-}
-
-} // namespace framework
+/*************************************************************************
+ *
+ * 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: uielementfactorymanager.cxx,v $
+ * $Revision: 1.10.12.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_framework.hxx"
+
+//_________________________________________________________________________________________________________________
+// my own includes
+//_________________________________________________________________________________________________________________
+#include <uifactory/windowcontentfactorymanager.hxx>
+#include <threadhelp/resetableguard.hxx>
+#include "services.h"
+
+//_________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+
+//_________________________________________________________________________________________________________________
+// includes of other projects
+//_________________________________________________________________________________________________________________
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/weak.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/svapp.hxx>
+
+//_________________________________________________________________________________________________________________
+// Defines
+//_________________________________________________________________________________________________________________
+//
+
+using namespace ::com::sun::star;
+
+//_________________________________________________________________________________________________________________
+// Namespace
+//_________________________________________________________________________________________________________________
+//
+
+namespace framework
+{
+
+// global function needed by both implementations
+static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName )
+{
+ rtl::OUStringBuffer aKey( aType );
+ aKey.appendAscii( "^" );
+ aKey.append( aName );
+ aKey.appendAscii( "^" );
+ aKey.append( aModuleName );
+ return aKey.makeStringAndClear();
+}
+
+
+//*****************************************************************************************************************
+// Configuration access class for UIElementFactoryManager implementation
+//*****************************************************************************************************************
+
+class ConfigurationAccess_WindowContentFactoryManager : // interfaces
+ public lang::XTypeProvider ,
+ public container::XContainerListener ,
+ // baseclasses
+ // Order is neccessary for right initialization!
+ private ThreadHelpBase ,
+ public ::cppu::OWeakObject
+{
+ public:
+ FWK_DECLARE_XINTERFACE
+ FWK_DECLARE_XTYPEPROVIDER
+
+ ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager );
+ virtual ~ConfigurationAccess_WindowContentFactoryManager();
+
+ void readConfigurationData();
+
+ rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
+
+ // container.XContainerListener
+ virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
+
+ // lang.XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException);
+
+ private:
+ class FactoryMap : public std::hash_map< rtl::OUString,
+ rtl::OUString,
+ OUStringHashCode,
+ ::std::equal_to< ::rtl::OUString > >
+ {
+ inline void free()
+ {
+ FactoryMap().swap( *this );
+ }
+ };
+
+ sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
+
+ rtl::OUString m_aPropType;
+ rtl::OUString m_aPropName;
+ rtl::OUString m_aPropModule;
+ rtl::OUString m_aPropFactory;
+ FactoryMap m_aFactoryMap;
+ uno::Reference< lang::XMultiServiceFactory > m_xServiceManager;
+ uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider;
+ uno::Reference< container::XNameAccess > m_xConfigAccess;
+ bool m_bConfigAccessInitialized;
+ bool m_bConfigDirty;
+};
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider
+//*****************************************************************************************************************
+DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager ,
+ OWeakObject ,
+ DIRECT_INTERFACE ( lang::XTypeProvider ),
+ DIRECT_INTERFACE ( container::XContainerListener ),
+ DERIVED_INTERFACE( lang::XEventListener, XContainerListener )
+ )
+
+DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager ,
+ lang::XTypeProvider ,
+ container::XContainerListener ,
+ lang::XEventListener
+ )
+
+ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
+ ThreadHelpBase(),
+ m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
+ m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
+ m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
+ m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
+ m_xServiceManager( rServiceManager ),
+ m_bConfigAccessInitialized( false ),
+ m_bConfigDirty( true )
+{
+ m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationProvider" ))),
+ uno::UNO_QUERY );
+}
+
+ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager()
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
+ if ( xContainer.is() )
+ xContainer->removeContainerListener( this );
+}
+
+rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ // Make sure that we read the configuration data at least once.
+ // May be more dependent on the dirty flag!
+ readConfigurationData();
+
+ FactoryMap::const_iterator pIter =
+ m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule ));
+ if ( pIter != m_aFactoryMap.end() )
+ return pIter->second;
+ else
+ {
+ pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
+ if ( pIter != m_aFactoryMap.end() )
+ return pIter->second;
+ else
+ {
+ // Support factories which uses a defined prefix for their element names.
+ sal_Int32 nIndex = rName.indexOf( '_' );
+ if ( nIndex > 0 )
+ {
+ rtl::OUString aName = rName.copy( 0, nIndex );
+ pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
+ if ( pIter != m_aFactoryMap.end() )
+ return pIter->second;
+ }
+
+ pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
+ if ( pIter != m_aFactoryMap.end() )
+ return pIter->second;
+ }
+ }
+
+ return rtl::OUString();
+}
+
+// container.XContainerListener
+void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ m_bConfigDirty = true;
+}
+
+void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ m_bConfigDirty = true;
+}
+
+void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException)
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ m_bConfigDirty = true;
+}
+
+// lang.XEventListener
+void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException)
+{
+ // SAFE
+ // remove our reference to the config access
+ ResetableGuard aLock( m_aLock );
+ m_xConfigAccess.clear();
+}
+
+void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData()
+{
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+
+ bool bConfigAccessInitialized(m_bConfigAccessInitialized);
+ if ( !m_bConfigAccessInitialized )
+ {
+ uno::Sequence< uno::Any > aArgs( 1 );
+ beans::PropertyValue aPropValue;
+
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" ));
+ aArgs[0] <<= aPropValue;
+
+ try
+ {
+ m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" )),
+ aArgs ),
+ uno::UNO_QUERY );
+ }
+ catch ( lang::WrappedTargetException& )
+ {
+ }
+
+ m_bConfigAccessInitialized = sal_True;
+ }
+
+ if ( m_xConfigAccess.is() && m_bConfigDirty )
+ {
+ uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
+
+ uno::Any a;
+ rtl::OUString aType;
+ rtl::OUString aName;
+ rtl::OUString aModule;
+ rtl::OUString aService;
+ rtl::OUString aHashKey;
+
+ uno::Reference< beans::XPropertySet > xPropertySet;
+
+ m_aFactoryMap.clear();
+ for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
+ {
+ if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
+ {
+ // Create hash key from type, name and module as they are together a primary key to
+ // the UNO service that implements the user interface element factory.
+ aHashKey = getHashKeyFromStrings( aType, aName, aModule );
+ m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService ));
+ }
+ }
+
+ uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
+ m_bConfigDirty = false;
+
+ aLock.unlock();
+ // UNSAFE
+
+ if ( xContainer.is() && !bConfigAccessInitialized)
+ xContainer->addContainerListener( this );
+ }
+}
+
+sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
+{
+ uno::Reference< beans::XPropertySet > xPropertySet;
+ uno::Reference< container::XNameAccess > xNameAccess;
+ aElement >>= xPropertySet;
+ aElement >>= xNameAccess;
+
+ if ( xPropertySet.is() )
+ {
+ try
+ {
+ xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
+ xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
+ xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
+ }
+ catch ( beans::UnknownPropertyException& )
+ {
+ return sal_False;
+ }
+ catch ( lang::WrappedTargetException& )
+ {
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+}
+
+//*****************************************************************************************************************
+// XInterface, XTypeProvider, XServiceInfo
+//*****************************************************************************************************************
+DEFINE_XINTERFACE_3 ( WindowContentFactoryManager ,
+ OWeakObject ,
+ DIRECT_INTERFACE( lang::XTypeProvider ),
+ DIRECT_INTERFACE( lang::XServiceInfo ),
+ DIRECT_INTERFACE( lang::XSingleComponentFactory )
+ )
+
+DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager ,
+ lang::XTypeProvider ,
+ lang::XServiceInfo ,
+ lang::XSingleComponentFactory
+ )
+
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
+ ::cppu::OWeakObject ,
+ SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
+ IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
+ )
+
+DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} )
+
+WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
+ ThreadHelpBase( &Application::GetSolarMutex() ),
+ m_bConfigRead( sal_False ),
+ m_xServiceManager( xServiceManager )
+{
+ m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager );
+ m_pConfigAccess->acquire();
+ m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY );
+}
+
+WindowContentFactoryManager::~WindowContentFactoryManager()
+{
+ ResetableGuard aLock( m_aLock );
+
+ // reduce reference count
+ m_pConfigAccess->release();
+}
+
+void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName )
+{
+ const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
+ const char RESOURCEURL_PREFIX[] = "private:resource/";
+
+ if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
+ sal_Int32 nToken = 0;
+ sal_Int32 nPart = 0;
+ do
+ {
+ ::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken);
+ if ( sToken.getLength() )
+ {
+ if ( nPart == 0 )
+ aType = sToken;
+ else if ( nPart == 1 )
+ aName = sToken;
+ else
+ break;
+ nPart++;
+ }
+ }
+ while( nToken >=0 );
+ }
+}
+
+// XSingleComponentFactory
+uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext(
+ const uno::Reference< uno::XComponentContext >& /*xContext*/ )
+throw (uno::Exception, uno::RuntimeException)
+{
+/*
+ // Currently this method cannot be implemented for generic use. There is no way for external
+ code to get a handle to the dialog model.
+
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY );
+
+ const ::rtl::OUString sToolkitService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"));
+ uno::Reference< awt::XToolkit > xToolkit( xServiceManager->createInstance( sToolkitService ), uno::UNO_QUERY_THROW );
+
+ const ::rtl::OUString sDialogModelService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModel"));
+ uno::Reference< awt::XControlModel > xDialogModel( xServiceManager->createInstance( sDialogModelService ), uno::UNO_QUERY_THROW );
+
+ const ::rtl::OUString sDecoration(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
+ uno::Reference< beans::XPropertySet > xPropSet( xDialogModel, uno::UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( sDecoration, uno::makeAny(false));
+
+ const ::rtl::OUString sDialogService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialog"));
+ uno::Reference< awt::XControl > xDialogControl( xServiceManager->createInstance( sDialogService ), uno::UNO_QUERY_THROW );
+
+ xDialogControl->setModel( xDialogModel );
+
+ uno::Reference< awt::XWindowPeer > xWindowParentPeer( xToolkit->getDesktopWindow(), uno::UNO_QUERY );
+ xDialogControl->createPeer( xToolkit, xWindowParentPeer );
+ uno::Reference< uno::XInterface > xWindow( xDialogControl->getPeer(), uno::UNO_QUERY );
+*/
+ uno::Reference< uno::XInterface > xWindow;
+ return xWindow;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithArgumentsAndContext(
+ const uno::Sequence< uno::Any >& Arguments, const uno::Reference< uno::XComponentContext >& Context )
+throw (uno::Exception, uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xWindow;
+ uno::Reference< frame::XFrame > xFrame;
+ ::rtl::OUString aResourceURL;
+
+ for (sal_Int32 i=0; i < Arguments.getLength(); i++ )
+ {
+ beans::PropertyValue aPropValue;
+ if ( Arguments[i] >>= aPropValue )
+ {
+ if ( aPropValue.Name.equalsAscii( "Frame" ))
+ aPropValue.Value >>= xFrame;
+ else if ( aPropValue.Name.equalsAscii( "ResourceURL" ))
+ aPropValue.Value >>= aResourceURL;
+ }
+ }
+
+ uno::Reference< frame::XModuleManager > xModuleManager;
+ // SAFE
+ {
+ ResetableGuard aLock( m_aLock );
+ xModuleManager = m_xModuleManager;
+ }
+ // UNSAFE
+
+ // Determine the module identifier
+ ::rtl::OUString aType;
+ ::rtl::OUString aName;
+ ::rtl::OUString aModuleId;
+ try
+ {
+ if ( xFrame.is() && xModuleManager.is() )
+ aModuleId = xModuleManager->identify( uno::Reference< uno::XInterface >( xFrame, uno::UNO_QUERY ) );
+ }
+ catch ( frame::UnknownModuleException& )
+ {
+ }
+
+ RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
+ if ( aType.getLength() > 0 &&
+ aName.getLength() > 0 &&
+ aModuleId.getLength() > 0 )
+ {
+ ::rtl::OUString aImplementationName;
+ uno::Reference< uno::XInterface > xHolder( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
+
+ // Detetmine the implementation name of the window content factory dependent on the
+ // module identifier, user interface element type and name
+ // SAFE
+ ResetableGuard aLock( m_aLock );
+ aImplementationName = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId );
+ if ( aImplementationName.getLength() > 0 )
+ {
+ aLock.unlock();
+ // UNSAFE
+
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager( Context->getServiceManager(), uno::UNO_QUERY );
+ if ( xServiceManager.is() )
+ {
+ uno::Reference< lang::XSingleComponentFactory > xFactory(
+ xServiceManager->createInstance( aImplementationName ), uno::UNO_QUERY );
+ if ( xFactory.is() )
+ {
+ // Be careful: We call external code. Therefore here we have to catch all exceptions
+ try
+ {
+ xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context );
+ }
+ catch ( uno::RuntimeException& )
+ {
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ }
+
+ // UNSAFE
+ if ( !xWindow.is())
+ {
+ // Fallback: Use internal factory code to create a toolkit dialog as a content window
+ xWindow = createInstanceWithContext(Context);
+ }
+
+ return xWindow;
+}
+
+} // namespace framework
diff --git a/sfx2/inc/sfx2/dockwin.hxx b/sfx2/inc/sfx2/dockwin.hxx
index 79727b628a92..7784ea2b9505 100644
--- a/sfx2/inc/sfx2/dockwin.hxx
+++ b/sfx2/inc/sfx2/dockwin.hxx
@@ -1,145 +1,145 @@
-/*************************************************************************
- *
- * 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: dockwin.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SFXDOCKWIN_HXX
-#define _SFXDOCKWIN_HXX
-
-#include "sal/config.h"
-#include "sal/types.h"
-#include <vcl/dockwin.hxx>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-
-#include "sfx2/dllapi.h"
-#include <sfx2/childwin.hxx>
-
-class SfxSplitWindow;
-class SfxDockingWindow_Impl;
-
-void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
-bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
-
-class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
-{
-private:
- Rectangle aInnerRect;
- Rectangle aOuterRect;
- SfxBindings* pBindings;
- Size aFloatSize;
- SfxChildWindow* pMgr;
- SfxDockingWindow_Impl* pImp;
-
- SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
- SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
-
-protected:
- SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
- void CalcSplitPosition(const Point rPos, Rectangle& rRect,
- SfxChildAlignment eAlign);
- virtual Size CalcDockingSize(SfxChildAlignment);
- virtual SfxChildAlignment
- CheckAlignment(SfxChildAlignment,SfxChildAlignment);
-
- virtual void Resize();
- virtual BOOL PrepareToggleFloatingMode();
- virtual void ToggleFloatingMode();
- virtual void StartDocking();
- virtual BOOL Docking( const Point& rPos, Rectangle& rRect );
- virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
- virtual void Resizing( Size& rSize );
- virtual void Paint( const Rectangle& rRect );
- virtual BOOL Close();
- virtual void Move();
-
-//#if 0 // _SOLAR__PRIVATE
- SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
-//#endif
-
-public:
- SfxDockingWindow( SfxBindings *pBindings,
- SfxChildWindow *pCW,
- Window* pParent,
- WinBits nWinBits=0);
- SfxDockingWindow( SfxBindings *pBindings,
- SfxChildWindow *pCW,
- Window* pParent,
- const ResId& rResId);
- ~SfxDockingWindow();
-
- void Initialize (SfxChildWinInfo* pInfo);
- virtual void FillInfo(SfxChildWinInfo&) const;
- virtual void StateChanged( StateChangedType nStateChange );
-
- void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
- { aInnerRect = rInner; aOuterRect = rOuter; }
- const Rectangle& GetInnerRect() const { return aInnerRect; }
- const Rectangle& GetOuterRect() const { return aOuterRect; }
- SfxBindings& GetBindings() const { return *pBindings; }
- USHORT GetType() const { return pMgr->GetType(); }
- SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
- void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
- Size GetFloatingSize() const { return aFloatSize; }
- void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
-
- void SetMinOutputSizePixel( const Size& rSize );
- Size GetMinOutputSizePixel() const;
- virtual long Notify( NotifyEvent& rNEvt );
- virtual void FadeIn( BOOL );
- void AutoShow( BOOL bShow = TRUE );
- DECL_LINK( TimerHdl, Timer* );
-
-//#if 0 // _SOLAR__PRIVATE
- SAL_DLLPRIVATE void Initialize_Impl();
- SAL_DLLPRIVATE USHORT GetWinBits_Impl() const;
- SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
- SAL_DLLPRIVATE void Disappear_Impl();
- SAL_DLLPRIVATE void Reappear_Impl();
- SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const;
- SAL_DLLPRIVATE BOOL IsPinned_Impl() const;
- SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE );
- SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned );
- SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
- SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
-//#endif
-};
-
-class SfxDockingWrapper : public SfxChildWindow
-{
- public:
- SfxDockingWrapper( Window* pParent ,
- USHORT nId ,
- SfxBindings* pBindings ,
- SfxChildWinInfo* pInfo );
-
- SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
-};
-
-#endif // #ifndef _SFXDOCKWIN_HXX
+/*************************************************************************
+ *
+ * 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: dockwin.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SFXDOCKWIN_HXX
+#define _SFXDOCKWIN_HXX
+
+#include "sal/config.h"
+#include "sal/types.h"
+#include <vcl/dockwin.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include "sfx2/dllapi.h"
+#include <sfx2/childwin.hxx>
+
+class SfxSplitWindow;
+class SfxDockingWindow_Impl;
+
+void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
+bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
+
+class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
+{
+private:
+ Rectangle aInnerRect;
+ Rectangle aOuterRect;
+ SfxBindings* pBindings;
+ Size aFloatSize;
+ SfxChildWindow* pMgr;
+ SfxDockingWindow_Impl* pImp;
+
+ SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
+ SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
+
+protected:
+ SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
+ void CalcSplitPosition(const Point rPos, Rectangle& rRect,
+ SfxChildAlignment eAlign);
+ virtual Size CalcDockingSize(SfxChildAlignment);
+ virtual SfxChildAlignment
+ CheckAlignment(SfxChildAlignment,SfxChildAlignment);
+
+ virtual void Resize();
+ virtual BOOL PrepareToggleFloatingMode();
+ virtual void ToggleFloatingMode();
+ virtual void StartDocking();
+ virtual BOOL Docking( const Point& rPos, Rectangle& rRect );
+ virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
+ virtual void Resizing( Size& rSize );
+ virtual void Paint( const Rectangle& rRect );
+ virtual BOOL Close();
+ virtual void Move();
+
+//#if 0 // _SOLAR__PRIVATE
+ SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
+//#endif
+
+public:
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ WinBits nWinBits=0);
+ SfxDockingWindow( SfxBindings *pBindings,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId);
+ ~SfxDockingWindow();
+
+ void Initialize (SfxChildWinInfo* pInfo);
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ virtual void StateChanged( StateChangedType nStateChange );
+
+ void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
+ { aInnerRect = rInner; aOuterRect = rOuter; }
+ const Rectangle& GetInnerRect() const { return aInnerRect; }
+ const Rectangle& GetOuterRect() const { return aOuterRect; }
+ SfxBindings& GetBindings() const { return *pBindings; }
+ USHORT GetType() const { return pMgr->GetType(); }
+ SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
+ void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
+ Size GetFloatingSize() const { return aFloatSize; }
+ void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
+
+ void SetMinOutputSizePixel( const Size& rSize );
+ Size GetMinOutputSizePixel() const;
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual void FadeIn( BOOL );
+ void AutoShow( BOOL bShow = TRUE );
+ DECL_LINK( TimerHdl, Timer* );
+
+//#if 0 // _SOLAR__PRIVATE
+ SAL_DLLPRIVATE void Initialize_Impl();
+ SAL_DLLPRIVATE USHORT GetWinBits_Impl() const;
+ SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
+ SAL_DLLPRIVATE void Disappear_Impl();
+ SAL_DLLPRIVATE void Reappear_Impl();
+ SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const;
+ SAL_DLLPRIVATE BOOL IsPinned_Impl() const;
+ SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE );
+ SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned );
+ SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
+ SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
+//#endif
+};
+
+class SfxDockingWrapper : public SfxChildWindow
+{
+ public:
+ SfxDockingWrapper( Window* pParent ,
+ USHORT nId ,
+ SfxBindings* pBindings ,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
+};
+
+#endif // #ifndef _SFXDOCKWIN_HXX
diff --git a/xmlhelp/source/com/sun/star/help/HelpComponent.java b/xmlhelp/source/com/sun/star/help/HelpComponent.java
index 35c856ec5788..481605cb2984 100755
--- a/xmlhelp/source/com/sun/star/help/HelpComponent.java
+++ b/xmlhelp/source/com/sun/star/help/HelpComponent.java
@@ -1,138 +1,138 @@
-/*************************************************************************
- *
- * 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: HelpSearch.java,v $
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.help;
-
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
-
-/*
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lib.uno.helper.WeakBase;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.AnyConverter;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.FilterIndexReader;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.WildcardQuery;
-
-import com.sun.star.script.XInvocation;
-import com.sun.star.beans.XIntrospectionAccess;
-
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.io.File;
-*/
-
-/** This class capsulates the class, that implements the minimal component, a
- * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
- * method, that writes the information into the given registry key
- * (<CODE>__writeRegistryServiceInfo</CODE>).
- */
-public class HelpComponent
-{
- /**
- * Gives a factory for creating the service.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns a <code>XSingleComponentFactory</code> for creating
- * the component
- * @param sImplName the name of the implementation for which a
- * service is desired
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static XSingleComponentFactory __getComponentFactory(String sImplName)
- {
- XSingleComponentFactory xFactory = null;
-
- if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) )
- xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class,
- HelpSearch._HelpSearch.getServiceNames());
- else if ( sImplName.equals( HelpIndexer.class.getName() ) )
- xFactory = Factory.createComponentFactory(HelpIndexer.class,
- HelpIndexer.getServiceNames());
- return xFactory;
- }
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
- {
- boolean bSuccessHelpSearch = Factory.writeRegistryServiceInfo
- (HelpSearch._HelpSearch.class.getName(),
- HelpSearch._HelpSearch.getServiceNames(), regKey);
- boolean bSuccessHelpIndexer = Factory.writeRegistryServiceInfo
- (HelpIndexer.class.getName(),
- HelpIndexer.getServiceNames(), regKey);
-
- return bSuccessHelpSearch && bSuccessHelpIndexer;
- }
- /** This method is a member of the interface for initializing an object
- * directly after its creation.
- * @param object This array of arbitrary objects will be passed to the
- * component after its creation.
- * @throws Exception Every exception will not be handled, but will be
- * passed to the caller.
- */
- public void initialize( Object[] object )
- throws com.sun.star.uno.Exception
- {
- /* The component describes what arguments its expected and in which
- * order!At this point you can read the objects and can intialize
- * your component using these objects.
- */
- }
-}
+/*************************************************************************
+ *
+ * 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: HelpSearch.java,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.help;
+
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.registry.XRegistryKey;
+
+/*
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.FilterIndexReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.WildcardQuery;
+
+import com.sun.star.script.XInvocation;
+import com.sun.star.beans.XIntrospectionAccess;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.io.File;
+*/
+
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
+ * method, that writes the information into the given registry key
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ */
+public class HelpComponent
+{
+ /**
+ * Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns a <code>XSingleComponentFactory</code> for creating
+ * the component
+ * @param sImplName the name of the implementation for which a
+ * service is desired
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static XSingleComponentFactory __getComponentFactory(String sImplName)
+ {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplName.equals( HelpSearch._HelpSearch.class.getName() ) )
+ xFactory = Factory.createComponentFactory(HelpSearch._HelpSearch.class,
+ HelpSearch._HelpSearch.getServiceNames());
+ else if ( sImplName.equals( HelpIndexer.class.getName() ) )
+ xFactory = Factory.createComponentFactory(HelpIndexer.class,
+ HelpIndexer.getServiceNames());
+ return xFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey)
+ {
+ boolean bSuccessHelpSearch = Factory.writeRegistryServiceInfo
+ (HelpSearch._HelpSearch.class.getName(),
+ HelpSearch._HelpSearch.getServiceNames(), regKey);
+ boolean bSuccessHelpIndexer = Factory.writeRegistryServiceInfo
+ (HelpIndexer.class.getName(),
+ HelpIndexer.getServiceNames(), regKey);
+
+ return bSuccessHelpSearch && bSuccessHelpIndexer;
+ }
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @throws Exception Every exception will not be handled, but will be
+ * passed to the caller.
+ */
+ public void initialize( Object[] object )
+ throws com.sun.star.uno.Exception
+ {
+ /* The component describes what arguments its expected and in which
+ * order!At this point you can read the objects and can intialize
+ * your component using these objects.
+ */
+ }
+}
diff --git a/xmlhelp/source/com/sun/star/help/HelpSearch.java b/xmlhelp/source/com/sun/star/help/HelpSearch.java
index e52dd2db7d83..9200702fb5a9 100644
--- a/xmlhelp/source/com/sun/star/help/HelpSearch.java
+++ b/xmlhelp/source/com/sun/star/help/HelpSearch.java
@@ -1,351 +1,351 @@
-/*************************************************************************
- *
- * 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: HelpSearch.java,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.help;
-
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lib.uno.helper.WeakBase;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.Any;
-import com.sun.star.uno.AnyConverter;
-
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.analysis.cjk.CJKAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.FilterIndexReader;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Searcher;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.WildcardQuery;
-
-import com.sun.star.script.XInvocation;
-import com.sun.star.beans.XIntrospectionAccess;
-
-/** This class capsulates the class, that implements the minimal component, a
- * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
- * method, that writes the information into the given registry key
- * (<CODE>__writeRegistryServiceInfo</CODE>).
- */
-public class HelpSearch
-{
- /** This class implements the component. At least the interfaces XServiceInfo,
- * XTypeProvider, and XInitialization should be provided by the service.
- */
- public static class _HelpSearch extends WeakBase
- implements XServiceInfo, XInvocation
- {
- /** The service name, that must be used to get an instance of this service.
- */
- static private final String __serviceName =
- "com.sun.star.help.HelpSearch";
- static private final String aSearchMethodName = "search";
-
- /** The initial component contextr, that gives access to
- * the service manager, supported singletons, ...
- * It's often later used
- */
- private XComponentContext m_cmpCtx;
-
- /** The service manager, that gives access to all registered services.
- * It's often later used
- */
- private XMultiComponentFactory m_xMCF;
-
- /** The constructor of the inner class has a XMultiServiceFactory parameter.
- * @param xmultiservicefactoryInitialization A special service factory
- * could be introduced while initializing.
- */
- public _HelpSearch(XComponentContext xCompContext)
- {
- try {
- m_cmpCtx = xCompContext;
- m_xMCF = m_cmpCtx.getServiceManager();
- }
- catch( Exception e ) {
- e.printStackTrace();
- }
- }
-
- /** This method returns an array of all supported service names.
- * @return Array of supported service names.
- */
- public String[] getSupportedServiceNames()
- {
- return getServiceNames();
- }
-
- /** This method is a simple helper function to used in the
- * static component initialisation functions as well as in
- * getSupportedServiceNames.
- */
- public static String[] getServiceNames()
- {
- String[] sSupportedServiceNames = { __serviceName };
- return sSupportedServiceNames;
- }
-
- /** This method returns true, if the given service will be
- * supported by the component.
- * @param sServiceName Service name.
- * @return True, if the given service name will be supported.
- */
- public boolean supportsService( String sServiceName )
- {
- return sServiceName.equals( __serviceName );
- }
-
- /** Return the class name of the component.
- * @return Class name of the component.
- */
- public String getImplementationName()
- {
- return _HelpSearch.class.getName();
- }
-
- //===================================================
- // XInvocation
- public XIntrospectionAccess getIntrospection()
- {
- return null;
- }
-
- public Object invoke( String aFunctionName, java.lang.Object[] aParams,
- short[][] aOutParamIndex, java.lang.Object[][] aOutParam )
- throws com.sun.star.lang.IllegalArgumentException,
- com.sun.star.script.CannotConvertException,
- com.sun.star.reflection.InvocationTargetException
- {
- String[] aRet = null;
- if( !aFunctionName.equals( aSearchMethodName ) )
- throw new com.sun.star.lang.IllegalArgumentException();
-
- Object[] aScoreOutArray = new Object[1];
- aScoreOutArray[0] = null;
- try
- {
- aRet = doQuery( aParams, aScoreOutArray );
- }
- catch( Exception e )
- {
- aRet = null;
- }
-
- Object aScoreArray = aScoreOutArray[0];
- if( aScoreArray == null )
- {
- aOutParamIndex[0] = new short[0];
- aOutParam[0] = new Object[0];
- }
- else
- {
- short nInParamCount = (short)aParams.length;
- aOutParamIndex[0] = new short[1];
- aOutParamIndex[0][0] = nInParamCount;
- aOutParam[0] = new Object[1];
- aOutParam[0][0] = aScoreArray;
- }
-
- Any aRetAny = new Any( new Type( String[].class ), aRet );
- return aRetAny;
- }
-
- public void setValue( String aPropertyName, java.lang.Object aValue )
- throws com.sun.star.beans.UnknownPropertyException,
- com.sun.star.script.CannotConvertException,
- com.sun.star.reflection.InvocationTargetException {
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public Object getValue( String aPropertyName )
- throws com.sun.star.beans.UnknownPropertyException {
- throw new com.sun.star.beans.UnknownPropertyException();
- }
-
- public boolean hasMethod( String aMethodName ) {
- boolean bRet = (aMethodName.equals( aSearchMethodName ) );
- return bRet;
- }
- public boolean hasProperty( String aName ) {
- return false;
- }
-
- // Command line interface for testing
- private static String[] doQuery( Object[] args, Object[] aScoreOutArray ) throws Exception
- {
- String aLanguageStr = "";
- String aIndexStr = "";
- String aQueryStr = "";
- boolean bCaptionOnly = false;
-
- int nParamCount = args.length;
- String aStrs[] = new String[nParamCount];
- for( int i = 0 ; i < nParamCount ; i++ )
- {
- try
- {
- aStrs[i] = AnyConverter.toString( args[i] );
- }
- catch( IllegalArgumentException e )
- {
- aStrs[i] = "";
- }
- }
-
- // TODO: Error handling
- for( int i = 0 ; i < nParamCount ; i++ )
- {
- if ("-lang".equals(aStrs[i]) )
- {
- aLanguageStr = aStrs[i + 1];
- i++;
- }
- else if( "-index".equals(aStrs[i]) )
- {
- aIndexStr = aStrs[i+1];
- i++;
- }
- else if( "-query".equals(aStrs[i]) )
- {
- aQueryStr = aStrs[i+1];
- i++;
- }
- else if( "-caption".equals(aStrs[i]) )
- {
- bCaptionOnly = true;
- }
- }
- String[] aDocs = queryImpl( aLanguageStr, aIndexStr, aQueryStr, bCaptionOnly, aScoreOutArray );
-
- return aDocs;
- }
-
- private static String[] queryImpl( String aLanguageStr, String aIndexStr, String aQueryStr,
- boolean bCaptionOnly, Object[] aScoreOutArray ) throws Exception
- {
- IndexReader reader = IndexReader.open( aIndexStr );
- Searcher searcher = new IndexSearcher( reader );
- Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer();
-
- String aField;
- if( bCaptionOnly )
- aField = "caption";
- else
- aField = "content";
-
- Query aQuery;
- if( aQueryStr.endsWith( "*" ) )
- aQuery = new WildcardQuery( new Term( aField, aQueryStr ) );
- else
- aQuery = new TermQuery( new Term( aField, aQueryStr ) );
-
- // Perform search
- Hits aHits = searcher.search( aQuery );
- int nHitCount = aHits.length();
-
- String aDocs[] = new String[nHitCount];
- float aScores[] = null;
- aScores = new float[nHitCount];
- for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
- {
- Document aDoc = aHits.doc( iHit );
- String aPath = aDoc.get( "path" );
- aDocs[iHit] = ( aPath != null ) ? aPath : "";
- aScores[iHit] = aHits.score( iHit );
- }
- aScoreOutArray[0] = aScores;
-
- reader.close();
-
- return aDocs;
- }
- }
-
- /**
- * Gives a factory for creating the service.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns a <code>XSingleComponentFactory</code> for creating
- * the component
- * @param sImplName the name of the implementation for which a
- * service is desired
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static XSingleComponentFactory __getComponentFactory(String sImplName)
- {
- XSingleComponentFactory xFactory = null;
-
- if ( sImplName.equals( _HelpSearch.class.getName() ) )
- xFactory = Factory.createComponentFactory(_HelpSearch.class,
- _HelpSearch.getServiceNames());
-
- return xFactory;
- }
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return Factory.writeRegistryServiceInfo(_HelpSearch.class.getName(),
- _HelpSearch.getServiceNames(),
- regKey);
- }
- /** This method is a member of the interface for initializing an object
- * directly after its creation.
- * @param object This array of arbitrary objects will be passed to the
- * component after its creation.
- * @throws Exception Every exception will not be handled, but will be
- * passed to the caller.
- */
- public void initialize( Object[] object )
- throws com.sun.star.uno.Exception {
- /* The component describes what arguments its expected and in which
- * order!At this point you can read the objects and can intialize
- * your component using these objects.
- */
- }
-}
+/*************************************************************************
+ *
+ * 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: HelpSearch.java,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.help;
+
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.analysis.cjk.CJKAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.FilterIndexReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.Searcher;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.WildcardQuery;
+
+import com.sun.star.script.XInvocation;
+import com.sun.star.beans.XIntrospectionAccess;
+
+/** This class capsulates the class, that implements the minimal component, a
+ * factory for creating the service (<CODE>__getComponentFactory</CODE>) and a
+ * method, that writes the information into the given registry key
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ */
+public class HelpSearch
+{
+ /** This class implements the component. At least the interfaces XServiceInfo,
+ * XTypeProvider, and XInitialization should be provided by the service.
+ */
+ public static class _HelpSearch extends WeakBase
+ implements XServiceInfo, XInvocation
+ {
+ /** The service name, that must be used to get an instance of this service.
+ */
+ static private final String __serviceName =
+ "com.sun.star.help.HelpSearch";
+ static private final String aSearchMethodName = "search";
+
+ /** The initial component contextr, that gives access to
+ * the service manager, supported singletons, ...
+ * It's often later used
+ */
+ private XComponentContext m_cmpCtx;
+
+ /** The service manager, that gives access to all registered services.
+ * It's often later used
+ */
+ private XMultiComponentFactory m_xMCF;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public _HelpSearch(XComponentContext xCompContext)
+ {
+ try {
+ m_cmpCtx = xCompContext;
+ m_xMCF = m_cmpCtx.getServiceManager();
+ }
+ catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /** This method returns an array of all supported service names.
+ * @return Array of supported service names.
+ */
+ public String[] getSupportedServiceNames()
+ {
+ return getServiceNames();
+ }
+
+ /** This method is a simple helper function to used in the
+ * static component initialisation functions as well as in
+ * getSupportedServiceNames.
+ */
+ public static String[] getServiceNames()
+ {
+ String[] sSupportedServiceNames = { __serviceName };
+ return sSupportedServiceNames;
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param sServiceName Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService( String sServiceName )
+ {
+ return sServiceName.equals( __serviceName );
+ }
+
+ /** Return the class name of the component.
+ * @return Class name of the component.
+ */
+ public String getImplementationName()
+ {
+ return _HelpSearch.class.getName();
+ }
+
+ //===================================================
+ // XInvocation
+ public XIntrospectionAccess getIntrospection()
+ {
+ return null;
+ }
+
+ public Object invoke( String aFunctionName, java.lang.Object[] aParams,
+ short[][] aOutParamIndex, java.lang.Object[][] aOutParam )
+ throws com.sun.star.lang.IllegalArgumentException,
+ com.sun.star.script.CannotConvertException,
+ com.sun.star.reflection.InvocationTargetException
+ {
+ String[] aRet = null;
+ if( !aFunctionName.equals( aSearchMethodName ) )
+ throw new com.sun.star.lang.IllegalArgumentException();
+
+ Object[] aScoreOutArray = new Object[1];
+ aScoreOutArray[0] = null;
+ try
+ {
+ aRet = doQuery( aParams, aScoreOutArray );
+ }
+ catch( Exception e )
+ {
+ aRet = null;
+ }
+
+ Object aScoreArray = aScoreOutArray[0];
+ if( aScoreArray == null )
+ {
+ aOutParamIndex[0] = new short[0];
+ aOutParam[0] = new Object[0];
+ }
+ else
+ {
+ short nInParamCount = (short)aParams.length;
+ aOutParamIndex[0] = new short[1];
+ aOutParamIndex[0][0] = nInParamCount;
+ aOutParam[0] = new Object[1];
+ aOutParam[0][0] = aScoreArray;
+ }
+
+ Any aRetAny = new Any( new Type( String[].class ), aRet );
+ return aRetAny;
+ }
+
+ public void setValue( String aPropertyName, java.lang.Object aValue )
+ throws com.sun.star.beans.UnknownPropertyException,
+ com.sun.star.script.CannotConvertException,
+ com.sun.star.reflection.InvocationTargetException {
+ throw new com.sun.star.beans.UnknownPropertyException();
+ }
+
+ public Object getValue( String aPropertyName )
+ throws com.sun.star.beans.UnknownPropertyException {
+ throw new com.sun.star.beans.UnknownPropertyException();
+ }
+
+ public boolean hasMethod( String aMethodName ) {
+ boolean bRet = (aMethodName.equals( aSearchMethodName ) );
+ return bRet;
+ }
+ public boolean hasProperty( String aName ) {
+ return false;
+ }
+
+ // Command line interface for testing
+ private static String[] doQuery( Object[] args, Object[] aScoreOutArray ) throws Exception
+ {
+ String aLanguageStr = "";
+ String aIndexStr = "";
+ String aQueryStr = "";
+ boolean bCaptionOnly = false;
+
+ int nParamCount = args.length;
+ String aStrs[] = new String[nParamCount];
+ for( int i = 0 ; i < nParamCount ; i++ )
+ {
+ try
+ {
+ aStrs[i] = AnyConverter.toString( args[i] );
+ }
+ catch( IllegalArgumentException e )
+ {
+ aStrs[i] = "";
+ }
+ }
+
+ // TODO: Error handling
+ for( int i = 0 ; i < nParamCount ; i++ )
+ {
+ if ("-lang".equals(aStrs[i]) )
+ {
+ aLanguageStr = aStrs[i + 1];
+ i++;
+ }
+ else if( "-index".equals(aStrs[i]) )
+ {
+ aIndexStr = aStrs[i+1];
+ i++;
+ }
+ else if( "-query".equals(aStrs[i]) )
+ {
+ aQueryStr = aStrs[i+1];
+ i++;
+ }
+ else if( "-caption".equals(aStrs[i]) )
+ {
+ bCaptionOnly = true;
+ }
+ }
+ String[] aDocs = queryImpl( aLanguageStr, aIndexStr, aQueryStr, bCaptionOnly, aScoreOutArray );
+
+ return aDocs;
+ }
+
+ private static String[] queryImpl( String aLanguageStr, String aIndexStr, String aQueryStr,
+ boolean bCaptionOnly, Object[] aScoreOutArray ) throws Exception
+ {
+ IndexReader reader = IndexReader.open( aIndexStr );
+ Searcher searcher = new IndexSearcher( reader );
+ Analyzer analyzer = aLanguageStr.equals("ja") ? (Analyzer)new CJKAnalyzer() : (Analyzer)new StandardAnalyzer();
+
+ String aField;
+ if( bCaptionOnly )
+ aField = "caption";
+ else
+ aField = "content";
+
+ Query aQuery;
+ if( aQueryStr.endsWith( "*" ) )
+ aQuery = new WildcardQuery( new Term( aField, aQueryStr ) );
+ else
+ aQuery = new TermQuery( new Term( aField, aQueryStr ) );
+
+ // Perform search
+ Hits aHits = searcher.search( aQuery );
+ int nHitCount = aHits.length();
+
+ String aDocs[] = new String[nHitCount];
+ float aScores[] = null;
+ aScores = new float[nHitCount];
+ for( int iHit = 0 ; iHit < nHitCount ; iHit++ )
+ {
+ Document aDoc = aHits.doc( iHit );
+ String aPath = aDoc.get( "path" );
+ aDocs[iHit] = ( aPath != null ) ? aPath : "";
+ aScores[iHit] = aHits.score( iHit );
+ }
+ aScoreOutArray[0] = aScores;
+
+ reader.close();
+
+ return aDocs;
+ }
+ }
+
+ /**
+ * Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns a <code>XSingleComponentFactory</code> for creating
+ * the component
+ * @param sImplName the name of the implementation for which a
+ * service is desired
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static XSingleComponentFactory __getComponentFactory(String sImplName)
+ {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplName.equals( _HelpSearch.class.getName() ) )
+ xFactory = Factory.createComponentFactory(_HelpSearch.class,
+ _HelpSearch.getServiceNames());
+
+ return xFactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return returns true if the operation succeeded
+ * @param regKey the registryKey
+ * @see com.sun.star.comp.loader.JavaLoader
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
+ return Factory.writeRegistryServiceInfo(_HelpSearch.class.getName(),
+ _HelpSearch.getServiceNames(),
+ regKey);
+ }
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @throws Exception Every exception will not be handled, but will be
+ * passed to the caller.
+ */
+ public void initialize( Object[] object )
+ throws com.sun.star.uno.Exception {
+ /* The component describes what arguments its expected and in which
+ * order!At this point you can read the objects and can intialize
+ * your component using these objects.
+ */
+ }
+}
diff --git a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx
index 08d4f508505d..bdad2d01d43c 100644
--- a/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx
+++ b/xmlhelp/source/cxxhelp/inc/qe/DocGenerator.hxx
@@ -1,107 +1,107 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: DocGenerator.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _XMLSEARCH_QE_DOCGENERATOR_HXX_
-#define _XMLSEARCH_QE_DOCGENERATOR_HXX_
-
-#include <rtl/ref.hxx>
-#ifndef _RTL_USTRING_HXX__
-#include <rtl/ustring.hxx>
-#endif
-#include <excep/XmlSearchExceptions.hxx>
-#include <util/CompressorIterator.hxx>
-#include <util/Decompressor.hxx>
-
-
-namespace xmlsearch {
-
- namespace qe {
-
-
- class Query;
-
-
- class NonnegativeIntegerGenerator
- {
- public:
-
- static const sal_Int32 END;
-
- virtual ~NonnegativeIntegerGenerator() { };
- virtual sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) = 0;
- virtual sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) = 0;
- };
-
-
- class RoleFiller
- {
- public:
-
- static RoleFiller* STOP() { return &roleFiller_; }
-
- RoleFiller();
-
- ~RoleFiller();
-
- void acquire() { ++m_nRefcount; }
- void release() { if( ! --m_nRefcount ) delete this; }
-
- private:
-
- static RoleFiller roleFiller_;
-
- sal_uInt32 m_nRefcount;
- sal_uInt8 fixedRole_;
- sal_Int16 filled_;
- sal_Int32 begin_,end_,parentContext_,limit_;
-
- RoleFiller* next_;
- std::vector< RoleFiller* > fillers_;
- };
-
-
- class GeneratorHeap
- {
- public:
-
- GeneratorHeap()
- : heapSize_( 0 ),
- free_( 0 )
- { }
- private:
-
- sal_Int32 heapSize_,free_;
- };
-
-
-
- }
-}
-
-#endif
+/*************************************************************************
+ *
+ * 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: DocGenerator.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _XMLSEARCH_QE_DOCGENERATOR_HXX_
+#define _XMLSEARCH_QE_DOCGENERATOR_HXX_
+
+#include <rtl/ref.hxx>
+#ifndef _RTL_USTRING_HXX__
+#include <rtl/ustring.hxx>
+#endif
+#include <excep/XmlSearchExceptions.hxx>
+#include <util/CompressorIterator.hxx>
+#include <util/Decompressor.hxx>
+
+
+namespace xmlsearch {
+
+ namespace qe {
+
+
+ class Query;
+
+
+ class NonnegativeIntegerGenerator
+ {
+ public:
+
+ static const sal_Int32 END;
+
+ virtual ~NonnegativeIntegerGenerator() { };
+ virtual sal_Int32 first() throw( xmlsearch::excep::XmlSearchException ) = 0;
+ virtual sal_Int32 next() throw( xmlsearch::excep::XmlSearchException ) = 0;
+ };
+
+
+ class RoleFiller
+ {
+ public:
+
+ static RoleFiller* STOP() { return &roleFiller_; }
+
+ RoleFiller();
+
+ ~RoleFiller();
+
+ void acquire() { ++m_nRefcount; }
+ void release() { if( ! --m_nRefcount ) delete this; }
+
+ private:
+
+ static RoleFiller roleFiller_;
+
+ sal_uInt32 m_nRefcount;
+ sal_uInt8 fixedRole_;
+ sal_Int16 filled_;
+ sal_Int32 begin_,end_,parentContext_,limit_;
+
+ RoleFiller* next_;
+ std::vector< RoleFiller* > fillers_;
+ };
+
+
+ class GeneratorHeap
+ {
+ public:
+
+ GeneratorHeap()
+ : heapSize_( 0 ),
+ free_( 0 )
+ { }
+ private:
+
+ sal_Int32 heapSize_,free_;
+ };
+
+
+
+ }
+}
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx
index 336bc9628252..33b0d3153ba4 100644
--- a/xmlhelp/source/cxxhelp/inc/qe/Query.hxx
+++ b/xmlhelp/source/cxxhelp/inc/qe/Query.hxx
@@ -1,178 +1,178 @@
-/*************************************************************************
- *
- * 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: Query.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _XMLSEARCH_QE_QUERY_HXX_
-#define _XMLSEARCH_QE_QUERY_HXX_
-
-#include <sal/types.h>
-#include <rtl/memory.h>
-#include <rtl/ustring.hxx>
-#include <vector>
-
-
-namespace xmlsearch {
-
- namespace qe {
-
- class Search;
- class RoleFiller;
-
- class QueryHit
- {
- public:
-
- QueryHit( sal_Int32 nColumns,double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end )
- : doc_( doc ),
- begin_( begin ),
- end_( end ),
- matchesL_( 2*nColumns ),
- matches_( new sal_Int32[ 2*nColumns ] ),
- penalty_( penalty )
- {
- rtl_zeroMemory( matches_,sizeof( sal_Int32 ) * matchesL_ );
- }
-
- ~QueryHit() { delete[] matches_; }
-
- sal_Int32 getDocument() const { return doc_; }
-
- sal_Int32 countOfMatches() const { return matchesL_; }
-
- sal_Int32 getBegin() const { return begin_; }
-
- sal_Int32 getEnd() const { return end_; }
-
- double getPenalty() const { return penalty_; }
-
- bool betterThan( const QueryHit* o )
- {
- if( penalty_ != o->penalty_ )
- return penalty_ < o->penalty_;
- else if( begin_ != o->begin_ )
- return begin_ < o->begin_;
- else if( end_ != o->end_ )
- return end_ < o->end_;
- else
- return false;
- }
-
- bool worseThan( const QueryHit* o )
- {
- if( penalty_ != o->penalty_ )
- return penalty_ > o->penalty_;
- else if( begin_ != o->begin_ )
- return begin_ > o->begin_;
- else if( end_ != o->end_ )
- return end_ > o->end_;
- else
- return false;
- }
-
- bool worseThan( double penalty,sal_Int32 begin,sal_Int32 end )
- {
- if( penalty_ != penalty )
- return penalty_ > penalty;
- else if( begin_ != begin )
- return begin_ > begin;
- else if( end_ != end )
- return end_ > end;
- else
- return false;
- }
-
- bool compareTo( const QueryHit* o ) const
- {
- if( penalty_ != o->penalty_ )
- return penalty_ < o->penalty_;
- else if( begin_ != o->begin_ )
- return begin_ < o->begin_;
- else if( end_ != o->end_ )
- return end_ < o->end_;
- else
- return false;
- }
-
-
- private:
-
- sal_Int32 doc_,begin_,end_;
-
- sal_Int32 matchesL_;
- sal_Int32 *matches_; // ...concept, word number, ...
-
- double penalty_;
-
- }; // end class QueryHit
-
-
-
- class QueryHitData
- {
- public:
-
- QueryHitData( double penalty,const rtl::OUString& document,sal_Int32 termsL, rtl::OUString* terms )
- : penalty_( penalty ),
- document_( document ),
- termsL_( termsL ),
- terms_( terms ) { }
-
- ~QueryHitData() { delete[] terms_; }
-
- rtl::OUString getDocument() const { return document_; }
-
- double getPenalty() const { return penalty_; }
-
-
- private:
-
- double penalty_;
-
- const rtl::OUString document_;
-
- sal_Int32 termsL_;
- rtl::OUString* terms_;
-
- }; // end class QueryHitData
-
-
- class PrefixTranslator
- {
- public:
-
- static PrefixTranslator* makePrefixTranslator( const rtl::OUString*,sal_Int32 )
- {
- return 0;
- }
- };
- }
-
-}
-
-
-#endif
+/*************************************************************************
+ *
+ * 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: Query.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _XMLSEARCH_QE_QUERY_HXX_
+#define _XMLSEARCH_QE_QUERY_HXX_
+
+#include <sal/types.h>
+#include <rtl/memory.h>
+#include <rtl/ustring.hxx>
+#include <vector>
+
+
+namespace xmlsearch {
+
+ namespace qe {
+
+ class Search;
+ class RoleFiller;
+
+ class QueryHit
+ {
+ public:
+
+ QueryHit( sal_Int32 nColumns,double penalty,sal_Int32 doc,sal_Int32 begin,sal_Int32 end )
+ : doc_( doc ),
+ begin_( begin ),
+ end_( end ),
+ matchesL_( 2*nColumns ),
+ matches_( new sal_Int32[ 2*nColumns ] ),
+ penalty_( penalty )
+ {
+ rtl_zeroMemory( matches_,sizeof( sal_Int32 ) * matchesL_ );
+ }
+
+ ~QueryHit() { delete[] matches_; }
+
+ sal_Int32 getDocument() const { return doc_; }
+
+ sal_Int32 countOfMatches() const { return matchesL_; }
+
+ sal_Int32 getBegin() const { return begin_; }
+
+ sal_Int32 getEnd() const { return end_; }
+
+ double getPenalty() const { return penalty_; }
+
+ bool betterThan( const QueryHit* o )
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ < o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ < o->begin_;
+ else if( end_ != o->end_ )
+ return end_ < o->end_;
+ else
+ return false;
+ }
+
+ bool worseThan( const QueryHit* o )
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ > o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ > o->begin_;
+ else if( end_ != o->end_ )
+ return end_ > o->end_;
+ else
+ return false;
+ }
+
+ bool worseThan( double penalty,sal_Int32 begin,sal_Int32 end )
+ {
+ if( penalty_ != penalty )
+ return penalty_ > penalty;
+ else if( begin_ != begin )
+ return begin_ > begin;
+ else if( end_ != end )
+ return end_ > end;
+ else
+ return false;
+ }
+
+ bool compareTo( const QueryHit* o ) const
+ {
+ if( penalty_ != o->penalty_ )
+ return penalty_ < o->penalty_;
+ else if( begin_ != o->begin_ )
+ return begin_ < o->begin_;
+ else if( end_ != o->end_ )
+ return end_ < o->end_;
+ else
+ return false;
+ }
+
+
+ private:
+
+ sal_Int32 doc_,begin_,end_;
+
+ sal_Int32 matchesL_;
+ sal_Int32 *matches_; // ...concept, word number, ...
+
+ double penalty_;
+
+ }; // end class QueryHit
+
+
+
+ class QueryHitData
+ {
+ public:
+
+ QueryHitData( double penalty,const rtl::OUString& document,sal_Int32 termsL, rtl::OUString* terms )
+ : penalty_( penalty ),
+ document_( document ),
+ termsL_( termsL ),
+ terms_( terms ) { }
+
+ ~QueryHitData() { delete[] terms_; }
+
+ rtl::OUString getDocument() const { return document_; }
+
+ double getPenalty() const { return penalty_; }
+
+
+ private:
+
+ double penalty_;
+
+ const rtl::OUString document_;
+
+ sal_Int32 termsL_;
+ rtl::OUString* terms_;
+
+ }; // end class QueryHitData
+
+
+ class PrefixTranslator
+ {
+ public:
+
+ static PrefixTranslator* makePrefixTranslator( const rtl::OUString*,sal_Int32 )
+ {
+ return 0;
+ }
+ };
+ }
+
+}
+
+
+#endif
diff --git a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
index 0e8413ea2de2..7492e66f9e9b 100644
--- a/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
+++ b/xmlhelp/source/cxxhelp/qe/DocGenerator.cxx
@@ -1,64 +1,64 @@
-/*************************************************************************
- *
- * 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: DocGenerator.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlhelp.hxx"
-#include <qe/DocGenerator.hxx>
-#include <qe/Query.hxx>
-
-
-using namespace xmlsearch;
-using namespace xmlsearch::qe;
-
-
-const sal_Int32 NonnegativeIntegerGenerator::END = -1;
-
-
-RoleFiller RoleFiller::roleFiller_;
-
-
-RoleFiller::RoleFiller()
- : m_nRefcount( 0 ),
- fixedRole_( 0 ),
- filled_( 0 ),
- begin_( 0 ),
- end_( 0 ),
- parentContext_( 0 ),
- limit_( 0 ),
- next_( 0 ),
- fillers_( 0 )
-{
-}
-
-
-RoleFiller::~RoleFiller()
-{
-
-}
+/*************************************************************************
+ *
+ * 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: DocGenerator.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlhelp.hxx"
+#include <qe/DocGenerator.hxx>
+#include <qe/Query.hxx>
+
+
+using namespace xmlsearch;
+using namespace xmlsearch::qe;
+
+
+const sal_Int32 NonnegativeIntegerGenerator::END = -1;
+
+
+RoleFiller RoleFiller::roleFiller_;
+
+
+RoleFiller::RoleFiller()
+ : m_nRefcount( 0 ),
+ fixedRole_( 0 ),
+ filled_( 0 ),
+ begin_( 0 ),
+ end_( 0 ),
+ parentContext_( 0 ),
+ limit_( 0 ),
+ next_( 0 ),
+ fillers_( 0 )
+{
+}
+
+
+RoleFiller::~RoleFiller()
+{
+
+}