diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unodraw.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 53 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 85 | ||||
-rw-r--r-- | sw/source/ui/uiview/view2.cxx | 14 | ||||
-rw-r--r-- | sw/uiconfig/swform/statusbar/statusbar.xml | 5 | ||||
-rw-r--r-- | sw/uiconfig/swreport/statusbar/statusbar.xml | 5 |
6 files changed, 124 insertions, 41 deletions
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index ce673f4344c9..05857bbc6fe1 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -318,6 +318,9 @@ public: SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;} ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;} + + // helper + static void AddExistingShapeToFmt( SdrObject& _rObj ); }; /* -----------------------------31.05.01 09:54-------------------------------- diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index cb3119d81c04..e75670aa9525 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -43,6 +43,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdviter.hxx> #include <svx/svdview.hxx> +#include <svx/shapepropertynotifier.hxx> // AW, OD 2004-04-30 #i28501# #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> @@ -59,6 +60,7 @@ #include <frmfmt.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> +#include <unodraw.hxx> #ifndef IDOCUMENTDRAWMODELACCESS_HXX_INCLUDED #include <IDocumentDrawModelAccess.hxx> #endif @@ -810,6 +812,10 @@ SwDrawContact::SwDrawContact( SwFrmFmt* pToRegisterIn, SdrObject* pObj ) : // OD 2004-03-29 #i26791# pObj->SetUserCall( this ); maAnchoredDrawObj.SetDrawObj( *pObj ); + + // if there already exists an SwXShape for the object, ensure it knows about us, and the SdrObject + // FS 2009-04-07 #i99056# + SwXShape::AddExistingShapeToFmt( *pObj ); } SwDrawContact::~SwDrawContact() @@ -1578,6 +1584,25 @@ void SwDrawContact::_Changed( const SdrObject& rObj, } } +namespace +{ + static const SwFmtAnchor* lcl_getAnchorFmt( const SfxPoolItem& _rItem ) + { + USHORT nWhich = _rItem.Which(); + const SwFmtAnchor* pAnchorFmt = NULL; + if ( RES_ATTRSET_CHG == nWhich ) + { + static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()-> + GetItemState( RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnchorFmt ); + } + else if ( RES_ANCHOR == nWhich ) + { + pAnchorFmt = &static_cast<const SwFmtAnchor&>(_rItem); + } + return pAnchorFmt; + } +} + /************************************************************************* |* |* SwDrawContact::Modify() @@ -1587,28 +1612,16 @@ void SwDrawContact::_Changed( const SdrObject& rObj, |* |*************************************************************************/ -void SwDrawContact::Modify( SfxPoolItem *, SfxPoolItem *pNew ) +void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { // OD 10.10.2003 #112299# ASSERT( !mbDisconnectInProgress, "<SwDrawContact::Modify(..)> called during disconnection."); USHORT nWhich = pNew ? pNew->Which() : 0; - SwFmtAnchor* pAnchorFmt = 0L; - if ( RES_ATTRSET_CHG == nWhich ) - { - if ( SFX_ITEM_SET == static_cast<SwAttrSetChg*>(pNew)->GetChgSet()-> - GetItemState( RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnchorFmt ) ) - { - // <pAnchorFmt> is set and will be handled below - } - } - else if ( RES_ANCHOR == nWhich ) - { - pAnchorFmt = static_cast<SwFmtAnchor*>(pNew); - } + const SwFmtAnchor* pNewAnchorFmt = pNew ? lcl_getAnchorFmt( *pNew ) : NULL; - if ( pAnchorFmt ) + if ( pNewAnchorFmt ) { // JP 10.04.95: nicht auf ein Reset Anchor reagieren !!!!! if ( SFX_ITEM_SET == @@ -1630,10 +1643,18 @@ void SwDrawContact::Modify( SfxPoolItem *, SfxPoolItem *pNew ) // <-- } // re-connect to layout due to anchor format change - ConnectToLayout( pAnchorFmt ); + ConnectToLayout( pNewAnchorFmt ); // notify background of drawing objects lcl_NotifyBackgroundOfObj( *this, *GetMaster(), pOldRect ); NotifyBackgrdOfAllVirtObjs( pOldRect ); + + const SwFmtAnchor* pOldAnchorFmt = pOld ? lcl_getAnchorFmt( *pOld ) : NULL; + if ( !pOldAnchorFmt || ( pOldAnchorFmt->GetAnchorId() != pNewAnchorFmt->GetAnchorId() ) ) + { + ASSERT( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" ); + if ( maAnchoredDrawObj.DrawObj() ) + maAnchoredDrawObj.DrawObj()->getShapePropertyChangeNotifier().notifyPropertyChange( ::svx::eTextShapeAnchorType ); + } } } else diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 8732c44598b7..1989c74df6ed 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -63,6 +63,7 @@ #include <rootfrm.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> +#include <svx/shapepropertynotifier.hxx> #include <crstate.hxx> #include <vos/mutex.hxx> #include <comphelper/extract.hxx> @@ -120,6 +121,9 @@ class SwShapeDescriptor_Impl // <-- public: + bool bInitializedPropertyNotifier; + +public: SwShapeDescriptor_Impl() : // --> OD 2004-08-18 #i32349# - no defaults, in order to determine on // adding a shape, if positioning attributes are set or not. @@ -139,7 +143,8 @@ public: text::WrapInfluenceOnPosition::ONCE_CONCURRENT ) ), // <-- // --> OD 2004-08-06 #i28749# - mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ) + mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), + bInitializedPropertyNotifier(false) {} ~SwShapeDescriptor_Impl() @@ -974,6 +979,15 @@ sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId } return 0; } +namespace +{ + static void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape ) + { + ::svx::PPropertyValueProvider pProvider( new ::svx::PropertyValueProvider( _rShape, "AnchorType" ) ); + _rObj.getShapePropertyChangeNotifier().registerProvider( ::svx::eTextShapeAnchorType, pProvider ); + } +} + /* -----------------01.02.99 11:38------------------- * * --------------------------------------------------*/ @@ -981,7 +995,7 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE)), m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE)), pImplementationId(0), - pImpl(new SwShapeDescriptor_Impl), + pImpl(new SwShapeDescriptor_Impl()), m_bDescriptor(sal_True) { if(xShape.is()) // default Ctor @@ -1019,6 +1033,37 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : SwFrmFmt* pFmt = ::FindFrmFmt( pObj ); if(pFmt) pFmt->Add(this); + + lcl_addShapePropertyEventFactories( *pObj, *this ); + pImpl->bInitializedPropertyNotifier = true; + } + } +} + +/*-- 09.04.09 15:06:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwXShape::AddExistingShapeToFmt( SdrObject& _rObj ) +{ + SwXShape* pSwShape = NULL; + uno::Reference< lang::XUnoTunnel > xShapeTunnel( _rObj.getWeakUnoShape(), uno::UNO_QUERY ); + if ( xShapeTunnel.is() ) + pSwShape = reinterpret_cast< SwXShape * >( + sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) ); + if ( pSwShape ) + { + if ( pSwShape->m_bDescriptor ) + { + SwFrmFmt* pFmt = ::FindFrmFmt( &const_cast< SdrObject& >( _rObj ) ); + if ( pFmt ) + pFmt->Add( pSwShape ); + pSwShape->m_bDescriptor = sal_False; + } + + if ( !pSwShape->pImpl->bInitializedPropertyNotifier ) + { + lcl_addShapePropertyEventFactories( _rObj, *pSwShape ); + pSwShape->pImpl->bInitializedPropertyNotifier = true; } } } @@ -1986,23 +2031,35 @@ uno::Any SwXShape::getPropertyDefault( const rtl::OUString& rPropertyName ) -----------------------------------------------------------------------*/ void SwXShape::addPropertyChangeListener( - const rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) + const rtl::OUString& _propertyName, + const uno::Reference< beans::XPropertyChangeListener > & _listener ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - DBG_WARNING("not implemented"); + if ( !xShapeAgg.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this ); + + // must be handled by the aggregate + uno::Reference< beans::XPropertySet > xShapeProps; + if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps ) + xShapeProps->addPropertyChangeListener( _propertyName, _listener ); } /*-- 22.01.99 11:42:27--------------------------------------------------- -----------------------------------------------------------------------*/ void SwXShape::removePropertyChangeListener( - const rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) + const rtl::OUString& _propertyName, + const uno::Reference< beans::XPropertyChangeListener > & _listener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - DBG_WARNING("not implemented"); + if ( !xShapeAgg.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this ); + + // must be handled by the aggregate + uno::Reference< beans::XPropertySet > xShapeProps; + if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps ) + xShapeProps->removePropertyChangeListener( _propertyName, _listener ); } /*-- 22.01.99 11:42:28--------------------------------------------------- @@ -2504,14 +2561,14 @@ awt::Point SwXShape::_GetAttrPosition() // <-- // --> OD 2004-11-10 #i35007# - If drawing object is anchored as-character, // it's x-position isn't sensible. Thus, return the x-position as zero in this case. - text::TextContentAnchorType eAnchorType = + text::TextContentAnchorType eTextAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; { rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) ); uno::Any aAny = getPropertyValue( sAnchorType ); - aAny >>= eAnchorType; + aAny >>= eTextAnchorType; } - if ( eAnchorType == text::TextContentAnchorType_AS_CHARACTER ) + if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER ) { aAttrPos.X = 0; } @@ -2648,14 +2705,14 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) // handle x-position // --> OD 2004-11-10 #i35007# - no handling of x-position, if drawing // object is anchored as-character, because it doesn't make sense. - text::TextContentAnchorType eAnchorType = + text::TextContentAnchorType eTextAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; { rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) ); uno::Any aAny = getPropertyValue( sAnchorType ); - aAny >>= eAnchorType; + aAny >>= eTextAnchorType; } - if ( eAnchorType != text::TextContentAnchorType_AS_CHARACTER ) + if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER ) // <-- { // determine current x-postion diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 243c994b64a5..c063c72c5892 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1246,7 +1246,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_ZOOM: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType(); @@ -1268,7 +1268,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_VIEWLAYOUT: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); const USHORT nColumns = pVOpt->GetViewLayoutColumns(); @@ -1282,7 +1282,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_ZOOMSLIDER: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); const USHORT nCurrentZoom = pVOpt->GetZoom(); @@ -1590,13 +1590,13 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) break; case SID_ATTR_ZOOM: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SfxItemSet *pSet = 0; AbstractSvxZoomDialog *pDlg = 0; if ( pArgs ) pSet = pArgs; - else if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + else { const SwViewOption& rViewOptions = *rSh.GetViewOptions(); SfxItemSet aCoreSet(pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 ); @@ -1661,7 +1661,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_VIEWLAYOUT: { if ( pArgs && !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { // PAGES01 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, TRUE, &pItem )) @@ -1684,7 +1684,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_ZOOMSLIDER: { - if ( pArgs && GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { // PAGES01 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, TRUE, &pItem )) diff --git a/sw/uiconfig/swform/statusbar/statusbar.xml b/sw/uiconfig/swform/statusbar/statusbar.xml index 58d7b18fe483..24ec9032bb47 100644 --- a/sw/uiconfig/swform/statusbar/statusbar.xml +++ b/sw/uiconfig/swform/statusbar/statusbar.xml @@ -3,11 +3,12 @@ <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:StatePageNumber" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:21181"/> <statusbar:statusbaritem xlink:href=".uno:PageStyleName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79" statusbar:helpid="helpid:21182"/> - <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> + <statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100" /> <statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="37" statusbar:helpid="helpid:10221"/> <statusbar:statusbaritem xlink:href=".uno:SelectionMode" statusbar:align="center" statusbar:width="30" statusbar:helpid="helpid:21185"/> - <statusbar:statusbaritem xlink:href=".uno:ExecHyperlinks" statusbar:align="center" statusbar:width="22" statusbar:helpid="helpid:21186"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="9" statusbar:helpid="helpid:5584"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/> <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="left" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="129" statusbar:helpid="helpid:10224"/> + <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/> + <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> </statusbar:statusbar> diff --git a/sw/uiconfig/swreport/statusbar/statusbar.xml b/sw/uiconfig/swreport/statusbar/statusbar.xml index 58d7b18fe483..24ec9032bb47 100644 --- a/sw/uiconfig/swreport/statusbar/statusbar.xml +++ b/sw/uiconfig/swreport/statusbar/statusbar.xml @@ -3,11 +3,12 @@ <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:StatePageNumber" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:21181"/> <statusbar:statusbaritem xlink:href=".uno:PageStyleName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79" statusbar:helpid="helpid:21182"/> - <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> + <statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100" /> <statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="37" statusbar:helpid="helpid:10221"/> <statusbar:statusbaritem xlink:href=".uno:SelectionMode" statusbar:align="center" statusbar:width="30" statusbar:helpid="helpid:21185"/> - <statusbar:statusbaritem xlink:href=".uno:ExecHyperlinks" statusbar:align="center" statusbar:width="22" statusbar:helpid="helpid:21186"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="9" statusbar:helpid="helpid:5584"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/> <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="left" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="129" statusbar:helpid="helpid:10224"/> + <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/> + <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> </statusbar:statusbar> |