summaryrefslogtreecommitdiff
path: root/forms/source
diff options
context:
space:
mode:
Diffstat (limited to 'forms/source')
-rw-r--r--forms/source/component/Button.cxx14
-rw-r--r--forms/source/component/Button.hxx10
-rw-r--r--forms/source/component/Columns.cxx16
-rw-r--r--forms/source/component/ComboBox.cxx7
-rw-r--r--forms/source/component/ComboBox.hxx2
-rw-r--r--forms/source/component/Currency.cxx9
-rw-r--r--forms/source/component/Currency.hxx2
-rw-r--r--forms/source/component/DatabaseForm.cxx155
-rw-r--r--forms/source/component/Date.cxx7
-rw-r--r--forms/source/component/Date.hxx2
-rw-r--r--forms/source/component/Edit.cxx7
-rw-r--r--forms/source/component/Edit.hxx2
-rw-r--r--forms/source/component/FormComponent.cxx24
-rw-r--r--forms/source/component/FormattedField.cxx13
-rw-r--r--forms/source/component/FormattedField.hxx1
-rw-r--r--forms/source/component/ImageControl.cxx3
-rw-r--r--forms/source/component/ListBox.cxx21
-rw-r--r--forms/source/component/ListBox.hxx1
-rw-r--r--forms/source/component/Numeric.cxx7
-rw-r--r--forms/source/component/Numeric.hxx1
-rw-r--r--forms/source/component/Pattern.cxx7
-rw-r--r--forms/source/component/Pattern.hxx1
-rw-r--r--forms/source/component/Time.cxx7
-rw-r--r--forms/source/component/Time.hxx1
-rw-r--r--forms/source/component/clickableimage.cxx5
-rw-r--r--forms/source/cppugen/makefile.mk68
-rw-r--r--forms/source/helper/commanddescriptionprovider.cxx139
-rw-r--r--forms/source/helper/commandimageprovider.cxx180
-rw-r--r--forms/source/helper/formnavigation.cxx162
-rw-r--r--forms/source/helper/makefile.mk2
-rw-r--r--forms/source/inc/FormComponent.hxx106
-rw-r--r--forms/source/inc/commanddescriptionprovider.hxx68
-rw-r--r--forms/source/inc/commandimageprovider.hxx77
-rw-r--r--forms/source/inc/featuredispatcher.hxx12
-rw-r--r--forms/source/inc/formnavigation.hxx24
-rw-r--r--forms/source/inc/frm_resource.hrc2
-rw-r--r--forms/source/inc/frm_strings.hxx2
-rw-r--r--forms/source/inc/property.hrc2
-rw-r--r--forms/source/resource/frm_resource.cxx2
-rw-r--r--forms/source/richtext/parametrizedattributedispatcher.cxx4
-rw-r--r--forms/source/richtext/richtextcontrol.cxx33
-rw-r--r--forms/source/richtext/richtextcontrol.hxx3
-rw-r--r--forms/source/richtext/richtextengine.cxx6
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx29
-rw-r--r--forms/source/richtext/richtextmodel.cxx12
-rw-r--r--forms/source/richtext/richtextmodel.hxx3
-rw-r--r--forms/source/richtext/richtextvclcontrol.cxx6
-rw-r--r--forms/source/richtext/richtextvclcontrol.hxx4
-rw-r--r--forms/source/richtext/rtattributehandler.cxx4
-rw-r--r--forms/source/richtext/rtattributes.hxx2
-rw-r--r--forms/source/runtime/formoperations.cxx2
-rw-r--r--forms/source/runtime/formoperations.hxx20
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx79
-rw-r--r--forms/source/solar/component/navbarcontrol.hxx22
-rw-r--r--forms/source/solar/control/navtoolbar.cxx254
-rw-r--r--forms/source/solar/inc/navtoolbar.hxx46
56 files changed, 1164 insertions, 536 deletions
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
index 8907dcd82712..575f842da4d0 100644
--- a/forms/source/component/Button.cxx
+++ b/forms/source/component/Button.cxx
@@ -509,7 +509,7 @@ IMPL_LINK( OButtonControl, OnClick, void*, EMPTYARG )
void OButtonControl::actionPerformed_Impl( sal_Bool _bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt )
{
{
- sal_Int32 nFeatureId = -1;
+ sal_Int16 nFeatureId = -1;
{
::osl::MutexGuard aGuard( m_aMutex );
nFeatureId = m_nTargetUrlFeatureId;
@@ -636,7 +636,7 @@ sal_Bool SAL_CALL OButtonControl::setModel( const Reference< XControlModel >& _r
//------------------------------------------------------------------------------
void OButtonControl::modelFeatureUrlPotentiallyChanged( )
{
- sal_Int32 nOldUrlFeatureId = m_nTargetUrlFeatureId;
+ sal_Int16 nOldUrlFeatureId = m_nTargetUrlFeatureId;
// doe we have another TargetURL now? If so, we need to update our dispatches
m_nTargetUrlFeatureId = getModelUrlFeatureId( );
@@ -675,9 +675,9 @@ namespace
}
//------------------------------------------------------------------------------
-sal_Int32 OButtonControl::getModelUrlFeatureId( ) const
+sal_Int16 OButtonControl::getModelUrlFeatureId( ) const
{
- sal_Int32 nFeatureId = -1;
+ sal_Int16 nFeatureId = -1;
// some URL related properties of the model
::rtl::OUString sUrl;
@@ -717,14 +717,14 @@ void SAL_CALL OButtonControl::setDesignMode( sal_Bool _bOn ) throw( RuntimeExcep
}
//------------------------------------------------------------------------------
-void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds )
+void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds )
{
if ( -1 != m_nTargetUrlFeatureId )
_rFeatureIds.push_back( m_nTargetUrlFeatureId );
}
//------------------------------------------------------------------
-void OButtonControl::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled )
+void OButtonControl::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled )
{
if ( _nFeatureId == m_nTargetUrlFeatureId )
{
@@ -754,7 +754,7 @@ void OButtonControl::allFeatureStatesChanged( )
}
//------------------------------------------------------------------
-bool OButtonControl::isEnabled( sal_Int32 _nFeatureId ) const
+bool OButtonControl::isEnabled( sal_Int16 _nFeatureId ) const
{
if ( const_cast< OButtonControl* >( this )->isDesignMode() )
// TODO: the model property?
diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx
index 5bbb7f387f85..3ca5154a9279 100644
--- a/forms/source/component/Button.hxx
+++ b/forms/source/component/Button.hxx
@@ -131,7 +131,7 @@ class OButtonControl :public OButtonControl_BASE
{
private:
sal_uInt32 m_nClickEvent;
- sal_Int32 m_nTargetUrlFeatureId;
+ sal_Int16 m_nTargetUrlFeatureId;
/// caches the value of the "Enabled" property of our model
sal_Bool m_bEnabledByPropertyValue;
@@ -176,10 +176,10 @@ public:
protected:
// OFormNavigationHelper overriables
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds );
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
virtual void allFeatureStatesChanged( );
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
// XDispatchProviderInterception disambiguaiton
virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
@@ -198,7 +198,7 @@ private:
/** retrieves the feature id (see OFormNavigationHelper) of the TargetURL of
the model.
*/
- sal_Int32 getModelUrlFeatureId( ) const;
+ sal_Int16 getModelUrlFeatureId( ) const;
/** starts or stops listening for changes in model properties we're interested in
*/
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index c307783f179b..29d6f1130509 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -342,7 +342,7 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_B
aForbiddenProperties.insert( PROPERTY_VSCROLL );
aForbiddenProperties.insert( PROPERTY_CONTROLLABEL );
aForbiddenProperties.insert( PROPERTY_RICH_TEXT );
- aForbiddenProperties.insert( PROPERTY_VERTICALALIGN );
+ aForbiddenProperties.insert( PROPERTY_VERTICAL_ALIGN );
aForbiddenProperties.insert( PROPERTY_IMAGE_URL );
aForbiddenProperties.insert( PROPERTY_IMAGE_POSITION );
aForbiddenProperties.insert( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) );
@@ -416,14 +416,14 @@ sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldV
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL));
break;
case PROPERTY_ID_ALIGN:
- try
+ bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType( (const sal_Int32*)NULL ) );
+ // strange enough, css.awt.TextAlign is a 32-bit integer, while the Align property (both here for grid controls
+ // and for ordinary toolkit controls) is a 16-bit integer. So, allow for 32 bit, but normalize it to 16 bit
+ if ( bModified )
{
- bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType((const sal_Int16*)NULL));
- }
- catch(starlang::IllegalArgumentException&)
- {
- OSL_ENSURE(0,"OGridColumn::convertFastPropertyValue: TextAlign must be casted to sal_Int16!");
- throw;
+ sal_Int32 nAlign( 0 );
+ if ( rConvertedValue >>= nAlign )
+ rConvertedValue <<= (sal_Int16)nAlign;
}
break;
case PROPERTY_ID_HIDDEN:
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 1d6d204ea977..432bc5124775 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -747,6 +747,13 @@ void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(Runtim
loadData( false );
}
+//------------------------------------------------------------------------------
+void OComboBoxModel::resetNoBroadcast()
+{
+ OBoundControlModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
//-----------------------------------------------------------------------------
sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx
index 835099a7637c..068f4fd97163 100644
--- a/forms/source/component/ComboBox.hxx
+++ b/forms/source/component/ComboBox.hxx
@@ -145,6 +145,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
// OEntryListHelper overriables
virtual void stringItemListChanged( ControlModelLock& _rInstanceLock );
virtual void connectedExternalListSource( );
diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx
index 1b19b794d273..5af83ca2fba1 100644
--- a/forms/source/component/Currency.cxx
+++ b/forms/source/component/Currency.cxx
@@ -34,7 +34,7 @@
#include <tools/debug.hxx>
#include <unotools/localedatawrapper.hxx>
#include <vcl/svapp.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
//.........................................................................
namespace frm
@@ -257,6 +257,13 @@ Any OCurrencyModel::getDefaultForReset() const
return aValue;
}
+//------------------------------------------------------------------------------
+void OCurrencyModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Currency.hxx b/forms/source/component/Currency.hxx
index 91eb109d6a14..3e968dcf3bc7 100644
--- a/forms/source/component/Currency.hxx
+++ b/forms/source/component/Currency.hxx
@@ -73,6 +73,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 96412feed10a..54225d6095a6 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -31,72 +31,71 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
-#include "componenttools.hxx"
-#include "DatabaseForm.hxx"
-#include "EventThread.hxx"
-#include "frm_module.hxx"
-#include "frm_resource.hrc"
-#include "frm_resource.hxx"
-#include "GroupManager.hxx"
-#include "property.hrc"
-#include "property.hxx"
-#include "services.hxx"
-
-#include <com/sun/star/awt/XControlContainer.hpp>
-#include <com/sun/star/awt/XTextComponent.hpp>
-#include <com/sun/star/form/DataSelectionType.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/form/TabulatorCycle.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/io/XObjectInputStream.hpp>
-#include <com/sun/star/io/XObjectOutputStream.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/RowSetVetoException.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdb/XColumnUpdate.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#include <com/sun/star/sdbc/ResultSetType.hpp>
-#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/util/XCancellable.hpp>
-#include <com/sun/star/util/XURLTransformer.hpp>
+#include "componenttools.hxx"
+#include "DatabaseForm.hxx"
+#include "EventThread.hxx"
+#include "frm_module.hxx"
+#include "frm_resource.hrc"
+#include "frm_resource.hxx"
+#include "GroupManager.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "services.hxx"
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/form/DataSelectionType.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/TabulatorCycle.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/RowSetVetoException.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XModifiable2.hpp>
-
-#include <comphelper/basicio.hxx>
-#include <comphelper/container.hxx>
-#include <comphelper/enumhelper.hxx>
-#include <comphelper/extract.hxx>
-#include <comphelper/seqstream.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/stl_types.hxx>
-#include <comphelper/uno3.hxx>
-#include <connectivity/dbtools.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/math.hxx>
-#include <rtl/tencinfo.h>
-#include <svtools/inetstrm.hxx>
-#include <svtools/inettype.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/fsys.hxx>
-#include <tools/inetmsg.hxx>
-#include <tools/urlobj.hxx>
-#include <unotools/ucblockbytes.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/timer.hxx>
-#include <vos/mutex.hxx>
-
-#include <ctype.h>
-#include <hash_map>
-//#include <stdio.h>
+
+#include <comphelper/basicio.hxx>
+#include <comphelper/container.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/seqstream.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/stl_types.hxx>
+#include <comphelper/uno3.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/math.hxx>
+#include <rtl/tencinfo.h>
+#include <svl/inetstrm.hxx>
+#include <svl/inettype.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/fsys.hxx>
+#include <tools/inetmsg.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/ucblockbytes.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/timer.hxx>
+#include <vos/mutex.hxx>
+
+#include <ctype.h>
+#include <hash_map>
// compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ...
namespace com {
@@ -152,7 +151,6 @@ public:
DocumentModifyGuard( const Reference< XInterface >& _rxFormComponent )
:m_xDocumentModify( getXModel( _rxFormComponent ), UNO_QUERY )
{
- OSL_ENSURE( m_xDocumentModify.is(), "DocumentModifyGuard::DocumentModifyGuard: no document, or no XModifiable2!" );
impl_changeModifiableFlag_nothrow( false );
}
~DocumentModifyGuard()
@@ -2630,16 +2628,15 @@ void ODatabaseForm::impl_createLoadTimer()
//------------------------------------------------------------------------------
void SAL_CALL ODatabaseForm::loaded(const EventObject& /*aEvent*/) throw( RuntimeException )
{
- // now start the rowset listening to recover cursor events
- load_impl(sal_True);
{
- ::osl::MutexGuard aGuard(m_aMutex);
- Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY);
- if (xParentRowSet.is())
- xParentRowSet->addRowSetListener(this);
+ ::osl::MutexGuard aGuard( m_aMutex );
+ Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
+ xParentRowSet->addRowSetListener( this );
impl_createLoadTimer();
}
+
+ load_impl( sal_True );
}
//------------------------------------------------------------------------------
@@ -2647,12 +2644,14 @@ void SAL_CALL ODatabaseForm::unloading(const EventObject& /*aEvent*/) throw( Run
{
{
// now stop the rowset listening if we are a subform
- ::osl::MutexGuard aGuard(m_aMutex);
- DELETEZ(m_pLoadTimer);
+ ::osl::MutexGuard aGuard( m_aMutex );
- Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY);
- if (xParentRowSet.is())
- xParentRowSet->removeRowSetListener(this);
+ if ( m_pLoadTimer && m_pLoadTimer->IsActive() )
+ m_pLoadTimer->Stop();
+ DELETEZ( m_pLoadTimer );
+
+ Reference< XRowSet > xParentRowSet( m_xParent, UNO_QUERY_THROW );
+ xParentRowSet->removeRowSetListener( this );
}
unload();
@@ -2880,7 +2879,7 @@ sal_Bool ODatabaseForm::implEnsureConnection()
}
catch( Exception )
{
- DBG_ERROR( "ODatabaseForm::implEnsureConnection: caught an exception which I cannot handle!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return sal_False;
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx
index 33332ae82908..5d0d3f21ce7a 100644
--- a/forms/source/component/Date.cxx
+++ b/forms/source/component/Date.cxx
@@ -348,6 +348,13 @@ Any ODateModel::getDefaultForReset() const
}
//------------------------------------------------------------------------------
+void ODateModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
+//------------------------------------------------------------------------------
Sequence< Type > ODateModel::getSupportedBindingTypes()
{
return Sequence< Type >( &::getCppuType( static_cast< util::Date* >( NULL ) ), 1 );
diff --git a/forms/source/component/Date.hxx b/forms/source/component/Date.hxx
index 4c4e84e2822f..7eb1acfabf75 100644
--- a/forms/source/component/Date.hxx
+++ b/forms/source/component/Date.hxx
@@ -96,6 +96,8 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
+
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
protected:
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index 0f4abd687d65..4eca9402fef8 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -675,6 +675,13 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
}
//------------------------------------------------------------------------------
+void OEditModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
+//------------------------------------------------------------------------------
sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index cb8d5c6300e4..774944eda939 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -118,6 +118,8 @@ protected:
virtual sal_Bool approveDbColumnType( sal_Int32 _nColumnType );
+ virtual void resetNoBroadcast();
+
protected:
virtual sal_uInt16 getPersistenceFlags() const;
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 3b6a6afaf5de..4a612642bbff 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -2216,7 +2216,7 @@ sal_Bool OBoundControlModel::approveDbColumnType(sal_Int32 _nColumnType)
|| (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER)
|| (_nColumnType == DataType::OBJECT) || (_nColumnType == DataType::DISTINCT)
|| (_nColumnType == DataType::STRUCT) || (_nColumnType == DataType::ARRAY)
- || (_nColumnType == DataType::BLOB) || (_nColumnType == DataType::CLOB)
+ || (_nColumnType == DataType::BLOB) /*|| (_nColumnType == DataType::CLOB)*/
|| (_nColumnType == DataType::REF) || (_nColumnType == DataType::SQLNULL))
return sal_False;
@@ -2266,14 +2266,6 @@ void OBoundControlModel::impl_connectDatabaseColumn_noNotify( bool _bFromReload
m_bLoaded = sal_True;
onConnectedDbColumn( xRowSet );
- // Some derived classes decide to cache the "current" (resp. "last known") control value, so operations like
- // commitControlValueToDbColumn can be made a no-op when nothing actually changed.
- // Normally, this cache is kept in sync with the column value, but during a reload, this synchronization is
- // temporarily disable. To allow the derived classes to update their cache from the current column value,
- // we call translateDbColumnToControlValue.
- if ( _bFromReload && hasField() )
- translateDbColumnToControlValue();
-
// initially transfer the db column value to the control, if we successfully connected to a database column
if ( hasField() )
initFromField( xRowSet );
@@ -2559,10 +2551,11 @@ void OBoundControlModel::reset() throw (RuntimeException)
|| ( nFieldType == DataType::VARBINARY )
|| ( nFieldType == DataType::LONGVARBINARY )
|| ( nFieldType == DataType::OBJECT )
- || ( nFieldType == DataType::BLOB )
- || ( nFieldType == DataType::CLOB )
+ /*|| ( nFieldType == DataType::CLOB )*/
)
m_xColumn->getBinaryStream();
+ else if ( nFieldType == DataType::BLOB )
+ m_xColumn->getBlob();
else
m_xColumn->getString();
@@ -2811,7 +2804,14 @@ void SAL_CALL OBoundControlModel::modified( const EventObject& _rEvent ) throw (
//--------------------------------------------------------------------
void OBoundControlModel::transferDbValueToControl( )
{
- setControlValue( translateDbColumnToControlValue(), eDbColumnBinding );
+ try
+ {
+ setControlValue( translateDbColumnToControlValue(), eDbColumnBinding );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index bc0e952f1735..77a108f300f9 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -42,8 +42,8 @@
#include <comphelper/numbers.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbconversion.hxx>
-#include <svtools/zforlist.hxx>
-#include <svtools/numuno.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/numuno.hxx>
#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include <vcl/wintypes.hxx>
@@ -583,7 +583,7 @@ void OFormattedModel::_propertyChanged( const com::sun::star::beans::PropertyCha
// as m_aSaveValue (which is used by commitControlValueToDbColumn) is format dependent we have
// to recalc it, which is done by translateDbColumnToControlValue
- if ( m_xColumn.is() && m_xAggregateFastSet.is() )
+ if ( m_xColumn.is() && m_xAggregateFastSet.is() && !m_xCursor->isBeforeFirst() && !m_xCursor->isAfterLast())
{
setControlValue( translateDbColumnToControlValue(), eOther );
}
@@ -1248,6 +1248,13 @@ Any OFormattedModel::getDefaultForReset() const
return m_xAggregateSet->getPropertyValue( PROPERTY_EFFECTIVE_DEFAULT );
}
+//------------------------------------------------------------------------------
+void OFormattedModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
}
//.........................................................................
diff --git a/forms/source/component/FormattedField.hxx b/forms/source/component/FormattedField.hxx
index 0e728288aaba..4a25d10c5c81 100644
--- a/forms/source/component/FormattedField.hxx
+++ b/forms/source/component/FormattedField.hxx
@@ -141,6 +141,7 @@ namespace frm
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
virtual void onDisconnectedDbColumn();
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 5d30c2776659..fbcc59271e00 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -65,7 +65,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/guarding.hxx>
#include <unotools/ucbstreamhelper.hxx>
-#include <svtools/urihelper.hxx>
+#include <svl/urihelper.hxx>
#include <memory>
@@ -115,6 +115,7 @@ namespace
|| ( _nFieldType == DataType::OBJECT )
|| ( _nFieldType == DataType::BLOB )
|| ( _nFieldType == DataType::LONGVARCHAR )
+ || ( _nFieldType == DataType::CLOB )
)
return ImageStoreBinary;
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index ec953f66c6f6..4bbf42381900 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -1003,23 +1003,23 @@ namespace frm
sal_Bool OListBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
// current selektion list
- const ORowSetValue rCurrentValue( getFirstSelectedValue() );
- if ( rCurrentValue != m_aSaveValue )
+ const ORowSetValue aCurrentValue( getFirstSelectedValue() );
+ if ( aCurrentValue != m_aSaveValue )
{
- if ( rCurrentValue.isNull() )
+ if ( aCurrentValue.isNull() )
m_xColumnUpdate->updateNull();
else
{
try
{
- m_xColumnUpdate->updateObject( rCurrentValue.makeAny() );
+ m_xColumnUpdate->updateObject( aCurrentValue.makeAny() );
}
catch ( const Exception& )
{
return sal_False;
}
}
- m_aSaveValue = rCurrentValue;
+ m_aSaveValue = aCurrentValue;
}
return sal_True;
}
@@ -1037,10 +1037,10 @@ namespace frm
Sequence< sal_Int16 > aSelectionIndicies;
- // Bei NULL-Eintraegen Selektion aufheben!
ORowSetValue aCurrentValue;
- aCurrentValue.fill( xBoundField->getPropertyValue( PROPERTY_VALUE ) );
+ aCurrentValue.fill( getFieldType(), m_xColumn );
+ // reset selection for NULL values
if ( aCurrentValue.isNull() )
{
if ( m_nNULLPos != -1 )
@@ -1088,6 +1088,13 @@ namespace frm
}
//--------------------------------------------------------------------
+ void OListBoxModel::resetNoBroadcast()
+ {
+ OBoundControlModel::resetNoBroadcast();
+ m_aSaveValue.setNull();
+ }
+
+ //--------------------------------------------------------------------
void SAL_CALL OListBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException )
{
if ( !OEntryListHelper::handleDisposing( _rSource ) )
diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx
index 60bd63b3712d..308fb618e18a 100644
--- a/forms/source/component/ListBox.hxx
+++ b/forms/source/component/ListBox.hxx
@@ -157,6 +157,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual ::com::sun::star::uno::Any
getCurrentFormComponentValue() const;
diff --git a/forms/source/component/Numeric.cxx b/forms/source/component/Numeric.cxx
index 2ec1f0cfcfdc..2eba2daae067 100644
--- a/forms/source/component/Numeric.cxx
+++ b/forms/source/component/Numeric.cxx
@@ -212,6 +212,13 @@ Any ONumericModel::getDefaultForReset() const
return aValue;
}
+//------------------------------------------------------------------------------
+void ONumericModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Numeric.hxx b/forms/source/component/Numeric.hxx
index 45b096afef50..5599707e86d5 100644
--- a/forms/source/component/Numeric.hxx
+++ b/forms/source/component/Numeric.hxx
@@ -72,6 +72,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx
index 64f5ea0e5e75..166522c18359 100644
--- a/forms/source/component/Pattern.cxx
+++ b/forms/source/component/Pattern.cxx
@@ -252,6 +252,13 @@ Any OPatternModel::getDefaultForReset() const
return makeAny( m_aDefaultText );
}
+//------------------------------------------------------------------------------
+void OPatternModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aLastKnownValue.clear();
+}
+
//.........................................................................
} // namespace frm
//.........................................................................
diff --git a/forms/source/component/Pattern.hxx b/forms/source/component/Pattern.hxx
index 8b2bf3b878c2..9e0bc3b68d77 100644
--- a/forms/source/component/Pattern.hxx
+++ b/forms/source/component/Pattern.hxx
@@ -81,6 +81,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
protected:
DECLARE_XCLONEABLE();
diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index 85ce1670572d..6a63724829d1 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -350,6 +350,13 @@ Any OTimeModel::getDefaultForReset() const
}
//------------------------------------------------------------------------------
+void OTimeModel::resetNoBroadcast()
+{
+ OEditBaseModel::resetNoBroadcast();
+ m_aSaveValue.clear();
+}
+
+//------------------------------------------------------------------------------
Sequence< Type > OTimeModel::getSupportedBindingTypes()
{
return Sequence< Type >( &::getCppuType( static_cast< util::Time* >( NULL ) ), 1 );
diff --git a/forms/source/component/Time.hxx b/forms/source/component/Time.hxx
index d2ba5381f466..7a7ce373b363 100644
--- a/forms/source/component/Time.hxx
+++ b/forms/source/component/Time.hxx
@@ -96,6 +96,7 @@ protected:
virtual ::com::sun::star::uno::Any
getDefaultForReset() const;
+ virtual void resetNoBroadcast();
virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx
index b9738ddd49ae..79d28727b5d5 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -435,6 +435,11 @@ namespace frm
// allowed to leave
throw;
}
+ catch( const WrappedTargetException& e )
+ {
+ // allowed to leave
+ throw;
+ }
catch( const Exception& e )
{
OSL_ENSURE( sal_False, "OClickableImageBaseControl::implSubmit: caught an unknown exception!" );
diff --git a/forms/source/cppugen/makefile.mk b/forms/source/cppugen/makefile.mk
deleted file mode 100644
index aa65a7122a33..000000000000
--- a/forms/source/cppugen/makefile.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.6 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJINC=$(PRJ)$/source$/inc
-PRJNAME=forms
-TARGET=fm_cppugen
-
-# --- Settings ----------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE: $(PRJ)$/makefile.pmk
-
-# --- Types -------------------------------------
-
-
-
-# --- Types -------------------------------------
-
-UNOTYPES+= \
- com.sun.star.form.binding.XBindableValue \
- com.sun.star.form.binding.XValueBinding \
- com.sun.star.form.binding.XListEntrySink \
- com.sun.star.form.binding.XListEntrySource \
- com.sun.star.form.binding.XListEntryListener \
- com.sun.star.form.validation.XValidator \
- com.sun.star.form.validation.XValidatable \
- com.sun.star.form.validation.XValidityConstraintListener \
- com.sun.star.form.validation.XValidatableFormComponent \
- com.sun.star.form.submission.XSubmissionSupplier \
- com.sun.star.xforms.XModel \
- com.sun.star.xforms.XFormsSupplier \
- com.sun.star.xforms.XSubmission \
- com.sun.star.xsd.WhiteSpaceTreatment \
- com.sun.star.xsd.XDataType \
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx
new file mode 100644
index 000000000000..87692c5b5b82
--- /dev/null
+++ b/forms/source/helper/commanddescriptionprovider.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_forms.hxx"
+
+#include "commanddescriptionprovider.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/namedvaluecollection.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::frame::XModuleManager;
+ using ::com::sun::star::beans::PropertyValue;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= DefaultCommandDescriptionProvider
+ //====================================================================
+ class DefaultCommandDescriptionProvider : public ICommandDescriptionProvider
+ {
+ public:
+ DefaultCommandDescriptionProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ impl_init_nothrow( _rContext, _rxDocument );
+ }
+
+ ~DefaultCommandDescriptionProvider()
+ {
+ }
+
+ // ICommandDescriptionProvider
+ virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const;
+
+ private:
+ void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument );
+
+ private:
+ Reference< XNameAccess > m_xCommandAccess;
+ };
+
+
+ //--------------------------------------------------------------------
+ void DefaultCommandDescriptionProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ OSL_ENSURE( _rxDocument.is(), "DefaultCommandDescriptionProvider::impl_init_nothrow: no document => no command descriptions!" );
+ if ( !_rxDocument.is() )
+ return;
+
+ try
+ {
+ Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument );
+
+ Reference< XNameAccess > xUICommandDescriptions( _rContext.createComponent( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY_THROW );
+ m_xCommandAccess.set( xUICommandDescriptions->getByName( sModuleID ), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString DefaultCommandDescriptionProvider::getCommandDescription( const ::rtl::OUString& _rCommandURL ) const
+ {
+ if ( !m_xCommandAccess.is() )
+ return ::rtl::OUString();
+
+ try
+ {
+ ::comphelper::NamedValueCollection aCommandProperties( m_xCommandAccess->getByName( _rCommandURL ) );
+ return aCommandProperties.getOrDefault( "Name", ::rtl::OUString() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ PCommandDescriptionProvider createDocumentCommandDescriptionProvider(
+ const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rContext, _rxDocument ) );
+ return pDescriptionProvider;
+ }
+
+//........................................................................
+} // namespace frm
+//........................................................................
diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx
new file mode 100644
index 000000000000..7240a7073943
--- /dev/null
+++ b/forms/source/helper/commandimageprovider.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_forms.hxx"
+
+#include "commandimageprovider.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/ui/XImageManager.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::ui::XImageManager;
+ using ::com::sun::star::ui::XUIConfigurationManagerSupplier;
+ using ::com::sun::star::ui::XUIConfigurationManager;
+ using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier;
+ using ::com::sun::star::frame::XModuleManager;
+ using ::com::sun::star::graphic::XGraphic;
+ /** === end UNO using === **/
+ namespace ImageType = ::com::sun::star::ui::ImageType;
+
+ //====================================================================
+ //= DocumentCommandImageProvider
+ //====================================================================
+ class DocumentCommandImageProvider : public ICommandImageProvider
+ {
+ public:
+ DocumentCommandImageProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ impl_init_nothrow( _rContext, _rxDocument );
+ }
+ virtual ~DocumentCommandImageProvider()
+ {
+ }
+
+ // ICommandImageProvider
+ virtual CommandImages getCommandImages( const CommandURLs& _rCommandURLs, const bool _bLarge, const bool _bHiContrast ) const;
+
+ private:
+ void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument );
+
+ private:
+ Reference< XImageManager > m_xDocumentImageManager;
+ Reference< XImageManager > m_xModuleImageManager;
+ };
+
+ //--------------------------------------------------------------------
+ void DocumentCommandImageProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ OSL_ENSURE( _rxDocument.is(), "DocumentCommandImageProvider::impl_init_nothrow: no document => no images!" );
+ if ( !_rxDocument.is() )
+ return;
+
+ // obtain the image manager of the document
+ try
+ {
+ Reference< XUIConfigurationManagerSupplier > xSuppUIConfig( _rxDocument, UNO_QUERY_THROW );
+ Reference< XUIConfigurationManager > xUIConfig( xSuppUIConfig->getUIConfigurationManager(), UNO_QUERY );
+ m_xDocumentImageManager.set( xUIConfig->getImageManager(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ // obtain the image manager or the module
+ try
+ {
+ Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW );
+ ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument );
+
+ Reference< XModuleUIConfigurationManagerSupplier > xSuppUIConfig(
+ _rContext.createComponent( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ), UNO_QUERY_THROW );
+ Reference< XUIConfigurationManager > xUIConfig(
+ xSuppUIConfig->getUIConfigurationManager( sModuleID ), UNO_SET_THROW );
+ m_xModuleImageManager.set( xUIConfig->getImageManager(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ CommandImages DocumentCommandImageProvider::getCommandImages( const CommandURLs& _rCommandURLs, const bool _bLarge, const bool _bHiContrast ) const
+ {
+ const size_t nCommandCount = _rCommandURLs.getLength();
+ CommandImages aImages( nCommandCount );
+ try
+ {
+ const sal_Int16 nImageType =
+ ( _bLarge ? ImageType::SIZE_LARGE : ImageType::SIZE_DEFAULT )
+ + ( _bHiContrast ? ImageType::COLOR_HIGHCONTRAST : ImageType::COLOR_NORMAL );
+
+ Sequence< Reference< XGraphic > > aDocImages( nCommandCount );
+ Sequence< Reference< XGraphic > > aModImages( nCommandCount );
+
+ // first try the document image manager
+ if ( m_xDocumentImageManager.is() )
+ aDocImages = m_xDocumentImageManager->getImages( nImageType, _rCommandURLs );
+
+ // then the module's image manager
+ if ( m_xModuleImageManager.is() )
+ aModImages = m_xModuleImageManager->getImages( nImageType, _rCommandURLs );
+
+ ENSURE_OR_THROW( (size_t)aDocImages.getLength() == nCommandCount, "illegal array size returned by getImages (document image manager)" );
+ ENSURE_OR_THROW( (size_t)aModImages.getLength() == nCommandCount, "illegal array size returned by getImages (module image manager)" );
+
+ for ( size_t i=0; i<nCommandCount; ++i )
+ {
+ if ( aDocImages[i].is() )
+ aImages[i] = Image( aDocImages[i] );
+ else
+ aImages[i] = Image( aModImages[i] );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aImages;
+ }
+
+ //--------------------------------------------------------------------
+ PCommandImageProvider createDocumentCommandImageProvider(
+ const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
+ {
+ PCommandImageProvider pImageProvider( new DocumentCommandImageProvider( _rContext, _rxDocument ) );
+ return pImageProvider;
+ }
+
+//........................................................................
+} // namespace frm
+//........................................................................
diff --git a/forms/source/helper/formnavigation.cxx b/forms/source/helper/formnavigation.cxx
index 895b48a563f8..8f3d14df4657 100644
--- a/forms/source/helper/formnavigation.cxx
+++ b/forms/source/helper/formnavigation.cxx
@@ -33,12 +33,13 @@
#include "formnavigation.hxx"
#include "urltransformer.hxx"
#include "controlfeatureinterception.hxx"
-#include <tools/debug.hxx>
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
#include "frm_strings.hxx"
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+
+#include <tools/debug.hxx>
+
+
//.........................................................................
namespace frm
{
@@ -49,6 +50,7 @@ namespace frm
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
//==================================================================
//= OFormNavigationHelper
@@ -83,7 +85,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::featureStateChanged( sal_Int32 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ )
+ void OFormNavigationHelper::featureStateChanged( sal_Int16 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ )
{
// not interested in
}
@@ -270,12 +272,12 @@ namespace frm
if ( m_aSupportedFeatures.empty() )
{
// ask the derivee which feature ids it wants us to support
- ::std::vector< sal_Int32 > aFeatureIds;
+ ::std::vector< sal_Int16 > aFeatureIds;
getSupportedFeatures( aFeatureIds );
OFormNavigationMapper aUrlMapper( m_xORB );
- for ( ::std::vector< sal_Int32 >::const_iterator aLoop = aFeatureIds.begin();
+ for ( ::std::vector< sal_Int16 >::const_iterator aLoop = aFeatureIds.begin();
aLoop != aFeatureIds.end();
++aLoop
)
@@ -300,7 +302,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamAsciiName,
+ void OFormNavigationHelper::dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamAsciiName,
const Any& _rParamValue ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
@@ -318,7 +320,7 @@ namespace frm
}
//------------------------------------------------------------------
- void OFormNavigationHelper::dispatch( sal_Int32 _nFeatureId ) const
+ void OFormNavigationHelper::dispatch( sal_Int16 _nFeatureId ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
if ( m_aSupportedFeatures.end() != aInfo )
@@ -332,7 +334,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationHelper::isEnabled( sal_Int32 _nFeatureId ) const
+ bool OFormNavigationHelper::isEnabled( sal_Int16 _nFeatureId ) const
{
FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId );
if ( m_aSupportedFeatures.end() != aInfo )
@@ -342,7 +344,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationHelper::getBooleanState( sal_Int32 _nFeatureId ) const
+ bool OFormNavigationHelper::getBooleanState( sal_Int16 _nFeatureId ) const
{
sal_Bool bState = sal_False;
@@ -354,7 +356,7 @@ namespace frm
}
//------------------------------------------------------------------
- ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int32 _nFeatureId ) const
+ ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int16 _nFeatureId ) const
{
::rtl::OUString sState;
@@ -366,7 +368,7 @@ namespace frm
}
//------------------------------------------------------------------
- sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int32 _nFeatureId ) const
+ sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int16 _nFeatureId ) const
{
sal_Int32 nState = 0;
@@ -382,7 +384,7 @@ namespace frm
{
disconnectDispatchers( );
// no supported features anymore:
- FeatureMap aEmpty;
+ FeatureMap aEmpty;
m_aSupportedFeatures.swap( aEmpty );
}
@@ -401,7 +403,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool OFormNavigationMapper::getFeatureURL( sal_Int32 _nFeatureId, URL& /* [out] */ _rURL )
+ bool OFormNavigationMapper::getFeatureURL( sal_Int16 _nFeatureId, URL& /* [out] */ _rURL )
{
// get the ascii version of the URL
const char* pAsciiURL = getFeatureURLAscii( _nFeatureId );
@@ -412,84 +414,72 @@ namespace frm
}
//------------------------------------------------------------------
- const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int32 _nFeatureId )
+ namespace
{
- const char* pAsciiURL = NULL;
-
- switch ( _nFeatureId )
+ struct FeatureURL
{
- case SID_FM_RECORD_ABSOLUTE : pAsciiURL = URL_FORM_POSITION; break;
- case SID_FM_RECORD_TOTAL : pAsciiURL = URL_FORM_RECORDCOUNT; break;
- case SID_FM_RECORD_FIRST : pAsciiURL = URL_RECORD_FIRST; break;
- case SID_FM_RECORD_PREV : pAsciiURL = URL_RECORD_PREV; break;
- case SID_FM_RECORD_NEXT : pAsciiURL = URL_RECORD_NEXT; break;
- case SID_FM_RECORD_LAST : pAsciiURL = URL_RECORD_LAST; break;
- case SID_FM_RECORD_SAVE : pAsciiURL = URL_RECORD_SAVE; break;
- case SID_FM_RECORD_UNDO : pAsciiURL = URL_RECORD_UNDO; break;
- case SID_FM_RECORD_NEW : pAsciiURL = URL_RECORD_NEW; break;
- case SID_FM_RECORD_DELETE : pAsciiURL = URL_RECORD_DELETE; break;
- case SID_FM_REFRESH : pAsciiURL = URL_FORM_REFRESH; break;
- case SID_FM_REFRESH_FORM_CONTROL: pAsciiURL = URL_FORM_REFRESH_CURRENT_CONTROL; break;
-
- case SID_FM_SORTUP : pAsciiURL = URL_FORM_SORT_UP; break;
- case SID_FM_SORTDOWN : pAsciiURL = URL_FORM_SORT_DOWN; break;
- case SID_FM_ORDERCRIT : pAsciiURL = URL_FORM_SORT; break;
- case SID_FM_AUTOFILTER : pAsciiURL = URL_FORM_AUTO_FILTER; break;
- case SID_FM_FILTERCRIT : pAsciiURL = URL_FORM_FILTER; break;
- case SID_FM_FORM_FILTERED : pAsciiURL = URL_FORM_APPLY_FILTER; break;
- case SID_FM_REMOVE_FILTER_SORT : pAsciiURL = URL_FORM_REMOVE_FILTER; break;
+ const sal_Int16 nFormFeature;
+ const sal_Char* pAsciiURL;
+
+ FeatureURL( const sal_Int16 _nFormFeature, const sal_Char* _pAsciiURL )
+ :nFormFeature( _nFormFeature )
+ ,pAsciiURL( _pAsciiURL )
+ {
+ }
};
- return pAsciiURL;
+ const FeatureURL* lcl_getFeatureTable()
+ {
+ static const FeatureURL s_aFeatureURLs[] =
+ {
+ FeatureURL( FormFeature::MoveAbsolute, URL_FORM_POSITION ),
+ FeatureURL( FormFeature::TotalRecords, URL_FORM_RECORDCOUNT ),
+ FeatureURL( FormFeature::MoveToFirst, URL_RECORD_FIRST ),
+ FeatureURL( FormFeature::MoveToPrevious, URL_RECORD_PREV ),
+ FeatureURL( FormFeature::MoveToNext, URL_RECORD_NEXT ),
+ FeatureURL( FormFeature::MoveToLast, URL_RECORD_LAST ),
+ FeatureURL( FormFeature::SaveRecordChanges, URL_RECORD_SAVE ),
+ FeatureURL( FormFeature::UndoRecordChanges, URL_RECORD_UNDO ),
+ FeatureURL( FormFeature::MoveToInsertRow, URL_RECORD_NEW ),
+ FeatureURL( FormFeature::DeleteRecord, URL_RECORD_DELETE ),
+ FeatureURL( FormFeature::ReloadForm, URL_FORM_REFRESH ),
+ FeatureURL( FormFeature::RefreshCurrentControl, URL_FORM_REFRESH_CURRENT_CONTROL ),
+ FeatureURL( FormFeature::SortAscending, URL_FORM_SORT_UP ),
+ FeatureURL( FormFeature::SortDescending, URL_FORM_SORT_DOWN ),
+ FeatureURL( FormFeature::InteractiveSort, URL_FORM_SORT ),
+ FeatureURL( FormFeature::AutoFilter, URL_FORM_AUTO_FILTER ),
+ FeatureURL( FormFeature::InteractiveFilter, URL_FORM_FILTER ),
+ FeatureURL( FormFeature::ToggleApplyFilter, URL_FORM_APPLY_FILTER ),
+ FeatureURL( FormFeature::RemoveFilterAndSort, URL_FORM_REMOVE_FILTER ),
+ FeatureURL( 0, NULL )
+ };
+ return s_aFeatureURLs;
+ }
+ }
+
+ //------------------------------------------------------------------
+ const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int16 _nFeatureId )
+ {
+ const FeatureURL* pFeatures = lcl_getFeatureTable();
+ while ( pFeatures->pAsciiURL )
+ {
+ if ( pFeatures->nFormFeature == _nFeatureId )
+ return pFeatures->pAsciiURL;
+ ++pFeatures;
+ }
+ return NULL;
}
//------------------------------------------------------------------
- sal_Int32 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL )
+ sal_Int16 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL )
{
- sal_Int32 nFeatureId = -1;
-
- if ( _rCompleteURL == URL_FORM_POSITION )
- nFeatureId = SID_FM_RECORD_ABSOLUTE;
- else if ( _rCompleteURL == URL_FORM_RECORDCOUNT )
- nFeatureId = SID_FM_RECORD_TOTAL;
- else if ( _rCompleteURL == URL_RECORD_FIRST )
- nFeatureId = SID_FM_RECORD_FIRST;
- else if ( _rCompleteURL == URL_RECORD_PREV )
- nFeatureId = SID_FM_RECORD_PREV;
- else if ( _rCompleteURL == URL_RECORD_NEXT )
- nFeatureId = SID_FM_RECORD_NEXT;
- else if ( _rCompleteURL == URL_RECORD_LAST )
- nFeatureId = SID_FM_RECORD_LAST;
- else if ( _rCompleteURL == URL_RECORD_SAVE )
- nFeatureId = SID_FM_RECORD_SAVE;
- else if ( _rCompleteURL == URL_RECORD_UNDO )
- nFeatureId = SID_FM_RECORD_UNDO;
- else if ( _rCompleteURL == URL_RECORD_NEW )
- nFeatureId = SID_FM_RECORD_NEW;
- else if ( _rCompleteURL == URL_RECORD_DELETE )
- nFeatureId = SID_FM_RECORD_DELETE;
- else if ( _rCompleteURL == URL_FORM_REFRESH )
- nFeatureId = SID_FM_REFRESH;
- else if ( _rCompleteURL == URL_FORM_REFRESH_CURRENT_CONTROL )
- nFeatureId = SID_FM_REFRESH_FORM_CONTROL;
- else if ( _rCompleteURL == URL_FORM_SORT_UP )
- nFeatureId = SID_FM_SORTUP;
- else if ( _rCompleteURL == URL_FORM_SORT_DOWN )
- nFeatureId = SID_FM_SORTDOWN;
- else if ( _rCompleteURL == URL_FORM_SORT )
- nFeatureId = SID_FM_ORDERCRIT;
- else if ( _rCompleteURL == URL_FORM_AUTO_FILTER )
- nFeatureId = SID_FM_AUTOFILTER;
- else if ( _rCompleteURL == URL_FORM_FILTER )
- nFeatureId = SID_FM_FILTERCRIT;
- else if ( _rCompleteURL == URL_FORM_APPLY_FILTER )
- nFeatureId = SID_FM_FORM_FILTERED;
- else if ( _rCompleteURL == URL_FORM_REMOVE_FILTER )
- nFeatureId = SID_FM_REMOVE_FILTER_SORT;
-
- DBG_ASSERT( ( -1 == nFeatureId ) || _rCompleteURL.equalsAscii( getFeatureURLAscii( nFeatureId ) ),
- "OFormNavigationMapper::getFeatureId: inconsistent maps!" );
-
- return nFeatureId;
+ const FeatureURL* pFeatures = lcl_getFeatureTable();
+ while ( pFeatures->pAsciiURL )
+ {
+ if ( _rCompleteURL.compareToAscii( pFeatures->pAsciiURL ) == 0 )
+ return pFeatures->nFormFeature;
+ ++pFeatures;
+ }
+ return -1;
}
//.........................................................................
diff --git a/forms/source/helper/makefile.mk b/forms/source/helper/makefile.mk
index 5739d1fcb6d0..e451048dd0de 100644
--- a/forms/source/helper/makefile.mk
+++ b/forms/source/helper/makefile.mk
@@ -53,6 +53,8 @@ SLOFILES= $(SLO)$/formnavigation.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/windowstateguard.obj \
$(SLO)$/resettable.obj \
+ $(SLO)$/commandimageprovider.obj \
+ $(SLO)$/commanddescriptionprovider.obj \
# --- Targets ----------------------------------
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx
index 05c8ad587902..2cc91945ae3d 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -31,61 +31,61 @@
#ifndef _FORMS_FORMCOMPONENT_HXX_
#define _FORMS_FORMCOMPONENT_HXX_
-#include "cloneable.hxx"
-#include "ids.hxx"
-#include "property.hrc"
-#include "property.hxx"
-#include "propertybaghelper.hxx"
+#include "cloneable.hxx"
+#include "ids.hxx"
+#include "property.hrc"
+#include "property.hxx"
+#include "propertybaghelper.hxx"
#include "resettable.hxx"
-#include "services.hxx"
-#include "windowstateguard.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/beans/XPropertyAccess.hpp>
-#include <com/sun/star/beans/XPropertyContainer.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/form/binding/XBindableValue.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
-#include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
-#include <com/sun/star/form/XBoundComponent.hpp>
-#include <com/sun/star/form/XBoundControl.hpp>
-#include <com/sun/star/form/XFormComponent.hpp>
-#include <com/sun/star/form/XLoadListener.hpp>
-#include <com/sun/star/form/XReset.hpp>
-#include <com/sun/star/io/XMarkableStream.hpp>
-#include <com/sun/star/io/XPersistObject.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/sdb/XColumn.hpp>
-#include <com/sun/star/sdb/XColumnUpdate.hpp>
-#include <com/sun/star/sdb/XRowSetChangeListener.hpp>
-#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/uno/XAggregation.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
+#include "services.hxx"
+#include "windowstateguard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
+#include <com/sun/star/form/validation/XValidityConstraintListener.hpp>
+#include <com/sun/star/form/XBoundComponent.hpp>
+#include <com/sun/star/form/XBoundControl.hpp>
+#include <com/sun/star/form/XFormComponent.hpp>
+#include <com/sun/star/form/XLoadListener.hpp>
+#include <com/sun/star/form/XReset.hpp>
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/sdb/XRowSetChangeListener.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/form/XLoadable.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/propagg.hxx>
-#include <comphelper/propertybag.hxx>
-#include <comphelper/propmultiplex.hxx>
-#include <comphelper/sequence.hxx>
-#include <comphelper/uno3.hxx>
-#include <cppuhelper/component.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase4.hxx>
-#include <cppuhelper/implbase7.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/ustring.hxx>
+#include <com/sun/star/form/XLoadable.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/propertybag.hxx>
+#include <comphelper/propmultiplex.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/component.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/ustring.hxx>
#include <memory>
diff --git a/forms/source/inc/commanddescriptionprovider.hxx b/forms/source/inc/commanddescriptionprovider.hxx
new file mode 100644
index 000000000000..64d28e2aabdc
--- /dev/null
+++ b/forms/source/inc/commanddescriptionprovider.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef COMMANDDESCRIPTIONPROVIDER_HXX
+#define COMMANDDESCRIPTIONPROVIDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ //====================================================================
+ //= ICommandDescriptionProvider
+ //====================================================================
+ class SAL_NO_VTABLE ICommandDescriptionProvider
+ {
+ public:
+ virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const = 0;
+
+ virtual ~ICommandDescriptionProvider() { }
+ };
+
+ typedef ::boost::shared_ptr< const ICommandDescriptionProvider > PCommandDescriptionProvider;
+
+ //=====================================================================
+ //= factory
+ //=====================================================================
+ PCommandDescriptionProvider
+ createDocumentCommandDescriptionProvider(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+//........................................................................
+} // namespace frm
+//........................................................................
+
+#endif // COMMANDDESCRIPTIONPROVIDER_HXX
diff --git a/forms/source/inc/commandimageprovider.hxx b/forms/source/inc/commandimageprovider.hxx
new file mode 100644
index 000000000000..7bbb719e410d
--- /dev/null
+++ b/forms/source/inc/commandimageprovider.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef COMMANDIMAGEPROVIDER_HXX
+#define COMMANDIMAGEPROVIDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XModel.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <vcl/image.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace frm
+{
+//........................................................................
+
+ //=====================================================================
+ //= ICommandImageProvider
+ //=====================================================================
+ typedef ::rtl::OUString CommandURL;
+ typedef ::com::sun::star::uno::Sequence< CommandURL > CommandURLs;
+ typedef ::std::vector< Image > CommandImages;
+
+ class SAL_NO_VTABLE ICommandImageProvider
+ {
+ public:
+ virtual CommandImages getCommandImages(
+ const CommandURLs& _rCommandURLs,
+ const bool _bLarge,
+ const bool _bHiContrast
+ ) const = 0;
+
+ virtual ~ICommandImageProvider() { }
+ };
+
+ typedef ::boost::shared_ptr< const ICommandImageProvider > PCommandImageProvider;
+
+ //=====================================================================
+ //= factory
+ //=====================================================================
+ PCommandImageProvider
+ createDocumentCommandImageProvider(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument
+ );
+
+//........................................................................
+} // namespace frm
+//........................................................................
+
+#endif // COMMANDIMAGEPROVIDER_HXX
diff --git a/forms/source/inc/featuredispatcher.hxx b/forms/source/inc/featuredispatcher.hxx
index 27fe022cd0b7..daf6a33eb5ba 100644
--- a/forms/source/inc/featuredispatcher.hxx
+++ b/forms/source/inc/featuredispatcher.hxx
@@ -49,7 +49,7 @@ namespace frm
@param _nFeatureId
the id of the feature to dispatch
*/
- virtual void dispatch( sal_Int32 _nFeatureId ) const = 0;
+ virtual void dispatch( sal_Int16 _nFeatureId ) const = 0;
/** dispatches a feature, with an additional named parameter
@@ -63,14 +63,14 @@ namespace frm
the value of the parameter of the dispatch call
*/
virtual void dispatchWithArgument(
- sal_Int32 _nFeatureId,
+ sal_Int16 _nFeatureId,
const sal_Char* _pParamName,
const ::com::sun::star::uno::Any& _rParamValue
) const = 0;
/** checks whether a given feature is enabled
*/
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const = 0;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const = 0;
/** returns the boolean state of a feature
@@ -81,7 +81,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
boolean information associated with it.
*/
- virtual bool getBooleanState( sal_Int32 _nFeatureId ) const = 0;
+ virtual bool getBooleanState( sal_Int16 _nFeatureId ) const = 0;
/** returns the string state of a feature
@@ -92,7 +92,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
string information associated with it.
*/
- virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const = 0;
+ virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const = 0;
/** returns the integer state of a feature
@@ -103,7 +103,7 @@ namespace frm
This method allows retrieving status information about features which have an additional
integer information associated with it.
*/
- virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const = 0;
+ virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const = 0;
};
//.........................................................................
diff --git a/forms/source/inc/formnavigation.hxx b/forms/source/inc/formnavigation.hxx
index be0512eb0583..05c976dac11a 100644
--- a/forms/source/inc/formnavigation.hxx
+++ b/forms/source/inc/formnavigation.hxx
@@ -71,7 +71,7 @@ namespace frm
FeatureInfo() : bCachedState( sal_False ) { }
};
- typedef ::std::map< sal_Int32, FeatureInfo > FeatureMap;
+ typedef ::std::map< sal_Int16, FeatureInfo > FeatureMap;
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
@@ -106,12 +106,12 @@ namespace frm
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
// IFeatureDispatcher
- virtual void dispatch( sal_Int32 _nFeatureId ) const;
- virtual void dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
- virtual bool getBooleanState( sal_Int32 _nFeatureId ) const;
- virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const;
- virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const;
+ virtual void dispatch( sal_Int16 _nFeatureId ) const;
+ virtual void dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
+ virtual bool getBooleanState( sal_Int16 _nFeatureId ) const;
+ virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const;
+ virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const;
// own overridables
/** is called when the interceptors have.
@@ -134,7 +134,7 @@ namespace frm
determines if the features is enabled or disabled
@see getBooleanState
*/
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
/** notification for (potential) changes in the state of all features
<p>The base class implementation does nothing. Derived classes could force
@@ -149,7 +149,7 @@ namespace frm
the array of features to support. Out parameter to fill by the derivee's implementation
@pure
*/
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ) = 0;
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) = 0;
protected:
/** update all our dispatches which are controlled by our dispatch interceptors
@@ -205,7 +205,7 @@ namespace frm
@complexity O(log n)
@return NULL if the given id is not a known feature id (which is a valid usage)
*/
- const char* getFeatureURLAscii( sal_Int32 _nFeatureId );
+ const char* getFeatureURLAscii( sal_Int16 _nFeatureId );
/** retrieves the feature URL belonging to an feature id
@@ -214,7 +214,7 @@ namespace frm
<TRUE/> if and only if the given id is a known feature id
(which is a valid usage)
*/
- bool getFeatureURL( sal_Int32 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL );
+ bool getFeatureURL( sal_Int16 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL );
/** retrieves the feature id belonging to an feature URL
@@ -223,7 +223,7 @@ namespace frm
the id of the feature URL, or -1 if the URl is not known
(which is a valid usage)
*/
- sal_Int32 getFeatureId( const ::rtl::OUString& _rCompleteURL );
+ sal_Int16 getFeatureId( const ::rtl::OUString& _rCompleteURL );
private:
OFormNavigationMapper( ); // never implemented
diff --git a/forms/source/inc/frm_resource.hrc b/forms/source/inc/frm_resource.hrc
index b446914fd114..c25ca4f2b6e4 100644
--- a/forms/source/inc/frm_resource.hrc
+++ b/forms/source/inc/frm_resource.hrc
@@ -32,7 +32,7 @@
#define _FRM_RESOURCE_HRC_
#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#endif
//------------------------------------------------------------------------------
diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx
index bf2d5d4d7446..8dd23dacb77f 100644
--- a/forms/source/inc/frm_strings.hxx
+++ b/forms/source/inc/frm_strings.hxx
@@ -153,7 +153,7 @@ namespace frm
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection" );
FORMS_CONSTASCII_STRING( PROPERTY_MULTISELECTION, "MultiSelection" );
FORMS_CONSTASCII_STRING( PROPERTY_ALIGN, "Align" );
- FORMS_CONSTASCII_STRING( PROPERTY_VERTICALALIGN, "VerticalAlign" );
+ FORMS_CONSTASCII_STRING( PROPERTY_VERTICAL_ALIGN, "VerticalAlign" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_DATE, "DefaultDate" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_TIME, "DefaultTime" );
FORMS_CONSTASCII_STRING( PROPERTY_DEFAULT_VALUE, "DefaultValue" );
diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc
index df94d1575a5a..624e4c2f1ce0 100644
--- a/forms/source/inc/property.hrc
+++ b/forms/source/inc/property.hrc
@@ -63,7 +63,7 @@ namespace frm
#define PROPERTY_ID_INPUT_REQUIRED (PROPERTY_ID_START + 19)
#define PROPERTY_ID_WRITING_MODE (PROPERTY_ID_START + 20)
#define PROPERTY_ID_CONTEXT_WRITING_MODE (PROPERTY_ID_START + 21)
- // free
+#define PROPERTY_ID_VERTICAL_ALIGN (PROPERTY_ID_START + 22)
// free
// free
// free
diff --git a/forms/source/resource/frm_resource.cxx b/forms/source/resource/frm_resource.cxx
index aa2df00e28c5..b3369b865475 100644
--- a/forms/source/resource/frm_resource.cxx
+++ b/forms/source/resource/frm_resource.cxx
@@ -39,7 +39,7 @@
//---------------------------------------------------
#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#endif
//.........................................................................
diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx b/forms/source/richtext/parametrizedattributedispatcher.cxx
index 68a3660d65e1..9f6c4c15ed68 100644
--- a/forms/source/richtext/parametrizedattributedispatcher.cxx
+++ b/forms/source/richtext/parametrizedattributedispatcher.cxx
@@ -32,8 +32,8 @@
#include "precompiled_forms.hxx"
#include "parametrizedattributedispatcher.hxx"
#include <svx/editview.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index 43f784f2219c..9150eac63e17 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -46,13 +46,15 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/PosSize.hpp>
/** === end UNO includes === **/
+
+#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
#include <svx/svxids.hrc>
#include <svx/editview.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#include <sfx2/msgpool.hxx>
//--------------------------------------------------------------------------
@@ -400,6 +402,33 @@ namespace frm
}
//--------------------------------------------------------------------
+ void SAL_CALL ORichTextPeer::draw( sal_Int32 _nX, sal_Int32 _nY ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ RichTextControl* pControl = static_cast< RichTextControl* >( GetWindow() );
+ if ( !pControl )
+ return;
+
+ OutputDevice* pTargetDevice = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ OSL_ENSURE( pTargetDevice != NULL, "ORichTextPeer::draw: no graphics -> no drawing!" );
+ if ( !pTargetDevice )
+ return;
+
+ ::Size aSize = pControl->GetSizePixel();
+ const MapUnit eTargetUnit = pTargetDevice->GetMapMode().GetMapUnit();
+ if ( eTargetUnit != MAP_PIXEL )
+ aSize = pControl->PixelToLogic( aSize, eTargetUnit );
+
+ ::Point aPos( _nX, _nY );
+ // the XView::draw API talks about pixels, always ...
+ if ( eTargetUnit != MAP_PIXEL )
+ aPos = pTargetDevice->PixelToLogic( aPos );
+
+ pControl->Draw( pTargetDevice, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+
+ //--------------------------------------------------------------------
void SAL_CALL ORichTextPeer::setProperty( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw (RuntimeException)
{
if ( !GetWindow() )
diff --git a/forms/source/richtext/richtextcontrol.hxx b/forms/source/richtext/richtextcontrol.hxx
index 5775e2626d2d..eecff6527eea 100644
--- a/forms/source/richtext/richtextcontrol.hxx
+++ b/forms/source/richtext/richtextcontrol.hxx
@@ -135,6 +135,9 @@ namespace frm
ORichTextPeer();
~ORichTextPeer();
+ // XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
// XVclWindowPeer
virtual void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/forms/source/richtext/richtextengine.cxx b/forms/source/richtext/richtextengine.cxx
index b13a6eebc94b..b87d6260b723 100644
--- a/forms/source/richtext/richtextengine.cxx
+++ b/forms/source/richtext/richtextengine.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
#include "richtextengine.hxx"
-#include <svtools/itempool.hxx>
+#include <svl/itempool.hxx>
#include <svx/eeitem.hxx>
#include <svx/editobj.hxx>
#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
@@ -44,8 +44,8 @@
#include <vcl/mapunit.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
-#include <svtools/lingucfg.hxx>
-#include <svtools/undo.hxx>
+#include <unotools/lingucfg.hxx>
+#include <svl/undo.hxx>
#include <vos/mutex.hxx>
#include <algorithm>
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index bcfb0fc2ad35..259197ac71d1 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -43,8 +43,8 @@
#include <svx/scripttypeitem.hxx>
#include <svx/editobj.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
#include <vcl/mapunit.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
@@ -605,21 +605,32 @@ namespace frm
_pDev->SetMapMode( aNormalizedMapMode );
// translate coordinates
- Point aPos( OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode ) );
- Size aSize( OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode ) );
+ Point aPos( _rPos );
+ Size aSize( _rSize );
+ if ( aOriginalMapMode.GetMapUnit() == MAP_PIXEL )
+ {
+ aPos = _pDev->PixelToLogic( _rPos, aNormalizedMapMode );
+ aSize = _pDev->PixelToLogic( _rSize, aNormalizedMapMode );
+ }
+ else
+ {
+ aPos = OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode );
+ aSize = OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode );
+ }
Rectangle aPlayground( aPos, aSize );
Size aOnePixel( _pDev->PixelToLogic( Size( 1, 1 ) ) );
+ aPlayground.Right() -= aOnePixel.Width();
+ aPlayground.Bottom() -= aOnePixel.Height();
// background
_pDev->SetLineColor();
- _pDev->DrawRect( Rectangle( aPlayground.TopLeft(), m_pEngine->GetPaperSize()) );
+ _pDev->DrawRect( aPlayground );
- // possibly with border
+ // do we need to draw a border?
bool bBorder = ( m_pAntiImpl->GetStyle() & WB_BORDER );
if ( bBorder )
- // let's draw a border
- _pDev->SetLineColor( COL_BLACK );
+ _pDev->SetLineColor( m_pAntiImpl->GetSettings().GetStyleSettings().GetMonoColor() );
else
_pDev->SetLineColor();
_pDev->SetFillColor( m_pAntiImpl->GetBackground().GetColor() );
@@ -632,7 +643,9 @@ namespace frm
// leave a space of one pixel between the "surroundings" of the control
// and the content
lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
+ lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
+ // actually draw the content
m_pEngine->Draw( _pDev, aPlayground, Point(), TRUE );
_pDev->Pop();
diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx
index d38b350ada32..067512d3c659 100644
--- a/forms/source/richtext/richtextmodel.cxx
+++ b/forms/source/richtext/richtextmodel.cxx
@@ -40,7 +40,9 @@
/** === begin UNO includes === **/
#include <com/sun/star/awt/LineEndFormat.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
/** === end UNO includes === **/
+
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/guarding.hxx>
#include <toolkit/awt/vclxdevice.hxx>
@@ -67,6 +69,7 @@ namespace frm
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::form;
using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::style;
namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
@@ -120,6 +123,7 @@ namespace frm
m_aTabStop = _pOriginal->m_aTabStop;
m_aBackgroundColor = _pOriginal->m_aBackgroundColor;
m_aBorderColor = _pOriginal->m_aBorderColor;
+ m_aVerticalAlignment = _pOriginal->m_aVerticalAlignment;
m_sDefaultControl = _pOriginal->m_sDefaultControl;
m_sHelpText = _pOriginal->m_sHelpText;
m_sHelpURL = _pOriginal->m_sHelpURL;
@@ -201,9 +205,10 @@ namespace frm
REGISTER_PROP_2( RICH_TEXT, m_bReallyActAsRichText, BOUND, MAYBEDEFAULT );
REGISTER_PROP_2( HIDEINACTIVESELECTION, m_bHideInactiveSelection, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( TABSTOP, m_aTabStop, sal_Bool, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32, BOUND, MAYBEDEFAULT );
- REGISTER_VOID_PROP_2( BORDERCOLOR, m_aBorderColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( TABSTOP, m_aTabStop, sal_Bool, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( BORDERCOLOR, m_aBorderColor, sal_Int32, BOUND, MAYBEDEFAULT );
+ REGISTER_VOID_PROP_2( VERTICAL_ALIGN, m_aVerticalAlignment, VerticalAlignment, BOUND, MAYBEDEFAULT );
// properties which exist only for compatibility with the css.swt.UnoControlEditModel,
// since we replace the default implementation for this service
@@ -455,6 +460,7 @@ namespace frm
case PROPERTY_ID_TABSTOP:
case PROPERTY_ID_BACKGROUNDCOLOR:
case PROPERTY_ID_BORDERCOLOR:
+ case PROPERTY_ID_VERTICAL_ALIGN:
/* void */
break;
diff --git a/forms/source/richtext/richtextmodel.hxx b/forms/source/richtext/richtextmodel.hxx
index 5e905e2873ad..5cdfe56f0dea 100644
--- a/forms/source/richtext/richtextmodel.hxx
+++ b/forms/source/richtext/richtextmodel.hxx
@@ -74,6 +74,7 @@ namespace frm
::com::sun::star::uno::Any m_aTabStop;
::com::sun::star::uno::Any m_aBackgroundColor;
::com::sun::star::uno::Any m_aBorderColor;
+ ::com::sun::star::uno::Any m_aVerticalAlignment;
::rtl::OUString m_sDefaultControl;
::rtl::OUString m_sHelpText;
::rtl::OUString m_sHelpURL;
@@ -115,7 +116,7 @@ namespace frm
DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel );
// UNO
- DECLARE_UNO3_AGG_DEFAULTS( ONavigationBarModel, OControlModel );
+ DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel, OControlModel );
virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx
index f3c56cc6cd88..495a85c02162 100644
--- a/forms/source/richtext/richtextvclcontrol.cxx
+++ b/forms/source/richtext/richtextvclcontrol.cxx
@@ -32,9 +32,9 @@
#include "precompiled_forms.hxx"
#include "richtextvclcontrol.hxx"
#include "richtextimplcontrol.hxx"
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/languageoptions.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/languageoptions.hxx>
#if OSL_DEBUG_LEVEL > 0
#ifndef _TOOLS_TEMPFILE_HXX
#include <tools/tempfile.hxx>
diff --git a/forms/source/richtext/richtextvclcontrol.hxx b/forms/source/richtext/richtextvclcontrol.hxx
index 778d31c3e6e1..a4f49aa2d41c 100644
--- a/forms/source/richtext/richtextvclcontrol.hxx
+++ b/forms/source/richtext/richtextvclcontrol.hxx
@@ -117,13 +117,15 @@ namespace frm
const EditView& getView() const;
EditView& getView();
+ // Window overridables
+ virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, ULONG _nFlags );
+
protected:
// Window overridables
virtual void Resize();
virtual void GetFocus();
virtual void StateChanged( StateChangedType nStateChange );
virtual long PreNotify( NotifyEvent& _rNEvt );
- virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, ULONG _nFlags );
virtual long Notify( NotifyEvent& _rNEvt );
private:
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index 8760a59bc180..d1090b82d914 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -36,8 +36,8 @@
#include <svx/svxids.hrc>
#endif
#include <svx/eeitem.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
#include <vcl/mapunit.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/outdev.hxx>
diff --git a/forms/source/richtext/rtattributes.hxx b/forms/source/richtext/rtattributes.hxx
index 3cc79ad7bef3..d5874ea566c2 100644
--- a/forms/source/richtext/rtattributes.hxx
+++ b/forms/source/richtext/rtattributes.hxx
@@ -33,7 +33,7 @@
#include <tools/solar.h>
#include <sal/types.h>
-#include <svtools/poolitem.hxx>
+#include <svl/poolitem.hxx>
//........................................................................
namespace frm
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index 5416e5d567e9..6b63d4b8a756 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -92,7 +92,7 @@ namespace frm
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::sdbc::XRowSet;
using ::com::sun::star::sdbc::XResultSetUpdate;
- using ::com::sun::star::form::XFormController;
+ using ::com::sun::star::form::runtime::XFormController;
using ::com::sun::star::form::runtime::XFeatureInvalidation;
using ::com::sun::star::form::runtime::FeatureState;
using ::com::sun::star::lang::IllegalArgumentException;
diff --git a/forms/source/runtime/formoperations.hxx b/forms/source/runtime/formoperations.hxx
index 211d0be60fd4..3d5eb8fa17ce 100644
--- a/forms/source/runtime/formoperations.hxx
+++ b/forms/source/runtime/formoperations.hxx
@@ -71,16 +71,16 @@ namespace frm
class MethodGuard;
private:
- ::comphelper::ComponentContext m_aContext;
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xController;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xCursor;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > m_xUpdateCursor;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCursorProperties;
- ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xLoadableForm;
+ ::comphelper::ComponentContext m_aContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > m_xUpdateCursor;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xCursorProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xLoadableForm;
::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation >
- m_xFeatureInvalidation;
+ m_xFeatureInvalidation;
mutable ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
- m_xParser;
+ m_xParser;
bool m_bInitializedParser;
bool m_bActiveControlModified;
@@ -132,7 +132,7 @@ namespace frm
// XFormOperations
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > SAL_CALL getCursor() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate > SAL_CALL getUpdateCursor() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > SAL_CALL getController() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getController() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation > SAL_CALL getFeatureInvalidation() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFeatureInvalidation(const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFeatureInvalidation > & the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::form::runtime::FeatureState SAL_CALL getState(::sal_Int16 Feature) throw (::com::sun::star::uno::RuntimeException);
@@ -163,7 +163,7 @@ namespace frm
private:
// service constructors
- void createWithFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController >& _rxController );
+ void createWithFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& _rxController );
void createWithForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm );
/** determines whether or not we're already disposed
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index 88995b49f4a8..eb975910a5da 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -34,17 +34,23 @@
#include "navbarcontrol.hxx"
#include "frm_strings.hxx"
#include "frm_module.hxx"
-#include "navtoolbar.hxx"
#include "FormComponent.hxx"
+#include "componenttools.hxx"
+#include "navtoolbar.hxx"
+#include "commandimageprovider.hxx"
+#include "commanddescriptionprovider.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/awt/XView.hpp>
#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
/** === end UNO includes === **/
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
-#include <svx/svxids.hrc>
//--------------------------------------------------------------------------
extern "C" void SAL_CALL createRegistryInfo_ONavigationBarControl()
@@ -62,6 +68,8 @@ namespace frm
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
+ using namespace ::com::sun::star::graphic;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
#define FORWARD_TO_PEER_1( unoInterface, method, param1 ) \
Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
@@ -129,7 +137,8 @@ namespace frm
//------------------------------------------------------------------
namespace
{
- static WinBits getWinBits( const Reference< XControlModel >& _rxModel )
+ //..............................................................
+ static WinBits lcl_getWinBits_nothrow( const Reference< XControlModel >& _rxModel )
{
WinBits nBits = 0;
try
@@ -149,7 +158,7 @@ namespace frm
}
catch( const Exception& )
{
- DBG_ERROR( "::getWinBits: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
return nBits;
}
@@ -175,7 +184,7 @@ namespace frm
}
// create the peer
- ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( m_xORB, pParentWin, getWinBits( getModel() ) );
+ ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( m_xORB, pParentWin, getModel() );
DBG_ASSERT( pPeer, "ONavigationBarControl::createPeer: invalid peer returned!" );
if ( pPeer )
// by definition, the returned component is aquired once
@@ -267,7 +276,7 @@ namespace frm
DBG_NAME( ONavigationBarPeer )
//------------------------------------------------------------------
ONavigationBarPeer* ONavigationBarPeer::Create( const Reference< XMultiServiceFactory >& _rxORB,
- Window* _pParentWindow, WinBits _nStyle )
+ Window* _pParentWindow, const Reference< XControlModel >& _rxModel )
{
DBG_TESTSOLARMUTEX();
@@ -276,7 +285,13 @@ namespace frm
pPeer->acquire(); // by definition, the returned object is aquired once
// the VCL control for the peer
- NavigationToolBar* pNavBar = new NavigationToolBar( _pParentWindow, _nStyle );
+ Reference< XModel > xContextDocument( getXModel( _rxModel ) );
+ NavigationToolBar* pNavBar = new NavigationToolBar(
+ _pParentWindow,
+ lcl_getWinBits_nothrow( _rxModel ),
+ createDocumentCommandImageProvider( _rxORB, xContextDocument ),
+ createDocumentCommandDescriptionProvider( _rxORB, xContextDocument )
+ );
// some knittings
pNavBar->setDispatcher( pPeer );
@@ -456,7 +471,7 @@ namespace frm
}
//------------------------------------------------------------------
- void ONavigationBarPeer::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled )
+ void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled )
{
// enable this button on the toolbox
NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
@@ -465,15 +480,15 @@ namespace frm
pNavBar->enableFeature( _nFeatureId, _bEnabled );
// is it a feature with additional state information?
- if ( _nFeatureId == SID_FM_FORM_FILTERED )
+ if ( _nFeatureId == FormFeature::ToggleApplyFilter )
{ // additional boolean state
pNavBar->checkFeature( _nFeatureId, getBooleanState( _nFeatureId ) );
}
- else if ( _nFeatureId == SID_FM_RECORD_TOTAL )
+ else if ( _nFeatureId == FormFeature::TotalRecords )
{
pNavBar->setFeatureText( _nFeatureId, getStringState( _nFeatureId ) );
}
- else if ( _nFeatureId == SID_FM_RECORD_ABSOLUTE )
+ else if ( _nFeatureId == FormFeature::MoveAbsolute )
{
pNavBar->setFeatureText( _nFeatureId, String::CreateFromInt32( getIntegerState( _nFeatureId ) ) );
}
@@ -496,7 +511,7 @@ namespace frm
}
//------------------------------------------------------------------
- bool ONavigationBarPeer::isEnabled( sal_Int32 _nFeatureId ) const
+ bool ONavigationBarPeer::isEnabled( sal_Int16 _nFeatureId ) const
{
if ( const_cast< ONavigationBarPeer* >( this )->isDesignMode() )
return false;
@@ -524,27 +539,27 @@ namespace frm
}
//------------------------------------------------------------------
- void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int32 >& _rFeatureIds )
+ void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int16 >& _rFeatureIds )
{
- _rFeatureIds.push_back( SID_FM_RECORD_ABSOLUTE );
- _rFeatureIds.push_back( SID_FM_RECORD_TOTAL );
- _rFeatureIds.push_back( SID_FM_RECORD_FIRST );
- _rFeatureIds.push_back( SID_FM_RECORD_PREV );
- _rFeatureIds.push_back( SID_FM_RECORD_NEXT );
- _rFeatureIds.push_back( SID_FM_RECORD_LAST );
- _rFeatureIds.push_back( SID_FM_RECORD_SAVE );
- _rFeatureIds.push_back( SID_FM_RECORD_UNDO );
- _rFeatureIds.push_back( SID_FM_RECORD_NEW );
- _rFeatureIds.push_back( SID_FM_RECORD_DELETE );
- _rFeatureIds.push_back( SID_FM_REFRESH );
- _rFeatureIds.push_back( SID_FM_REFRESH_FORM_CONTROL );
- _rFeatureIds.push_back( SID_FM_SORTUP );
- _rFeatureIds.push_back( SID_FM_SORTDOWN );
- _rFeatureIds.push_back( SID_FM_ORDERCRIT );
- _rFeatureIds.push_back( SID_FM_AUTOFILTER );
- _rFeatureIds.push_back( SID_FM_FILTERCRIT );
- _rFeatureIds.push_back( SID_FM_FORM_FILTERED );
- _rFeatureIds.push_back( SID_FM_REMOVE_FILTER_SORT );
+ _rFeatureIds.push_back( FormFeature::MoveAbsolute );
+ _rFeatureIds.push_back( FormFeature::TotalRecords );
+ _rFeatureIds.push_back( FormFeature::MoveToFirst );
+ _rFeatureIds.push_back( FormFeature::MoveToPrevious );
+ _rFeatureIds.push_back( FormFeature::MoveToNext );
+ _rFeatureIds.push_back( FormFeature::MoveToLast );
+ _rFeatureIds.push_back( FormFeature::SaveRecordChanges );
+ _rFeatureIds.push_back( FormFeature::UndoRecordChanges );
+ _rFeatureIds.push_back( FormFeature::MoveToInsertRow );
+ _rFeatureIds.push_back( FormFeature::DeleteRecord );
+ _rFeatureIds.push_back( FormFeature::ReloadForm );
+ _rFeatureIds.push_back( FormFeature::RefreshCurrentControl );
+ _rFeatureIds.push_back( FormFeature::SortAscending );
+ _rFeatureIds.push_back( FormFeature::SortDescending );
+ _rFeatureIds.push_back( FormFeature::InteractiveSort );
+ _rFeatureIds.push_back( FormFeature::AutoFilter );
+ _rFeatureIds.push_back( FormFeature::InteractiveFilter );
+ _rFeatureIds.push_back( FormFeature::ToggleApplyFilter );
+ _rFeatureIds.push_back( FormFeature::RemoveFilterAndSort );
}
//.........................................................................
diff --git a/forms/source/solar/component/navbarcontrol.hxx b/forms/source/solar/component/navbarcontrol.hxx
index 0c3f76f315ed..62d44774d0b3 100644
--- a/forms/source/solar/component/navbarcontrol.hxx
+++ b/forms/source/solar/component/navbarcontrol.hxx
@@ -31,14 +31,18 @@
#ifndef FORMS_NAVBARCONTROL_HXX
#define FORMS_NAVBARCONTROL_HXX
+#include "formnavigation.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+/** === end UNO includes === **/
+
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase1.hxx>
#include <vcl/wintypes.hxx>
-#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
-#include <com/sun/star/frame/XStatusListener.hpp>
-#include "formnavigation.hxx"
//.........................................................................
namespace frm
@@ -111,11 +115,13 @@ namespace frm
static ONavigationBarPeer* Create(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
Window* _pParentWindow,
- WinBits _nStyle
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel
);
protected:
- ONavigationBarPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
+ ONavigationBarPeer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
~ONavigationBarPeer();
public:
@@ -144,12 +150,12 @@ namespace frm
// OFormNavigationHelper overriables
virtual void interceptorsChanged( );
- virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled );
+ virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled );
virtual void allFeatureStatesChanged( );
- virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds );
+ virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds );
// IFeatureDispatcher overriables
- virtual bool isEnabled( sal_Int32 _nFeatureId ) const;
+ virtual bool isEnabled( sal_Int16 _nFeatureId ) const;
};
//.........................................................................
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 37b9faf8a5f4..58f22f0c95e4 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -30,39 +30,41 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_forms.hxx"
+
#include "navtoolbar.hxx"
#include "frm_resource.hxx"
-#ifndef _FRM_RESOURCE_HRC_
-#include "frm_resource.hrc"
-#endif
-#include <vcl/fixed.hxx>
-#ifndef _SVX_SVXIDS_HRC
-#include <svx/svxids.hrc>
-#endif
-#include <sfx2/msgpool.hxx>
-#include <sfx2/imgmgr.hxx>
#include "featuredispatcher.hxx"
+#include "frm_resource.hrc"
+#include "commandimageprovider.hxx"
+#include "commanddescriptionprovider.hxx"
+
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/form/runtime/FormFeature.hpp>
+
+#include <sfx2/imgmgr.hxx>
+#include <vcl/fixed.hxx>
#include <memory>
-#define LID_RECORD_LABEL 1
-#define LID_RECORD_FILLER 2
+#define LID_RECORD_LABEL 1000
+#define LID_RECORD_FILLER 1001
//.........................................................................
namespace frm
{
//.........................................................................
+ using ::com::sun::star::uno::makeAny;
+ namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
+
//=====================================================================
//.....................................................................
namespace
{
- static bool isSfxSlot( sal_Int32 _nFeatureId )
+ static bool isArtificialItem( sal_Int16 _nFeatureId )
{
- // everything we use in this class is an SFX-slot - except the LID_* ids
- return ( _nFeatureId != LID_RECORD_LABEL )
- && ( _nFeatureId != LID_RECORD_FILLER );
+ return ( _nFeatureId == LID_RECORD_LABEL )
+ || ( _nFeatureId == LID_RECORD_FILLER );
}
static String getLabelString( USHORT _nResId )
@@ -72,9 +74,37 @@ namespace frm
sLabel += String::CreateFromAscii( " " );
return sLabel;
}
- static bool lcl_isHighContrast( const Color& _rColor )
+
+ ::rtl::OUString lcl_getCommandURL( const sal_Int16 _nFormFeature )
{
- return _rColor.IsDark();
+ const sal_Char* pAsciiCommandName = NULL;
+ switch ( _nFormFeature )
+ {
+ case FormFeature::MoveAbsolute : pAsciiCommandName = "AbsoluteRecord"; break;
+ case FormFeature::TotalRecords : pAsciiCommandName = "RecTotal"; break;
+ case FormFeature::MoveToFirst : pAsciiCommandName = "FirstRecord"; break;
+ case FormFeature::MoveToPrevious : pAsciiCommandName = "PrevRecord"; break;
+ case FormFeature::MoveToNext : pAsciiCommandName = "NextRecord"; break;
+ case FormFeature::MoveToLast : pAsciiCommandName = "LastRecord"; break;
+ case FormFeature::SaveRecordChanges : pAsciiCommandName = "RecSave"; break;
+ case FormFeature::UndoRecordChanges : pAsciiCommandName = "RecUndo"; break;
+ case FormFeature::MoveToInsertRow : pAsciiCommandName = "NewRecord"; break;
+ case FormFeature::DeleteRecord : pAsciiCommandName = "DeleteRecord"; break;
+ case FormFeature::ReloadForm : pAsciiCommandName = "Refresh"; break;
+ case FormFeature::RefreshCurrentControl : pAsciiCommandName = "RefreshFormControl"; break;
+ case FormFeature::SortAscending : pAsciiCommandName = "Sortup"; break;
+ case FormFeature::SortDescending : pAsciiCommandName = "SortDown"; break;
+ case FormFeature::InteractiveSort : pAsciiCommandName = "OrderCrit"; break;
+ case FormFeature::AutoFilter : pAsciiCommandName = "AutoFilter"; break;
+ case FormFeature::InteractiveFilter : pAsciiCommandName = "FilterCrit"; break;
+ case FormFeature::ToggleApplyFilter : pAsciiCommandName = "FormFiltered"; break;
+ case FormFeature::RemoveFilterAndSort : pAsciiCommandName = "RemoveFilterSort"; break;
+ }
+ if ( pAsciiCommandName != NULL )
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) ) + ::rtl::OUString::createFromAscii( pAsciiCommandName );
+
+ OSL_ENSURE( false, "lcl_getCommandURL: unknown FormFeature!" );
+ return ::rtl::OUString();
}
}
@@ -123,9 +153,12 @@ namespace frm
//=====================================================================
DBG_NAME( NavigationToolBar )
//---------------------------------------------------------------------
- NavigationToolBar::NavigationToolBar( Window* _pParent, WinBits _nStyle )
+ NavigationToolBar::NavigationToolBar( Window* _pParent, WinBits _nStyle, const PCommandImageProvider& _pImageProvider,
+ const PCommandDescriptionProvider& _pDescriptionProvider )
:Window( _pParent, _nStyle )
,m_pDispatcher( NULL )
+ ,m_pImageProvider( _pImageProvider )
+ ,m_pDescriptionProvider( _pDescriptionProvider )
,m_eImageSize( eSmall )
,m_pToolbar( NULL )
{
@@ -154,7 +187,7 @@ namespace frm
m_pToolbar->setDispatcher( _pDispatcher );
- RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( SID_FM_RECORD_ABSOLUTE ) );
+ RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( FormFeature::MoveAbsolute ) );
OSL_ENSURE( pPositionWindow, "NavigationToolBar::setDispatcher: can't forward the dispatcher to the position window!" );
if ( pPositionWindow )
pPositionWindow->setDispatcher( _pDispatcher );
@@ -183,15 +216,15 @@ namespace frm
{
m_pToolbar->EnableItem( _nItemId, _bEnabled );
- if ( _nItemId == SID_FM_RECORD_ABSOLUTE )
+ if ( _nItemId == FormFeature::MoveAbsolute )
m_pToolbar->EnableItem( LID_RECORD_LABEL, _bEnabled );
- if ( _nItemId == SID_FM_RECORD_TOTAL )
+ if ( _nItemId == FormFeature::TotalRecords )
m_pToolbar->EnableItem( LID_RECORD_FILLER, _bEnabled );
}
//---------------------------------------------------------------------
- void NavigationToolBar::enableFeature( sal_Int32 _nFeatureId, bool _bEnabled )
+ void NavigationToolBar::enableFeature( sal_Int16 _nFeatureId, bool _bEnabled )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::enableFeature: invalid id!" );
@@ -200,7 +233,7 @@ namespace frm
}
//---------------------------------------------------------------------
- void NavigationToolBar::checkFeature( sal_Int32 _nFeatureId, bool _bEnabled )
+ void NavigationToolBar::checkFeature( sal_Int16 _nFeatureId, bool _bEnabled )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::checkFeature: invalid id!" );
@@ -209,7 +242,7 @@ namespace frm
}
//---------------------------------------------------------------------
- void NavigationToolBar::setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText )
+ void NavigationToolBar::setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText )
{
DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND,
"NavigationToolBar::checkFeature: invalid id!" );
@@ -232,71 +265,67 @@ namespace frm
// items. We could duplicate all the information here in our lib
// (such as the item text and the image), but why should we?
- struct SlotDescription
+ struct FeatureDescription
{
USHORT nId;
bool bRepeat;
bool bItemWindow;
- } aSupportedSlots[] =
+ } aSupportedFeatures[] =
{
- { LID_RECORD_LABEL, false, true },
- { SID_FM_RECORD_ABSOLUTE, false, true },
- { LID_RECORD_FILLER, false, true },
- { SID_FM_RECORD_TOTAL, false, true },
-
- { SID_FM_RECORD_FIRST, true, false },
- { SID_FM_RECORD_PREV, true, false },
- { SID_FM_RECORD_NEXT, true, false },
- { SID_FM_RECORD_LAST, true, false },
+ { LID_RECORD_LABEL, false, true },
+ { FormFeature::MoveAbsolute, false, true },
+ { LID_RECORD_FILLER, false, true },
+ { FormFeature::TotalRecords, false, true },
+ { FormFeature::MoveToFirst, true, false },
+ { FormFeature::MoveToPrevious, true, false },
+ { FormFeature::MoveToNext, true, false },
+ { FormFeature::MoveToLast, true, false },
+ { FormFeature::MoveToInsertRow, false, false },
{ 0, false, false },
- { SID_FM_RECORD_SAVE, false, false },
- { SID_FM_RECORD_UNDO, false, false },
- { SID_FM_RECORD_NEW, false, false },
- { SID_FM_RECORD_DELETE, false, false },
- { SID_FM_REFRESH, false, false },
- { SID_FM_REFRESH_FORM_CONTROL, false, false },
+ { FormFeature::SaveRecordChanges, false, false },
+ { FormFeature::UndoRecordChanges, false, false },
+ { FormFeature::DeleteRecord, false, false },
+ { FormFeature::ReloadForm, false, false },
+ { FormFeature::RefreshCurrentControl, false, false },
{ 0, false, false },
- { SID_FM_SORTUP, false, false },
- { SID_FM_SORTDOWN, false, false },
- { SID_FM_ORDERCRIT, false, false },
- { SID_FM_AUTOFILTER, false, false },
- { SID_FM_FILTERCRIT, false, false },
- { SID_FM_FORM_FILTERED, false, false },
- { SID_FM_REMOVE_FILTER_SORT, false, false },
+ { FormFeature::SortAscending, false, false },
+ { FormFeature::SortDescending, false, false },
+ { FormFeature::InteractiveSort, false, false },
+ { FormFeature::AutoFilter, false, false },
+ { FormFeature::InteractiveFilter, false, false },
+ { FormFeature::ToggleApplyFilter, false, false },
+ { FormFeature::RemoveFilterAndSort, false, false },
};
- size_t nSupportedSlots = sizeof( aSupportedSlots ) / sizeof( aSupportedSlots[0] );
- SlotDescription* pSupportedSlots = aSupportedSlots;
- SlotDescription* pSupportedSlotsEnd = aSupportedSlots + nSupportedSlots;
- for ( ; pSupportedSlots < pSupportedSlotsEnd; ++pSupportedSlots )
+ size_t nSupportedFeatures = sizeof( aSupportedFeatures ) / sizeof( aSupportedFeatures[0] );
+ FeatureDescription* pSupportedFeatures = aSupportedFeatures;
+ FeatureDescription* pSupportedFeaturesEnd = aSupportedFeatures + nSupportedFeatures;
+ for ( ; pSupportedFeatures < pSupportedFeaturesEnd; ++pSupportedFeatures )
{
- if ( pSupportedSlots->nId )
+ if ( pSupportedFeatures->nId )
{ // it's _not_ a separator
- // the text(s) of the item
- String sItemText;
- String sItemHelpText;
-
- // TODO/CLEANUP: this code does nothing(!) nowadays
- //SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( NULL );
- //sItemText = rSlotPool.GetSlotName( pSupportedSlots->nId, &sItemHelpText );
-
// insert the entry
- m_pToolbar->InsertItem( pSupportedSlots->nId, sItemText, pSupportedSlots->bRepeat ? TIB_REPEAT : 0 );
- m_pToolbar->SetQuickHelpText( pSupportedSlots->nId, sItemHelpText );
- if ( isSfxSlot( pSupportedSlots->nId ) )
- m_pToolbar->SetHelpId( pSupportedSlots->nId, pSupportedSlots->nId );
+ m_pToolbar->InsertItem( pSupportedFeatures->nId, String(), pSupportedFeatures->bRepeat ? TIB_REPEAT : 0 );
+ m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, String() ); // TODO
+ if ( !isArtificialItem( pSupportedFeatures->nId ) )
+ {
+ ::rtl::OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
+ m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
+ if ( m_pDescriptionProvider )
+ m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, m_pDescriptionProvider->getCommandDescription( sCommandURL ) );
+ }
- if ( pSupportedSlots->bItemWindow )
+ if ( pSupportedFeatures->bItemWindow )
{
Window* pItemWindow = NULL;
- if ( SID_FM_RECORD_ABSOLUTE == pSupportedSlots->nId )
+ if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId )
{
pItemWindow = new RecordPositionInput( m_pToolbar );
static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher );
}
- else if ( LID_RECORD_FILLER == pSupportedSlots->nId )
+ else if ( LID_RECORD_FILLER == pSupportedFeatures->nId )
{
pItemWindow = new FixedText( m_pToolbar, WB_CENTER | WB_VCENTER );
pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
@@ -309,7 +338,7 @@ namespace frm
}
m_aChildWins.push_back( pItemWindow );
- switch ( pSupportedSlots->nId )
+ switch ( pSupportedFeatures->nId )
{
case LID_RECORD_LABEL:
pItemWindow->SetText( getLabelString( RID_STR_LABEL_RECORD ) );
@@ -320,7 +349,7 @@ namespace frm
break;
}
- m_pToolbar->SetItemWindow( pSupportedSlots->nId, pItemWindow );
+ m_pToolbar->SetItemWindow( pSupportedFeatures->nId, pItemWindow );
}
}
else
@@ -331,25 +360,66 @@ namespace frm
forEachItemWindow( &NavigationToolBar::adjustItemWindowWidth, NULL );
- // the image of the item
- ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) );
- pImageManager->SetImagesForceSize( *m_pToolbar, FALSE, m_eImageSize == eLarge );
+ implUpdateImages();
+ }
+
+ //---------------------------------------------------------------------
+ void NavigationToolBar::implUpdateImages()
+ {
+ OSL_ENSURE( m_pImageProvider, "NavigationToolBar::implUpdateImages: no image provider => no images!" );
+ if ( !m_pImageProvider )
+ return;
+
+ const bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ const USHORT nItemCount = m_pToolbar->GetItemCount();
+
+ // collect the FormFeatures in the toolbar
+ typedef ::std::vector< sal_Int16 > FormFeatures;
+ FormFeatures aFormFeatures;
+ aFormFeatures.reserve( nItemCount );
+
+ for ( USHORT i=0; i<nItemCount; ++i )
+ {
+ USHORT nId = m_pToolbar->GetItemId( i );
+ if ( ( TOOLBOXITEM_BUTTON == m_pToolbar->GetItemType( i ) ) && !isArtificialItem( nId ) )
+ aFormFeatures.push_back( nId );
+ }
+
+ // translate them into command URLs
+ CommandURLs aCommandURLs( aFormFeatures.size() );
+ for ( FormFeatures::const_iterator formFeature = aFormFeatures.begin();
+ formFeature != aFormFeatures.end();
+ ++formFeature
+ )
+ {
+ aCommandURLs[ formFeature - aFormFeatures.begin() ] = lcl_getCommandURL( *formFeature );
+ }
+
+ // retrieve the images for the command URLs
+ CommandImages aCommandImages = m_pImageProvider->getCommandImages( aCommandURLs, m_eImageSize == eLarge, bIsHighContrast );
+
+ // and set them at the toolbar
+ CommandImages::const_iterator commandImage = aCommandImages.begin();
+ for ( FormFeatures::const_iterator formFeature = aFormFeatures.begin();
+ formFeature != aFormFeatures.end();
+ ++formFeature, ++commandImage
+ )
+ {
+ m_pToolbar->SetItemImage( *formFeature, *commandImage );
+ }
// parts of our layout is dependent on the size of our icons
Resize();
}
//---------------------------------------------------------------------
- void NavigationToolBar::implSetImageSize( ImageSize _eSize, bool _bForce )
+ void NavigationToolBar::implSetImageSize( ImageSize _eSize )
{
- if ( ( _eSize != m_eImageSize ) || _bForce )
+ if ( _eSize != m_eImageSize )
{
m_eImageSize = _eSize;
- ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) );
- pImageManager->SetImagesForceSize( *m_pToolbar, lcl_isHighContrast( GetBackground().GetColor() ), m_eImageSize == eLarge );
-
- // parts of our layout is dependent on the size of our icons
- Resize();
+ implUpdateImages();
}
}
@@ -369,7 +439,7 @@ namespace frm
case ePosition:
{
static const USHORT aPositionIds[] = {
- LID_RECORD_LABEL, SID_FM_RECORD_ABSOLUTE, LID_RECORD_FILLER, SID_FM_RECORD_TOTAL, 0
+ LID_RECORD_LABEL, FormFeature::MoveAbsolute, LID_RECORD_FILLER, FormFeature::TotalRecords, 0
};
pGroupIds = aPositionIds;
}
@@ -377,7 +447,7 @@ namespace frm
case eNavigation:
{
static const USHORT aNavigationIds[] = {
- SID_FM_RECORD_FIRST, SID_FM_RECORD_PREV, SID_FM_RECORD_NEXT, SID_FM_RECORD_LAST, 0
+ FormFeature::MoveToFirst, FormFeature::MoveToPrevious, FormFeature::MoveToNext, FormFeature::MoveToLast, FormFeature::MoveToInsertRow, 0
};
pGroupIds = aNavigationIds;
}
@@ -385,7 +455,7 @@ namespace frm
case eRecordActions:
{
static const USHORT aActionIds[] = {
- SID_FM_RECORD_SAVE, SID_FM_RECORD_UNDO, SID_FM_RECORD_NEW, SID_FM_RECORD_DELETE, SID_FM_REFRESH, SID_FM_REFRESH_FORM_CONTROL, 0
+ FormFeature::SaveRecordChanges, FormFeature::UndoRecordChanges, FormFeature::DeleteRecord, FormFeature::ReloadForm, FormFeature::RefreshCurrentControl, 0
};
pGroupIds = aActionIds;
}
@@ -393,7 +463,7 @@ namespace frm
case eFilterSort:
{
static const USHORT aFilterSortIds[] = {
- SID_FM_SORTUP, SID_FM_SORTDOWN, SID_FM_ORDERCRIT, SID_FM_AUTOFILTER, SID_FM_FILTERCRIT, SID_FM_FORM_FILTERED, SID_FM_REMOVE_FILTER_SORT, 0
+ FormFeature::SortAscending, FormFeature::SortDescending, FormFeature::InteractiveSort, FormFeature::AutoFilter, FormFeature::InteractiveFilter, FormFeature::ToggleApplyFilter, FormFeature::RemoveFilterAndSort, 0
};
pGroupIds = aFilterSortIds;
}
@@ -414,9 +484,9 @@ namespace frm
switch ( _eGroup )
{
case ePosition : nIndicatorItem = LID_RECORD_LABEL; break;
- case eNavigation : nIndicatorItem = SID_FM_RECORD_FIRST; break;
- case eRecordActions : nIndicatorItem = SID_FM_RECORD_SAVE; break;
- case eFilterSort : nIndicatorItem = SID_FM_SORTUP; break;
+ case eNavigation : nIndicatorItem = FormFeature::MoveToFirst; break;
+ case eRecordActions : nIndicatorItem = FormFeature::SaveRecordChanges; break;
+ case eFilterSort : nIndicatorItem = FormFeature::SortAscending; break;
default:
OSL_ENSURE( sal_False, "NavigationToolBar::IsFunctionGroupVisible: invalid group id!" );
}
@@ -481,7 +551,7 @@ namespace frm
// the contrast of the background color may have changed, so force
// the images to be rebuild (high contrast requires a possibly different
// image set)
- implSetImageSize( m_eImageSize, true );
+ implUpdateImages();
}
//---------------------------------------------------------------------
@@ -494,7 +564,7 @@ namespace frm
// the contrast of the background color may have changed, so force
// the images to be rebuild (high contrast requires a possibly different
// image set)
- implSetImageSize( m_eImageSize, true );
+ implUpdateImages();
}
//---------------------------------------------------------------------
@@ -583,11 +653,11 @@ namespace frm
sItemText = getLabelString( RID_STR_LABEL_OF );
break;
- case SID_FM_RECORD_ABSOLUTE:
+ case FormFeature::MoveAbsolute:
sItemText = String::CreateFromAscii( "12345678" );
break;
- case SID_FM_RECORD_TOTAL:
+ case FormFeature::TotalRecords:
sItemText = String::CreateFromAscii( "123456" );
break;
}
@@ -642,7 +712,7 @@ namespace frm
return;
if ( m_pDispatcher )
- m_pDispatcher->dispatchWithArgument( SID_FM_RECORD_ABSOLUTE, "Position", ::com::sun::star::uno::makeAny( (sal_Int32)nRecord ) );
+ m_pDispatcher->dispatchWithArgument( FormFeature::MoveAbsolute, "Position", makeAny( (sal_Int32)nRecord ) );
SaveValue();
}
diff --git a/forms/source/solar/inc/navtoolbar.hxx b/forms/source/solar/inc/navtoolbar.hxx
index b19c57431706..eaa3717bc4d2 100644
--- a/forms/source/solar/inc/navtoolbar.hxx
+++ b/forms/source/solar/inc/navtoolbar.hxx
@@ -34,14 +34,19 @@
#include <vcl/toolbox.hxx>
#include <vcl/field.hxx>
+#include <boost/shared_ptr.hpp>
+
//.........................................................................
namespace frm
{
//.........................................................................
class IFeatureDispatcher;
+ class ICommandImageProvider;
+ class ICommandDescriptionProvider;
class ImplNavToolBar;
+
//=====================================================================
//= NavigationToolBar
//=====================================================================
@@ -63,13 +68,22 @@ namespace frm
};
private:
- const IFeatureDispatcher* m_pDispatcher;
- ImageSize m_eImageSize;
- ImplNavToolBar* m_pToolbar;
- ::std::vector< Window* > m_aChildWins;
+ const IFeatureDispatcher* m_pDispatcher;
+ const ::boost::shared_ptr< const ICommandImageProvider >
+ m_pImageProvider;
+ const ::boost::shared_ptr< const ICommandDescriptionProvider >
+ m_pDescriptionProvider;
+ ImageSize m_eImageSize;
+ ImplNavToolBar* m_pToolbar;
+ ::std::vector< Window* > m_aChildWins;
public:
- NavigationToolBar( Window* _pParent, WinBits _nStyle );
+ NavigationToolBar(
+ Window* _pParent,
+ WinBits _nStyle,
+ const ::boost::shared_ptr< const ICommandImageProvider >& _pImageProvider,
+ const ::boost::shared_ptr< const ICommandDescriptionProvider >& _pDescriptionProvider
+ );
~NavigationToolBar( );
/** sets the dispatcher which is to be used for the features
@@ -82,19 +96,16 @@ namespace frm
ensuring the life time of the object does exceed the life time
of the tool bar instance.
*/
- void setDispatcher( const IFeatureDispatcher* _pDispatcher );
+ void setDispatcher( const IFeatureDispatcher* _pDispatcher );
- /** enables or disables a given feature
- */
- void enableFeature( sal_Int32 _nFeatureId, bool _bEnabled );
+ /// enables or disables a given feature
+ void enableFeature( sal_Int16 _nFeatureId, bool _bEnabled );
- /** checks or unchecks a given feature
- */
- void checkFeature( sal_Int32 _nFeatureId, bool _bEnabled );
+ /// checks or unchecks a given feature
+ void checkFeature( sal_Int16 _nFeatureId, bool _bEnabled );
- /** sets the text of a given feature
- */
- void setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText );
+ /// sets the text of a given feature
+ void setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText );
/** retrieves the current image size
*/
@@ -127,7 +138,10 @@ namespace frm
void implInit( );
/// impl version of SetImageSize
- void implSetImageSize( ImageSize _eSize, bool _bForce = false );
+ void implSetImageSize( ImageSize _eSize );
+
+ /// updates the images of our items
+ void implUpdateImages();
/// enables or disables an item, plus possible dependent items
void implEnableItem( USHORT _nItemId, bool _bEnabled );