summaryrefslogtreecommitdiff
path: root/svx/source/unodraw
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-12-16 13:30:53 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-12-16 13:30:53 +0000
commit2aba9f078c1e241eec4d453eb52c08eca743d695 (patch)
tree72fbd284b917da8f25e423fafd272174bf463692 /svx/source/unodraw
parentac20273a69b2557e89a4c3e6eb9a1d543390739d (diff)
CWS-TOOLING: integrate CWS rtlcontrols
2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient 2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3 2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID 2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37 2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring 2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls 2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4) 2008-12-03 12:55:24 +0100 fs r264768 : #i100000# 2008-12-03 07:11:48 +0100 fs r264741 : #i10000# 2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36) 2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk 2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572# 2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode 2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL) 2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode 2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode 2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL 2008-11-19 08:51:48 +0100 fs r263963 : #i10000# 2008-11-18 20:58:11 +0100 fs r263878 : #i10000# 2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN the CVS changes contained in this change set are the ones between the following two CVS tags: CWS_DEV300_RTLCONTROLS_ANCHOR CWS_DEV300_RTLCONTROLS_PRE_MIGRATION 2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r--svx/source/unodraw/unoprov.cxx1
-rw-r--r--svx/source/unodraw/unoshap2.cxx133
2 files changed, 72 insertions, 62 deletions
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index b83671e61e..1cf5bda741 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -634,6 +634,7 @@ SfxItemPropertyMap* ImplGetSvxControlShapePropertyMap()
{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
{ MAP_CHAR_LEN("ControlTextEmphasis"), 0, &::getCppuType((const sal_Int16*)0), 0, 0 },
+ { MAP_CHAR_LEN("ControlWritingMode"), 0, &::cppu::UnoType< sal_Int16 >::get(), 0, 0},
// the following properties are handled by SvxShape
{ MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 },
{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0},
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 069aa4577a..1b812fd25e 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -715,75 +715,89 @@ SvxShapeControlPropertyMapping[] =
{ MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
{ MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
{ MAP_CHAR_LEN("ImageScaleMode"), MAP_CHAR_LEN("ScaleMode") },
+ { MAP_CHAR_LEN("ControlWritingMode"), MAP_CHAR_LEN("WritingMode") },
{ NULL,0, NULL, 0 }
};
-void SvxShapeControl::convertPropertyName( const OUString& rApiName, OUString& rInternalName )
+namespace
{
- sal_uInt16 i = 0;
- while( SvxShapeControlPropertyMapping[i].mpAPIName )
+ static bool lcl_convertPropertyName( const OUString& rApiName, OUString& rInternalName )
{
- if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
+ sal_uInt16 i = 0;
+ while( SvxShapeControlPropertyMapping[i].mpAPIName )
{
- rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
+ if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
+ {
+ rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
+ }
+ ++i;
}
- ++i;
+ return rInternalName.getLength() > 0;
}
-}
-//added by BerryJia for fixing Bug102407 2002-11-04
-static struct
-{
- sal_Int16 nAPIValue;
- sal_Int16 nFormValue;
-}
-SvxShapeControlPropertyValueMapping[] =
-{
- // note that order matters:
- // valueAlignToParaAdjust and valueParaAdjustToAlign search this map from the _beginning_
- // and use the first matching entry
- {style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT},
- {style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER},
- {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT},
- {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT},
- {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT},
- {-1,-1}
-};
+ struct EnumConversionMap
+ {
+ sal_Int16 nAPIValue;
+ sal_Int16 nFormValue;
+ };
-void SvxShapeControl::valueAlignToParaAdjust(Any& rValue)
-{
- sal_Int16 nValue = sal_Int16();
- rValue >>= nValue;
- sal_uInt16 i = 0;
- while (-1 != SvxShapeControlPropertyValueMapping[i].nFormValue)
+ EnumConversionMap aMapAdjustToAlign[] =
+ {
+ // note that order matters:
+ // lcl_convertTextAlignmentToParaAdjustment and lcl_convertParaAdjustmentToTextAlignment search this map from the _beginning_
+ // and use the first matching entry
+ {style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT},
+ {style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER},
+ {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT},
+ {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT},
+ {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT},
+ {-1,-1}
+ };
+
+ static void lcl_mapFormToAPIValue( Any& _rValue, const EnumConversionMap* _pMap )
{
- if (nValue == SvxShapeControlPropertyValueMapping[i].nFormValue)
+ sal_Int16 nValue = sal_Int16();
+ OSL_VERIFY( _rValue >>= nValue );
+
+ const EnumConversionMap* pEntry = _pMap;
+ while ( pEntry && ( pEntry->nFormValue != -1 ) )
{
- rValue <<= (SvxShapeControlPropertyValueMapping[i].nAPIValue);
- return;
+ if ( nValue == pEntry->nFormValue )
+ {
+ _rValue <<= pEntry->nAPIValue;
+ return;
+ }
+ ++pEntry;
}
- i++;
}
-}
-void SvxShapeControl::valueParaAdjustToAlign(Any& rValue)
-{
- sal_Int32 nValue = 0;
- rValue >>= nValue;
- sal_uInt16 i = 0;
- while (-1 != SvxShapeControlPropertyValueMapping[i].nAPIValue)
+ static void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap )
{
- if ( nValue == SvxShapeControlPropertyValueMapping[i].nAPIValue)
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( _rValue >>= nValue );
+
+ const EnumConversionMap* pEntry = _pMap;
+ while ( pEntry && ( pEntry->nAPIValue != -1 ) )
{
- rValue <<= (SvxShapeControlPropertyValueMapping[i].nFormValue);
- return;
+ if ( nValue == pEntry->nAPIValue )
+ {
+ _rValue <<= pEntry->nFormValue;
+ return;
+ }
+ ++pEntry;
}
- i++;
}
-}
-namespace
-{
+ static void lcl_convertTextAlignmentToParaAdjustment( Any& rValue )
+ {
+ lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign );
+ }
+
+ static void lcl_convertParaAdjustmentToTextAlignment( Any& rValue )
+ {
+ lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign );
+ }
+
void convertVerticalAdjustToVerticalAlign( Any& _rValue ) SAL_THROW( ( lang::IllegalArgumentException ) )
{
if ( !_rValue.hasValue() )
@@ -823,8 +837,7 @@ void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName,
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
{
OUString aFormsName;
- convertPropertyName( aPropertyName, aFormsName );
- if( aFormsName.getLength() )
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
{
uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
if( xControl.is() )
@@ -842,7 +855,7 @@ void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName,
}
else if ( aFormsName.equalsAscii( "Align" ) )
{
- valueParaAdjustToAlign( aConvertedValue );
+ lcl_convertParaAdjustmentToTextAlignment( aConvertedValue );
}
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
{
@@ -863,8 +876,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyNa
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
OUString aFormsName;
- convertPropertyName( aPropertyName, aFormsName );
- if( aFormsName.getLength() )
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
{
uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
@@ -891,7 +903,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyNa
}
else if ( aFormsName.equalsAscii( "Align" ) )
{
- valueAlignToParaAdjust( aValue );
+ lcl_convertTextAlignmentToParaAdjustment( aValue );
}
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
{
@@ -913,8 +925,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyNa
beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
{
OUString aFormsName;
- convertPropertyName( PropertyName, aFormsName );
- if( aFormsName.getLength() )
+ if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
{
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
@@ -939,8 +950,7 @@ beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const ::rtl::OU
void SAL_CALL SvxShapeControl::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
{
OUString aFormsName;
- convertPropertyName( PropertyName, aFormsName );
- if( aFormsName.getLength() )
+ if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
{
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
@@ -964,8 +974,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const ::rtl::OUString& aP
throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
{
OUString aFormsName;
- convertPropertyName( aPropertyName, aFormsName );
- if( aFormsName.getLength() )
+ if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
{
uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
@@ -980,7 +989,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const ::rtl::OUString& aP
}
else if ( aFormsName.equalsAscii( "Align" ) )
{
- valueAlignToParaAdjust( aDefault );
+ lcl_convertTextAlignmentToParaAdjustment( aDefault );
}
else if ( aFormsName.equalsAscii( "VerticalAlign" ) )
{