diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-13 09:31:00 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-13 09:31:00 +0000 |
commit | 608c587a7521c5126f0fddb623204721be6d91e5 (patch) | |
tree | d437f2fe5c539f620ee90a0415209128261af61b | |
parent | 3dc801ce9c8d4325413ee1fff48bc5eef76208ea (diff) |
CWS-TOOLING: integrate CWS sjfixes12_DEV300
-rw-r--r-- | svx/source/accessibility/ChildrenManagerImpl.cxx | 136 | ||||
-rw-r--r-- | svx/source/accessibility/ChildrenManagerImpl.hxx | 21 | ||||
-rw-r--r-- | svx/source/svdraw/svdfppt.cxx | 10 |
3 files changed, 116 insertions, 51 deletions
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 5a088faca934..ff5555184c87 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -77,7 +77,8 @@ ChildrenManagerImpl::ChildrenManagerImpl ( mxParent (rxParent), maShapeTreeInfo (rShapeTreeInfo), mrContext (rContext), - mnNewNameIndex(1) + mnNewNameIndex(1), + mpFocusedShape(NULL) { } @@ -96,11 +97,17 @@ ChildrenManagerImpl::~ChildrenManagerImpl (void) void ChildrenManagerImpl::Init (void) { // Register as view::XSelectionChangeListener. + Reference<frame::XController> xController(maShapeTreeInfo.GetController()); Reference<view::XSelectionSupplier> xSelectionSupplier ( - maShapeTreeInfo.GetController(), uno::UNO_QUERY); + xController, uno::UNO_QUERY); if (xSelectionSupplier.is()) + { + xController->addEventListener( + static_cast<document::XEventListener*>(this)); + xSelectionSupplier->addSelectionChangeListener ( static_cast<view::XSelectionChangeListener*>(this)); + } // Register at model as document::XEventListener. if (maShapeTreeInfo.GetModelBroadcaster().is()) @@ -217,26 +224,46 @@ void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand) Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea(); // 1. Create a local list of visible shapes. - ChildDescriptorListType aNewChildList; - CreateListOfVisibleShapes (aNewChildList); + ChildDescriptorListType aChildList; + CreateListOfVisibleShapes (aChildList); - // 2. Find all shapes in the current list that are not in the new list, - // send appropriate events and remove the accessible shape. - RemoveNonVisibleChildren (aNewChildList); - - // 3. Merge the information that is already known about the visible + // 2. Merge the information that is already known about the visible // shapes from the current list into the new list. - MergeAccessibilityInformation (aNewChildList); + MergeAccessibilityInformation (aChildList); - // 4. Replace the current list of visible shapes with the new one. Do + // 3. Replace the current list of visible shapes with the new one. Do // the same with the visible area. { ::osl::MutexGuard aGuard (maMutex); - adjustIndexInParentOfShapes(aNewChildList); + adjustIndexInParentOfShapes(aChildList); // Use swap to copy the contents of the new list in constant time. - maVisibleChildren.swap (aNewChildList); - aNewChildList.clear(); + maVisibleChildren.swap (aChildList); + + // aChildList now contains all the old children, while maVisibleChildren + // contains all the current children + + // 4. Find all shapes in the old list that are not in the current list, + // send appropriate events and remove the accessible shape. + // + // Do this *after* we have set our new list of children, because + // removing a child may cause + // + // ChildDescriptor::disposeAccessibleObject --> + // AccessibleContextBase::CommitChange --> + // AtkListener::notifyEvent -> + // AtkListener::handleChildRemoved -> + // AtkListener::updateChildList + // AccessibleDrawDocumentView::getAccessibleChildCount -> + // ChildrenManagerImpl::GetChildCount -> + // maVisibleChildren.size() + // + // to be fired, and so the operations will take place on + // the list we are trying to replace + // + RemoveNonVisibleChildren (maVisibleChildren, aChildList); + + aChildList.clear(); maVisibleArea = aVisibleArea; } @@ -318,15 +345,16 @@ void ChildrenManagerImpl::CreateListOfVisibleShapes ( void ChildrenManagerImpl::RemoveNonVisibleChildren ( - ChildDescriptorListType& raNewChildList) + const ChildDescriptorListType& rNewChildList, + ChildDescriptorListType& rOldChildList) { // Iterate over list of formerly visible children and remove those that // are not visible anymore, i.e. member of the new list of visible // children. - ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end(); - for (I=maVisibleChildren.begin(); I != aEnd; ++I) + ChildDescriptorListType::iterator I, aEnd = rOldChildList.end(); + for (I=rOldChildList.begin(); I != aEnd; ++I) { - if (::std::find(raNewChildList.begin(), raNewChildList.end(), *I) == raNewChildList.end()) + if (::std::find(rNewChildList.begin(), rNewChildList.end(), *I) == rNewChildList.end()) { // The child is disposed when there is a UNO shape from which // the accessible shape can be created when the shape becomes @@ -573,12 +601,14 @@ void ChildrenManagerImpl::SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo { // Remember the current broadcasters and exchange the shape tree info. Reference<document::XEventBroadcaster> xCurrentBroadcaster; + Reference<frame::XController> xCurrentController; Reference<view::XSelectionSupplier> xCurrentSelectionSupplier; { ::osl::MutexGuard aGuard (maMutex); xCurrentBroadcaster = maShapeTreeInfo.GetModelBroadcaster(); + xCurrentController = maShapeTreeInfo.GetController(); xCurrentSelectionSupplier = Reference<view::XSelectionSupplier> ( - maShapeTreeInfo.GetController(), uno::UNO_QUERY); + xCurrentController, uno::UNO_QUERY); maShapeTreeInfo = rShapeTreeInfo; } @@ -597,19 +627,30 @@ void ChildrenManagerImpl::SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo } // Move registration to new selection supplier. + Reference<frame::XController> xNewController(maShapeTreeInfo.GetController()); Reference<view::XSelectionSupplier> xNewSelectionSupplier ( - maShapeTreeInfo.GetController(), uno::UNO_QUERY); + xNewController, uno::UNO_QUERY); if (xNewSelectionSupplier != xCurrentSelectionSupplier) { // Register at new broadcaster. if (xNewSelectionSupplier.is()) + { + xNewController->addEventListener( + static_cast<document::XEventListener*>(this)); + xNewSelectionSupplier->addSelectionChangeListener ( static_cast<view::XSelectionChangeListener*>(this)); + } // Unregister at old broadcaster. if (xCurrentSelectionSupplier.is()) + { xCurrentSelectionSupplier->removeSelectionChangeListener ( static_cast<view::XSelectionChangeListener*>(this)); + + xCurrentController->removeEventListener( + static_cast<document::XEventListener*>(this)); + } } } @@ -622,20 +663,10 @@ void SAL_CALL ChildrenManagerImpl::disposing (const lang::EventObject& rEventObject) throw (uno::RuntimeException) { - if (rEventObject.Source == maShapeTreeInfo.GetModelBroadcaster()) - { - maShapeTreeInfo.SetModelBroadcaster (NULL); - // The disposing of a model should be handled elsewhere. But to be - // on the safe side we remove all of our children. - ClearAccessibleShapeList (); - SetShapeList (NULL); - } - - else if (rEventObject.Source - == Reference<view::XSelectionSupplier> ( - maShapeTreeInfo.GetController(), uno::UNO_QUERY)) + if (rEventObject.Source == maShapeTreeInfo.GetModelBroadcaster() + || rEventObject.Source == maShapeTreeInfo.GetController()) { - maShapeTreeInfo.SetController (NULL); + impl_dispose(); } // Handle disposing UNO shapes. @@ -696,27 +727,54 @@ void SAL_CALL -void SAL_CALL ChildrenManagerImpl::disposing (void) +void ChildrenManagerImpl::impl_dispose (void) { + Reference<frame::XController> xController(maShapeTreeInfo.GetController()); + // Remove from broadcasters. try { - // Remove from broadcasters. Reference<view::XSelectionSupplier> xSelectionSupplier ( - maShapeTreeInfo.GetController(), uno::UNO_QUERY); + xController, uno::UNO_QUERY); if (xSelectionSupplier.is()) + { xSelectionSupplier->removeSelectionChangeListener ( static_cast<view::XSelectionChangeListener*>(this)); + } + } + catch( uno::RuntimeException&) + {} + + try + { + if (xController.is()) + xController->removeEventListener( + static_cast<document::XEventListener*>(this)); + } + catch( uno::RuntimeException&) + {} + + maShapeTreeInfo.SetController (NULL); + try + { + // Remove from broadcaster. if (maShapeTreeInfo.GetModelBroadcaster().is()) maShapeTreeInfo.GetModelBroadcaster()->removeEventListener ( static_cast<document::XEventListener*>(this)); + maShapeTreeInfo.SetModelBroadcaster (NULL); } catch( uno::RuntimeException& ) - { - // our XSelectionSupplier may be already disposed - } + {} ClearAccessibleShapeList (); + SetShapeList (NULL); +} + + + +void SAL_CALL ChildrenManagerImpl::disposing (void) +{ + impl_dispose(); } diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx index 7f2c0f52b45c..77dd60808dc2 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.hxx +++ b/svx/source/accessibility/ChildrenManagerImpl.hxx @@ -378,6 +378,8 @@ protected: ::com::sun::star::accessibility::XAccessible>& xChild) const throw (::com::sun::star::uno::RuntimeException); + void impl_dispose (void); + private: /** Names of new accessible objects are disambiguated with this index. It gets increased every time a new object is created and (at the @@ -406,14 +408,19 @@ private: */ void CreateListOfVisibleShapes (ChildDescriptorListType& raChildList); - /** From the internal list of (former) visible shapes remove those that - are not member of the given list. Send appropriate events for every + /** From the old list of (former) visible shapes remove those that + are not member of the new list. Send appropriate events for every such shape. - @param raChildList - The new list of visible children against which the internal one + @param raNewChildList + The new list of visible children against which the old one + is compared. + @param raOldChildList + The old list of visible children against which the new one is compared. */ - void RemoveNonVisibleChildren (ChildDescriptorListType& raChildList); + void RemoveNonVisibleChildren ( + const ChildDescriptorListType& raNewChildList, + ChildDescriptorListType& raOldChildList); /** Merge the information that is already known about the visible shapes from the current list into the new list. @@ -548,7 +555,7 @@ public: descriptor may be based on a UNO shape or, already, on an accessible shape. */ - inline bool operator == (const ChildDescriptor& aDescriptor) + inline bool operator == (const ChildDescriptor& aDescriptor) const { return ( this == &aDescriptor || @@ -563,7 +570,7 @@ public: to put child descriptors in some STL containers. The ordering itself is not so important, its 'features' are not used. */ - inline bool operator < (const ChildDescriptor& aDescriptor) + inline bool operator < (const ChildDescriptor& aDescriptor) const { return (mxShape.get() < aDescriptor.mxShape.get()); } diff --git a/svx/source/svdraw/svdfppt.cxx b/svx/source/svdraw/svdfppt.cxx index 3328ce5a3d8a..32bc5ecca46f 100644 --- a/svx/source/svdraw/svdfppt.cxx +++ b/svx/source/svdraw/svdfppt.cxx @@ -5248,11 +5248,6 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo rIn >> aSet.mnFontHeight; aSet.mnAttrSet |= 1 << PPT_CharAttr_FontHeight; } - if ( nMask & 0x80000 ) // cfPosition - { - rIn >> aSet.mnEscapement; - aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement; - } if ( nMask & 0x40000 ) // cfColor { sal_uInt32 nVal; @@ -5262,6 +5257,11 @@ PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImpo aSet.mnColor = nVal; aSet.mnAttrSet |= 1 << PPT_CharAttr_FontColor; } + if ( nMask & 0x80000 ) // cfPosition + { + rIn >> aSet.mnEscapement; + aSet.mnAttrSet |= 1 << PPT_CharAttr_Escapement; + } if ( nExtParaPos ) { sal_uInt32 nExtBuInd = nMask & 0x3c00; |