summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2009-11-05 13:44:53 +0100
committerMichael Stahl <mst@openoffice.org>2009-11-05 13:44:53 +0100
commit6e5d340f9b6ac5541a8f68412d8d3bb8da550feb (patch)
treea13eb916f709ad51c8697fee3c66ebc747f17412
parent2083665c037ec598c2e20d3c949164d65bc56cad (diff)
parente92917d1bc75f095222ec757f0006b8ef6883a9b (diff)
merge DEV300_m63
-rwxr-xr-xconnectivity/inc/connectivity/DriversConfig.hxx179
-rw-r--r--connectivity/inc/connectivity/dbmetadata.hxx6
-rwxr-xr-xconnectivity/source/commontools/DriversConfig.cxx60
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx16
-rwxr-xr-xconnectivity/source/drivers/jdbc/jdbc.xcu2
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx6
-rw-r--r--formula/prj/CVS/Entries4
-rw-r--r--formula/prj/CVS/Repository1
-rw-r--r--formula/prj/CVS/Root1
-rw-r--r--formula/prj/CVS/Tag1
-rw-r--r--formula/prj/CVS/Template42
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx14
-rw-r--r--framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx92
-rw-r--r--framework/inc/uiconfiguration/uiconfigurationmanager.hxx81
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx19
-rw-r--r--framework/source/jobs/job.cxx2
-rw-r--r--framework/source/loadenv/loadenv.cxx28
-rw-r--r--framework/source/uiconfiguration/makefile.mk1
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx1428
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx1157
-rwxr-xr-xframework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx8
-rw-r--r--framework/util/makefile.mk1
-rw-r--r--idl/inc/command.hxx1
-rw-r--r--idl/inc/database.hxx7
-rw-r--r--idl/source/prj/command.cxx10
-rw-r--r--idl/source/prj/database.cxx6
-rw-r--r--idl/source/prj/svidl.cxx8
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs15
-rw-r--r--oovbaapi/ooo/vba/constants/makefile.mk2
-rw-r--r--oovbaapi/ooo/vba/makefile.mk3
-rw-r--r--sfx2/source/view/viewimp.hxx10
-rw-r--r--sfx2/source/view/viewsh.cxx53
-rw-r--r--svx/inc/svx/msdffimp.hxx1
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx48
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx3
-rw-r--r--svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx5
-rw-r--r--svx/source/fmcomp/gridctrl.cxx15
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx2
-rw-r--r--svx/source/msfilter/msdffimp.cxx70
-rw-r--r--svx/source/outliner/outliner.cxx27
-rw-r--r--svx/source/outliner/outlvw.cxx8
-rw-r--r--svx/source/sdr/contact/viewcontactofgraphic.cxx1
-rw-r--r--svx/source/sdr/contact/viewcontactofunocontrol.cxx40
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx161
-rw-r--r--svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx1
-rw-r--r--svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx5
-rw-r--r--svx/source/sdr/primitive2d/sdrdecompositiontools.cxx6
-rw-r--r--svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx4
-rw-r--r--svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx1
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx12
-rw-r--r--svx/source/svdraw/svdfppt.cxx12
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx41
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx5
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx1
-rw-r--r--xmloff/source/core/xmlimp.cxx20
61 files changed, 3256 insertions, 509 deletions
diff --git a/connectivity/inc/connectivity/DriversConfig.hxx b/connectivity/inc/connectivity/DriversConfig.hxx
index bd86e9ce4397..da68443bb68e 100755
--- a/connectivity/inc/connectivity/DriversConfig.hxx
+++ b/connectivity/inc/connectivity/DriversConfig.hxx
@@ -1,92 +1,95 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: makefile,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
-#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
-
-#include <comphelper/stl_types.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/uno/Sequence.h>
-#include "connectivity/dbtoolsdllapi.hxx"
-#include <salhelper/singletonref.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <unotools/confignode.hxx>
-
-namespace connectivity
-{
- typedef struct
- {
- ::comphelper::NamedValueCollection aProperties;
- ::comphelper::NamedValueCollection aFeatures;
- ::comphelper::NamedValueCollection aMetaData;
- ::rtl::OUString sDriverFactory;
- ::rtl::OUString sDriverTypeDisplayName;
- } TInstalledDriver;
- DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
-
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: makefile,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: st $ $Date: 2000/11/22 02:32:00 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ typedef struct
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ ::rtl::OUString sDriverFactory;
+ ::rtl::OUString sDriverTypeDisplayName;
+ } TInstalledDriver;
+ DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
+
class DriversConfigImpl
{
- ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable TInstalledDrivers m_aDrivers;
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const;
public:
DriversConfigImpl();
- void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers);
- };
- //
- // Allows to access all driver which are located in the configuration
- //
- class OOO_DLLPUBLIC_DBTOOLS DriversConfig
- {
- typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
-
- const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
- public:
- DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
- ~DriversConfig();
-
- DriversConfig( const DriversConfig& );
- DriversConfig& operator=( const DriversConfig& );
-
- ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const;
- ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const;
- const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const;
- const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const;
- const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
- private:
- TInstalledDrivers m_aDrivers;
- OSharedConfigNode m_aNode;
- };
-}
-#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+ const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
+ };
+ //
+ // Allows to access all driver which are located in the configuration
+ //
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
+ ~DriversConfig();
+
+ DriversConfig( const DriversConfig& );
+ DriversConfig& operator=( const DriversConfig& );
+
+ ::rtl::OUString getDriverFactoryName(const ::rtl::OUString& _sUrl) const;
+ ::rtl::OUString getDriverTypeDisplayName(const ::rtl::OUString& _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(const ::rtl::OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(const ::rtl::OUString& _sURL) const;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getURLs() const;
+ private:
+ OSharedConfigNode m_aNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB;
+ };
+}
+#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
diff --git a/connectivity/inc/connectivity/dbmetadata.hxx b/connectivity/inc/connectivity/dbmetadata.hxx
index 32662c5c157a..1ee1718247ae 100644
--- a/connectivity/inc/connectivity/dbmetadata.hxx
+++ b/connectivity/inc/connectivity/dbmetadata.hxx
@@ -177,6 +177,12 @@ namespace dbtools
/** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
*/
bool displayEmptyTableFolders() const;
+
+ /** determines that threads are supported.
+ *
+ * \return <TRUE/> when threads are supported, otherwise <FALSE/>
+ */
+ bool supportsThreads() const;
};
//........................................................................
diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx
index a72816d6427b..30c822b6f169 100755
--- a/connectivity/source/commontools/DriversConfig.cxx
+++ b/connectivity/source/commontools/DriversConfig.cxx
@@ -112,32 +112,35 @@ DriversConfigImpl::DriversConfigImpl()
{
}
// -----------------------------------------------------------------------------
-void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB,TInstalledDrivers& _rDrivers)
+void DriversConfigImpl::Load(const uno::Reference< lang::XMultiServiceFactory >& _rxORB) const
{
- if ( !m_aInstalled.isValid() )
+ if ( m_aDrivers.empty() )
{
- static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed
- m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
- }
-
- if ( m_aInstalled.isValid() )
- {
- const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames();
- const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray();
- const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
- for (;pPatternIter != pPatternEnd ; ++pPatternIter)
+ if ( !m_aInstalled.isValid() )
{
- TInstalledDriver aInstalledDriver;
- lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
- if ( aInstalledDriver.sDriverFactory.getLength() )
- _rDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver));
+ static const ::rtl::OUString s_sNodeName(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.DataAccess.Drivers/Installed")); ///Installed
+ m_aInstalled = ::utl::OConfigurationTreeRoot::createWithServiceFactory(_rxORB, s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY);
}
+
+ if ( m_aInstalled.isValid() )
+ {
+ const uno::Sequence< ::rtl::OUString > aURLPatterns = m_aInstalled.getNodeNames();
+ const ::rtl::OUString* pPatternIter = aURLPatterns.getConstArray();
+ const ::rtl::OUString* pPatternEnd = pPatternIter + aURLPatterns.getLength();
+ for (;pPatternIter != pPatternEnd ; ++pPatternIter)
+ {
+ TInstalledDriver aInstalledDriver;
+ lcl_readURLPatternNode(m_aInstalled,*pPatternIter,aInstalledDriver);
+ if ( aInstalledDriver.sDriverFactory.getLength() )
+ m_aDrivers.insert(TInstalledDrivers::value_type(*pPatternIter,aInstalledDriver));
+ }
+ } // if ( m_aInstalled.isValid() )
}
}
// -----------------------------------------------------------------------------
DriversConfig::DriversConfig(const uno::Reference< lang::XMultiServiceFactory >& _rxORB)
+:m_xORB(_rxORB)
{
- m_aNode->Load(_rxORB,m_aDrivers);
}
// -----------------------------------------------------------------------------
@@ -156,7 +159,6 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
{
if ( this != &_rhs )
{
- m_aDrivers = _rhs.m_aDrivers;
m_aNode = _rhs.m_aNode;
}
return *this;
@@ -165,10 +167,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
// -----------------------------------------------------------------------------
::rtl::OUString DriversConfig::getDriverFactoryName(const ::rtl::OUString& _sURL) const
{
+ const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
::rtl::OUString sRet;
::rtl::OUString sOldPattern;
- TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
- TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ TInstalledDrivers::const_iterator aIter = rDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = rDrivers.end();
for(;aIter != aEnd;++aIter)
{
WildCard aWildCard(aIter->first);
@@ -184,10 +187,11 @@ DriversConfig& DriversConfig::operator=( const DriversConfig& _rhs )
// -----------------------------------------------------------------------------
::rtl::OUString DriversConfig::getDriverTypeDisplayName(const ::rtl::OUString& _sURL) const
{
+ const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
::rtl::OUString sRet;
::rtl::OUString sOldPattern;
- TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
- TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ TInstalledDrivers::const_iterator aIter = rDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = rDrivers.end();
for(;aIter != aEnd;++aIter)
{
WildCard aWildCard(aIter->first);
@@ -218,10 +222,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::getMetaData(const ::rtl
// -----------------------------------------------------------------------------
const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::OUString& _sURL,sal_Int32 _nProps) const
{
+ const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
const ::comphelper::NamedValueCollection* pRet = NULL;
::rtl::OUString sOldPattern;
- TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
- TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ TInstalledDrivers::const_iterator aIter = rDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = rDrivers.end();
for(;aIter != aEnd;++aIter)
{
WildCard aWildCard(aIter->first);
@@ -252,10 +257,11 @@ const ::comphelper::NamedValueCollection& DriversConfig::impl_get(const ::rtl::O
// -----------------------------------------------------------------------------
uno::Sequence< ::rtl::OUString > DriversConfig::getURLs() const
{
- uno::Sequence< ::rtl::OUString > aRet(m_aDrivers.size());
+ const TInstalledDrivers& rDrivers = m_aNode->getInstalledDrivers(m_xORB);
+ uno::Sequence< ::rtl::OUString > aRet(rDrivers.size());
::rtl::OUString* pIter = aRet.getArray();
- TInstalledDrivers::const_iterator aIter = m_aDrivers.begin();
- TInstalledDrivers::const_iterator aEnd = m_aDrivers.end();
+ TInstalledDrivers::const_iterator aIter = rDrivers.begin();
+ TInstalledDrivers::const_iterator aEnd = rDrivers.end();
for(;aIter != aEnd;++aIter,++pIter)
{
*pIter = aIter->first;
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 70220b1cd563..c5b65a9d113b 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -407,6 +407,22 @@ namespace dbtools
#endif
return doDisplay;
}
+ //--------------------------------------------------------------------
+ bool DatabaseMetaData::supportsThreads() const
+ {
+ bool bSupported( true );
+ try
+ {
+ Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW );
+ ::rtl::OUString sConnectionURL( xMeta->getURL() );
+ bSupported = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) != 0;
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return bSupported;
+ }
//........................................................................
} // namespace dbtools
diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu
index 73fe2e9adc55..ae1bbad227e7 100755
--- a/connectivity/source/drivers/jdbc/jdbc.xcu
+++ b/connectivity/source/drivers/jdbc/jdbc.xcu
@@ -174,7 +174,7 @@
<node oor:name="Properties">
<node oor:name="IgnoreCurrency" oor:op="replace">
<prop oor:name="Value" oor:type="xs:boolean">
- <value>false</value>
+ <value>true</value>
</prop>
</node>
<node oor:name="TypeInfoSettings" oor:op="replace">
diff --git a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
index 349d5425eb04..3397c5c515a9 100644
--- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
@@ -126,13 +126,13 @@ SQLSMALLINT OResultSetMetaData::getColumnODBCType(OConnection* _pConnection
SQLSMALLINT nType = 0;
try
{
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
+ nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE);
if(nType == SQL_UNKNOWN_TYPE)
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
+ nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE);
}
catch(SQLException& ) // in this case we have an odbc 2.0 driver
{
- nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE );
+ nType = (SQLSMALLINT)getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE );
}
return nType;
diff --git a/formula/prj/CVS/Entries b/formula/prj/CVS/Entries
deleted file mode 100644
index 3ae75e3153ff..000000000000
--- a/formula/prj/CVS/Entries
+++ /dev/null
@@ -1,4 +0,0 @@
-/build.lst/1.10/Wed Aug 20 14:15:04 2008//Tcws_dev300_frmdlg
-/d.lst/1.6/Fri Aug 17 11:27:10 2007//Tcws_dev300_frmdlg
-/rpt.xml/1.2/Mon Jul 09 11:56:12 2007//Tcws_dev300_frmdlg
-D
diff --git a/formula/prj/CVS/Repository b/formula/prj/CVS/Repository
deleted file mode 100644
index 573341612fc8..000000000000
--- a/formula/prj/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
-/cvs/dba/reportdesign/prj
diff --git a/formula/prj/CVS/Root b/formula/prj/CVS/Root
deleted file mode 100644
index ed0df2a21830..000000000000
--- a/formula/prj/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
-:pserver:oj@so-cvs-tunnel.germany.sun.com:/cvs
diff --git a/formula/prj/CVS/Tag b/formula/prj/CVS/Tag
deleted file mode 100644
index 9ff93ee1efdd..000000000000
--- a/formula/prj/CVS/Tag
+++ /dev/null
@@ -1 +0,0 @@
-Tcws_dev300_frmdlg
diff --git a/formula/prj/CVS/Template b/formula/prj/CVS/Template
deleted file mode 100644
index eec9bab36d48..000000000000
--- a/formula/prj/CVS/Template
+++ /dev/null
@@ -1,42 +0,0 @@
-Issue number:
-Submitted by:
-Reviewed by:
-CVS: ----------------------------------------------------------------------
-CVS: Issue number:
-CVS: If this change addresses one or more issues,
-CVS: then enter the issue number(s) here.
-CVS: Submitted by:
-CVS: If this code has been contributed to the project by someone else; i.e.,
-CVS: they sent us a patch or a set of diffs, then include their name/email
-CVS: address here. If this is your work then delete this line.
-CVS: Reviewed by:
-CVS: If we are doing pre-commit code reviews and someone else has
-CVS: reviewed your changes, include their name(s) here.
-CVS: If you have not had it reviewed then delete this line.
-CVS: ----------------------------------------------------------------------
-CVS: Committers,
-CVS:
-CVS: Please follow these protocols:
-CVS:
-CVS: * Please include in the log message
-CVS: reference(s) by ID / number and/or URL
-CVS: to any and all relevant OpenOffice.org issue(s).
-CVS:
-CVS: * If the code is contributed from outside Sun
-CVS: then please verify using the list at the following URL
-CVS: http://www.openoffice.org/copyright/copyrightapproved.html
-CVS: that Sun has received a signed Copyright Assignment Form
-CVS: from the submitter.
-CVS:
-CVS: Otherwise,
-CVS: please send an email TO: the submitter; and CC: OOCRequest@eng.sun.com
-CVS: the letter (CopyRightRequest.txt) to request assignment of copyright to Sun
-CVS: (http://www.openoffice.org/copyright/assign_copyright.html).
-CVS:
-CVS: Please do NOT commit code until you have verified (as detailed above) that
-CVS: Sun has received a signed Copyright Assignment Form from the submitter.
-CVS:
-CVS: * Please send an email TO: the submitter
-CVS: (particularly, if from outside Sun)
-CVS: advising that the code has been committed,
-CVS: and gratefully recognizing the contribution.
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 4cfa28d1806d..2fd4e08deeb4 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1183,10 +1183,10 @@ void FormulaCompiler::RangeLine()
//---------------------------------------------------------------------------
-void FormulaCompiler::UnionLine()
+void FormulaCompiler::IntersectionLine()
{
RangeLine();
- while (pToken->GetOpCode() == ocUnion)
+ while (pToken->GetOpCode() == ocIntersect)
{
FormulaTokenRef p = pToken;
NextToken();
@@ -1197,14 +1197,14 @@ void FormulaCompiler::UnionLine()
//---------------------------------------------------------------------------
-void FormulaCompiler::IntersectionLine()
+void FormulaCompiler::UnionLine()
{
- UnionLine();
- while (pToken->GetOpCode() == ocIntersect)
+ IntersectionLine();
+ while (pToken->GetOpCode() == ocUnion)
{
FormulaTokenRef p = pToken;
NextToken();
- UnionLine();
+ IntersectionLine();
PutCode(p);
}
}
@@ -1224,7 +1224,7 @@ void FormulaCompiler::UnaryLine()
PutCode( p );
}
else
- IntersectionLine();
+ UnionLine();
}
//---------------------------------------------------------------------------
diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
index 62c0477a5169..a0dc92ae50d3 100644
--- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx
@@ -38,7 +38,6 @@
#include <vector>
#include <list>
#include <hash_map>
-#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -78,7 +77,6 @@
namespace framework
{
- class UIConfigurationManagerImpl;
class ModuleUIConfigurationManager : public com::sun::star::lang::XTypeProvider ,
public com::sun::star::lang::XServiceInfo ,
public com::sun::star::lang::XComponent ,
@@ -87,6 +85,7 @@ namespace framework
public ::com::sun::star::ui::XUIConfigurationManager ,
public ::com::sun::star::ui::XModuleUIConfigurationManager ,
public ::com::sun::star::ui::XUIConfigurationPersistence ,
+ private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::OWeakObject
{
public:
@@ -135,7 +134,94 @@ namespace framework
virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException);
private:
- ::std::auto_ptr<UIConfigurationManagerImpl> m_pImpl;
+ // private data types
+ enum Layer
+ {
+ LAYER_DEFAULT,
+ LAYER_USERDEFINED,
+ LAYER_COUNT
+ };
+
+ enum NotifyOp
+ {
+ NotifyOp_Remove,
+ NotifyOp_Insert,
+ NotifyOp_Replace
+ };
+
+ struct UIElementInfo
+ {
+ UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) :
+ aResourceURL( rResourceURL), aUIName( rUIName ) {}
+ rtl::OUString aResourceURL;
+ rtl::OUString aUIName;
+ };
+
+ struct UIElementData
+ {
+ UIElementData() : bModified( false ), bDefault( true ), bDefaultNode( true ) {};
+
+ rtl::OUString aResourceURL;
+ rtl::OUString aName;
+ bool bModified; // has been changed since last storing
+ bool bDefault; // default settings
+ bool bDefaultNode; // this is a default layer element data
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings;
+ };
+
+ struct UIElementType;
+ friend struct UIElementType;
+ typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap;
+
+ struct UIElementType
+ {
+ UIElementType() : bModified( false ),
+ bLoaded( false ),
+ bDefaultLayer( false ),
+ nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {}
+
+
+ bool bModified;
+ bool bLoaded;
+ bool bDefaultLayer;
+ sal_Int16 nElementType;
+ UIElementDataHashMap aElementsHashMap;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage;
+ };
+
+ typedef ::std::vector< UIElementType > UIElementTypesVector;
+ typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
+ typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap;
+
+ // private methods
+ void impl_Initialize();
+ void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
+ void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType );
+ void impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType );
+ UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true );
+ void impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData );
+ void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState = true );
+ void impl_resetElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
+ void impl_reloadElementTypeData( UIElementType& rUserElementType, UIElementType& rDefaultElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
+
+ UIElementTypesVector m_aUIElements[LAYER_COUNT];
+ PresetHandler* m_pStorageHandler[::com::sun::star::ui::UIElementType::COUNT];
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultConfigStorage;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserConfigStorage;
+ bool m_bReadOnly;
+ bool m_bInitialized;
+ bool m_bModified;
+ bool m_bConfigRead;
+ bool m_bDisposed;
+ rtl::OUString m_aXMLPostfix;
+ rtl::OUString m_aPropUIName;
+ rtl::OUString m_aPropResourceURL;
+ rtl::OUString m_aModuleIdentifier;
+ rtl::OUString m_aModuleShortName;
+ com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager;
};
}
diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
index 39f1d9503513..e7ecec183570 100644
--- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
+++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx
@@ -38,7 +38,6 @@
#include <vector>
#include <list>
#include <hash_map>
-#include <memory>
//_________________________________________________________________________________________________________________
// my own includes
@@ -78,7 +77,6 @@
namespace framework
{
- class UIConfigurationManagerImpl;
class UIConfigurationManager : public com::sun::star::lang::XTypeProvider ,
public com::sun::star::lang::XServiceInfo ,
public com::sun::star::lang::XComponent ,
@@ -86,6 +84,7 @@ namespace framework
public ::com::sun::star::ui::XUIConfigurationManager ,
public ::com::sun::star::ui::XUIConfigurationPersistence ,
public ::com::sun::star::ui::XUIConfigurationStorage ,
+ private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::OWeakObject
{
public:
@@ -131,7 +130,83 @@ namespace framework
virtual sal_Bool SAL_CALL hasStorage() throw (::com::sun::star::uno::RuntimeException);
private:
- ::std::auto_ptr<UIConfigurationManagerImpl> m_pImpl;
+ // private data types
+ enum NotifyOp
+ {
+ NotifyOp_Remove,
+ NotifyOp_Insert,
+ NotifyOp_Replace
+ };
+
+ struct UIElementInfo
+ {
+ UIElementInfo( const rtl::OUString& rResourceURL, const rtl::OUString& rUIName ) :
+ aResourceURL( rResourceURL), aUIName( rUIName ) {}
+ rtl::OUString aResourceURL;
+ rtl::OUString aUIName;
+ };
+
+ struct UIElementData
+ {
+ UIElementData() : bModified( false ), bDefault( true ) {};
+
+ rtl::OUString aResourceURL;
+ rtl::OUString aName;
+ bool bModified; // has been changed since last storing
+ bool bDefault; // default settings
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > xSettings;
+ };
+
+ struct UIElementType;
+ friend struct UIElementType;
+ typedef ::std::hash_map< rtl::OUString, UIElementData, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementDataHashMap;
+
+ struct UIElementType
+ {
+ UIElementType() : bModified( false ),
+ bLoaded( false ),
+ bDefaultLayer( false ),
+ nElementType( ::com::sun::star::ui::UIElementType::UNKNOWN ) {}
+
+
+ bool bModified;
+ bool bLoaded;
+ bool bDefaultLayer;
+ sal_Int16 nElementType;
+ UIElementDataHashMap aElementsHashMap;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > xStorage;
+ };
+
+ typedef ::std::vector< UIElementType > UIElementTypesVector;
+ typedef ::std::vector< ::com::sun::star::ui::ConfigurationEvent > ConfigEventNotifyContainer;
+ typedef ::std::hash_map< rtl::OUString, UIElementInfo, OUStringHashCode, ::std::equal_to< rtl::OUString > > UIElementInfoHashMap;
+
+ // private methods
+ void impl_Initialize();
+ void implts_notifyContainerListener( const ::com::sun::star::ui::ConfigurationEvent& aEvent, NotifyOp eOp );
+ void impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType );
+ void impl_preloadUIElementTypeList( sal_Int16 nElementType );
+ UIElementData* impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad = true );
+ void impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData );
+ void impl_storeElementTypeData( com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState = true );
+ void impl_resetElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer );
+ void impl_reloadElementTypeData( UIElementType& rDocElementType, ConfigEventNotifyContainer& rRemoveNotifyContainer, ConfigEventNotifyContainer& rReplaceNotifyContainer );
+
+ UIElementTypesVector m_aUIElements;
+ com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDocConfigStorage;
+ bool m_bReadOnly;
+ bool m_bInitialized;
+ bool m_bModified;
+ bool m_bConfigRead;
+ bool m_bDisposed;
+ rtl::OUString m_aXMLPostfix;
+ rtl::OUString m_aPropUIName;
+ rtl::OUString m_aPropResourceURL;
+ rtl::OUString m_aModuleIdentifier;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager;
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig;
};
}
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index b2139488a0ee..ee59097aa3fc 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -67,6 +67,7 @@
// includes of other projects
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/mediadescriptor.hxx>
+#include <comphelper/configurationhelper.hxx>
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
@@ -361,6 +362,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
css::uno::Reference< css::awt::XWindow > xPluggWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY);
aReadLock.unlock();
// <- SAFE ----------------------------------
@@ -432,8 +434,21 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
// is visible too.
impl_showProgress();
- if (xParentWindow.is())
- xParentWindow->setVisible(sal_True);
+ ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+ Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
+ if ( pWindow )
+ {
+ bool bForceFrontAndFocus(false);
+ ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+ ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+ ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+ ::comphelper::ConfigurationHelper::E_READONLY) >>= bForceFrontAndFocus;
+
+ pWindow->Show(sal_True, bForceFrontAndFocus ? SHOW_FOREGROUNDTASK : 0 );
+ }
+
/*
#i75167# dont disturb window manager handling .-)
css::uno::Reference< css::awt::XTopWindow > xParentWindowTop(xParentWindow, css::uno::UNO_QUERY);
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index 40d36f9a65f8..c0c5c90d45b3 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -51,7 +51,6 @@
// includes of other projects
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
-#include <comphelper/uieventslogger.hxx>
//________________________________
// namespace
@@ -238,7 +237,6 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD
// Otherwhise we might die by ref count ...
css::uno::Reference< css::task::XJobListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- if ( ::comphelper::UiEventsLogger::isEnabled() )
try
{
// create the job
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 0af8ea0e6587..ee39e583e5e7 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1740,14 +1740,28 @@ void LoadEnv::impl_reactForLoadingState()
void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::XWindow >& xWindow ,
sal_Bool bForceToFront)
{
- css::uno::Reference< css::awt::XTopWindow > xTopWindow(xWindow, css::uno::UNO_QUERY);
-
- if (xWindow.is())
- xWindow->setVisible(sal_True);
-
- if (xTopWindow.is() && bForceToFront)
- xTopWindow->toFront();
+ // SAFE -> ----------------------------------
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY );
+ aReadLock.unlock();
+ // <- SAFE ----------------------------------
+ ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+ Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+ if ( pWindow )
+ {
+ bool bForceFrontAndFocus(false);
+ css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey(
+ xSMGR,
+ ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+ ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+ ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+ ::comphelper::ConfigurationHelper::E_READONLY);
+ a >>= bForceFrontAndFocus;
+
+ pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 );
+ }
+
/* #i19976#
We tried to prevent a toFront() call in case the user putted the
loading document into the background ..
diff --git a/framework/source/uiconfiguration/makefile.mk b/framework/source/uiconfiguration/makefile.mk
index c7d6eb435d4f..3ef9006072a2 100644
--- a/framework/source/uiconfiguration/makefile.mk
+++ b/framework/source/uiconfiguration/makefile.mk
@@ -43,7 +43,6 @@ ENABLE_EXCEPTIONS= TRUE
SLOFILES= \
$(SLO)$/uiconfigurationmanager.obj \
- $(SLO)$/uiconfigurationmanagerimpl.obj \
$(SLO)$/moduleuiconfigurationmanager.obj \
$(SLO)$/moduleuicfgsupplier.obj \
$(SLO)$/windowstateconfiguration.obj \
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 04c87a2c3946..663c2d0d6dd8 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -38,7 +38,6 @@
#include <uielement/uielementtypenames.hxx>
#include <xml/menuconfiguration.hxx>
#include <xml/toolboxconfiguration.hxx>
-#include <uiconfigurationmanagerimpl.hxx>
#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
#include <xml/statusbarconfiguration.hxx>
@@ -114,127 +113,1292 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( ModuleUIConfigurationManager
DEFINE_INIT_SERVICE ( ModuleUIConfigurationManager, {} )
-ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager )
-: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),true) )
+// important: The order and position of the elements must match the constant
+// definition of "::com::sun::star::ui::UIElementType"
+static const char* UIELEMENTTYPENAMES[] =
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::ModuleUIConfigurationManager" );
+ "", // Dummy value for unknown!
+ UIELEMENTTYPE_MENUBAR_NAME,
+ UIELEMENTTYPE_POPUPMENU_NAME,
+ UIELEMENTTYPE_TOOLBAR_NAME,
+ UIELEMENTTYPE_STATUSBAR_NAME,
+ UIELEMENTTYPE_FLOATINGWINDOW_NAME,
+ UIELEMENTTYPE_PROGRESSBAR_NAME
+};
+
+static const char RESOURCEURL_PREFIX[] = "private:resource/";
+static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
+static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_";
+
+static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL )
+{
+
+ if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE );
+ sal_Int32 nIndex = aTmpStr.indexOf( '/' );
+ if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
+ {
+ OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
+ for ( int i = 0; i < UIElementType::COUNT; i++ )
+ {
+ if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] ))
+ return sal_Int16( i );
+ }
+ }
+ }
+
+ return UIElementType::UNKNOWN;
+}
+
+static OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL )
+{
+ if (( aResourceURL.indexOf( OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' );
+ if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength()))
+ return aResourceURL.copy( nIndex+1 );
+ }
+
+ return OUString();
+}
+
+void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType )
+{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
+ UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
+
+ OUString aCustomUrlPrefix( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_CUSTOM_ELEMENT ));
+ while ( pUserIter != rUserElements.end() )
+ {
+ sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+ if ( nIndex > RESOURCEURL_PREFIX_SIZE )
+ {
+ // Performance: Retrieve user interface name only for custom user interface elements.
+ // It's only used by them!
+ UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // Retrieve user interface name from XPropertySet interface
+ rtl::OUString aUIName;
+ Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ Any a = xPropSet->getPropertyValue( m_aPropUIName );
+ a >>= aUIName;
+ }
+
+ UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
+ }
+ }
+ else
+ {
+ // The user interface name for standard user interface elements is stored in the WindowState.xcu file
+ UIElementInfo aInfo( pUserIter->second.aResourceURL, OUString() );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
+ }
+ ++pUserIter;
+ }
+
+ UIElementDataHashMap& rDefaultElements = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ UIElementDataHashMap::const_iterator pDefIter = rDefaultElements.begin();
+
+ while ( pDefIter != rDefaultElements.end() )
+ {
+ UIElementInfoHashMap::const_iterator pIterInfo = aUIElementInfoCollection.find( pDefIter->second.aResourceURL );
+ if ( pIterInfo == aUIElementInfoCollection.end() )
+ {
+ sal_Int32 nIndex = pDefIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
+ if ( nIndex > RESOURCEURL_PREFIX_SIZE )
+ {
+ // Performance: Retrieve user interface name only for custom user interface elements.
+ // It's only used by them!
+ UIElementData* pDataSettings = impl_findUIElementData( pDefIter->second.aResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // Retrieve user interface name from XPropertySet interface
+ rtl::OUString aUIName;
+ Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ Any a = xPropSet->getPropertyValue( m_aPropUIName );
+ a >>= aUIName;
+ }
+
+ UIElementInfo aInfo( pDefIter->second.aResourceURL, aUIName );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
+ }
+ }
+ else
+ {
+ // The user interface name for standard user interface elements is stored in the WindowState.xcu file
+ UIElementInfo aInfo( pDefIter->second.aResourceURL, OUString() );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pDefIter->second.aResourceURL, aInfo ));
+ }
+ }
+
+ ++pDefIter;
+ }
+}
+
+void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, sal_Int16 nElementType )
+{
+ UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
+
+ if ( !rElementTypeData.bLoaded )
+ {
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() )
+ {
+ rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
+ aBuf.appendAscii( RESOURCEURL_PREFIX );
+ aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
+ aBuf.appendAscii( "/" );
+ OUString aResURLPrefix( aBuf.makeStringAndClear() );
+
+ UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
+ Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY );
+ Sequence< OUString > aUIElementNames = xNameAccess->getElementNames();
+ for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+ {
+ UIElementData aUIElementData;
+
+ // Resource name must be without ".xml"
+ sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
+ if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+ {
+ OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
+ OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+
+ if (( aUIElementName.getLength() > 0 ) &&
+ ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 )))
+ {
+ aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
+ aUIElementData.aName = aUIElementNames[n];
+
+ if ( eLayer == LAYER_USERDEFINED )
+ {
+ aUIElementData.bModified = false;
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
+ }
+
+ // Create hash_map entries for all user interface elements inside the storage. We don't load the
+ // settings to speed up the process.
+ rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData ));
+ }
+ }
+ }
+ }
+ }
+
+ rElementTypeData.bLoaded = true;
+}
+
+void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Layer eLayer, UIElementData& aUIElementData )
+{
+ UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
+
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() )
+ {
+ try
+ {
+ Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ );
+ Reference< XInputStream > xInputStream = xStream->getInputStream();
+
+ if ( xInputStream.is() )
+ {
+ switch ( nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::UNKNOWN:
+ break;
+
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
+ if ( pRootItemContainer )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::POPUPMENU:
+ {
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW:
+ {
+ break;
+ }
+ }
+ }
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+
+ // At least we provide an empty settings container!
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer() ), UNO_QUERY );
+}
+
+ModuleUIConfigurationManager::UIElementData* ModuleUIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad )
+{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_USERDEFINED, nElementType );
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ // first try to look into our user-defined vector/hash_map combination
+ UIElementDataHashMap& rUserHashMap = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL );
+ if ( pIter != rUserHashMap.end() )
+ {
+ // Default data settings data must be retrieved from the default layer!
+ if ( !pIter->second.bDefault )
+ {
+ if ( !pIter->second.xSettings.is() && bLoad )
+ impl_requestUIElementData( nElementType, LAYER_USERDEFINED, pIter->second );
+ return &(pIter->second);
+ }
+ }
+
+ // Not successfull, we have to look into our default vector/hash_map combination
+ UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ pIter = rDefaultHashMap.find( aResourceURL );
+ if ( pIter != rDefaultHashMap.end() )
+ {
+ if ( !pIter->second.xSettings.is() && bLoad )
+ impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
+ return &(pIter->second);
+ }
+
+ // Nothing has been found!
+ return NULL;
+}
+
+void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorage > xStorage, UIElementType& rElementType, bool bResetModifyState )
+{
+ UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( rElement.bDefault )
+ {
+ xStorage->removeElement( rElement.aName );
+ rElement.bModified = sal_False; // mark as not modified
+ }
+ else
+ {
+ Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY );
+ Reference< XOutputStream > xOutputStream( xStream->getOutputStream() );
+
+ if ( xOutputStream.is() )
+ {
+ switch( rElementType.nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // mark as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElement.bModified = sal_False;
+ }
+ }
+
+ ++pIter;
+ }
+
+ // commit element type storage
+ Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+
+ // mark UIElementType as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElementType.bModified = sal_False;
+}
+
+// This is only allowed to be called on the LAYER_USER_DEFINED!
+void ModuleUIConfigurationManager::impl_resetElementTypeData(
+ UIElementType& rUserElementType,
+ UIElementType& rDefaultElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer,
+ ConfigEventNotifyContainer& rReplaceNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+ Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
+ sal_Int16 nType = rUserElementType.nElementType;
+
+ // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
+ // our listeners!
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( !rElement.bDefault )
+ {
+ if ( xDefaultNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from default layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+ impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = xIfac;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ else
+ {
+ // Remove user-defined settings from user layer
+ ConfigurationEvent aEvent;
+ aEvent.ResourceURL = rElement.aResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ }
+
+ ++pIter;
+ }
+
+ // Remove all settings from our user interface elements
+ rHashMap.clear();
+}
+
+void ModuleUIConfigurationManager::impl_reloadElementTypeData(
+ UIElementType& rUserElementType,
+ UIElementType& rDefaultElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer,
+ ConfigEventNotifyContainer& rReplaceNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+ Reference< XStorage > xUserStorage( rUserElementType.xStorage );
+ Reference< XStorage > xDefaultStorage( rDefaultElementType.xStorage );
+ Reference< XNameAccess > xUserNameAccess( rUserElementType.xStorage, UNO_QUERY );
+ Reference< XNameAccess > xDefaultNameAccess( rDefaultElementType.xStorage, UNO_QUERY );
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+ sal_Int16 nType = rUserElementType.nElementType;
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( xUserNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from user layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+
+ impl_requestUIElementData( nType, LAYER_USERDEFINED, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = xIfac;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ rElement.bModified = false;
+ }
+ else if ( xDefaultNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from default layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+
+ impl_requestUIElementData( nType, LAYER_DEFAULT, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = xIfac;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ else
+ {
+ // Element settings are not in any storage => remove
+ ConfigurationEvent aRemoveEvent;
+
+ aRemoveEvent.ResourceURL = rElement.aResourceURL;
+ aRemoveEvent.Accessor <<= xThis;
+ aRemoveEvent.Source = xIfac;
+ aRemoveEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aRemoveEvent );
+
+ // Mark element as default and not modified. That means "not active"
+ // in the user layer anymore.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ }
+ ++pIter;
+ }
+
+ rUserElementType.bModified = sal_False;
+}
+
+void ModuleUIConfigurationManager::impl_Initialize()
+{
+ // Initialize the top-level structures with the storage data
+ if ( m_xUserConfigStorage.is() )
+ {
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ if ( m_pStorageHandler[i] )
+ xElementTypeStorage = m_pStorageHandler[i]->getWorkingStorageUser();
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+
+ m_aUIElements[LAYER_USERDEFINED][i].nElementType = i;
+ m_aUIElements[LAYER_USERDEFINED][i].bModified = false;
+ m_aUIElements[LAYER_USERDEFINED][i].xStorage = xElementTypeStorage;
+ m_aUIElements[LAYER_USERDEFINED][i].bDefaultLayer = false;
+ }
+ }
+
+ if ( m_xDefaultConfigStorage.is() )
+ {
+ Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW );
+
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ Any a = xNameAccess->getByName( OUString::createFromAscii( UIELEMENTTYPENAMES[i] ));
+ a >>= xElementTypeStorage;
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+
+ m_aUIElements[LAYER_DEFAULT][i].nElementType = i;
+ m_aUIElements[LAYER_DEFAULT][i].bModified = false;
+ m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage;
+ m_aUIElements[LAYER_DEFAULT][i].bDefaultLayer = true;
+ }
+ }
+}
+
+ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) :
+ ThreadHelpBase( &Application::GetSolarMutex() )
+ , m_xDefaultConfigStorage( 0 )
+ , m_xUserConfigStorage( 0 )
+ , m_bReadOnly( true )
+ , m_bInitialized( false )
+ , m_bModified( false )
+ , m_bConfigRead( false )
+ , m_bDisposed( false )
+ , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
+ , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))
+ , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ))
+ , m_xServiceManager( xServiceManager )
+ , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+{
+ for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ m_pStorageHandler[i] = 0;
+
+ // Make sure we have a default initialized entry for every layer and user interface element type!
+ // The following code depends on this!
+ m_aUIElements[LAYER_DEFAULT].resize( ::com::sun::star::ui::UIElementType::COUNT );
+ m_aUIElements[LAYER_USERDEFINED].resize( ::com::sun::star::ui::UIElementType::COUNT );
}
ModuleUIConfigurationManager::~ModuleUIConfigurationManager()
{
+ for ( int i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ delete m_pStorageHandler[i];
}
// XComponent
void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::dispose" );
- m_pImpl->dispose();
+ Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
+
+ css::lang::EventObject aEvent( xThis );
+ m_aListenerContainer.disposeAndClear( aEvent );
+
+ {
+ ResetableGuard aGuard( m_aLock );
+ try
+ {
+ if ( m_xModuleImageManager.is() )
+ m_xModuleImageManager->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+
+ m_xModuleImageManager.clear();
+ m_aUIElements[LAYER_USERDEFINED].clear();
+ m_aUIElements[LAYER_DEFAULT].clear();
+ m_xDefaultConfigStorage.clear();
+ m_xUserConfigStorage.clear();
+ m_xUserRootCommit.clear();
+ m_bConfigRead = false;
+ m_bModified = false;
+ m_bDisposed = true;
+ }
}
void SAL_CALL ModuleUIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addEventListener" );
- m_pImpl->addEventListener(xListener);
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
void SAL_CALL ModuleUIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeEventListener" );
- m_pImpl->removeEventListener(xListener);
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
// XInitialization
void SAL_CALL ModuleUIConfigurationManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::initialize" );
- m_pImpl->initialize(aArguments);
+ ResetableGuard aLock( m_aLock );
+
+ if ( !m_bInitialized )
+ {
+ ::comphelper::SequenceAsHashMap lArgs(aArguments);
+ m_aModuleIdentifier = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleIdentifier"), ::rtl::OUString());
+ m_aModuleShortName = lArgs.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("ModuleShortName"), ::rtl::OUString());
+
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ rtl::OUString aResourceType;
+ if ( i == ::com::sun::star::ui::UIElementType::MENUBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_MENUBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR();
+ else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR )
+ aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR();
+
+ if ( aResourceType.getLength() > 0 )
+ {
+ m_pStorageHandler[i] = new PresetHandler( m_xServiceManager );
+ m_pStorageHandler[i]->connectToResource( PresetHandler::E_MODULES,
+ aResourceType, // this path wont be used later ... seee next lines!
+ m_aModuleShortName,
+ css::uno::Reference< css::embed::XStorage >()); // no document root used here!
+ }
+ }
+
+ // initialize root storages for all resource types
+ m_xUserRootCommit = css::uno::Reference< css::embed::XTransactedObject >(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getOrCreateRootStorageUser(), css::uno::UNO_QUERY); // can be empty
+ m_xDefaultConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageShare(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageShare());
+ m_xUserConfigStorage = m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getParentStorageUser(
+ m_pStorageHandler[::com::sun::star::ui::UIElementType::MENUBAR]->getWorkingStorageUser());
+
+ if ( m_xUserConfigStorage.is() )
+ {
+ Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ long nOpenMode = 0;
+ Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
+ if ( a >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
+ }
+ }
+
+ impl_Initialize();
+
+ m_bInitialized = true;
+ }
}
// XUIConfiguration
void SAL_CALL ModuleUIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addConfigurationListener" );
- m_pImpl->addConfigurationListener(xListener);
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
}
void SAL_CALL ModuleUIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeConfigurationListener" );
- m_pImpl->removeConfigurationListener(xListener);
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
}
// XUIConfigurationManager
void SAL_CALL ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reset" );
- m_pImpl->reset();
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ bool bResetStorage( false );
+
+ if ( !isReadOnly() )
+ {
+ // Remove all elements from our user-defined storage!
+ try
+ {
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( xSubStorage.is() )
+ {
+ bool bCommitSubStorage( false );
+ Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY );
+ Sequence< OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames();
+ for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
+ {
+ xSubStorage->removeElement( aUIElementStreamNames[j] );
+ bCommitSubStorage = true;
+ }
+
+ if ( bCommitSubStorage )
+ {
+ Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ m_pStorageHandler[i]->commitUserChanges();
+ }
+ }
+ }
+
+ bResetStorage = true;
+
+ // remove settings from user defined layer and notify listener about removed settings data!
+ ConfigEventNotifyContainer aRemoveEventNotifyContainer;
+ ConfigEventNotifyContainer aReplaceEventNotifyContainer;
+ for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ )
+ {
+ try
+ {
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j];
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j];
+
+ impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
+ rUserElementType.bModified = sal_False;
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ sal_uInt32 k = 0;
+ for ( k = 0; k < aRemoveEventNotifyContainer.size(); k++ )
+ implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove );
+ for ( k = 0; k < aReplaceEventNotifyContainer.size(); k++ )
+ implts_notifyContainerListener( aReplaceEventNotifyContainer[k], NotifyOp_Replace );
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
}
Sequence< Sequence< PropertyValue > > SAL_CALL ModuleUIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType )
throw ( IllegalArgumentException, RuntimeException )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getUIElementsInfo" );
- return m_pImpl->getUIElementsInfo(ElementType);
+ if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+
+ ResetableGuard aGuard( m_aLock );
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ Sequence< Sequence< PropertyValue > > aElementInfoSeq;
+ UIElementInfoHashMap aUIElementInfoCollection;
+
+ if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN )
+ {
+ for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) );
+ }
+ else
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType );
+
+ Sequence< PropertyValue > aUIElementInfo( 2 );
+ aUIElementInfo[0].Name = m_aPropResourceURL;
+ aUIElementInfo[1].Name = m_aPropUIName;
+
+ aElementInfoSeq.realloc( aUIElementInfoCollection.size() );
+ UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
+
+ sal_Int32 n = 0;
+ while ( pIter != aUIElementInfoCollection.end() )
+ {
+ aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
+ aUIElementInfo[1].Value <<= pIter->second.aUIName;
+ aElementInfoSeq[n++] = aUIElementInfo;
+ ++pIter;
+ }
+
+ return aElementInfoSeq;
}
Reference< XIndexContainer > SAL_CALL ModuleUIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::createSettings" );
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
// Creates an empty item container which can be filled from outside
- return m_pImpl->createSettings();
+ return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::hasSettings" );
- return m_pImpl->hasSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+ if ( pDataSettings )
+ return sal_True;
+ }
+
+ return sal_False;
}
Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getSettings" );
- return m_pImpl->getSettings(ResourceURL,bWriteable);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // Create a copy of our data if someone wants to change the data.
+ if ( bWriteable )
+ return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
+ else
+ return pDataSettings->xSettings;
+ }
+ }
+
+ throw NoSuchElementException();
}
void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::replaceSettings" );
- return m_pImpl->replaceSettings(ResourceURL,aNewData);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ if ( !pDataSettings->bDefaultNode )
+ {
+ // we have a settings entry in our user-defined layer - replace
+ Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ pDataSettings->xSettings = aNewData;
+ pDataSettings->bDefault = false;
+ pDataSettings->bModified = true;
+ m_bModified = true;
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.ReplacedElement <<= xOldSettings;
+ aEvent.Element <<= pDataSettings->xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ else
+ {
+ // we have no settings in our user-defined layer - insert
+ UIElementData aUIElementData;
+
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
+ aUIElementData.bModified = true;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = aNewData;
+ aUIElementData.aName = RetrieveNameFromResourceURL( ResourceURL ) + m_aXMLPostfix;
+ aUIElementData.aResourceURL = ResourceURL;
+ m_bModified = true;
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
+
+ // Check our user element settings hash map as it can already contain settings that have been set to default!
+ // If no node can be found, we have to insert it.
+ UIElementDataHashMap::iterator pIter = rElements.find( ResourceURL );
+ if ( pIter != rElements.end() )
+ pIter->second = aUIElementData;
+ else
+ rElements.insert( UIElementDataHashMap::value_type( ResourceURL, aUIElementData ));
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.ReplacedElement <<= pDataSettings->xSettings;
+ aEvent.Element <<= aUIElementData.xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ }
+ else
+ throw NoSuchElementException();
+ }
}
void SAL_CALL ModuleUIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL )
throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeSettings" );
- m_pImpl->removeSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // If element settings are default, we don't need to change anything!
+ if ( pDataSettings->bDefault )
+ return;
+ else
+ {
+ Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
+ pDataSettings->bDefault = true;
+
+ // check if this is a default layer node
+ if ( !pDataSettings->bDefaultNode )
+ pDataSettings->bModified = true; // we have to remove this node from the user layer!
+ pDataSettings->xSettings.clear();
+ m_bModified = true; // user layer must be written
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Check if we have settings in the default layer which replaces the user-defined one!
+ UIElementData* pDefaultDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDefaultDataSettings )
+ {
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= xRemovedSettings;
+ aEvent.ReplacedElement <<= pDefaultDataSettings->xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ else
+ {
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= xRemovedSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Remove );
+ }
+ }
+ }
+ else
+ throw NoSuchElementException();
+ }
}
void SAL_CALL ModuleUIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData )
throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException )
{
- m_pImpl->insertSettings(NewResourceURL,aNewData);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
+ if ( !pDataSettings )
+ {
+ UIElementData aUIElementData;
+
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
+ aUIElementData.bModified = true;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = aNewData;
+ aUIElementData.aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix;
+ aUIElementData.aResourceURL = NewResourceURL;
+ m_bModified = true;
+
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType];
+ rElementType.bModified = true;
+
+ UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
+ rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, aUIElementData ));
+
+ Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings );
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = NewResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= xInsertSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Insert );
+ }
+ else
+ throw ElementExistException();
+ }
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getImageManager" );
- return m_pImpl->getImageManager();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( !m_xModuleImageManager.is() )
+ {
+ m_xModuleImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ModuleImageManager( m_xServiceManager )),
+ UNO_QUERY );
+ Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY );
+
+ Sequence< Any > aPropSeq( 3 );
+ PropertyValue aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ));
+ aPropValue.Value = makeAny( m_xUserConfigStorage );
+ aPropSeq[0] = makeAny( aPropValue );
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
+ aPropValue.Value = makeAny( m_aModuleIdentifier );
+ aPropSeq[1] = makeAny( aPropValue );
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserRootCommit" ));
+ aPropValue.Value = makeAny( m_xUserRootCommit );
+ aPropSeq[2] = makeAny( aPropValue );
+
+ xInit->initialize( aPropSeq );
+ }
+
+ return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
+
+// return Reference< XInterface >();
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getShortCutManager" );
- return m_pImpl->getShortCutManager();
+ ResetableGuard aGuard( m_aLock );
+ Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
+ ::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier;
+ aGuard.unlock();
+
+ Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION);
+ Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
+
+ PropertyValue aProp;
+ aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier");
+ aProp.Value <<= aModule;
+
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= aProp;
+
+ xInit->initialize(lArgs);
+
+ return xManager;
}
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getEventsManager" );
return Reference< XInterface >();
}
@@ -242,46 +1406,210 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager(
sal_Bool SAL_CALL ModuleUIConfigurationManager::isDefaultSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isDefaultSettings" );
- return m_pImpl->isDefaultSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+ if ( pDataSettings && pDataSettings->bDefaultNode )
+ return sal_True;
+ }
+
+ return sal_False;
}
Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getDefaultSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getDefaultSettings" );
- return m_pImpl->getDefaultSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+ // Look into our default vector/hash_map combination
+ UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL );
+ if ( pIter != rDefaultHashMap.end() )
+ {
+ if ( !pIter->second.xSettings.is() )
+ impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
+ return pIter->second.xSettings;
+ }
+ }
+
+ // Nothing has been found!
+ throw NoSuchElementException();
}
// XUIConfigurationPersistence
void SAL_CALL ModuleUIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reload" );
- m_pImpl->reload();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveNotifyContainer;
+ ConfigEventNotifyContainer aReplaceNotifyContainer;
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i];
+
+ if ( rUserElementType.bModified )
+ impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ )
+ implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove );
+ for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ )
+ implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace );
+ }
}
void SAL_CALL ModuleUIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::store" );
- m_pImpl->store();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( rElementType.bModified && xStorage.is() )
+ {
+ impl_storeElementTypeData( xStorage, rElementType );
+ m_pStorageHandler[i]->commitUserChanges();
+ }
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = false;
+ }
}
void SAL_CALL ModuleUIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::storeToStorage" );
- m_pImpl->storeToStorage(Storage);
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
+ OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE ));
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+
+ if ( rElementType.bModified && xElementTypeStorage.is() )
+ impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isModified" );
- return m_pImpl->isModified();
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bModified;
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isReadOnly" );
- return m_pImpl->isReadOnly();
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bReadOnly;
+}
+
+void ModuleUIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
+ if ( pContainer != NULL )
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
+ {
+ try
+ {
+ switch ( eOp )
+ {
+ case NotifyOp_Replace:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
+ break;
+ }
+ }
+ catch( css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
+ }
+ }
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 67049d9eb4dc..3309333fb327 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -38,7 +38,6 @@
#include <uielement/uielementtypenames.hxx>
#include <xml/menuconfiguration.hxx>
#include <xml/toolboxconfiguration.hxx>
-#include <uiconfigurationmanagerimpl.hxx>
#ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
#include <xml/statusbarconfiguration.hxx>
@@ -111,9 +110,511 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager
DEFINE_INIT_SERVICE ( UIConfigurationManager, {} )
-UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager )
-: m_pImpl( new UIConfigurationManagerImpl(xServiceManager,static_cast< OWeakObject* >(this),false) )
+
+// important: The order and position of the elements must match the constant
+// definition of "::com::sun::star::ui::UIElementType"
+static const char* UIELEMENTTYPENAMES[] =
+{
+ "", // Dummy value for unknown!
+ UIELEMENTTYPE_MENUBAR_NAME,
+ UIELEMENTTYPE_POPUPMENU_NAME,
+ UIELEMENTTYPE_TOOLBAR_NAME,
+ UIELEMENTTYPE_STATUSBAR_NAME,
+ UIELEMENTTYPE_FLOATINGWINDOW_NAME,
+ UIELEMENTTYPE_PROGRESSBAR_NAME
+};
+
+static const char RESOURCEURL_PREFIX[] = "private:resource/";
+static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
+
+static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL )
+{
+
+ 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 nIndex = aTmpStr.indexOf( '/' );
+ if (( nIndex > 0 ) && ( aTmpStr.getLength() > nIndex ))
+ {
+ rtl::OUString aTypeStr( aTmpStr.copy( 0, nIndex ));
+ for ( int i = 0; i < UIElementType::COUNT; i++ )
+ {
+ if ( aTypeStr.equalsAscii( UIELEMENTTYPENAMES[i] ))
+ return sal_Int16( i );
+ }
+ }
+ }
+
+ return UIElementType::UNKNOWN;
+}
+
+static rtl::OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL )
+{
+ if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
+ ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
+ {
+ sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' );
+ if (( nIndex > 0 ) && (( nIndex+1 ) < aResourceURL.getLength()))
+ return aResourceURL.copy( nIndex+1 );
+ }
+
+ return rtl::OUString();
+}
+
+void UIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIElementInfoHashMap& aUIElementInfoCollection, sal_Int16 nElementType )
{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( nElementType );
+
+ UIElementDataHashMap& rUserElements = m_aUIElements[nElementType].aElementsHashMap;
+ UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin();
+
+ while ( pUserIter != rUserElements.end() )
+ {
+ UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
+ if ( pDataSettings && !pDataSettings->bDefault )
+ {
+ // Retrieve user interface name from XPropertySet interface
+ rtl::OUString aUIName;
+ Reference< XPropertySet > xPropSet( pDataSettings->xSettings, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ Any a = xPropSet->getPropertyValue( m_aPropUIName );
+ a >>= aUIName;
+ }
+
+ UIElementInfo aInfo( pUserIter->second.aResourceURL, aUIName );
+ aUIElementInfoCollection.insert( UIElementInfoHashMap::value_type( pUserIter->second.aResourceURL, aInfo ));
+ }
+ ++pUserIter;
+ }
+}
+
+void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementType )
+{
+ UIElementType& rElementTypeData = m_aUIElements[nElementType];
+
+ if ( !rElementTypeData.bLoaded )
+ {
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() )
+ {
+ rtl::OUStringBuffer aBuf( RESOURCEURL_PREFIX_SIZE );
+ aBuf.appendAscii( RESOURCEURL_PREFIX );
+ aBuf.appendAscii( UIELEMENTTYPENAMES[ nElementType ] );
+ aBuf.appendAscii( "/" );
+ rtl::OUString aResURLPrefix( aBuf.makeStringAndClear() );
+
+ UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
+ Reference< XNameAccess > xNameAccess( xElementTypeStorage, UNO_QUERY );
+ Sequence< rtl::OUString > aUIElementNames = xNameAccess->getElementNames();
+ for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+ {
+ UIElementData aUIElementData;
+
+ // Resource name must be without ".xml"
+ sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
+ if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+ {
+ rtl::OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
+ rtl::OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+
+ if (( aUIElementName.getLength() > 0 ) &&
+ ( aExtension.equalsIgnoreAsciiCaseAsciiL( "xml", 3 )))
+ {
+ aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
+ aUIElementData.aName = aUIElementNames[n];
+ aUIElementData.bModified = false;
+ aUIElementData.bDefault = false;
+
+ // Create hash_map entries for all user interface elements inside the storage. We don't load the
+ // settings to speed up the process.
+ rHashMap.insert( UIElementDataHashMap::value_type( aUIElementData.aResourceURL, aUIElementData ));
+ }
+ }
+ }
+ }
+ }
+
+ rElementTypeData.bLoaded = true;
+}
+
+void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, UIElementData& aUIElementData )
+{
+ UIElementType& rElementTypeData = m_aUIElements[nElementType];
+
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( xElementTypeStorage.is() && aUIElementData.aName.getLength() )
+ {
+ try
+ {
+ Reference< XStream > xStream = xElementTypeStorage->openStreamElement( aUIElementData.aName, ElementModes::READ );
+ Reference< XInputStream > xInputStream = xStream->getInputStream();
+
+ if ( xInputStream.is() )
+ {
+ switch ( nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::UNKNOWN:
+ break;
+
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xContainer );
+ if ( pRootItemContainer )
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ else
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::POPUPMENU:
+ {
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
+ StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
+ RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
+ return;
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+
+ break;
+ }
+
+ case ::com::sun::star::ui::UIElementType::FLOATINGWINDOW:
+ {
+ break;
+ }
+ }
+ }
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
+
+ // At least we provide an empty settings container!
+ aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer()), UNO_QUERY );
+}
+
+UIConfigurationManager::UIElementData* UIConfigurationManager::impl_findUIElementData( const rtl::OUString& aResourceURL, sal_Int16 nElementType, bool bLoad )
+{
+ // preload list of element types on demand
+ impl_preloadUIElementTypeList( nElementType );
+
+ // try to look into our document vector/hash_map combination
+ UIElementDataHashMap& rUserHashMap = m_aUIElements[nElementType].aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rUserHashMap.find( aResourceURL );
+ if ( pIter != rUserHashMap.end() )
+ {
+ // Default data settings data means removed!
+ if ( pIter->second.bDefault )
+ return &(pIter->second);
+ else
+ {
+ if ( !pIter->second.xSettings.is() && bLoad )
+ impl_requestUIElementData( nElementType, pIter->second );
+ return &(pIter->second);
+ }
+ }
+
+ // Nothing has been found!
+ return NULL;
+}
+
+void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& xStorage, UIElementType& rElementType, bool bResetModifyState )
+{
+ UIElementDataHashMap& rHashMap = rElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( rElement.bDefault )
+ {
+ xStorage->removeElement( rElement.aName );
+ rElement.bModified = sal_False; // mark as not modified
+ }
+ else
+ {
+ Reference< XStream > xStream( xStorage->openStreamElement( rElement.aName, ElementModes::WRITE|ElementModes::TRUNCATE ), UNO_QUERY );
+ Reference< XOutputStream > xOutputStream( xStream->getOutputStream() );
+
+ if ( xOutputStream.is() )
+ {
+ switch( rElementType.nElementType )
+ {
+ case ::com::sun::star::ui::UIElementType::MENUBAR:
+ {
+ try
+ {
+ MenuConfiguration aMenuCfg( m_xServiceManager );
+ aMenuCfg.StoreMenuBarConfigurationToXML( rElement.xSettings, xOutputStream );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::TOOLBAR:
+ {
+ try
+ {
+ ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ case ::com::sun::star::ui::UIElementType::STATUSBAR:
+ {
+ try
+ {
+ StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings );
+ }
+ catch ( ::com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // mark as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElement.bModified = sal_False;
+ }
+ }
+
+ ++pIter;
+ }
+
+ // commit element type storage
+ Reference< XTransactedObject > xTransactedObject( xStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+
+ // mark UIElementType as not modified if we store to our own storage
+ if ( bResetModifyState )
+ rElementType.bModified = sal_False;
+}
+
+void UIConfigurationManager::impl_resetElementTypeData(
+ UIElementType& rDocElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling
+ // our listeners!
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( !rElement.bDefault )
+ {
+ // Remove user-defined settings from document
+ ConfigurationEvent aEvent;
+ aEvent.ResourceURL = rElement.aResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aEvent );
+
+ // Mark element as default.
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ else
+ rElement.bModified = false;
+
+ ++pIter;
+ }
+
+ // Remove all settings from our user interface elements
+ rHashMap.clear();
+}
+
+void UIConfigurationManager::impl_reloadElementTypeData(
+ UIElementType& rDocElementType,
+ ConfigEventNotifyContainer& rRemoveNotifyContainer,
+ ConfigEventNotifyContainer& rReplaceNotifyContainer )
+{
+ UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap;
+ UIElementDataHashMap::iterator pIter = rHashMap.begin();
+ Reference< XStorage > xElementStorage( rDocElementType.xStorage );
+ Reference< XNameAccess > xElementNameAccess( xElementStorage, UNO_QUERY );
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+ sal_Int16 nType = rDocElementType.nElementType;
+
+ while ( pIter != rHashMap.end() )
+ {
+ UIElementData& rElement = pIter->second;
+ if ( rElement.bModified )
+ {
+ if ( xElementNameAccess->hasByName( rElement.aName ))
+ {
+ // Replace settings with data from user layer
+ Reference< XIndexAccess > xOldSettings( rElement.xSettings );
+
+ impl_requestUIElementData( nType, rElement );
+
+ ConfigurationEvent aReplaceEvent;
+
+ aReplaceEvent.ResourceURL = rElement.aResourceURL;
+ aReplaceEvent.Accessor <<= xThis;
+ aReplaceEvent.Source = xIfac;
+ aReplaceEvent.ReplacedElement <<= xOldSettings;
+ aReplaceEvent.Element <<= rElement.xSettings;
+ rReplaceNotifyContainer.push_back( aReplaceEvent );
+
+ rElement.bModified = false;
+ }
+ else
+ {
+ // Element settings are not in any storage => remove
+ ConfigurationEvent aRemoveEvent;
+
+ aRemoveEvent.ResourceURL = rElement.aResourceURL;
+ aRemoveEvent.Accessor <<= xThis;
+ aRemoveEvent.Source = xIfac;
+ aRemoveEvent.Element <<= rElement.xSettings;
+
+ rRemoveNotifyContainer.push_back( aRemoveEvent );
+
+ // Mark element as default and not modified. That means "not active" in the document anymore
+ rElement.bModified = false;
+ rElement.bDefault = true;
+ }
+ }
+ ++pIter;
+ }
+
+ rDocElementType.bModified = sal_False;
+}
+
+void UIConfigurationManager::impl_Initialize()
+{
+ // Initialize the top-level structures with the storage data
+ if ( m_xDocConfigStorage.is() )
+ {
+ long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
+
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ xElementTypeStorage = m_xDocConfigStorage->openStorageElement( rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), nModes );
+ }
+ catch ( com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::io::IOException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+
+ m_aUIElements[i].nElementType = i;
+ m_aUIElements[i].bModified = false;
+ m_aUIElements[i].xStorage = xElementTypeStorage;
+ m_aUIElements[i].bDefaultLayer = false;
+ }
+ }
+ else
+ {
+ // We have no storage, just initialize ui element types with empty storage!
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ m_aUIElements[i].xStorage = m_xDocConfigStorage;
+ }
+}
+
+UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager ) :
+ ThreadHelpBase( &Application::GetSolarMutex() )
+ , m_xDocConfigStorage( 0 )
+ , m_bReadOnly( true )
+ , m_bInitialized( false )
+ , m_bModified( false )
+ , m_bConfigRead( false )
+ , m_bDisposed( false )
+ , m_aXMLPostfix( RTL_CONSTASCII_USTRINGPARAM( ".xml" ))
+ , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))
+ , m_aPropResourceURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ))
+ , m_xServiceManager( xServiceManager )
+ , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+{
+ // Make sure we have a default initialized entry for every layer and user interface element type!
+ // The following code depends on this!
+ m_aUIElements.resize( ::com::sun::star::ui::UIElementType::COUNT );
}
UIConfigurationManager::~UIConfigurationManager()
@@ -123,86 +624,507 @@ UIConfigurationManager::~UIConfigurationManager()
// XComponent
void SAL_CALL UIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->dispose();
+ Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
+
+ css::lang::EventObject aEvent( xThis );
+ m_aListenerContainer.disposeAndClear( aEvent );
+
+ {
+ ResetableGuard aGuard( m_aLock );
+ try
+ {
+ if ( m_xImageManager.is() )
+ m_xImageManager->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+
+ m_xImageManager.clear();
+ m_aUIElements.clear();
+ m_xDocConfigStorage.clear();
+ m_bConfigRead = false;
+ m_bModified = false;
+ m_bDisposed = true;
+ }
}
void SAL_CALL UIConfigurationManager::addEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
+ {
+ ResetableGuard aGuard( m_aLock );
- m_pImpl->addEventListener(xListener);
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
void SAL_CALL UIConfigurationManager::removeEventListener( const Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeEventListener(xListener);
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XEventListener >* ) NULL ), xListener );
}
// XUIConfigurationManager
void SAL_CALL UIConfigurationManager::addConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->addConfigurationListener(xListener);
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+ }
+
+ m_aListenerContainer.addInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
}
void SAL_CALL UIConfigurationManager::removeConfigurationListener( const Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->removeConfigurationListener(xListener);
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ m_aListenerContainer.removeInterface( ::getCppuType( ( const Reference< XUIConfigurationListener >* ) NULL ), xListener );
}
void SAL_CALL UIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->reset();
+ ResetableGuard aGuard( m_aLock );
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( isReadOnly() )
+ return;
+
+ bool bResetStorage( false );
+ if ( m_xDocConfigStorage.is() )
+ {
+ try
+ {
+ // Remove all elements from our user-defined storage!
+ bool bCommit( false );
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ UIElementType& rElementType = m_aUIElements[i];
+ Reference< XStorage > xSubStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( xSubStorage.is() )
+ {
+ bool bCommitSubStorage( false );
+ Reference< XNameAccess > xSubStorageNameAccess( xSubStorage, UNO_QUERY );
+ Sequence< rtl::OUString > aUIElementStreamNames = xSubStorageNameAccess->getElementNames();
+ for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
+ {
+ xSubStorage->removeElement( aUIElementStreamNames[j] );
+ bCommitSubStorage = true;
+ bCommit = true;
+ }
+
+ if ( bCommitSubStorage )
+ {
+ Reference< XTransactedObject > xTransactedObject( xSubStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
+ }
+ }
+
+ // Commit changes
+ if ( bCommit )
+ {
+ Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
+ bResetStorage = true;
+
+ // remove settings from user defined layer and notify listener about removed settings data!
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveEventNotifyContainer;
+ for ( sal_Int16 j = 1; j < ::com::sun::star::ui::UIElementType::COUNT; j++ )
+ {
+ UIElementType& rDocElementType = m_aUIElements[j];
+
+ impl_resetElementTypeData( rDocElementType, aRemoveEventNotifyContainer );
+ rDocElementType.bModified = sal_False;
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ for ( sal_uInt32 k = 0; k < aRemoveEventNotifyContainer.size(); k++ )
+ implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove );
+ }
+ catch ( ::com::sun::star::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( ::com::sun::star::container::NoSuchElementException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::InvalidStorageException& )
+ {
+ }
+ catch ( ::com::sun::star::embed::StorageWrappedTargetException& )
+ {
+ }
+ }
}
Sequence< Sequence< PropertyValue > > SAL_CALL UIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType )
throw ( IllegalArgumentException, RuntimeException )
{
- return m_pImpl->getUIElementsInfo(ElementType);
+ if (( ElementType < 0 ) || ( ElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+
+ ResetableGuard aGuard( m_aLock );
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ Sequence< Sequence< PropertyValue > > aElementInfoSeq;
+ UIElementInfoHashMap aUIElementInfoCollection;
+
+ if ( ElementType == ::com::sun::star::ui::UIElementType::UNKNOWN )
+ {
+ for ( sal_Int16 i = 0; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, sal_Int16( i ) );
+ }
+ else
+ impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType );
+
+ Sequence< PropertyValue > aUIElementInfo( 2 );
+ aUIElementInfo[0].Name = m_aPropResourceURL;
+ aUIElementInfo[1].Name = m_aPropUIName;
+
+ aElementInfoSeq.realloc( aUIElementInfoCollection.size() );
+ UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin();
+
+ sal_Int32 n = 0;
+ while ( pIter != aUIElementInfoCollection.end() )
+ {
+ aUIElementInfo[0].Value <<= pIter->second.aResourceURL;
+ aUIElementInfo[1].Value <<= pIter->second.aUIName;
+ aElementInfoSeq[n++] = aUIElementInfo;
+ ++pIter;
+ }
+
+ return aElementInfoSeq;
}
Reference< XIndexContainer > SAL_CALL UIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->createSettings();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ // Creates an empty item container which can be filled from outside
+ return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer()), UNO_QUERY );
}
sal_Bool SAL_CALL UIConfigurationManager::hasSettings( const ::rtl::OUString& ResourceURL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->hasSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+ if ( pDataSettings && !pDataSettings->bDefault )
+ return sal_True;
+ }
+
+ return sal_False;
}
Reference< XIndexAccess > SAL_CALL UIConfigurationManager::getSettings( const ::rtl::OUString& ResourceURL, sal_Bool bWriteable )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->getSettings(ResourceURL,bWriteable);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings && !pDataSettings->bDefault )
+ {
+ // Create a copy of our data if someone wants to change the data.
+ if ( bWriteable )
+ return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
+ else
+ return pDataSettings->xSettings;
+ }
+ }
+
+ throw NoSuchElementException();
}
void SAL_CALL UIConfigurationManager::replaceSettings( const ::rtl::OUString& ResourceURL, const Reference< ::com::sun::star::container::XIndexAccess >& aNewData )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->replaceSettings(ResourceURL,aNewData);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings && !pDataSettings->bDefault )
+ {
+ // we have a settings entry in our user-defined layer - replace
+ Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ pDataSettings->xSettings = aNewData;
+
+ pDataSettings->bDefault = false;
+ pDataSettings->bModified = true;
+ m_bModified = true;
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+
+ // Create event to notify listener about replaced element settings
+ ConfigurationEvent aEvent;
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.ReplacedElement <<= xOldSettings;
+ aEvent.Element <<= pDataSettings->xSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Replace );
+ }
+ else
+ throw NoSuchElementException();
+ }
}
void SAL_CALL UIConfigurationManager::removeSettings( const ::rtl::OUString& ResourceURL )
throw ( NoSuchElementException, IllegalArgumentException, IllegalAccessException, RuntimeException)
{
- m_pImpl->removeSettings(ResourceURL);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( ResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+ if ( pDataSettings )
+ {
+ // If element settings are default, we don't need to change anything!
+ if ( pDataSettings->bDefault )
+ return;
+ else
+ {
+ Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
+ pDataSettings->bDefault = true;
+
+ // check if this is a default layer node
+ pDataSettings->bModified = true; // we have to remove this node from the user layer!
+ pDataSettings->xSettings.clear();
+ m_bModified = true; // user layer must be written
+
+ // Modify type container
+ UIElementType& rElementType = m_aUIElements[nElementType];
+ rElementType.bModified = true;
+
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = ResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= xRemovedSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Remove );
+ }
+ }
+ else
+ throw NoSuchElementException();
+ }
}
void SAL_CALL UIConfigurationManager::insertSettings( const ::rtl::OUString& NewResourceURL, const Reference< XIndexAccess >& aNewData )
throw ( ElementExistException, IllegalArgumentException, IllegalAccessException, RuntimeException )
{
- m_pImpl->insertSettings(NewResourceURL,aNewData);
+ sal_Int16 nElementType = RetrieveTypeFromResourceURL( NewResourceURL );
+
+ if (( nElementType == ::com::sun::star::ui::UIElementType::UNKNOWN ) ||
+ ( nElementType >= ::com::sun::star::ui::UIElementType::COUNT ))
+ throw IllegalArgumentException();
+ else if ( m_bReadOnly )
+ throw IllegalAccessException();
+ else
+ {
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ bool bInsertData( false );
+ UIElementData aUIElementData;
+ UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
+
+ if ( pDataSettings && !pDataSettings->bDefault )
+ throw ElementExistException();
+
+ if ( !pDataSettings )
+ {
+ pDataSettings = &aUIElementData;
+ bInsertData = true;
+ }
+
+ {
+ pDataSettings->bDefault = false;
+ pDataSettings->bModified = true;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
+ if ( xReplace.is() )
+ pDataSettings->xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
+ else
+ pDataSettings->xSettings = aNewData;
+
+ m_bModified = true;
+
+ UIElementType& rElementType = m_aUIElements[nElementType];
+ rElementType.bModified = true;
+
+ if ( bInsertData )
+ {
+ pDataSettings->aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix;
+ pDataSettings->aResourceURL = NewResourceURL;
+
+ UIElementDataHashMap& rElements = rElementType.aElementsHashMap;
+ rElements.insert( UIElementDataHashMap::value_type( NewResourceURL, *pDataSettings ));
+ }
+
+ Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings );
+ Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XInterface > xIfac( xThis, UNO_QUERY );
+
+ // Create event to notify listener about removed element settings
+ ConfigurationEvent aEvent;
+
+ aEvent.ResourceURL = NewResourceURL;
+ aEvent.Accessor <<= xThis;
+ aEvent.Source = xIfac;
+ aEvent.Element <<= xInsertSettings;
+
+ aGuard.unlock();
+
+ implts_notifyContainerListener( aEvent, NotifyOp_Insert );
+ }
+ }
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->getImageManager();
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( !m_xImageManager.is() )
+ {
+ m_xImageManager = Reference< XComponent >( static_cast< cppu::OWeakObject *>( new ImageManager( m_xServiceManager )),
+ UNO_QUERY );
+ Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY );
+
+ Sequence< Any > aPropSeq( 2 );
+ PropertyValue aPropValue;
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserConfigStorage" ));
+ aPropValue.Value = makeAny( m_xDocConfigStorage );
+ aPropSeq[0] = makeAny( aPropValue );
+ aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ));
+ aPropValue.Value = makeAny( m_aModuleIdentifier );
+ aPropSeq[1] = makeAny( aPropValue );
+
+ xInit->initialize( aPropSeq );
+ }
+
+ return Reference< XInterface >( m_xImageManager, UNO_QUERY );
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->getShortCutManager();
+ // SAFE ->
+ ResetableGuard aGuard( m_aLock );
+
+ if (m_xAccConfig.is())
+ return m_xAccConfig;
+
+ Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
+ Reference< XStorage > xDocumentRoot = m_xDocConfigStorage;
+
+ aGuard.unlock();
+ // <- SAFE
+
+ Reference< XInterface > xAccConfig = xSMGR->createInstance(SERVICENAME_DOCUMENTACCELERATORCONFIGURATION);
+ Reference< XInitialization > xInit (xAccConfig, UNO_QUERY_THROW);
+
+ PropertyValue aProp;
+ aProp.Name = ::rtl::OUString::createFromAscii("DocumentRoot");
+ aProp.Value <<= xDocumentRoot;
+
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= aProp;
+
+ xInit->initialize(lArgs);
+
+ // SAFE ->
+ aGuard.lock();
+ m_xAccConfig = xAccConfig;
+ aGuard.unlock();
+ // <- SAFE
+
+ return xAccConfig;
}
Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
@@ -213,38 +1135,223 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getEventsManager() thro
// XUIConfigurationStorage
void SAL_CALL UIConfigurationManager::setStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException)
{
- m_pImpl->setStorage(Storage);
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xDocConfigStorage.is() )
+ {
+ try
+ {
+ // Dispose old storage to be sure that it will be closed
+ Reference< XComponent > xComponent( m_xDocConfigStorage, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+
+ // We store the new storage. Be careful it could be an empty reference!
+ m_xDocConfigStorage = Storage;
+ m_bReadOnly = sal_True;
+
+ Reference< XUIConfigurationStorage > xAccUpdate(m_xAccConfig, UNO_QUERY);
+ if ( xAccUpdate.is() )
+ xAccUpdate->setStorage( m_xDocConfigStorage );
+
+ if ( m_xImageManager.is() )
+ {
+ ImageManager* pImageManager = (ImageManager*)m_xImageManager.get();
+ if ( pImageManager )
+ pImageManager->setStorage( m_xDocConfigStorage );
+ }
+
+ if ( m_xDocConfigStorage.is() )
+ {
+ Reference< XPropertySet > xPropSet( m_xDocConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ try
+ {
+ long nOpenMode = 0;
+ Any a = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" )));
+ if ( a >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
+ }
+ catch ( com::sun::star::beans::UnknownPropertyException& )
+ {
+ }
+ catch ( com::sun::star::lang::WrappedTargetException& )
+ {
+ }
+ }
+ }
+
+ impl_Initialize();
}
sal_Bool SAL_CALL UIConfigurationManager::hasStorage() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->hasStorage();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ return ( m_xDocConfigStorage.is() );
}
// XUIConfigurationPersistence
void SAL_CALL UIConfigurationManager::reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- m_pImpl->reload();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveNotifyContainer;
+ ConfigEventNotifyContainer aReplaceNotifyContainer;
+ for ( sal_Int16 i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rDocElementType = m_aUIElements[i];
+ if ( rDocElementType.bModified )
+ impl_reloadElementTypeData( rDocElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = sal_False;
+
+ // Unlock mutex before notify our listeners
+ aGuard.unlock();
+
+ // Notify our listeners
+ for ( sal_uInt32 j = 0; j < aRemoveNotifyContainer.size(); j++ )
+ implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove );
+ for ( sal_uInt32 k = 0; k < aReplaceNotifyContainer.size(); k++ )
+ implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace );
+ }
}
void SAL_CALL UIConfigurationManager::store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- m_pImpl->store();
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ UIElementType& rElementType = m_aUIElements[i];
+ Reference< XStorage > xStorage( rElementType.xStorage, UNO_QUERY );
+
+ if ( rElementType.bModified && xStorage.is() )
+ impl_storeElementTypeData( xStorage, rElementType );
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ m_bModified = false;
+ Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
}
void SAL_CALL UIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
{
- m_pImpl->storeToStorage(Storage);
+ ResetableGuard aGuard( m_aLock );
+
+ if ( m_bDisposed )
+ throw DisposedException();
+
+ if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ {
+ // Try to access our module sub folder
+ for ( int i = 1; i < ::com::sun::star::ui::UIElementType::COUNT; i++ )
+ {
+ try
+ {
+ Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
+ rtl::OUString::createFromAscii( UIELEMENTTYPENAMES[i] ), ElementModes::READWRITE ));
+ UIElementType& rElementType = m_aUIElements[i];
+
+ if ( rElementType.bModified && xElementTypeStorage.is() )
+ impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
+ }
+ catch ( Exception& )
+ {
+ throw IOException();
+ }
+ }
+
+ Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
}
sal_Bool SAL_CALL UIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->isModified();
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bModified;
}
sal_Bool SAL_CALL UIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
{
- return m_pImpl->isReadOnly();
+ ResetableGuard aGuard( m_aLock );
+
+ return m_bReadOnly;
+}
+
+void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
+{
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >*) NULL ) );
+ if ( pContainer != NULL )
+ {
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
+ {
+ try
+ {
+ switch ( eOp )
+ {
+ case NotifyOp_Replace:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ ((::com::sun::star::ui::XUIConfigurationListener*)pIterator.next())->elementRemoved( aEvent );
+ break;
+ }
+ }
+ catch( css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
+ }
+ }
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
index 5b67b13d8805..40c2c3f10708 100755
--- a/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx
@@ -148,12 +148,12 @@ void UIConfigurationManagerImpl::impl_fillSequenceWithElementTypeInfo( UIElement
while ( pUserIter != rUserElements.end() )
{
sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE );
- if ( !m_bUseDefault && nIndex > RESOURCEURL_PREFIX_SIZE )
+ if ( nIndex > RESOURCEURL_PREFIX_SIZE )
{
// Performance: Retrieve user interface name only for custom user interface elements.
// It's only used by them!
UIElementData* pDataSettings = impl_findUIElementData( pUserIter->second.aResourceURL, nElementType );
- if ( pDataSettings && ( !m_bUseDefault || !pDataSettings->bDefault) )
+ if ( pDataSettings && ( m_bUseDefault || !pDataSettings->bDefault ))
{
// Retrieve user interface name from XPropertySet interface
rtl::OUString aUIName;
@@ -1268,7 +1268,7 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException,
if ( m_bDisposed )
throw DisposedException();
- bool bInsertData( m_bUseDefault );
+ bool bInsertData( false );
UIElementData aUIElementData;
UIElementData* pDataSettings = impl_findUIElementData( NewResourceURL, nElementType );
if ( !m_bUseDefault )
@@ -1281,7 +1281,7 @@ throw ( ElementExistException, IllegalArgumentException, IllegalAccessException,
bInsertData = true;
}
}
- if ( !pDataSettings || bInsertData )
+ if ( !pDataSettings || !m_bUseDefault )
{
aUIElementData.bDefault = false;
if ( !m_bUseDefault )
diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk
index 60a44dba706f..0a07f3cf137d 100644
--- a/framework/util/makefile.mk
+++ b/framework/util/makefile.mk
@@ -334,7 +334,6 @@ SHL4OBJS= \
$(SLO)$/uicategorydescription.obj \
$(SLO)$/uicommanddescription.obj \
$(SLO)$/uiconfigurationmanager.obj \
- $(SLO)$/uiconfigurationmanagerimpl.obj \
$(SLO)$/uielementfactorymanager.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/vclstatusindicator.obj \
diff --git a/idl/inc/command.hxx b/idl/inc/command.hxx
index 6829edcebe60..fa978119d810 100644
--- a/idl/inc/command.hxx
+++ b/idl/inc/command.hxx
@@ -65,6 +65,7 @@ public:
String aCSVFile;
String aExportFile;
String aDocuFile;
+ UINT32 nVerbosity;
UINT32 nFlags;
SvCommand( int argc, char ** argv );
diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx
index 4d334bba000c..d0e6c92e349e 100644
--- a/idl/inc/database.hxx
+++ b/idl/inc/database.hxx
@@ -39,6 +39,8 @@
/*************************************************************************
*************************************************************************/
+class SvCommand;
+
#ifdef IDL_COMPILER
/******************** class SvIdlError ***********************************/
class SvIdlError
@@ -70,6 +72,7 @@ class SvIdlDataBase
BOOL bExport;
String aExportFile;
sal_uInt32 nUniqueId;
+ sal_uInt32 nVerbosity;
String aDataBaseFile;
SvFileStream * pStm;
BOOL bIsModified;
@@ -96,7 +99,7 @@ protected:
}
#endif
public:
- SvIdlDataBase();
+ explicit SvIdlDataBase( const SvCommand& rCmd );
~SvIdlDataBase();
static BOOL IsBinaryFormat( SvStream & rInStm );
@@ -165,7 +168,7 @@ public:
class SvIdlWorkingBase : public SvIdlDataBase
{
public:
- SvIdlWorkingBase();
+ explicit SvIdlWorkingBase( const SvCommand& rCmd );
BOOL ReadSvIdl( SvTokenStream &, BOOL bImported, const String & rPath );
BOOL WriteSvIdl( SvStream & );
diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx
index 66790b457334..29c49199dc30 100644
--- a/idl/source/prj/command.cxx
+++ b/idl/source/prj/command.cxx
@@ -258,7 +258,7 @@ static BOOL ResponseFile( StringList * pList, int argc, char ** argv )
|* Beschreibung
*************************************************************************/
SvCommand::SvCommand( int argc, char ** argv )
- : nFlags( 0 )
+ : nVerbosity(1), nFlags( 0 )
{
StringList aList;
@@ -353,6 +353,14 @@ SvCommand::SvCommand( int argc, char ** argv )
{ // Hilfe
printf( "%s", CommandLineSyntax );
}
+ else if( aParam.EqualsIgnoreCaseAscii( "quiet" ) )
+ {
+ nVerbosity = 0;
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "verbose" ) )
+ {
+ nVerbosity = 2;
+ }
else if( aParam.EqualsIgnoreCaseAscii( "syntax" ) )
{ // Hilfe
int j = 0;
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index 8933156bfc69..3c6d07f19921 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -58,9 +58,10 @@ void PrimeNumber(){
}
*/
-SvIdlDataBase::SvIdlDataBase()
+SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
: bExport( FALSE )
, nUniqueId( 0 )
+ , nVerbosity( rCmd.nVerbosity )
, bIsModified( FALSE )
, aPersStream( *IDLAPP->pClassMgr, NULL )
, pIdTable( NULL )
@@ -700,6 +701,7 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
void SvIdlDataBase::Write( const ByteString & rText )
{
#ifndef W31
+ if( nVerbosity != 0 )
fprintf( stdout, "%s", rText.GetBuffer() );
#endif
}
@@ -803,7 +805,7 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
|*
|* Beschreibung
*************************************************************************/
-SvIdlWorkingBase::SvIdlWorkingBase()
+SvIdlWorkingBase::SvIdlWorkingBase(const SvCommand& rCmd) : SvIdlDataBase(rCmd)
{
}
diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx
index 16706e936f30..8ae94ae896f5 100644
--- a/idl/source/prj/svidl.cxx
+++ b/idl/source/prj/svidl.cxx
@@ -112,8 +112,6 @@ int cdecl main ( int argc, char ** argv)
{
#endif
- printf( "StarView Interface Definition Language (IDL) Compiler 3.0\n" );
-
/*
pStr = ::ResponseFile( &aCmdLine, argv, argc );
if( pStr )
@@ -136,8 +134,12 @@ int cdecl main ( int argc, char ** argv)
String aTmpDocuFile;
SvCommand aCommand( argc, argv );
+
+ if( aCommand.nVerbosity != 0 )
+ printf( "StarView Interface Definition Language (IDL) Compiler 3.0\n" );
+
Init();
- SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase();
+ SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase(aCommand);
int nExit = 0;
if( aCommand.aExportFile.Len() )
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 72c0b768ed84..f816a55e93a7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2105,7 +2105,7 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
</info>
</set>
</group>
- <group oor:name="Save">
+ <group oor:name="Save">
<info>
<author>MBA</author>
<desc>Contains general settings about the saving process.</desc>
@@ -2616,6 +2616,19 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
</constraints>
<value>0</value>
</prop>
+ <group oor:name="NewDocumentHandling">
+ <info>
+ <author>CD</author>
+ <desc>Contains settings to change new document window behavior.</desc>
+ </info>
+ <prop oor:name="ForceFocusAndToFront" oor:type="xs:boolean">
+ <info>
+ <author>CD</author>
+ <desc>Every new document window will be forced to front and grabs the focus.</desc>
+ </info>
+ <value>true</value>
+ </prop>
+ </group>
<group oor:name="AppWindow">
<info>
<author>MBA</author>
diff --git a/oovbaapi/ooo/vba/constants/makefile.mk b/oovbaapi/ooo/vba/constants/makefile.mk
index 0b092e6f7999..fa9cdaddc1c4 100644
--- a/oovbaapi/ooo/vba/constants/makefile.mk
+++ b/oovbaapi/ooo/vba/constants/makefile.mk
@@ -55,7 +55,6 @@ MYIDLFILES=$(foreach,i,$(MYTMPIDLFILES) $(MY_GEN_IDL_PATH)$/$(i))
MYURDFILES=$(foreach,i,$(MYIDLFILES) $(MY_GEN_UCR_PATH)$/$(i:b).urd)
MYDBTARGET=$(OUT)$/ucr/constants.db
.ENDIF
-.ENDIF
.INCLUDE : target.mk
@@ -69,3 +68,4 @@ $(MYDBTARGET) : $(MYURDFILES) $(MYIDLFILES)
$(REGMERGE) $(OUT)$/ucr/constants.db /UCR @$(mktmp $(MYURDFILES))
.ENDIF
+.ENDIF
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index 6f9815bfeb72..99a11e5ac0fa 100644
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -41,7 +41,7 @@ PACKAGE=ooo$/vba
.IF "$(ENABLE_VBA)"!="YES"
dummy:
@echo "not building vba..."
-.ENDIF
+.ELSE
# ------------------------------------------------------------------------
.IF "$(L10N_framework)"=""
@@ -62,3 +62,4 @@ IDLFILES=\
# ------------------------------------------------------------------
.ENDIF
.INCLUDE : target.mk
+.ENDIF
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index f75d68fe1413..97f86ee1f395 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -45,6 +45,8 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <svtools/acceleratorexecute.hxx>
+#include <rtl/ref.hxx>
+
#include <queue>
// forward ---------------------------------------------------------------
@@ -71,6 +73,8 @@ public:
void AddRequest( SfxRequest& rReq );
};
+class SfxClipboardChangeListener;
+
struct SfxViewShell_Impl
{
::osl::Mutex aMutex;
@@ -96,11 +100,9 @@ struct SfxViewShell_Impl
::svt::AcceleratorExecute* pAccExec;
SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
+ ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
- SfxViewShell_Impl()
- : aInterceptorContainer( aMutex )
- , pAccExec(0)
- {}
+ SfxViewShell_Impl();
};
#endif
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 299c928c748b..f6053a467ed4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -131,6 +131,8 @@ class SfxClipboardChangeListener : public ::cppu::WeakImplHelper1<
public:
SfxClipboardChangeListener( SfxViewShell* pView );
virtual ~SfxClipboardChangeListener();
+
+ void DisconnectViewShell() { pViewShell = NULL; }
};
SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView )
@@ -241,7 +243,12 @@ static ::rtl::OUString RetrieveLabelFromCommand(
}
//=========================================================================
+SfxViewShell_Impl::SfxViewShell_Impl()
+: aInterceptorContainer( aMutex )
+, pAccExec(0)
+{}
+//=========================================================================
SFX_IMPL_INTERFACE(SfxViewShell,SfxShell,SfxResId(0))
{
SFX_CHILDWINDOW_REGISTRATION( SID_MAIL_CHILDWIN );
@@ -1297,21 +1304,27 @@ SfxViewShell::~SfxViewShell()
SfxViewShellArr_Impl &rViewArr = SFX_APP()->GetViewShells_Impl();
rViewArr.Remove( rViewArr.GetPos(pThis) );
+ if ( pImp->xClipboardListener.is() )
+ {
+ pImp->xClipboardListener->DisconnectViewShell();
+ pImp->xClipboardListener = NULL;
+ }
+
if ( pImp->pController )
{
pImp->pController->ReleaseShell_Impl();
pImp->pController->release();
+ pImp->pController = NULL;
}
if (pImp->pAccExec)
{
- delete pImp->pAccExec;
- pImp->pAccExec = 0;
+ DELETEZ( pImp->pAccExec );
}
- delete pImp->pPrinterCommandQueue;
- delete pImp;
- delete pIPClientList;
+ DELETEZ( pImp->pPrinterCommandQueue );
+ DELETEZ( pImp );
+ DELETEZ( pIPClientList );
}
//--------------------------------------------------------------------
@@ -1997,7 +2010,12 @@ void SfxViewShell::SetController( SfxBaseController* pController )
pImp->pController->acquire();
pImp->bControllerSet = TRUE;
- AddRemoveClipboardListener( new SfxClipboardChangeListener( this ), TRUE );
+ // there should be no old listener, but if there is one, it should be disconnected
+ if ( pImp->xClipboardListener.is() )
+ pImp->xClipboardListener->DisconnectViewShell();
+
+ pImp->xClipboardListener = new SfxClipboardChangeListener( this );
+ AddRemoveClipboardListener( pImp->xClipboardListener.get(), TRUE );
}
Reference < XController > SfxViewShell::GetController()
@@ -2205,17 +2223,20 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf
{
try
{
- uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
- if( !xClipboard.is() )
- return;
-
- uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
- if( xClpbrdNtfr.is() )
+ if ( GetViewFrame() )
{
- if( bAdd )
- xClpbrdNtfr->addClipboardListener( rClp );
- else
- xClpbrdNtfr->removeClipboardListener( rClp );
+ uno::Reference< datatransfer::clipboard::XClipboard > xClipboard( GetViewFrame()->GetWindow().GetClipboard() );
+ if( xClipboard.is() )
+ {
+ uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClpbrdNtfr( xClipboard, uno::UNO_QUERY );
+ if( xClpbrdNtfr.is() )
+ {
+ if( bAdd )
+ xClpbrdNtfr->addClipboardListener( rClp );
+ else
+ xClpbrdNtfr->removeClipboardListener( rClp );
+ }
+ }
}
}
catch( const uno::Exception& )
diff --git a/svx/inc/svx/msdffimp.hxx b/svx/inc/svx/msdffimp.hxx
index 248a31dcf71f..603a6831fe30 100644
--- a/svx/inc/svx/msdffimp.hxx
+++ b/svx/inc/svx/msdffimp.hxx
@@ -481,6 +481,7 @@ public:
MSFilterTracer* mpTracer;
sal_Bool mbTracing;
+ Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
Color MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
virtual BOOL SeekToShape( SvStream& rSt, void* pClientData, UINT32 nId ) const;
FASTBOOL SeekToRec( SvStream& rSt, USHORT nRecId, ULONG nMaxFilePos, DffRecordHeader* pRecHd = NULL, ULONG nSkipCount = 0 ) const;
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
index 27359ebf9738..87a1de55ec0a 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
@@ -65,6 +65,8 @@ namespace sdr { namespace contact {
::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pImpl;
public:
+ ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
+
/// determines whether an XControl already exists, and is currently visible
bool isControlVisible() const;
@@ -98,7 +100,6 @@ namespace sdr { namespace contact {
virtual void ActionChanged();
protected:
- ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
~ViewObjectContactOfUnoControl();
// support for Primitive2D
@@ -111,36 +112,6 @@ namespace sdr { namespace contact {
};
//====================================================================
- //= UnoControlDefaultContact
- //====================================================================
- class SVX_DLLPRIVATE UnoControlDefaultContact : public ViewObjectContactOfUnoControl
- {
- public:
- UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
- ~UnoControlDefaultContact();
-
- private:
- UnoControlDefaultContact(); // never implemented
- UnoControlDefaultContact( const UnoControlDefaultContact& ); // never implemented
- UnoControlDefaultContact& operator=( const UnoControlDefaultContact& ); // never implemented
- };
-
- //====================================================================
- //= UnoControlWindowContact
- //====================================================================
- class SVX_DLLPRIVATE UnoControlWindowContact : public ViewObjectContactOfUnoControl
- {
- public:
- UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
- ~UnoControlWindowContact();
-
- private:
- UnoControlWindowContact(); // never implemented
- UnoControlWindowContact( const UnoControlWindowContact& ); // never implemented
- UnoControlWindowContact& operator=( const UnoControlWindowContact& ); // never implemented
- };
-
- //====================================================================
//= UnoControlPrintOrPreviewContact
//====================================================================
class SVX_DLLPRIVATE UnoControlPrintOrPreviewContact : public ViewObjectContactOfUnoControl
@@ -157,21 +128,6 @@ namespace sdr { namespace contact {
virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequence(const DisplayInfo& rDisplayInfo ) const;
};
- //====================================================================
- //= UnoControlPDFExportContact
- //====================================================================
- class SVX_DLLPRIVATE UnoControlPDFExportContact : public ViewObjectContactOfUnoControl
- {
- public:
- UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
- ~UnoControlPDFExportContact();
-
- private:
- UnoControlPDFExportContact(); // never implemented
- UnoControlPDFExportContact( const UnoControlPDFExportContact& ); // never implemented
- UnoControlPDFExportContact& operator=( const UnoControlPDFExportContact& ); // never implemented
- };
-
//........................................................................
} } // namespace sdr::contact
//........................................................................
diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
index 798e5b53d6de..0f46c2809597 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx
@@ -75,7 +75,8 @@ namespace drawinglayer
const attribute::SdrTextAttribute& rText,
const attribute::SdrLineAttribute* pStroke,
bool bCellText,
- bool bWordWrap);
+ bool bWordWrap,
+ bool bClipOnBounds);
Primitive2DSequence createEmbeddedShadowPrimitive(
const Primitive2DSequence& rContent,
diff --git a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
index 132a3ecc2538..059849531566 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
@@ -219,6 +219,7 @@ namespace drawinglayer
unsigned mbUnlimitedPage : 1; // force layout with no text break
unsigned mbCellText : 1; // this is a cell text as block text
unsigned mbWordWrap : 1; // for CustomShapes text layout
+ unsigned mbClipOnBounds : 1; // for CustomShapes text layout
protected:
// local decomposition.
@@ -234,7 +235,8 @@ namespace drawinglayer
bool bFixedCellHeight,
bool bUnlimitedPage,
bool bCellText,
- bool bWordWrap);
+ bool bWordWrap,
+ bool bClipOnBounds);
// get data
const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
@@ -244,6 +246,7 @@ namespace drawinglayer
bool getUnlimitedPage() const { return mbUnlimitedPage; }
bool getCellText() const { return mbCellText; }
bool getWordWrap() const { return mbWordWrap; }
+ bool getClipOnBounds() const { return mbClipOnBounds; }
// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index f53168a273ac..afff309168ac 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -763,12 +763,18 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
Fraction aZoom = GetZoom();
// not all of these controls need to know the new zoom, but to be sure ...
- Font aFont( IsControlFont() ? GetControlFont() : GetPointFont());
+ Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+
for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
{
pWindows[i]->SetZoom(aZoom);
pWindows[i]->SetZoomedPointFont(aFont);
}
+
+ SetZoomedPointFont( aFont );
+
// rearrange the controls
m_nDefaultWidth = ArrangeControls();
}
@@ -1075,18 +1081,13 @@ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
{
if ( m_bNavigationBar )
{
- m_aBar.SetZoom( GetZoom() );
-
Font aFont = m_aBar.GetSettings().GetStyleSettings().GetFieldFont();
if ( IsControlFont() )
- {
m_aBar.SetControlFont( GetControlFont() );
- aFont.Merge( GetControlFont() );
- }
else
m_aBar.SetControlFont();
- m_aBar.SetZoomedPointFont( aFont );
+ m_aBar.SetZoom( GetZoom() );
}
}
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 10c0978288a6..fc7f1aa78558 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -101,6 +101,7 @@ namespace svx
//====================================================================
static SfxSlotId pTextControlSlots[] =
{
+ SID_CLIPBOARD_FORMAT_ITEMS,
SID_CUT,
SID_COPY,
SID_PASTE,
@@ -140,7 +141,6 @@ namespace svx
// SID_TEXTDIRECTION_TOP_TO_BOTTOM,
SID_ATTR_CHAR_SCALEWIDTH, /* 911 */
SID_ATTR_CHAR_RELIEF,
- SID_CLIPBOARD_FORMAT_ITEMS, /* 922 */
SID_ATTR_PARA_LEFT_TO_RIGHT, /* 950 */
SID_ATTR_PARA_RIGHT_TO_LEFT,
0
diff --git a/svx/source/msfilter/msdffimp.cxx b/svx/source/msfilter/msdffimp.cxx
index 0e751e3181e7..c9cfde91547a 100644
--- a/svx/source/msfilter/msdffimp.cxx
+++ b/svx/source/msfilter/msdffimp.cxx
@@ -3234,6 +3234,8 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const
{
// MapUnit eMap( rManager.GetModel()->GetScaleUnit() );
+ sal_Bool bHasShadow = sal_False;
+
for ( void* pDummy = ((DffPropertyReader*)this)->First(); pDummy; pDummy = ((DffPropertyReader*)this)->Next() )
{
UINT32 nRecType = GetCurKey();
@@ -3305,8 +3307,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const
break;
case DFF_Prop_fshadowObscured :
{
- sal_Bool bHasShadow = ( nContent & 2 ) != 0;
- rSet.Put( SdrShadowItem( bHasShadow ) );
+ bHasShadow = ( nContent & 2 ) != 0;
if ( bHasShadow )
{
if ( !IsProperty( DFF_Prop_shadowOffsetX ) )
@@ -3319,6 +3320,44 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, const
}
}
+ if ( bHasShadow )
+ {
+ // #160376# sj: activating shadow only if fill and or linestyle is used
+ // this is required because of the latest drawing layer core changes.
+ // Issue i104085 is related to this.
+ UINT32 nLineFlags(GetPropertyValue( DFF_Prop_fNoLineDrawDash ));
+ if(!IsHardAttribute( DFF_Prop_fLine ) && !IsCustomShapeStrokedByDefault( rObjData.eShapeType ))
+ nLineFlags &= ~0x08;
+ UINT32 nFillFlags(GetPropertyValue( DFF_Prop_fNoFillHitTest ));
+ if(!IsHardAttribute( DFF_Prop_fFilled ) && !IsCustomShapeFilledByDefault( rObjData.eShapeType ))
+ nFillFlags &= ~0x10;
+ if ( nFillFlags & 0x10 )
+ {
+ MSO_FillType eMSO_FillType = (MSO_FillType)GetPropertyValue( DFF_Prop_fillType, mso_fillSolid );
+ switch( eMSO_FillType )
+ {
+ case mso_fillSolid :
+ case mso_fillPattern :
+ case mso_fillTexture :
+ case mso_fillPicture :
+ case mso_fillShade :
+ case mso_fillShadeCenter :
+ case mso_fillShadeShape :
+ case mso_fillShadeScale :
+ case mso_fillShadeTitle :
+ break;
+ // case mso_fillBackground :
+ default:
+ nFillFlags &=~0x10; // no fillstyle used
+ break;
+ }
+ }
+ if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) == 0 ) ) // if there is no fillstyle and linestyle
+ bHasShadow = sal_False; // we are turning shadow off.
+
+ if ( bHasShadow )
+ rSet.Put( SdrShadowItem( bHasShadow ) );
+ }
ApplyLineAttributes( rSet, rObjData.eShapeType ); // #i28269#
ApplyFillAttributes( rIn, rSet, rObjData );
if ( rObjData.eShapeType != mso_sptNil )
@@ -3770,14 +3809,37 @@ FASTBOOL SvxMSDffManager::GetColorFromPalette( USHORT /* nNum */, Color& rColor
return TRUE;
}
+// sj: the documentation is not complete, especially in ppt the normal rgb for text
+// color is written as 0xfeRRGGBB, this can't be explained by the documentation, nearly
+// every bit in the upper code is set -> so there seems to be a special handling for
+// ppt text colors, i decided not to fix this in MSO_CLR_ToColor because of possible
+// side effects, instead MSO_TEXT_CLR_ToColor is called for PPT text colors, to map
+// the color code to something that behaves like the other standard color codes used by
+// fill and line color
+Color SvxMSDffManager::MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const
+{
+ // Fuer Textfarben: Header ist 0xfeRRGGBB
+ if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 )
+ nColorCode &= 0x00ffffff;
+ else
+ {
+ // for colorscheme colors the color index are the lower three bits of the upper byte
+ if ( ( nColorCode & 0xf8000000 ) == 0 ) // this must be a colorscheme index
+ {
+ nColorCode >>= 24;
+ nColorCode |= 0x8000000;
+ }
+ }
+ return MSO_CLR_ToColor( nColorCode );
+}
Color SvxMSDffManager::MSO_CLR_ToColor( sal_uInt32 nColorCode, sal_uInt16 nContentProperty ) const
{
Color aColor( mnDefaultColor );
// Fuer Textfarben: Header ist 0xfeRRGGBB
- if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 )
- nColorCode &= 0x00ffffff;
+ if ( ( nColorCode & 0xfe000000 ) == 0xfe000000 ) // sj: it needs to be checked if 0xfe is used in
+ nColorCode &= 0x00ffffff; // other cases than ppt text -> if not this code can be removed
sal_uInt8 nUpper = (sal_uInt8)( nColorCode >> 24 );
diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx
index 3da9e8dbecac..fc144cf4304f 100644
--- a/svx/source/outliner/outliner.cxx
+++ b/svx/source/outliner/outliner.cxx
@@ -1867,6 +1867,20 @@ IMPL_LINK( Outliner, EndMovingParagraphsHdl, MoveParagraphsInfo*, pInfos )
return 0;
}
+static bool isSameNumbering( const SvxNumberFormat& rN1, const SvxNumberFormat& rN2 )
+{
+ if( rN1.GetNumberingType() != rN2.GetNumberingType() )
+ return false;
+
+ if( rN1.GetNumStr(1) != rN2.GetNumStr(1) )
+ return false;
+
+ if( (rN1.GetPrefix() != rN2.GetPrefix()) || (rN1.GetSuffix() != rN2.GetSuffix()) )
+ return false;
+
+ return true;
+}
+
sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pParaFmt )
{
sal_uInt16 nNumber = pParaFmt->GetStart() - 1;
@@ -1879,8 +1893,8 @@ sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pPar
pPara = pParaList->GetParagraph( nPara );
const sal_Int16 nDepth = pPara->GetDepth();
- // ignore paragraphs that are below our paragraph
- if( nDepth > nParaDepth )
+ // ignore paragraphs that are below our paragraph or have no numbering
+ if( (nDepth > nParaDepth) || (nDepth == -1) )
continue;
// stop on paragraphs that are above our paragraph
@@ -1888,8 +1902,13 @@ sal_uInt16 Outliner::ImplGetNumbering( USHORT nPara, const SvxNumberFormat* pPar
break;
const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- if( pFmt == 0 || (*pFmt != *pParaFmt) )
- break; // change in number format, stop here
+
+ if( pFmt == 0 )
+ continue; // ignore paragraphs without bullets
+
+ // check if numbering is the same
+ if( !isSameNumbering( *pFmt, *pParaFmt ) )
+ break;
const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE );
diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx
index 098a4055ce0f..a69776df14e8 100644
--- a/svx/source/outliner/outlvw.cxx
+++ b/svx/source/outliner/outlvw.cxx
@@ -1010,6 +1010,14 @@ void OutlinerView::PasteSpecial()
pOwner->bPasting = TRUE;
pEditView->PasteSpecial();
+ if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
+ {
+ const USHORT nParaCount = pOwner->pEditEngine->GetParagraphCount();
+
+ for( USHORT nPara = 0; nPara < nParaCount; nPara++ )
+ pOwner->ImplSetLevelDependendStyleSheet( nPara );
+ }
+
pEditView->SetEditEngineUpdateMode( TRUE );
pOwner->UndoActionEnd( OLUNDO_INSERT );
pEditView->ShowCursor( TRUE, TRUE );
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 6a92cb27ff8c..7527b177b3a4 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -310,6 +310,7 @@ namespace sdr
false,
false,
false,
+ false,
false);
// decompose immediately with neutral ViewInformation. This will
diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index 9d6548a1b791..7bea25feeeed 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -121,36 +121,18 @@ namespace sdr { namespace contact {
//--------------------------------------------------------------------
ViewObjectContact& ViewContactOfUnoControl::CreateObjectSpecificViewObjectContact( ObjectContact& _rObjectContact )
{
+ // print or print preview requires special handling
+ const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice();
+ bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER );
+
ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact );
- if ( pPageViewContact )
- {
- // special classes for special devices:
- // - PDF export
- ::vcl::PDFExtOutDevData* pPDFExport = PTR_CAST( ::vcl::PDFExtOutDevData, pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetExtOutDevData() );
- if ( pPDFExport != NULL )
- return *new UnoControlPDFExportContact( *pPageViewContact, *this );
-
- // - print preview
- if ( pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview() )
- return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
-
- OutDevType eDeviceType = pPageViewContact->GetPageWindow().GetPaintWindow().GetOutputDevice().GetOutDevType();
- // - printing
- if ( eDeviceType == OUTDEV_PRINTER )
- return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
-
- // - any other virtual device
- if ( eDeviceType == OUTDEV_VIRDEV )
- return *new UnoControlDefaultContact( *pPageViewContact, *this );
-
- // - normal windows have special, design-mode dependent handling
- if ( eDeviceType == OUTDEV_WINDOW )
- return *new UnoControlWindowContact( *pPageViewContact, *this );
- }
+ bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview();
+
+ if ( bPrintOrPreview )
+ return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
- // if we're not working for a ObjectContactOfPageView, then we can't use a ViewObjectContactOfUnoControl, or any
- // of its derivees. Fall back to a "normal" SdrObj's contact object.
- return *new ViewObjectContactOfSdrObj( _rObjectContact, *this );
+ // all others are nowadays served by the same implementation
+ return *new ViewObjectContactOfUnoControl( _rObjectContact, *this );
}
//--------------------------------------------------------------------
@@ -173,7 +155,7 @@ namespace sdr { namespace contact {
aTransform.set(0, 2, aRange.getMinX());
aTransform.set(1, 2, aRange.getMinY());
- // create control primitive WITHOUT evtl. existing XControl; this would be done in
+ // create control primitive WITHOUT possibly existing XControl; this would be done in
// the VOC in createPrimitive2DSequence()
const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D(
aTransform, xControlModel));
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 667129e27653..bbfe3eaf65ab 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -402,7 +402,7 @@ namespace sdr { namespace contact {
//= InvisibleControlViewAccess
//====================================================================
/** is a ->IPageViewAccess implementation which can be used to create an invisble control for
- an arbitrary device
+ an arbitrary window
*/
class InvisibleControlViewAccess : public IPageViewAccess
{
@@ -446,6 +446,47 @@ namespace sdr { namespace contact {
}
//====================================================================
+ //= DummyPageViewAccess
+ //====================================================================
+ /** is a ->IPageViewAccess implementation which can be used to create a control for an arbitrary
+ non-Window device
+
+ The implementation will report the "PageView" as being in design mode, all layers to be visible,
+ and will not return any ControlContainer, so all control container related features (notifications etc)
+ are not available.
+ */
+ class DummyPageViewAccess : public IPageViewAccess
+ {
+ public:
+ DummyPageViewAccess()
+ {
+ }
+
+ virtual bool isDesignMode() const;
+ virtual Reference< XControlContainer >
+ getControlContainer( const OutputDevice& _rDevice ) const;
+ virtual bool isLayerVisible( SdrLayerID _nLayerID ) const;
+ };
+
+ //--------------------------------------------------------------------
+ bool DummyPageViewAccess::isDesignMode() const
+ {
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XControlContainer > DummyPageViewAccess::getControlContainer( const OutputDevice& /*_rDevice*/ ) const
+ {
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ bool DummyPageViewAccess::isLayerVisible( SdrLayerID /*_nLayerID*/ ) const
+ {
+ return true;
+ }
+
+ //====================================================================
//= ViewObjectContactOfUnoControl_Impl
//====================================================================
typedef ::cppu::WeakImplHelper4 < XWindowListener
@@ -763,8 +804,9 @@ namespace sdr { namespace contact {
This method cares for this, by retrieving the very original OutputDevice.
*/
- static const OutputDevice& imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact );
- const OutputDevice& imp_getPageViewDevice_nothrow() const;
+ static const OutputDevice& impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact );
+
+ const OutputDevice& impl_getOutputDevice_throw() const;
private:
ViewObjectContactOfUnoControl_Impl(); // never implemented
@@ -829,6 +871,13 @@ namespace sdr { namespace contact {
static void getTransformation( const ViewContactOfUnoControl& _rVOC, ::basegfx::B2DHomMatrix& _out_Transformation );
private:
+ void impl_positionAndZoomControl( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
+ {
+ if ( !_rViewInformation.getViewport().isEmpty() )
+ m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+ }
+
+ private:
::rtl::Reference< ViewObjectContactOfUnoControl_Impl > m_pVOCImpl;
/** The geometry is part of the identity of an primitive, so we cannot calculate it on demand
(since the data the calculation is based on might have changed then), but need to calc
@@ -854,9 +903,15 @@ namespace sdr { namespace contact {
DBG_CTOR( ViewObjectContactOfUnoControl_Impl, NULL );
DBG_ASSERT( m_pAntiImpl, "ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl: invalid AntiImpl!" );
- const OutputDevice& rPageViewDevice( imp_getPageViewDevice_nothrow() );
+ const OutputDevice& rPageViewDevice( impl_getOutputDevice_throw() );
m_aZoomLevelNormalization = rPageViewDevice.GetInverseViewTransformation();
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ m_aZoomLevelNormalization.decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
+
::basegfx::B2DHomMatrix aScaleNormalization;
MapMode aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() );
aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() );
@@ -953,27 +1008,40 @@ namespace sdr { namespace contact {
return false;
ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
- DBG_ASSERT( pPageViewContact, "ViewObjectContactOfUnoControl_Impl::ensureControl: cannot create a control if I don't have a PageView!" );
- if ( !pPageViewContact )
- return false;
+ if ( pPageViewContact )
+ {
+ SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() );
+ return impl_ensureControl_nothrow(
+ aPVAccess,
+ impl_getPageViewOutputDevice_nothrow( *pPageViewContact )
+ );
+ }
- SdrPageViewAccess aPVAccess( pPageViewContact->GetPageWindow().GetPageView() );
+ DummyPageViewAccess aNoPageView;
return impl_ensureControl_nothrow(
- aPVAccess,
- imp_getPageViewDevice_nothrow( *pPageViewContact )
+ aNoPageView,
+ impl_getOutputDevice_throw()
);
}
//--------------------------------------------------------------------
- const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow() const
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getOutputDevice_throw() const
{
ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &m_pAntiImpl->GetObjectContact() );
- ENSURE_OR_THROW( pPageViewContact, "need a ObjectContactOfPageView." );
- return imp_getPageViewDevice_nothrow( *pPageViewContact );
+ if ( pPageViewContact )
+ {
+ // do not use ObjectContact::TryToGetOutputDevice here, it would not care for the PageWindow's
+ // OriginalPaintWindow
+ return impl_getPageViewOutputDevice_nothrow( *pPageViewContact );
+ }
+
+ const OutputDevice* pDevice = m_pAntiImpl->GetObjectContact().TryToGetOutputDevice();
+ ENSURE_OR_THROW( pDevice, "no output device -> no control" );
+ return *pDevice;
}
//--------------------------------------------------------------------
- const OutputDevice& ViewObjectContactOfUnoControl_Impl::imp_getPageViewDevice_nothrow( const ObjectContactOfPageView& _rObjectContact )
+ const OutputDevice& ViewObjectContactOfUnoControl_Impl::impl_getPageViewOutputDevice_nothrow( const ObjectContactOfPageView& _rObjectContact )
{
// if the PageWindow has a patched PaintWindow, use the original PaintWindow
// this ensures that our control is _not_ re-created just because somebody
@@ -1522,18 +1590,28 @@ namespace sdr { namespace contact {
//--------------------------------------------------------------------
::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::get2DDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
{
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
if ( m_pVOCImpl->hasControl() )
- m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+ impl_positionAndZoomControl( _rViewInformation );
return BasePrimitive2D::get2DDecomposition( _rViewInformation );
}
//--------------------------------------------------------------------
::drawinglayer::primitive2d::Primitive2DSequence LazyControlCreationPrimitive2D::createLocalDecomposition( const ::drawinglayer::geometry::ViewInformation2D& _rViewInformation ) const
{
+ #if OSL_DEBUG_LEVEL > 1
+ ::basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ _rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
+ #endif
// force control here to make it a VCL ChildWindow. Will be fetched
// and used below by getExistentControl()
m_pVOCImpl->ensureControl();
- m_pVOCImpl->positionAndZoomControl( _rViewInformation.getObjectToViewTransformation() );
+ impl_positionAndZoomControl( _rViewInformation );
// get needed data
const ViewContactOfUnoControl& rViewContactOfUnoControl( m_pVOCImpl->getViewContact() );
@@ -1704,40 +1782,6 @@ namespace sdr { namespace contact {
}
//====================================================================
- //= UnoControlDefaultContact
- //====================================================================
- DBG_NAME( UnoControlDefaultContact )
- //--------------------------------------------------------------------
- UnoControlDefaultContact::UnoControlDefaultContact( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact )
- :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact )
- {
- DBG_CTOR( UnoControlDefaultContact, NULL );
- }
-
- //--------------------------------------------------------------------
- UnoControlDefaultContact::~UnoControlDefaultContact()
- {
- DBG_DTOR( UnoControlDefaultContact, NULL );
- }
-
- //====================================================================
- //= UnoControlWindowContact
- //====================================================================
- DBG_NAME( UnoControlWindowContact )
- //--------------------------------------------------------------------
- UnoControlWindowContact::UnoControlWindowContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact )
- :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact )
- {
- DBG_CTOR( UnoControlWindowContact, NULL );
- }
-
- //--------------------------------------------------------------------
- UnoControlWindowContact::~UnoControlWindowContact()
- {
- DBG_DTOR( UnoControlWindowContact, NULL );
- }
-
- //====================================================================
//= UnoControlPrintOrPreviewContact
//====================================================================
DBG_NAME( UnoControlPrintOrPreviewContact )
@@ -1762,23 +1806,6 @@ namespace sdr { namespace contact {
return ViewObjectContactOfUnoControl::createPrimitive2DSequence( rDisplayInfo );
}
- //====================================================================
- //= UnoControlPDFExportContact
- //====================================================================
- DBG_NAME( UnoControlPDFExportContact )
- //--------------------------------------------------------------------
- UnoControlPDFExportContact::UnoControlPDFExportContact( ObjectContactOfPageView& _rObjectContact, ViewContactOfUnoControl& _rViewContact )
- :ViewObjectContactOfUnoControl( _rObjectContact, _rViewContact )
- {
- DBG_CTOR( UnoControlPDFExportContact, NULL );
- }
-
- //--------------------------------------------------------------------
- UnoControlPDFExportContact::~UnoControlPDFExportContact()
- {
- DBG_DTOR( UnoControlPDFExportContact, NULL );
- }
-
//........................................................................
} } // namespace sdr::contact
//........................................................................
diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
index 3c8feb7ff2b2..73d5689350c2 100644
--- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx
@@ -123,6 +123,7 @@ namespace drawinglayer
*getSdrLFSTAttribute().getText(),
getSdrLFSTAttribute().getLine(),
false,
+ false,
false));
}
diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
index 0edbe1a35046..a04021ae21ad 100644
--- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx
@@ -72,7 +72,7 @@ namespace drawinglayer
// add text
if(getSdrLSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
index 497266433d67..e2dce7b551ed 100644
--- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
@@ -60,8 +60,9 @@ namespace drawinglayer
getTextBox(),
*getSdrSTAttribute().getText(),
0,
- isForceTextClipToTextRange(), // #SJ# use CellText mode; text upper-left
- getWordWrap()));
+ false,
+ getWordWrap(),
+ isForceTextClipToTextRange()));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 09769a2a013e..cd426edfdd05 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -173,7 +173,8 @@ namespace drawinglayer
const attribute::SdrTextAttribute& rText,
const attribute::SdrLineAttribute* pStroke,
bool bCellText,
- bool bWordWrap)
+ bool bWordWrap,
+ bool bClipOnBounds)
{
basegfx::B2DHomMatrix aAnchorTransform(rObjectTransform);
SdrTextPrimitive2D* pNew = 0;
@@ -297,7 +298,8 @@ namespace drawinglayer
rText.isFixedCellHeight(),
rText.isScroll(),
bCellText,
- bWordWrap);
+ bWordWrap,
+ bClipOnBounds);
}
}
diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
index ed3062184f1a..4f7e2c768669 100644
--- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
@@ -94,7 +94,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
@@ -191,7 +191,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index f5f2f4e876dc..63d050a775af 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -104,7 +104,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 94e59f79c3de..f5445cefa5f6 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -134,6 +134,7 @@ namespace drawinglayer
pTextAttribute->isScroll(),
false,
false,
+ false,
false);
aTextRange = pBlockText->getB2DRange(aViewInformation);
}
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
index ab5d23962719..7c44311d3c5a 100644
--- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -110,7 +110,7 @@ namespace drawinglayer
// always supported by the old paints, too
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
index 91ed0bd2adce..96da706fb66a 100644
--- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx
@@ -89,7 +89,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
index 64ac716b40e9..edb2837ef670 100644
--- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx
@@ -110,7 +110,7 @@ namespace drawinglayer
// add text
if(getSdrLFSTAttribute().getText())
{
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false));
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false));
}
// add shadow
diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
index 748270c36977..47e85894f37e 100644
--- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
@@ -382,7 +382,8 @@ namespace drawinglayer
bool bFixedCellHeight,
bool bUnlimitedPage,
bool bCellText,
- bool bWordWrap)
+ bool bWordWrap,
+ bool bClipOnBounds)
: SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
maTextRangeTransform(rTextRangeTransform),
maSdrTextHorzAdjust(aSdrTextHorzAdjust),
@@ -390,7 +391,8 @@ namespace drawinglayer
mbFixedCellHeight(bFixedCellHeight),
mbUnlimitedPage(bUnlimitedPage),
mbCellText(bCellText),
- mbWordWrap(bWordWrap)
+ mbWordWrap(bWordWrap),
+ mbClipOnBounds(bClipOnBounds)
{
}
@@ -406,7 +408,8 @@ namespace drawinglayer
&& isFixedCellHeight() == rCompare.isFixedCellHeight()
&& getUnlimitedPage() == rCompare.getUnlimitedPage()
&& getCellText() == rCompare.getCellText()
- && getWordWrap() == rCompare.getWordWrap());
+ && getWordWrap() == rCompare.getWordWrap()
+ && getClipOnBounds() == rCompare.getClipOnBounds());
}
return false;
@@ -423,7 +426,8 @@ namespace drawinglayer
isFixedCellHeight(),
getUnlimitedPage(),
getCellText(),
- getWordWrap());
+ getWordWrap(),
+ getClipOnBounds());
}
// provide unique ID
diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx
index d0b01f6a820f..af38c34e0749 100644
--- a/svx/source/svdraw/svdfppt.cxx
+++ b/svx/source/svdraw/svdfppt.cxx
@@ -3972,7 +3972,7 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport& rManager,
aFont.SetFamily( pAtom->eFamily );
aFont.SetPitch( pAtom->ePitch );
}
- Color aCol( rManager.MSO_CLR_ToColor( nBulletColor ) );
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nBulletColor ) );
aFont.SetColor( aCol );
sal_uInt16 nBuChar = (sal_uInt16)nBulletChar;
@@ -5886,14 +5886,14 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, U
{
if ( GetAttrib( PPT_CharAttr_FontColor, nVal, nDestinationInstance ) ) // Textfarbe (4Byte-Arg)
{
- Color aCol( rManager.MSO_CLR_ToColor( nVal ) );
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
if ( nDestinationInstance == 0xffffffff )
mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet = aCol;
}
else if ( nVal & 0x0f000000 ) // this is not a hard attribute, but maybe the page has a different colerscheme,
{ // so that in this case we must use a hard color attribute
- Color aCol( rManager.MSO_CLR_ToColor( nVal ) );
+ Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) );
Color& aColorInSheet = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet;
if ( aColorInSheet != aCol )
rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) );
@@ -6315,7 +6315,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
nColor = rParaLevel.mnBulletColor;
else
nColor = rCharLevel.mnFontColor;
- aNumberFormat2.SetBulletColor( rManager.MSO_CLR_ToColor( nColor ) );
+ aNumberFormat2.SetBulletColor( rManager.MSO_TEXT_CLR_ToColor( nColor ) );
pRule->SetLevel( i, aNumberFormat2 );
}
}
@@ -7611,8 +7611,8 @@ void ApplyCellLineAttributes( const SdrObject* pLine, Reference< XTable >& xTabl
{
Color aLineColor( ((XLineColorItem&)pLine->GetMergedItem( XATTR_LINECOLOR )).GetColorValue() );
aBorderLine.Color = aLineColor.GetColor();
- aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() );
- aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 );
+ aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( ((const XLineWidthItem&)(pLine->GetMergedItem(XATTR_LINEWIDTH))).GetValue() / 4 );
aBorderLine.LineDistance = 0;
}
break;
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 93d3651e3f01..e72b606f3b53 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -800,24 +800,32 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
const bool bVerticalWritintg(rSdrBlockTextPrimitive.getOutlinerParaObject().IsVertical());
const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
+ // check if block text is used (only one of them can be true)
+ const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg);
+ const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg);
+
+ // set minimal paper size hor/ver if needed
+ if(bHorizontalIsBlock)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
+ }
+ else if(bVerticalIsBlock)
+ {
+ rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
+ }
+
if(bIsCell)
{
// cell text is formated neither like a text object nor like a object
// text, so use a special setup here
- rOutliner.SetMinAutoPaperSize(aNullSize);
rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
rOutliner.SetPaperSize(aAnchorTextSize);
- rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
- rOutliner.SetUpdateMode(TRUE);
+ rOutliner.SetUpdateMode(true);
rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
- rOutliner.SetUpdateMode(TRUE);
rOutliner.SetControlWord(nOriginalControlWord);
}
else
{
- // check if block text is used (only one of them can be true)
- const bool bHorizontalIsBlock(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg);
- const bool bVerticalIsBlock(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg);
if((rSdrBlockTextPrimitive.getWordWrap() || IsTextFrame()) && !rSdrBlockTextPrimitive.getUnlimitedPage())
{
@@ -843,16 +851,6 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
rOutliner.SetMaxAutoPaperSize(aMaxAutoPaperSize);
}
- // set minimal paper size hor/ver if needed
- if(bHorizontalIsBlock)
- {
- rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
- }
- else if(bVerticalIsBlock)
- {
- rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
- }
-
rOutliner.SetPaperSize(aNullSize);
rOutliner.SetUpdateMode(true);
rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject());
@@ -931,7 +929,8 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
// as the master shape we are working on. For vertical, use the top-right
// corner
const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
- aNewTransformA.translate(fStartInX, aAdjustTranslate.getY());
+ const basegfx::B2DTuple aAdjOffset(fStartInX, aAdjustTranslate.getY());
+ aNewTransformA.translate(aAdjOffset.getX(), aAdjOffset.getY());
// mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
// move the null point which was top left to bottom right.
@@ -948,10 +947,10 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
// #SJ# create ClipRange (if needed)
basegfx::B2DRange aClipRange;
- if(bIsCell)
+ if(rSdrBlockTextPrimitive.getClipOnBounds())
{
- aClipRange.expand(basegfx::B2DTuple(0.0, 0.0));
- aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()));
+ aClipRange.expand(-aAdjOffset);
+ aClipRange.expand(basegfx::B2DTuple(aAnchorTextSize.Width(), aAnchorTextSize.Height()) - aAdjOffset);
}
// now break up text primitives.
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 45a24211f7b2..e53f41251ff2 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -123,7 +123,7 @@ namespace drawinglayer
getTransform(),
*getSdrFTAttribute().getText(),
0,
- true, false));
+ true, false, false));
}
}
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 050b5d419c99..c0980017c2ed 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -802,6 +802,10 @@ void KeywordInfo::KeywordElement::init( Databases *pDatabases,Db* pDb,const rtl:
for( sal_uInt32 i = 0; i < id.size(); ++i )
{
+ // the following object must live longer than the
+ // pointer returned by aDBData.getData()
+ DBData aDBData;
+
listId[i] = id[i];
listAnchor[i] = anchor[i];
@@ -813,7 +817,6 @@ void KeywordInfo::KeywordElement::init( Databases *pDatabases,Db* pDb,const rtl:
DBHelp* pDBHelp = pDb->getDBHelp();
if( pDBHelp != NULL )
{
- DBData aDBData;
bool bSuccess = pDBHelp->getValueForKey( idi, aDBData );
if( bSuccess )
{
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index d46758ba2ee7..c8685645c6fd 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -1080,6 +1080,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
ugblData = &userData;
+ xmlInitParser();
xmlRegisterInputCallbacks(zipMatch, zipOpen, zipRead, uriClose);
xmlRegisterInputCallbacks(helpMatch, helpOpen, helpRead, uriClose);
xmlRegisterInputCallbacks(fileMatch, fileOpen, fileRead, fileClose);
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index d4dc48ede241..0dece7c6965c 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1629,6 +1629,7 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion
if ( aODFVersion.getLength() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
{
// check the consistency only for the ODF1.2 and later ( according to content.xml )
+ // manifest.xml might have no version, it should be checked here and the correct version should be set
try
{
uno::Reference< document::XStorageBasedDocument > xDoc( mxModel, uno::UNO_QUERY_THROW );
@@ -1654,7 +1655,24 @@ sal_Bool SvXMLImport::IsODFVersionConsistent( const ::rtl::OUString& aODFVersion
::rtl::OUString aStorVersion;
xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) )
>>= aStorVersion;
- bResult = aODFVersion.equals( aStorVersion );
+
+ // if the storage version is set in manifest.xml, it must be the same as in content.xml
+ // if not, set it explicitly to be used further ( it will work even for readonly storage )
+ // This workaround is not nice, but I see no other way to handle it, since there are
+ // ODF1.2 documents without version in manifest.xml
+ if ( aStorVersion.getLength() )
+ bResult = aODFVersion.equals( aStorVersion );
+ else
+ xStorProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ),
+ uno::makeAny( aODFVersion ) );
+
+ if ( bResult )
+ {
+ sal_Bool bInconsistent = sal_False;
+ xStorProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsInconsistent" ) ) )
+ >>= bInconsistent;
+ bResult = !bInconsistent;
+ }
}
}
}