diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-07 13:03:58 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-06-08 01:29:32 +0200 |
commit | 5708534b942c1d0ce384f6a8473da6bb569410e7 (patch) | |
tree | 2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /sd | |
parent | 1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff) |
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned
to the value.
Idea from tml.
Used the following script to find places:
git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()'
Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969
Reviewed-on: https://gerrit.libreoffice.org/55417
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/activex-controls-tests.cxx | 35 | ||||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 1 | ||||
-rw-r--r-- | sd/qa/unit/sdmodeltestbase.hxx | 4 | ||||
-rw-r--r-- | sd/source/core/CustomAnimationEffect.cxx | 8 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptexanimations.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationPane.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/presenter/PresenterTextView.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/table/TableDesignPane.cxx | 35 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 33 |
9 files changed, 39 insertions, 96 deletions
diff --git a/sd/qa/unit/activex-controls-tests.cxx b/sd/qa/unit/activex-controls-tests.cxx index 186d9a737624..677db75a0a6c 100644 --- a/sd/qa/unit/activex-controls-tests.cxx +++ b/sd/qa/unit/activex-controls-tests.cxx @@ -97,7 +97,6 @@ void SdActiveXControlsTest::testBackgroundColor() for (size_t i = 0; i < vBackgroundColors.size(); ++i) { uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(i, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); sal_Int32 nColor; @@ -115,7 +114,6 @@ void SdActiveXControlsTest::testLabelProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sLabel; @@ -151,7 +149,6 @@ void SdActiveXControlsTest::testLabelProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Label") >>= sLabel; @@ -184,7 +181,6 @@ void SdActiveXControlsTest::testLabelProperties() // Third control has transparent background xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(false, xPropertySet->getPropertyValue("BackgroundColor") >>= nColor); @@ -198,7 +194,6 @@ void SdActiveXControlsTest::testTextBoxProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sText; @@ -257,7 +252,6 @@ void SdActiveXControlsTest::testTextBoxProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Text") >>= sText; @@ -303,7 +297,6 @@ void SdActiveXControlsTest::testTextBoxProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); // Transparent background @@ -320,7 +313,6 @@ void SdActiveXControlsTest::testTextBoxProperties() // Fourth shape has both scroll bar xControlShape.set(getShapeFromPage(3, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("HScroll") >>= bHScroll; @@ -338,7 +330,6 @@ void SdActiveXControlsTest::testSpinButtonProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); bool bEnabled; @@ -383,7 +374,6 @@ void SdActiveXControlsTest::testSpinButtonProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Enabled") >>= bEnabled; @@ -418,7 +408,6 @@ void SdActiveXControlsTest::testSpinButtonProperties() // Third control has horizontal orientation xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Orientation") >>= nOrientation; @@ -433,7 +422,6 @@ void SdActiveXControlsTest::testCommandButtonProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sLabel; @@ -465,7 +453,6 @@ void SdActiveXControlsTest::testCommandButtonProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Label") >>= sLabel; @@ -491,7 +478,6 @@ void SdActiveXControlsTest::testCommandButtonProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); // Transparent background @@ -507,7 +493,6 @@ void SdActiveXControlsTest::testScrollBarProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); bool bEnabled; @@ -559,7 +544,6 @@ void SdActiveXControlsTest::testScrollBarProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Enabled") >>= bEnabled; @@ -600,7 +584,6 @@ void SdActiveXControlsTest::testScrollBarProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Orientation") >>= nOrientation; @@ -618,7 +601,6 @@ void SdActiveXControlsTest::testCheckBoxProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sLabel; @@ -658,7 +640,6 @@ void SdActiveXControlsTest::testCheckBoxProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Label") >>= sLabel; @@ -690,7 +671,6 @@ void SdActiveXControlsTest::testCheckBoxProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("TriState") >>= bTriState; @@ -714,7 +694,6 @@ void SdActiveXControlsTest::testOptionButtonProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sLabel; @@ -750,7 +729,6 @@ void SdActiveXControlsTest::testOptionButtonProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Label") >>= sLabel; @@ -779,7 +757,6 @@ void SdActiveXControlsTest::testOptionButtonProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("State") >>= nState; @@ -800,7 +777,6 @@ void SdActiveXControlsTest::testComboBoxProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); bool bEnabled; @@ -852,7 +828,6 @@ void SdActiveXControlsTest::testComboBoxProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Enabled") >>= bEnabled; @@ -893,7 +868,6 @@ void SdActiveXControlsTest::testComboBoxProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Autocomplete") >>= bAutocomplete; @@ -917,7 +891,6 @@ void SdActiveXControlsTest::testListBoxProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); bool bEnabled; @@ -961,7 +934,6 @@ void SdActiveXControlsTest::testListBoxProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Enabled") >>= bEnabled; @@ -990,7 +962,6 @@ void SdActiveXControlsTest::testListBoxProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("MultiSelection") >>= bMultiSelection; @@ -1008,7 +979,6 @@ void SdActiveXControlsTest::testToggleButtonProperties() // First control has default properties uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OUString sLabel; @@ -1044,7 +1014,6 @@ void SdActiveXControlsTest::testToggleButtonProperties() // Second control has custom properties xControlShape.set(getShapeFromPage(1, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("Label") >>= sLabel; @@ -1073,7 +1042,6 @@ void SdActiveXControlsTest::testToggleButtonProperties() // Third shape has some other custom properties xControlShape.set(getShapeFromPage(2, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); xPropertySet->getPropertyValue("State") >>= nState; @@ -1116,7 +1084,6 @@ void SdActiveXControlsTest::testPictureProperties() for (size_t i = 0; i < vImagePositions.size(); ++i) { uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(i, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); uno::Reference<graphic::XGraphic> xGraphic; @@ -1133,7 +1100,6 @@ void SdActiveXControlsTest::testPictureProperties() for (size_t i = 0; i < 4; ++i) { uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(vImagePositions.size() + i, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OString sMessage = "The wrong control's index is: " + OString::number(i); @@ -1170,7 +1136,6 @@ void SdActiveXControlsTest::testFontProperties() for (size_t i = 0; i < 8; ++i) { uno::Reference< drawing::XControlShape > xControlShape(getShapeFromPage(i, 0, xDocShRef), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xControlShape.is()); uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); OString sMessage = "The wrong control's index is: " + OString::number(i); diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 5fdb232625ef..9e07f8be4774 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1236,7 +1236,6 @@ void SdImportTest::testPDFImportSkipImages() CPPUNIT_ASSERT_EQUAL_MESSAGE( "no exactly one shape", static_cast<sal_Int32>(1), xPage->getCount() ); uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW ); - CPPUNIT_ASSERT_MESSAGE( "failed to load shape", xShape.is() ); uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() ); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index a51bc3c260a1..6a6af6ea7cdf 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -237,9 +237,7 @@ protected: CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() ); uno::Reference<frame::XModel> xTempModel(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xTempModel.is()); uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier (xTempModel, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDrawPagesSupplier.is()); uno::Reference< drawing::XDrawPages > xDrawPages = xDrawPagesSupplier->getDrawPages(); CPPUNIT_ASSERT(xDrawPages.is()); @@ -282,7 +280,6 @@ protected: { uno::Reference< drawing::XDrawPagesSupplier > xDoc ( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); - CPPUNIT_ASSERT_MESSAGE( "no document", xDoc.is() ); return xDoc; } @@ -290,7 +287,6 @@ protected: { uno::Reference< drawing::XDrawPagesSupplier > xDoc( getDoc( xDocShRef ) ); uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex( nPage ), uno::UNO_QUERY_THROW ); - CPPUNIT_ASSERT_MESSAGE( "no page", xPage.is() ); return xPage; } diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 0b18595be1de..bba621dbab1e 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -2021,12 +2021,8 @@ void stl_process_after_effect_node_func(AfterEffectNode const & rNode) xNextContainer.set( ParallelTimeContainer::create( xContext ), UNO_QUERY_THROW ); - DBG_ASSERT( xNextContainer.is(), "ppt::stl_process_after_effect_node_func::operator(), could not create container!" ); - if( xNextContainer.is() ) - { - xNextContainer->setBegin( makeAny( 0.0 ) ); - xNewClickContainer->appendChild( xNextContainer ); - } + xNextContainer->setBegin( makeAny( 0.0 ) ); + xNewClickContainer->appendChild( xNextContainer ); } if( xNextContainer.is() ) diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index a861b162f32c..169dc83c202e 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -1275,7 +1275,7 @@ void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnim // taking the first child Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW ); Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW ); - if ( xE.is() && xE->hasMoreElements() ) + if ( xE->hasMoreElements() ) { Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY ); aAny = xClickNode->getBegin(); diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index e7f8c553d6a2..cca48273915f 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -859,12 +859,9 @@ void CustomAnimationPane::onSelectionChanged() if( mxView.is() ) try { Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW ); - if (xSel.is()) - { - maViewSelection = xSel->getSelection(); - mpCustomAnimationList->onSelectionChanged( maViewSelection ); - updateControls(); - } + maViewSelection = xSel->getSelection(); + mpCustomAnimationList->onSelectionChanged( maViewSelection ); + updateControls(); } catch( Exception& ) { diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx index 42406d994f55..a1b7ca35ba8f 100644 --- a/sd/source/ui/presenter/PresenterTextView.cxx +++ b/sd/source/ui/presenter/PresenterTextView.cxx @@ -123,12 +123,8 @@ void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments) } Reference<rendering::XCanvas> xCanvas (rArguments[0], UNO_QUERY_THROW); - if (xCanvas.is()) - { - mpImplementation->SetCanvas( - cppcanvas::VCLFactory::createCanvas(xCanvas)); - } - + mpImplementation->SetCanvas( + cppcanvas::VCLFactory::createCanvas(xCanvas)); } Any PresenterTextView::GetPropertyValue (const OUString& rsPropertyName) diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 23a8dd2499e4..a752b7407a70 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -246,27 +246,24 @@ void TableDesignWidget::onSelectionChanged() if( mxView.is() ) try { Reference< XSelectionSupplier > xSel( mxView, UNO_QUERY_THROW ); - if (xSel.is()) + Any aSel( xSel->getSelection() ); + Sequence< XShape > xShapeSeq; + if( aSel >>= xShapeSeq ) { - Any aSel( xSel->getSelection() ); - Sequence< XShape > xShapeSeq; - if( aSel >>= xShapeSeq ) - { - if( xShapeSeq.getLength() == 1 ) - aSel <<= xShapeSeq[0]; - } - else - { - Reference< XShapes > xShapes( aSel, UNO_QUERY ); - if( xShapes.is() && (xShapes->getCount() == 1) ) - aSel = xShapes->getByIndex(0); - } + if( xShapeSeq.getLength() == 1 ) + aSel <<= xShapeSeq[0]; + } + else + { + Reference< XShapes > xShapes( aSel, UNO_QUERY ); + if( xShapes.is() && (xShapes->getCount() == 1) ) + aSel = xShapes->getByIndex(0); + } - Reference< XShapeDescriptor > xDesc( aSel, UNO_QUERY ); - if( xDesc.is() && ( xDesc->getShapeType() == "com.sun.star.drawing.TableShape" || xDesc->getShapeType() == "com.sun.star.presentation.TableShape" ) ) - { - xNewSelection.set( xDesc, UNO_QUERY ); - } + Reference< XShapeDescriptor > xDesc( aSel, UNO_QUERY ); + if( xDesc.is() && ( xDesc->getShapeType() == "com.sun.star.drawing.TableShape" || xDesc->getShapeType() == "com.sun.star.presentation.TableShape" ) ) + { + xNewSelection.set( xDesc, UNO_QUERY ); } } catch( Exception& ) diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index b612cc66ce46..8749fa94d287 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2809,29 +2809,26 @@ void SdMasterPage::setBackground( const Any& rValue ) { Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW ); Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ; - if( xFamily.is() ) - { - OUString aStyleName(sUNO_PseudoSheet_Background); + OUString aStyleName(sUNO_PseudoSheet_Background); - Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW ); + Reference< beans::XPropertySet > xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW ); - Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW ); - Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); + Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW ); + Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); - PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries(); - PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin(); - while( aIt != aBackgroundProperties.end() ) + PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries(); + PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin(); + while( aIt != aBackgroundProperties.end() ) + { + if( xSetInfo->hasPropertyByName( aIt->sName ) ) { - if( xSetInfo->hasPropertyByName( aIt->sName ) ) - { - if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE ) - xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) ); - else - xSetStates->setPropertyToDefault( aIt->sName ); - } - - ++aIt; + if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE ) + xStyleSet->setPropertyValue( aIt->sName, xInputSet->getPropertyValue( aIt->sName ) ); + else + xSetStates->setPropertyToDefault( aIt->sName ); } + + ++aIt; } } else |