summaryrefslogtreecommitdiff
path: root/chart2/source/model/main/FormattedString.cxx
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-05-22 17:36:42 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-05-22 17:36:42 +0000
commit78d16cfb2a6c2fdebc0a00a0462f35716c5e61c1 (patch)
tree5f9b813088994ef211d5e24556611664199cde13 /chart2/source/model/main/FormattedString.cxx
parent96d91d5ece1035612e10b560d6a12e10bca7b3fc (diff)
INTEGRATION: CWS chart2mst3 (1.3.4); FILE MERGED
2006/10/18 17:10:46 bm 1.3.4.10: RESYNC: (1.4-1.5); FILE MERGED 2006/01/20 16:51:45 bm 1.3.4.9: moved ReferencePageSize from XFormattedString to XTitle 2005/11/08 12:55:25 bm 1.3.4.8: notification mechanism added 2005/10/07 11:54:47 bm 1.3.4.7: RESYNC: (1.3-1.4); FILE MERGED 2005/09/23 15:25:00 iha 1.3.4.6: #i55000# crash caused by dead reference to mutex 2005/08/03 16:36:19 bm 1.3.4.5: algohelper.hxx split up into CommonFunctors.hxx ContainerHelper.hxx CloneHelper.hxx 2005/07/14 12:45:43 iha 1.3.4.4: remove unused parameter 'bIncludeStyleProperties' from characterproperties 2005/03/31 14:54:59 bm 1.3.4.3: make titles cloneable 2004/05/26 16:26:57 bm 1.3.4.2: default font sizes adapted 2004/02/13 16:51:30 bm 1.3.4.1: join from changes on branch bm_post_chart01
Diffstat (limited to 'chart2/source/model/main/FormattedString.cxx')
-rw-r--r--chart2/source/model/main/FormattedString.cxx123
1 files changed, 82 insertions, 41 deletions
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index 5f22245e5a96..03d07bde5950 100644
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: FormattedString.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 13:11:56 $
+ * last change: $Author: vg $ $Date: 2007-05-22 18:36:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -36,18 +36,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "FormattedString.hxx"
+#include "ContainerHelper.hxx"
#include "CharacterProperties.hxx"
#include "PropertyHelper.hxx"
-#include "algohelper.hxx"
#include "macros.hxx"
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
-#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
-#include <com/sun/star/awt/Size.hpp>
-#endif
using namespace ::com::sun::star;
@@ -61,22 +58,6 @@ using ::osl::MutexGuard;
namespace
{
-enum
-{
- PROP_FORMATTED_STRING_REF_PAGE_SIZE
-};
-
-void lcl_AddPropertiesToVector(
- ::std::vector< Property > & rOutProperties )
-{
- rOutProperties.push_back(
- Property( C2U( "ReferencePageSize" ),
- PROP_FORMATTED_STRING_REF_PAGE_SIZE,
- ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEVOID ));
-}
-
const Sequence< Property > & lcl_GetPropertySequence()
{
static Sequence< Property > aPropSeq;
@@ -87,16 +68,14 @@ const Sequence< Property > & lcl_GetPropertySequence()
{
// get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector(
- aProperties, /* bIncludeStyleProperties = */ true );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
// and sort them for access via bsearch
::std::sort( aProperties.begin(), aProperties.end(),
- ::chart::helper::PropertyNameLess() );
+ ::chart::PropertyNameLess() );
// transfer result to static Sequence
- aPropSeq = ::chart::helper::VectorToSequence( aProperties );
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
}
return aPropSeq;
@@ -118,18 +97,33 @@ namespace chart
FormattedString::FormattedString( const ::rtl::OUString & rString ) :
::property::OPropertySet( m_aMutex ),
- m_aString( rString )
+ m_aString( rString ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex ))
{}
FormattedString::FormattedString(
uno::Reference< uno::XComponentContext > const & xContext ) :
::property::OPropertySet( m_aMutex ),
- m_aString()
+ m_aString(),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex ))
+{}
+
+FormattedString::FormattedString( const FormattedString & rOther ) :
+ ::property::OPropertySet( rOther, m_aMutex ),
+ m_aString( rOther.m_aString ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder( m_aMutex ))
{}
FormattedString::~FormattedString()
{}
+// ____ XCloneable ____
+uno::Reference< util::XCloneable > SAL_CALL FormattedString::createClone()
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< util::XCloneable >( new FormattedString( *this ));
+}
+
// ____ XFormattedString ____
::rtl::OUString SAL_CALL FormattedString::getString()
throw (uno::RuntimeException)
@@ -146,9 +140,65 @@ void SAL_CALL FormattedString::setString( const ::rtl::OUString& String )
// /--
MutexGuard aGuard( GetMutex());
m_aString = String;
+ fireModifyEvent();
// \--
}
+// ____ XModifyBroadcaster ____
+void SAL_CALL FormattedString::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->addModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void SAL_CALL FormattedString::removeModifyListener( const uno::Reference< util::XModifyListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ try
+ {
+ uno::Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
+ xBroadcaster->removeModifyListener( aListener );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+// ____ XModifyListener ____
+void SAL_CALL FormattedString::modified( const lang::EventObject& aEvent )
+ throw (uno::RuntimeException)
+{
+ m_xModifyEventForwarder->modified( aEvent );
+}
+
+// ____ XEventListener (base of XModifyListener) ____
+void SAL_CALL FormattedString::disposing( const lang::EventObject& Source )
+ throw (uno::RuntimeException)
+{
+ // nothing
+}
+
+// ____ OPropertySet ____
+void FormattedString::firePropertyChangeEvent()
+{
+ fireModifyEvent();
+}
+
+void FormattedString::fireModifyEvent()
+{
+ m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
+}
+
+
// ----------------------------------------
Sequence< OUString > FormattedString::getSupportedServiceNames_Static()
@@ -164,26 +214,17 @@ Sequence< OUString > FormattedString::getSupportedServiceNames_Static()
uno::Any FormattedString::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- // todo: default is just for testing. should be void
- if( nHandle == PROP_FORMATTED_STRING_REF_PAGE_SIZE )
- {
- return uno::makeAny( awt::Size( 10000, 7500 ) );
- }
- // remove till here
-
- static helper::tPropertyValueMap aStaticDefaults;
+ static tPropertyValueMap aStaticDefaults;
// /--
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( 0 == aStaticDefaults.size() )
{
// initialize defaults
- CharacterProperties::AddDefaultsToMap(
- aStaticDefaults,
- /* bIncludeStyleProperties = */ true );
+ CharacterProperties::AddDefaultsToMap( aStaticDefaults );
}
- helper::tPropertyValueMap::const_iterator aFound(
+ tPropertyValueMap::const_iterator aFound(
aStaticDefaults.find( nHandle ));
if( aFound == aStaticDefaults.end())