diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-16 13:30:53 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-16 13:30:53 +0000 |
commit | ba13251d79d9eee4e77beebe3f6b02e8127b8892 (patch) | |
tree | 4aa004ed142c1eb3ce30b80760a24fa2e064be30 /svx | |
parent | 4f70cd8e18074e87aa8af64bf37585e5fcebfc3f (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')
-rw-r--r-- | svx/inc/svx/gridctrl.hxx | 14 | ||||
-rw-r--r-- | svx/inc/svx/svdobj.hxx | 17 | ||||
-rw-r--r-- | svx/inc/svx/svdouno.hxx | 2 | ||||
-rw-r--r-- | svx/inc/svx/unoshape.hxx | 5 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 29 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 92 | ||||
-rw-r--r-- | svx/source/form/fmprop.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmvwimp.cxx | 6 | ||||
-rw-r--r-- | svx/source/inc/fmprop.hrc | 1 | ||||
-rw-r--r-- | svx/source/inc/gridcell.hxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdouno.cxx | 22 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 1 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap2.cxx | 133 |
14 files changed, 222 insertions, 116 deletions
diff --git a/svx/inc/svx/gridctrl.hxx b/svx/inc/svx/gridctrl.hxx index 5b7637cce621..632ca6ea0805 100644 --- a/svx/inc/svx/gridctrl.hxx +++ b/svx/inc/svx/gridctrl.hxx @@ -122,6 +122,18 @@ public: #define GRID_COLUMN_NOT_FOUND ((sal_uInt16)-1) //================================================================== +// InitWindowFacet, describing which aspect of a column's Window to (re-)initialize +//================================================================== +enum InitWindowFacet +{ + InitFont = 0x01, + InitForeground = 0x02, + InitBackground = 0x04, + InitWritingMode = 0x08, + InitAll = 0xFF +}; + +//================================================================== class FmXGridSourcePropListener; class DisposeListenerGridBridge; typedef ::svt::EditBrowseBox DbGridControl_Base; @@ -585,7 +597,7 @@ protected: protected: virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol); void Construct(); - void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); + void ImplInitWindow( const InitWindowFacet _eInitWhat ); DECL_LINK(OnDelete, void*); DECL_LINK(OnAsyncAdjust, void*); diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 3d1b28bf1b9d..65ab5a8d4ebd 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -943,6 +943,23 @@ public: virtual void DisconnectFromNode(FASTBOOL bTail1); virtual SdrObject* GetConnectedNode(FASTBOOL bTail1) const; + /** sets the writing mode of the object's context + + Objects which itself do not support different writing modes will ignore this call. + + Objects which support different writing modes, but have an own, explicit writing mode set, + will also ignore this call. + + Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT, + will use the given writing mode to calculate their "effective writing mode". + + The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT. + + @param _nContextWritingMode + the effective writing mode of the context of the object + */ + virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode ); + // Wenn ein Objekt in der Lage ist, sich in ein Polygon oder in eine // Bezierkurve (oder beides) zu verwandeln, dann sollten die folgenden // Methoden ueberladen werden. diff --git a/svx/inc/svx/svdouno.hxx b/svx/inc/svx/svdouno.hxx index c1914f0b59ee..b454c59207f8 100644 --- a/svx/inc/svx/svdouno.hxx +++ b/svx/inc/svx/svdouno.hxx @@ -101,6 +101,8 @@ public: virtual void TakeObjNameSingul(XubString& rName) const; virtual void TakeObjNamePlural(XubString& rName) const; + virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode ); + ::com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > GetUnoControlModel() const {return xUnoControlModel;} ::com::sun::star::uno::Reference< com::sun::star::awt::XControl > GetUnoControl(const SdrView& _rView, const OutputDevice& _rOut) const; diff --git a/svx/inc/svx/unoshape.hxx b/svx/inc/svx/unoshape.hxx index 61d691984079..3d55f9286236 100644 --- a/svx/inc/svx/unoshape.hxx +++ b/svx/inc/svx/unoshape.hxx @@ -483,11 +483,6 @@ public: ***********************************************************************/ class SVX_DLLPUBLIC SvxShapeControl : public ::com::sun::star::drawing::XControlShape, public SvxShapeText { -private: - void convertPropertyName( const rtl::OUString& rApiName, rtl::OUString& rInternalName ); - void valueAlignToParaAdjust(::com::sun::star::uno::Any& rValue); //added by BerryJia for fixing Bug102407 2002-11-04 - void valueParaAdjustToAlign(::com::sun::star::uno::Any& rValue); //added by BerryJia for fixing Bug102407 2002-11-04 - protected: using SvxUnoTextRangeBase::setPropertyValue; using SvxUnoTextRangeBase::getPropertyValue; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 72aeb08ce60a..49778b7a4b69 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -525,10 +525,10 @@ void DbGridColumn::Paint(OutputDevice& rDev, } //------------------------------------------------------------------------------ -void DbGridColumn::ImplInitSettings(Window& rParent, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground) +void DbGridColumn::ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ) { - if (m_pCell) - m_pCell->ImplInitSettings(rParent, bFont, bForeground, bBackground); + if ( m_pCell ) + m_pCell->ImplInitWindow( rParent, _eInitWhat ); } //============================================================================== @@ -685,10 +685,20 @@ sal_Bool DbCellControl::Commit() } //------------------------------------------------------------------------------ -void DbCellControl::ImplInitSettings(Window& rParent, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground) +void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ) { Window* pWindows[] = { m_pPainter, m_pWindow }; - if (bFont) + + if ( ( _eInitWhat & InitWritingMode ) != 0 ) + { + for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) + { + if ( pWindows[i] ) + pWindows[i]->EnableRTL( rParent.IsRTLEnabled() ); + } + } + + if ( ( _eInitWhat & InitFont ) != 0 ) { for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) { @@ -713,7 +723,9 @@ void DbCellControl::ImplInitSettings(Window& rParent, sal_Bool bFont, sal_Bool b } } - if (bFont || bForeground) + if ( ( ( _eInitWhat & InitFont ) != 0 ) + || ( ( _eInitWhat & InitForeground ) != 0 ) + ) { Color aTextColor( rParent.IsControlForeground() ? rParent.GetControlForeground() : rParent.GetTextColor() ); @@ -736,7 +748,7 @@ void DbCellControl::ImplInitSettings(Window& rParent, sal_Bool bFont, sal_Bool b } } - if (bBackground) + if ( ( _eInitWhat & InitBackground ) != 0 ) { if (rParent.IsControlBackground()) { @@ -811,7 +823,8 @@ void DbCellControl::implAdjustEnabled( const Reference< XPropertySet >& _rxModel //------------------------------------------------------------------------------ void DbCellControl::Init( Window& rParent, const Reference< XRowSet >& _rxCursor ) { - ImplInitSettings( rParent, sal_True, sal_True, sal_True ); + ImplInitWindow( rParent, InitAll ); + if ( m_pWindow ) { // align the control diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 4b997db3b08e..b3b18632884c 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -754,32 +754,44 @@ void DbGridControl::NavigationBar::Paint(const Rectangle& rRect) //------------------------------------------------------------------------------ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) { - Control::StateChanged(nType); - if (STATE_CHANGE_ZOOM == nType) - { - Fraction aZoom = GetZoom(); + Control::StateChanged( nType ); - Window* pWindows[] = { - &m_aRecordText, - &m_aAbsolute, - &m_aRecordOf, - &m_aRecordCount, - &m_aFirstBtn, - &m_aPrevBtn, - &m_aNextBtn, - &m_aLastBtn, - &m_aNewBtn - }; + Window* pWindows[] = { &m_aRecordText, + &m_aAbsolute, + &m_aRecordOf, + &m_aRecordCount, + &m_aFirstBtn, + &m_aPrevBtn, + &m_aNextBtn, + &m_aLastBtn, + &m_aNewBtn + }; - // not all of these controls need to know the new zoom, but to be sure ... - Font aFont( IsControlFont() ? GetControlFont() : GetPointFont()); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + switch ( nType ) + { + case STATE_CHANGE_MIRRORING: { - pWindows[i]->SetZoom(aZoom); - pWindows[i]->SetZoomedPointFont(aFont); + BOOL bIsRTLEnabled = IsRTLEnabled(); + for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) + pWindows[i]->EnableRTL( bIsRTLEnabled ); } - // rearrange the controls - m_nDefaultWidth = ArrangeControls(); + break; + + case STATE_CHANGE_ZOOM: + { + Fraction aZoom = GetZoom(); + + // not all of these controls need to know the new zoom, but to be sure ... + Font aFont( IsControlFont() ? GetControlFont() : GetPointFont()); + for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + { + pWindows[i]->SetZoom(aZoom); + pWindows[i]->SetZoomedPointFont(aFont); + } + // rearrange the controls + m_nDefaultWidth = ArrangeControls(); + } + break; } } @@ -935,7 +947,7 @@ DbGridControl::DbGridControl( String sName(SVX_RES(RID_STR_NAVIGATIONBAR)); m_aBar.SetAccessibleName(sName); m_aBar.Show(); - ImplInitSettings(sal_True,sal_True,sal_True); + ImplInitWindow( InitAll ); } //------------------------------------------------------------------------------ @@ -1002,11 +1014,17 @@ DbGridControl::~DbGridControl() void DbGridControl::StateChanged( StateChangedType nType ) { DbGridControl_Base::StateChanged( nType ); + switch (nType) { + case STATE_CHANGE_MIRRORING: + ImplInitWindow( InitWritingMode ); + Invalidate(); + break; + case STATE_CHANGE_ZOOM: { - ImplInitSettings( sal_True, sal_False, sal_False ); + ImplInitWindow( InitFont ); // and give it a chance to rearrange Point aPoint = GetControlArea().TopLeft(); @@ -1016,15 +1034,15 @@ void DbGridControl::StateChanged( StateChangedType nType ) } break; case STATE_CHANGE_CONTROLFONT: - ImplInitSettings( sal_True, sal_False, sal_False ); + ImplInitWindow( InitFont ); Invalidate(); break; case STATE_CHANGE_CONTROLFOREGROUND: - ImplInitSettings( sal_False, sal_True, sal_False ); + ImplInitWindow( InitForeground ); Invalidate(); break; case STATE_CHANGE_CONTROLBACKGROUND: - ImplInitSettings( sal_False, sal_False, sal_True ); + ImplInitWindow( InitBackground ); Invalidate(); break; } @@ -1037,7 +1055,7 @@ void DbGridControl::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS ) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - ImplInitSettings( sal_True, sal_True, sal_True ); + ImplInitWindow( InitAll ); Invalidate(); } } @@ -1055,16 +1073,24 @@ void DbGridControl::Select() } //------------------------------------------------------------------------------ -void DbGridControl::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) +void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { - for (sal_uInt32 i = 0; i < m_aColumns.Count(); i++) + for ( sal_uInt32 i = 0; i < m_aColumns.Count(); ++i ) { DbGridColumn* pCol = m_aColumns.GetObject(i); if (pCol) - pCol->ImplInitSettings( GetDataWindow(), bFont, bForeground, bBackground ); + pCol->ImplInitWindow( GetDataWindow(), _eInitWhat ); + } + + if ( ( _eInitWhat & InitWritingMode ) != 0 ) + { + if ( m_bNavigationBar ) + { + m_aBar.EnableRTL( IsRTLEnabled() ); + } } - if ( bFont ) + if ( ( _eInitWhat & InitFont ) != 0 ) { if ( m_bNavigationBar ) { @@ -1083,7 +1109,7 @@ void DbGridControl::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_ } } - if (bBackground) + if ( ( _eInitWhat & InitBackground ) != 0 ) { if (IsControlBackground()) { diff --git a/svx/source/form/fmprop.cxx b/svx/source/form/fmprop.cxx index 577b8b3ec550..2cf5f158ac1f 100644 --- a/svx/source/form/fmprop.cxx +++ b/svx/source/form/fmprop.cxx @@ -188,5 +188,7 @@ namespace svxform IMPLEMENT_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS, "FormOperations" ); IMPLEMENT_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED, "InputRequired" ); + IMPLEMENT_CONSTASCII_USTRING( FM_PROP_WRITING_MODE, "WritingMode" ); + } // namespace svxform diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 4a8d993cf595..398e14d3a25b 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -84,6 +84,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbc/XPreparedStatement.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> +#include <com/sun/star/text/WritingMode2.hpp> /** === end UNO includes === **/ #include <comphelper/enumhelper.hxx> @@ -119,6 +120,8 @@ using com::sun::star::style::VerticalAlignment_MIDDLE; using ::com::sun::star::form::binding::XValueBinding; using ::com::sun::star::form::binding::XBindableValue; +namespace WritingMode2 = ::com::sun::star::text::WritingMode2; + namespace svxform { //======================================================================== @@ -1052,6 +1055,9 @@ IMPL_LINK( FmXFormView, OnStartControlWizard, void*, /**/ ) DBG_UNHANDLED_EXCEPTION(); } } + + if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_WRITING_MODE ) ) + _rxModel->setPropertyValue( FM_PROP_WRITING_MODE, makeAny( WritingMode2::CONTEXT ) ); } m_xLastCreatedControlModel.clear(); diff --git a/svx/source/inc/fmprop.hrc b/svx/source/inc/fmprop.hrc index 8bf5da856f70..adfb73ad1dc8 100644 --- a/svx/source/inc/fmprop.hrc +++ b/svx/source/inc/fmprop.hrc @@ -181,6 +181,7 @@ namespace svxform DECLARE_CONSTASCII_USTRING( FM_PROP_BUTTON_TYPE ); DECLARE_CONSTASCII_USTRING( FM_PROP_FORM_OPERATIONS ); DECLARE_CONSTASCII_USTRING( FM_PROP_INPUT_REQUIRED ); + DECLARE_CONSTASCII_USTRING( FM_PROP_WRITING_MODE ); } // namespace svxform diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index f621eb04ea6f..6a552da6edb7 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -183,7 +183,8 @@ public: void SetReadOnly(sal_Bool bRead){m_bReadOnly = bRead;} void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = sal_True; m_nFieldPos = nPos;} - void ImplInitSettings( Window& rParent, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); + + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ); // Properties, die auf den ::com::sun::star::frame::Controller durchschlagen koennen sal_Int16 SetAlignment(sal_Int16 _nAlign); @@ -308,7 +309,7 @@ public: virtual void PaintFieldToCell( OutputDevice& rDev, const Rectangle& rRect, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter); virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect ); - void ImplInitSettings( Window& rParent, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ); double GetValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const; @@ -781,8 +782,8 @@ public: virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException); sal_Bool Commit() {return m_pCellControl->Commit();} - void ImplInitSettings( Window& rParent, sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) - { m_pCellControl->ImplInitSettings( rParent, bFont, bForeground, bBackground ); } + void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat ) + { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); } sal_Bool isAlignedController() const { return m_pCellControl->isAlignedController(); } void AlignControl(sal_Int16 nAlignment) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 514d78e2cbf9..d9f7ffa0c922 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3077,6 +3077,11 @@ void SdrObject::SetBLIPSizeRectangle( const Rectangle& aRect ) maBLIPSizeRectangle = aRect; } +void SdrObject::SetContextWritingMode( const sal_Int16 /*_nContextWritingMode*/ ) +{ + // this base class does not support different writing modes, so ignore the call +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // // @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@ @@@@@@ @@@@ @@@@@ @@ @@ diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index 2c42adfd63c6..92077ebf85c2 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -61,8 +61,8 @@ #include <memory> #include <svx/sdrpagewindow.hxx> #include <sdrpaintwindow.hxx> +#include <tools/diagnose_ex.h> -using namespace ::rtl; using namespace ::com::sun::star; using namespace ::sdr::contact; @@ -251,6 +251,22 @@ UINT16 SdrUnoObj::GetObjIdentifier() const return UINT16(OBJ_UNO); } +void SdrUnoObj::SetContextWritingMode( const sal_Int16 _nContextWritingMode ) +{ + try + { + uno::Reference< beans::XPropertySet > xModelProperties( GetUnoControlModel(), uno::UNO_QUERY_THROW ); + xModelProperties->setPropertyValue( + ::rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "ContextWritingMode" ) ), + uno::makeAny( _nContextWritingMode ) + ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + // ---------------------------------------------------------------------------- namespace { @@ -379,7 +395,7 @@ void SdrUnoObj::operator = (const SdrObject& rObj) if (xSet.is()) { uno::Any aValue( xSet->getPropertyValue( rtl::OUString::createFromAscii("DefaultControl")) ); - OUString aStr; + ::rtl::OUString aStr; if( aValue >>= aStr ) aUnoControlTypeName = String(aStr); @@ -545,7 +561,7 @@ void SdrUnoObj::SetUnoControlModel( uno::Reference< awt::XControlModel > xModel) if (xSet.is()) { uno::Any aValue( xSet->getPropertyValue(String("DefaultControl", gsl_getSystemTextEncoding())) ); - OUString aStr; + ::rtl::OUString aStr; if( aValue >>= aStr ) aUnoControlTypeName = String(aStr); } diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index bbb05cb7d3ae..a897b486b5e3 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 ad90a29093b8..654318630069 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" ) ) { |