diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 12:18:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-06 13:32:08 +0200 |
commit | feafbaa0372705be3f4cc4616983fb8641a81d44 (patch) | |
tree | 53ea3273f875e18735bee4c44dda126ed73b1e59 /svx | |
parent | 73993fdb5d4b507694cd0edf80887d19f7e2bf9a (diff) |
loplugin:flatten in svx
Change-Id: If6154c1d464558c616a3593ed74fa6606458c9ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100230
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/ClassificationDialog.cxx | 82 | ||||
-rw-r--r-- | svx/source/dialog/_bmpmask.cxx | 38 | ||||
-rw-r--r-- | svx/source/dialog/charmap.cxx | 26 | ||||
-rw-r--r-- | svx/source/dialog/dlgctl3d.cxx | 226 | ||||
-rw-r--r-- | svx/source/dialog/fontwork.cxx | 106 | ||||
-rw-r--r-- | svx/source/dialog/frmsel.cxx | 58 | ||||
-rw-r--r-- | svx/source/dialog/imapdlg.cxx | 32 | ||||
-rw-r--r-- | svx/source/dialog/imapwnd.cxx | 226 | ||||
-rw-r--r-- | svx/source/dialog/optgrid.cxx | 39 | ||||
-rw-r--r-- | svx/source/dialog/pagectrl.cxx | 112 | ||||
-rw-r--r-- | svx/source/dialog/relfld.cxx | 44 | ||||
-rw-r--r-- | svx/source/dialog/rubydialog.cxx | 135 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 180 | ||||
-rw-r--r-- | svx/source/dialog/svxruler.cxx | 120 |
14 files changed, 711 insertions, 713 deletions
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx index 25144cc8e4a6..a23e56029bf8 100644 --- a/svx/source/dialog/ClassificationDialog.cxx +++ b/svx/source/dialog/ClassificationDialog.cxx @@ -311,62 +311,62 @@ void ClassificationDialog::readRecentlyUsed() if (!aWalker.open(&aFileStream)) return; - if (aWalker.name() == "recentlyUsedClassifications") + if (aWalker.name() != "recentlyUsedClassifications") + return; + + aWalker.children(); + while (aWalker.isValid()) { - aWalker.children(); - while (aWalker.isValid()) + if (aWalker.name() == "elementGroup") { - if (aWalker.name() == "elementGroup") - { - std::vector<ClassificationResult> aResults; + std::vector<ClassificationResult> aResults; - aWalker.children(); + aWalker.children(); - while (aWalker.isValid()) + while (aWalker.isValid()) + { + if (aWalker.name() == "element") { - if (aWalker.name() == "element") + svx::ClassificationType eType = svx::ClassificationType::TEXT; + OUString sString; + OUString sAbbreviatedString; + OUString sIdentifier; + + // Convert string to classification type, but continue only if + // conversion was successful. + if (stringToClassificationType(aWalker.attribute("type"), eType)) { - svx::ClassificationType eType = svx::ClassificationType::TEXT; - OUString sString; - OUString sAbbreviatedString; - OUString sIdentifier; - - // Convert string to classification type, but continue only if - // conversion was successful. - if (stringToClassificationType(aWalker.attribute("type"), eType)) - { - aWalker.children(); + aWalker.children(); - while (aWalker.isValid()) + while (aWalker.isValid()) + { + if (aWalker.name() == "string") { - if (aWalker.name() == "string") - { - sString = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); - } - else if (aWalker.name() == "abbreviatedString") - { - sAbbreviatedString = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); - } - else if (aWalker.name() == "identifier") - { - sIdentifier = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); - } - aWalker.next(); + sString = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); } - aWalker.parent(); - - aResults.push_back({ eType, sString, sAbbreviatedString, sIdentifier }); + else if (aWalker.name() == "abbreviatedString") + { + sAbbreviatedString = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); + } + else if (aWalker.name() == "identifier") + { + sIdentifier = OStringToOUString(aWalker.content(), RTL_TEXTENCODING_UTF8); + } + aWalker.next(); } + aWalker.parent(); + + aResults.push_back({ eType, sString, sAbbreviatedString, sIdentifier }); } - aWalker.next(); } - aWalker.parent(); - m_aRecentlyUsedValuesCollection.push_back(aResults); + aWalker.next(); } - aWalker.next(); + aWalker.parent(); + m_aRecentlyUsedValuesCollection.push_back(aResults); } - aWalker.parent(); + aWalker.next(); } + aWalker.parent(); } void ClassificationDialog::writeRecentlyUsed() diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 05957ba376c3..52cd4f2ae79b 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -209,25 +209,25 @@ IMPL_LINK( MaskData, CbxHdl, weld::ToggleButton&, rCbx, void ) pMask->m_xBtnExec->set_sensitive(false); // When a checkbox is checked, the pipette is enabled - if ( rCbx.get_active() ) - { - MaskSet* pSet = nullptr; - - if (&rCbx == pMask->m_xCbx1.get()) - pSet = pMask->m_xQSet1.get(); - else if (&rCbx == pMask->m_xCbx2.get()) - pSet = pMask->m_xQSet2.get(); - else if (&rCbx == pMask->m_xCbx3.get()) - pSet = pMask->m_xQSet3.get(); - else // if ( &rCbx == pMask->m_xCbx4 ) - pSet = pMask->m_xQSet4.get(); - - pSet->SelectItem( 1 ); - pSet->Select(); - - pMask->m_xTbxPipette->set_item_active("pipette", true); - PipetteHdl("pipette"); - } + if ( !rCbx.get_active() ) + return; + + MaskSet* pSet = nullptr; + + if (&rCbx == pMask->m_xCbx1.get()) + pSet = pMask->m_xQSet1.get(); + else if (&rCbx == pMask->m_xCbx2.get()) + pSet = pMask->m_xQSet2.get(); + else if (&rCbx == pMask->m_xCbx3.get()) + pSet = pMask->m_xQSet3.get(); + else // if ( &rCbx == pMask->m_xCbx4 ) + pSet = pMask->m_xQSet4.get(); + + pSet->SelectItem( 1 ); + pSet->Select(); + + pMask->m_xTbxPipette->set_item_active("pipette", true); + PipetteHdl("pipette"); } IMPL_LINK( MaskData, CbxTransHdl, weld::ToggleButton&, rCbx, void ) diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index c43cafb9eb55..5ad20c80ba00 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -259,21 +259,21 @@ void SvxShowCharSet::CopyToClipboard(const OUString& rOUStr) css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard = css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext()); - if (xClipboard.is()) - { - TETextDataObject* pDataObj = new TETextDataObject(rOUStr); + if (!xClipboard.is()) + return; - try - { - xClipboard->setContents( pDataObj, nullptr ); + TETextDataObject* pDataObj = new TETextDataObject(rOUStr); - css::uno::Reference<css::datatransfer::clipboard::XFlushableClipboard> xFlushableClipboard(xClipboard, css::uno::UNO_QUERY); - if( xFlushableClipboard.is() ) - xFlushableClipboard->flushClipboard(); - } - catch( const css::uno::Exception& ) - { - } + try + { + xClipboard->setContents( pDataObj, nullptr ); + + css::uno::Reference<css::datatransfer::clipboard::XFlushableClipboard> xFlushableClipboard(xClipboard, css::uno::UNO_QUERY); + if( xFlushableClipboard.is() ) + xFlushableClipboard->flushClipboard(); + } + catch( const css::uno::Exception& ) + { } } diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index fd96aaf68df0..7eb7e07f9f9a 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -177,51 +177,51 @@ bool Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt) void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType) { - if( mnObjectType != nType || !mp3DObj) - { - SfxItemSet aSet(mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{}); - mnObjectType = nType; + if(mnObjectType == nType && mp3DObj) + return; - if( mp3DObj ) - { - aSet.Put(mp3DObj->GetMergedItemSet()); - mpScene->RemoveObject( mp3DObj->GetOrdNum() ); - // always use SdrObject::Free(...) for SdrObjects (!) - SdrObject* pTemp(mp3DObj); - SdrObject::Free(pTemp); - } + SfxItemSet aSet(mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{}); + mnObjectType = nType; - switch( nType ) - { - case SvxPreviewObjectType::SPHERE: - { - mp3DObj = new E3dSphereObj( - *mpModel, - mp3DView->Get3DDefaultAttributes(), - basegfx::B3DPoint( 0, 0, 0 ), - basegfx::B3DVector( 5000, 5000, 5000 )); - } - break; + if( mp3DObj ) + { + aSet.Put(mp3DObj->GetMergedItemSet()); + mpScene->RemoveObject( mp3DObj->GetOrdNum() ); + // always use SdrObject::Free(...) for SdrObjects (!) + SdrObject* pTemp(mp3DObj); + SdrObject::Free(pTemp); + } - case SvxPreviewObjectType::CUBE: - { - mp3DObj = new E3dCubeObj( - *mpModel, - mp3DView->Get3DDefaultAttributes(), - basegfx::B3DPoint( -2500, -2500, -2500 ), - basegfx::B3DVector( 5000, 5000, 5000 )); - } - break; + switch( nType ) + { + case SvxPreviewObjectType::SPHERE: + { + mp3DObj = new E3dSphereObj( + *mpModel, + mp3DView->Get3DDefaultAttributes(), + basegfx::B3DPoint( 0, 0, 0 ), + basegfx::B3DVector( 5000, 5000, 5000 )); } + break; - if (mp3DObj) + case SvxPreviewObjectType::CUBE: { - mpScene->InsertObject( mp3DObj ); - mp3DObj->SetMergedItemSet(aSet); + mp3DObj = new E3dCubeObj( + *mpModel, + mp3DView->Get3DDefaultAttributes(), + basegfx::B3DPoint( -2500, -2500, -2500 ), + basegfx::B3DVector( 5000, 5000, 5000 )); } + break; + } - Invalidate(); + if (mp3DObj) + { + mpScene->InsertObject( mp3DObj ); + mp3DObj->SetMergedItemSet(aSet); } + + Invalidate(); } SfxItemSet const & Svx3DPreviewControl::Get3DAttributes() const @@ -461,65 +461,65 @@ void Svx3DLightControl::AdaptToSelectedLight() void Svx3DLightControl::TrySelection(Point aPosPixel) { - if(mpScene) + if(!mpScene) + return; + + const Point aPosLogic(GetDrawingArea()->get_ref_device().PixelToLogic(aPosPixel)); + const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y()); + std::vector< const E3dCompoundObject* > aResult; + getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult); + + if(aResult.empty()) + return; + + // exclude expansion object which will be part of + // the hits. It's invisible, but for HitTest, it's included + const E3dCompoundObject* pResult = nullptr; + + for(auto const & b: aResult) { - const Point aPosLogic(GetDrawingArea()->get_ref_device().PixelToLogic(aPosPixel)); - const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y()); - std::vector< const E3dCompoundObject* > aResult; - getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult); + if(b && b != mpExpansionObject) + { + pResult = b; + break; + } + } - if(!aResult.empty()) + if(pResult == mp3DObj) + { + if(!mbGeometrySelected) { - // exclude expansion object which will be part of - // the hits. It's invisible, but for HitTest, it's included - const E3dCompoundObject* pResult = nullptr; + mbGeometrySelected = true; + maSelectedLight = NO_LIGHT_SELECTED; + ConstructLightObjects(); + AdaptToSelectedLight(); + Invalidate(); - for(auto const & b: aResult) + if(maSelectionChangeCallback.IsSet()) { - if(b && b != mpExpansionObject) - { - pResult = b; - break; - } + maSelectionChangeCallback.Call(this); } + } + } + else + { + sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED); - if(pResult == mp3DObj) + for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++) + { + if(maLightObjects[a] && maLightObjects[a] == pResult) { - if(!mbGeometrySelected) - { - mbGeometrySelected = true; - maSelectedLight = NO_LIGHT_SELECTED; - ConstructLightObjects(); - AdaptToSelectedLight(); - Invalidate(); - - if(maSelectionChangeCallback.IsSet()) - { - maSelectionChangeCallback.Call(this); - } - } + aNewSelectedLight = a; } - else - { - sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED); - - for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++) - { - if(maLightObjects[a] && maLightObjects[a] == pResult) - { - aNewSelectedLight = a; - } - } + } - if(aNewSelectedLight != maSelectedLight) - { - SelectLight(aNewSelectedLight); + if(aNewSelectedLight != maSelectedLight) + { + SelectLight(aNewSelectedLight); - if(maSelectionChangeCallback.IsSet()) - { - maSelectionChangeCallback.Call(this); - } - } + if(maSelectionChangeCallback.IsSet()) + { + maSelectionChangeCallback.Call(this); } } } @@ -761,44 +761,44 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) Invalidate(); } } - if(IsGeometrySelected()) - { - if(mfRotateX != fVer || mfRotateY != fHor) - { - mfRotateX = basegfx::deg2rad(fVer); - mfRotateY = basegfx::deg2rad(fHor); + if(!IsGeometrySelected()) + return; - if(mp3DObj) - { - basegfx::B3DHomMatrix aObjectRotation; - aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ); - mp3DObj->SetTransform(aObjectRotation); + if(mfRotateX == fVer && mfRotateY == fHor) + return; - Invalidate(); - } - } + mfRotateX = basegfx::deg2rad(fVer); + mfRotateY = basegfx::deg2rad(fHor); + + if(mp3DObj) + { + basegfx::B3DHomMatrix aObjectRotation; + aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ); + mp3DObj->SetTransform(aObjectRotation); + + Invalidate(); } } void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ) { - if(IsGeometrySelected()) - { - if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ) - { - mfRotateX = fRotX; - mfRotateY = fRotY; - mfRotateZ = fRotZ; + if(!IsGeometrySelected()) + return; - if(mp3DObj) - { - basegfx::B3DHomMatrix aObjectRotation; - aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ); - mp3DObj->SetTransform(aObjectRotation); + if(fRotX == mfRotateX && fRotY == mfRotateY && fRotZ == mfRotateZ) + return; - Invalidate(); - } - } + mfRotateX = fRotX; + mfRotateY = fRotY; + mfRotateZ = fRotZ; + + if(mp3DObj) + { + basegfx::B3DHomMatrix aObjectRotation; + aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ); + mp3DObj->SetTransform(aObjectRotation); + + Invalidate(); } } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 33fd244bebae..6531ffc1b50e 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -553,49 +553,49 @@ void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pIte // Enter X-value for shadow in edit field void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem) { - if (pItem && !m_xMtrFldShadowX->has_focus()) - { - // #i19251# - // sal_Int32 nValue = pItem->GetValue(); + if (!pItem || m_xMtrFldShadowX->has_focus()) + return; + // #i19251# + // sal_Int32 nValue = pItem->GetValue(); + + // #i19251# + // The two involved fields/items are used double and contain/give different + // values regarding to the access method. Thus, here we need to separate the access + // methods regarding to the kind of value accessed. + if (m_xTbxShadow->get_item_active("slant")) + { // #i19251# - // The two involved fields/items are used double and contain/give different - // values regarding to the access method. Thus, here we need to separate the access - // methods regarding to the kind of value accessed. - if (m_xTbxShadow->get_item_active("slant")) - { - // #i19251# - // There is no value correction necessary at all, i think this - // was only tried to be done without understanding that the two - // involved fields/items are used double and contain/give different - // values regarding to the access method. - // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 ); - m_xMtrFldShadowX->set_value(pItem->GetValue(), FieldUnit::NONE); - } - else - { - SetMetricValue(*m_xMtrFldShadowX, pItem->GetValue(), MapUnit::Map100thMM); - } + // There is no value correction necessary at all, i think this + // was only tried to be done without understanding that the two + // involved fields/items are used double and contain/give different + // values regarding to the access method. + // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 ); + m_xMtrFldShadowX->set_value(pItem->GetValue(), FieldUnit::NONE); + } + else + { + SetMetricValue(*m_xMtrFldShadowX, pItem->GetValue(), MapUnit::Map100thMM); } } // Enter Y-value for shadow in edit field void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem) { - if (pItem && !m_xMtrFldShadowY->has_focus()) + if (!pItem || m_xMtrFldShadowY->has_focus()) + return; + + // #i19251# + // The two involved fields/items are used double and contain/give different + // values regarding to the access method. Thus, here we need to separate the access + // methods regarding to the kind of value accessed. + if (m_xTbxShadow->get_item_active("slant")) { - // #i19251# - // The two involved fields/items are used double and contain/give different - // values regarding to the access method. Thus, here we need to separate the access - // methods regarding to the kind of value accessed. - if (m_xTbxShadow->get_item_active("slant")) - { - m_xMtrFldShadowY->set_value(pItem->GetValue(), FieldUnit::NONE); - } - else - { - SetMetricValue(*m_xMtrFldShadowY, pItem->GetValue(), MapUnit::Map100thMM); - } + m_xMtrFldShadowY->set_value(pItem->GetValue(), FieldUnit::NONE); + } + else + { + SetMetricValue(*m_xMtrFldShadowY, pItem->GetValue(), MapUnit::Map100thMM); } } @@ -606,25 +606,25 @@ IMPL_LINK(SvxFontWorkDialog, SelectStyleHdl_Impl, const OString&, rId, void) // override the toolbox behaviour of unchecking the item after second // click on it: One of the items has to be checked at all times (when // enabled that is.) - if (rId == "off" || rId != m_sLastStyleTbxId) - { - XFormTextStyle eStyle = XFormTextStyle::NONE; - - if (rId == "rotate") - eStyle = XFormTextStyle::Rotate; - else if (rId == "upright") - eStyle = XFormTextStyle::Upright; - else if (rId == "hori") - eStyle = XFormTextStyle::SlantX; - else if (rId == "vert") - eStyle = XFormTextStyle::SlantY; - - XFormTextStyleItem aItem( eStyle ); - GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_STYLE, - SfxCallMode::RECORD, { &aItem }); - SetStyle_Impl( &aItem ); - m_sLastStyleTbxId = rId; - } + if (rId != "off" && rId == m_sLastStyleTbxId) + return; + + XFormTextStyle eStyle = XFormTextStyle::NONE; + + if (rId == "rotate") + eStyle = XFormTextStyle::Rotate; + else if (rId == "upright") + eStyle = XFormTextStyle::Upright; + else if (rId == "hori") + eStyle = XFormTextStyle::SlantX; + else if (rId == "vert") + eStyle = XFormTextStyle::SlantY; + + XFormTextStyleItem aItem( eStyle ); + GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_STYLE, + SfxCallMode::RECORD, { &aItem }); + SetStyle_Impl( &aItem ); + m_sLastStyleTbxId = rId; } IMPL_LINK(SvxFontWorkDialog, SelectAdjustHdl_Impl, const OString&, rId, void) diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 8fb2b8cabd10..80f56b47940e 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -465,39 +465,39 @@ void FrameSelectorImpl::InitBorderGeometry() maBottom.AddClickRect( tools::Rectangle( mnLine1 - nClO, mnLine3 - nClH, mnLine3 + nClO, mnLine3 + nClO ) ); /* Diagonal frame borders use the remaining space between outer and inner frame borders. */ - if( mbTLBR || mbBLTR ) + if( !(mbTLBR || mbBLTR) ) + return; + + for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol ) { - for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol ) + for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) { - for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow ) + // the usable area between horizontal/vertical frame borders of current quadrant + const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true )); + const tools::Rectangle aRect( + basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1, + basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1); + + /* Both diagonal frame borders enabled. */ + if( mbTLBR && mbBLTR ) { - // the usable area between horizontal/vertical frame borders of current quadrant - const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow, true )); - const tools::Rectangle aRect( - basegfx::fround(aCellRange.getMinX()) + nClV + 1, basegfx::fround(aCellRange.getMinY()) + nClH + 1, - basegfx::fround(aCellRange.getMaxX()) - nClV + 1, basegfx::fround(aCellRange.getMaxY()) - nClH + 1); - - /* Both diagonal frame borders enabled. */ - if( mbTLBR && mbBLTR ) - { - // single areas - Point aMid( aRect.Center() ); - maTLBR.AddClickRect( tools::Rectangle( aRect.TopLeft(), aMid ) ); - maTLBR.AddClickRect( tools::Rectangle( aMid + Point( 1, 1 ), aRect.BottomRight() ) ); - maBLTR.AddClickRect( tools::Rectangle( aRect.Left(), aMid.Y() + 1, aMid.X(), aRect.Bottom() ) ); - maBLTR.AddClickRect( tools::Rectangle( aMid.X() + 1, aRect.Top(), aRect.Right(), aMid.Y() ) ); - // centered rectangle for both frame borders - tools::Rectangle aMidRect( aRect.TopLeft(), Size( aRect.GetWidth() / 3, aRect.GetHeight() / 3 ) ); - aMidRect.Move( (aRect.GetWidth() - aMidRect.GetWidth()) / 2, (aRect.GetHeight() - aMidRect.GetHeight()) / 2 ); - maTLBR.AddClickRect( aMidRect ); - maBLTR.AddClickRect( aMidRect ); - } - /* One of the diagonal frame borders enabled - use entire rectangle. */ - else if( mbTLBR && !mbBLTR ) // top-left to bottom-right only - maTLBR.AddClickRect( aRect ); - else if( !mbTLBR && mbBLTR ) // bottom-left to top-right only - maBLTR.AddClickRect( aRect ); + // single areas + Point aMid( aRect.Center() ); + maTLBR.AddClickRect( tools::Rectangle( aRect.TopLeft(), aMid ) ); + maTLBR.AddClickRect( tools::Rectangle( aMid + Point( 1, 1 ), aRect.BottomRight() ) ); + maBLTR.AddClickRect( tools::Rectangle( aRect.Left(), aMid.Y() + 1, aMid.X(), aRect.Bottom() ) ); + maBLTR.AddClickRect( tools::Rectangle( aMid.X() + 1, aRect.Top(), aRect.Right(), aMid.Y() ) ); + // centered rectangle for both frame borders + tools::Rectangle aMidRect( aRect.TopLeft(), Size( aRect.GetWidth() / 3, aRect.GetHeight() / 3 ) ); + aMidRect.Move( (aRect.GetWidth() - aMidRect.GetWidth()) / 2, (aRect.GetHeight() - aMidRect.GetHeight()) / 2 ); + maTLBR.AddClickRect( aMidRect ); + maBLTR.AddClickRect( aMidRect ); } + /* One of the diagonal frame borders enabled - use entire rectangle. */ + else if( mbTLBR && !mbBLTR ) // top-left to bottom-right only + maTLBR.AddClickRect( aRect ); + else if( !mbTLBR && mbBLTR ) // bottom-left to top-right only + maBLTR.AddClickRect( aRect ); } } } diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index e015b3716351..df8cf7095426 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -374,27 +374,27 @@ void SvxIMapDlg::DoOpen() aDlg.SetCurrentFilter( aFilter ); aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() ); - if( aDlg.Execute() == ERRCODE_NONE ) + if( aDlg.Execute() != ERRCODE_NONE ) + return; + + INetURLObject aURL( aDlg.GetPath() ); + DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); + std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ )); + + if( pIStm ) { - INetURLObject aURL( aDlg.GetPath() ); - DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" ); - std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ )); + aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT ); - if( pIStm ) + if( pIStm->GetError() ) { - aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT ); - - if( pIStm->GetError() ) - { - SfxErrorContext eEC(ERRCTX_ERROR, m_xDialog.get()); - ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); - } - else - m_xIMapWnd->SetImageMap( aLoadIMap ); + SfxErrorContext eEC(ERRCTX_ERROR, m_xDialog.get()); + ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); } - - m_xIMapWnd->Invalidate(); + else + m_xIMapWnd->SetImageMap( aLoadIMap ); } + + m_xIMapWnd->Invalidate(); } bool SvxIMapDlg::DoSave() diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 2caa529e12bc..0b44f16af1ff 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -354,71 +354,71 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) { IMapUserData* pUserData = static_cast<IMapUserData*>( rObj.GetUserData( 0 ) ); - if ( pUserData ) + if ( !pUserData ) + return; + + OUString aURL; + OUString aAltText; + OUString aDesc; + OUString aTarget; + IMapObjectPtr pIMapObj = pUserData->GetObject(); + bool bActive = true; + + if ( pIMapObj ) { - OUString aURL; - OUString aAltText; - OUString aDesc; - OUString aTarget; - IMapObjectPtr pIMapObj = pUserData->GetObject(); - bool bActive = true; + aURL = pIMapObj->GetURL(); + aAltText = pIMapObj->GetAltText(); + aDesc = pIMapObj->GetDesc(); + aTarget = pIMapObj->GetTarget(); + bActive = pIMapObj->IsActive(); + } - if ( pIMapObj ) + switch( rObj.GetObjIdentifier() ) + { + case OBJ_RECT: { - aURL = pIMapObj->GetURL(); - aAltText = pIMapObj->GetAltText(); - aDesc = pIMapObj->GetDesc(); - aTarget = pIMapObj->GetTarget(); - bActive = pIMapObj->IsActive(); + pUserData->ReplaceObject( std::make_shared<IMapRectangleObject>( static_cast<const SdrRectObj&>(rObj).GetLogicRect(), + aURL, aAltText, aDesc, aTarget, "", bActive, false ) ); } + break; - switch( rObj.GetObjIdentifier() ) + case OBJ_CIRC: { - case OBJ_RECT: - { - pUserData->ReplaceObject( std::make_shared<IMapRectangleObject>( static_cast<const SdrRectObj&>(rObj).GetLogicRect(), - aURL, aAltText, aDesc, aTarget, "", bActive, false ) ); - } - break; + const SdrCircObj& rCircObj = static_cast<const SdrCircObj&>(rObj); + SdrPathObj* pPathObj = static_cast<SdrPathObj*>( rCircObj.ConvertToPolyObj( false, false ).release() ); + tools::Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0)); - case OBJ_CIRC: - { - const SdrCircObj& rCircObj = static_cast<const SdrCircObj&>(rObj); - SdrPathObj* pPathObj = static_cast<SdrPathObj*>( rCircObj.ConvertToPolyObj( false, false ).release() ); - tools::Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0)); + auto pObj = std::make_shared<IMapPolygonObject>( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false ); + pObj->SetExtraEllipse( aPoly.GetBoundRect() ); - auto pObj = std::make_shared<IMapPolygonObject>( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false ); - pObj->SetExtraEllipse( aPoly.GetBoundRect() ); + // was only created by us temporarily + // always use SdrObject::Free(...) for SdrObjects (!) + SdrObject* pTemp(pPathObj); + SdrObject::Free(pTemp); - // was only created by us temporarily - // always use SdrObject::Free(...) for SdrObjects (!) - SdrObject* pTemp(pPathObj); - SdrObject::Free(pTemp); + pUserData->ReplaceObject( pObj ); + } + break; - pUserData->ReplaceObject( pObj ); - } - break; + case OBJ_POLY: + case OBJ_FREEFILL: + case OBJ_PATHPOLY: + case OBJ_PATHFILL: + { + const SdrPathObj& rPathObj = static_cast<const SdrPathObj&>(rObj); + const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly(); - case OBJ_POLY: - case OBJ_FREEFILL: - case OBJ_PATHPOLY: - case OBJ_PATHFILL: + if ( rXPolyPoly.count() ) { - const SdrPathObj& rPathObj = static_cast<const SdrPathObj&>(rObj); - const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly(); - - if ( rXPolyPoly.count() ) - { - tools::Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0)); - auto pObj = std::make_shared<IMapPolygonObject>( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false ); - pUserData->ReplaceObject( pObj ); - } + tools::Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0)); + auto pObj = std::make_shared<IMapPolygonObject>( aPoly, aURL, aAltText, aDesc, aTarget, "", bActive, false ); + pUserData->ReplaceObject( pObj ); } - break; - - default: - break; } + break; + + default: + break; } } @@ -601,58 +601,58 @@ void IMapWindow::SetCurrentObjState( bool bActive ) { SdrObject* pObj = GetSelectedSdrObject(); - if ( pObj ) - { - SfxItemSet aSet( pModel->GetItemPool() ); + if ( !pObj ) + return; - GetIMapObj( pObj )->SetActive( bActive ); + SfxItemSet aSet( pModel->GetItemPool() ); - aSet.Put( XFillColorItem( "", TRANSCOL ) ); + GetIMapObj( pObj )->SetActive( bActive ); - if ( !bActive ) - { - aSet.Put( XFillTransparenceItem( 100 ) ); - aSet.Put( XLineColorItem( "", COL_RED ) ); - } - else - { - aSet.Put( XFillTransparenceItem( 50 ) ); - aSet.Put( XLineColorItem( "", COL_BLACK ) ); - } + aSet.Put( XFillColorItem( "", TRANSCOL ) ); - pView->SetAttributes( aSet ); + if ( !bActive ) + { + aSet.Put( XFillTransparenceItem( 100 ) ); + aSet.Put( XLineColorItem( "", COL_RED ) ); } + else + { + aSet.Put( XFillTransparenceItem( 50 ) ); + aSet.Put( XLineColorItem( "", COL_BLACK ) ); + } + + pView->SetAttributes( aSet ); } void IMapWindow::UpdateInfo( bool bNewObj ) { - if ( aInfoLink.IsSet() ) - { - const SdrObject* pSdrObj = GetSelectedSdrObject(); - const IMapObject* pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : nullptr; + if ( !aInfoLink.IsSet() ) + return; - aInfo.bNewObj = bNewObj; + const SdrObject* pSdrObj = GetSelectedSdrObject(); + const IMapObject* pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : nullptr; - if ( pIMapObj ) - { - aInfo.bOneMarked = true; - aInfo.aMarkURL = pIMapObj->GetURL(); - aInfo.aMarkAltText = pIMapObj->GetAltText(); - aInfo.aMarkTarget = pIMapObj->GetTarget(); - aInfo.bActivated = pIMapObj->IsActive(); - aInfoLink.Call( *this ); - } - else - { - aInfo.aMarkURL.clear(); - aInfo.aMarkAltText.clear(); - aInfo.aMarkTarget.clear(); - aInfo.bOneMarked = false; - aInfo.bActivated = false; - } + aInfo.bNewObj = bNewObj; + if ( pIMapObj ) + { + aInfo.bOneMarked = true; + aInfo.aMarkURL = pIMapObj->GetURL(); + aInfo.aMarkAltText = pIMapObj->GetAltText(); + aInfo.aMarkTarget = pIMapObj->GetTarget(); + aInfo.bActivated = pIMapObj->IsActive(); aInfoLink.Call( *this ); } + else + { + aInfo.aMarkURL.clear(); + aInfo.aMarkAltText.clear(); + aInfo.aMarkTarget.clear(); + aInfo.bOneMarked = false; + aInfo.bActivated = false; + } + + aInfoLink.Call( *this ); } void IMapWindow::DoMacroAssign() @@ -690,33 +690,33 @@ void IMapWindow::DoPropertyDialog() { SdrObject* pSdrObj = GetSelectedSdrObject(); - if ( pSdrObj ) - { - IMapObject* pIMapObj = GetIMapObj( pSdrObj ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog(GetDrawingArea(), pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), - pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList)); - if ( aDlg->Execute() == RET_OK ) - { - const OUString aURLText( aDlg->GetURL() ); + if ( !pSdrObj ) + return; - if ( !aURLText.isEmpty() ) - { - INetURLObject aObj( aURLText, INetProtocol::File ); - DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL" ); - pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); - } - else - pIMapObj->SetURL( aURLText ); + IMapObject* pIMapObj = GetIMapObj( pSdrObj ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog(GetDrawingArea(), pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), + pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList)); + if ( aDlg->Execute() != RET_OK ) + return; - pIMapObj->SetAltText( aDlg->GetAltText() ); - pIMapObj->SetDesc( aDlg->GetDesc() ); - pIMapObj->SetTarget( aDlg->GetTarget() ); - pIMapObj->SetName( aDlg->GetName() ); - pModel->SetChanged(); - UpdateInfo( true ); - } + const OUString aURLText( aDlg->GetURL() ); + + if ( !aURLText.isEmpty() ) + { + INetURLObject aObj( aURLText, INetProtocol::File ); + DBG_ASSERT( aObj.GetProtocol() != INetProtocol::NotValid, "Invalid URL" ); + pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); } + else + pIMapObj->SetURL( aURLText ); + + pIMapObj->SetAltText( aDlg->GetAltText() ); + pIMapObj->SetDesc( aDlg->GetDesc() ); + pIMapObj->SetTarget( aDlg->GetTarget() ); + pIMapObj->SetName( aDlg->GetName() ); + pModel->SetChanged(); + UpdateInfo( true ); } void IMapWindow::MenuSelectHdl(const OString& rId) diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx index 9cf4926bf5b9..104000303210 100644 --- a/svx/source/dialog/optgrid.cxx +++ b/svx/source/dialog/optgrid.cxx @@ -213,33 +213,32 @@ void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet ) // Metric Change if necessary (as TabPage is in the dialog, where the // metric can be set - if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_METRIC , false, + if( SfxItemState::SET != rSet.GetItemState( SID_ATTR_METRIC , false, &pAttr )) - { - const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pAttr); + return; - FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<long>(pItem->GetValue())); + const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pAttr); - if (eFUnit != m_xMtrFldDrawX->get_unit()) - { - // Set Metrics - int nMin, nMax; - int nVal = m_xMtrFldDrawX->denormalize(m_xMtrFldDrawX->get_value(FieldUnit::TWIP)); + FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<long>(pItem->GetValue())); - lcl_GetMinMax(*m_xMtrFldDrawX, nMin, nMax); - SetFieldUnit(*m_xMtrFldDrawX, eFUnit, true); - lcl_SetMinMax(*m_xMtrFldDrawX, nMin, nMax); + if (eFUnit == m_xMtrFldDrawX->get_unit()) + return; - m_xMtrFldDrawX->set_value(m_xMtrFldDrawX->normalize(nVal), FieldUnit::TWIP); + // Set Metrics + int nMin, nMax; + int nVal = m_xMtrFldDrawX->denormalize(m_xMtrFldDrawX->get_value(FieldUnit::TWIP)); - nVal = m_xMtrFldDrawY->denormalize(m_xMtrFldDrawY->get_value(FieldUnit::TWIP)); - lcl_GetMinMax(*m_xMtrFldDrawY, nMin, nMax); - SetFieldUnit(*m_xMtrFldDrawY, eFUnit, true); - lcl_SetMinMax(*m_xMtrFldDrawY, nMin, nMax); - m_xMtrFldDrawY->set_value(m_xMtrFldDrawY->normalize(nVal), FieldUnit::TWIP); + lcl_GetMinMax(*m_xMtrFldDrawX, nMin, nMax); + SetFieldUnit(*m_xMtrFldDrawX, eFUnit, true); + lcl_SetMinMax(*m_xMtrFldDrawX, nMin, nMax); - } - } + m_xMtrFldDrawX->set_value(m_xMtrFldDrawX->normalize(nVal), FieldUnit::TWIP); + + nVal = m_xMtrFldDrawY->denormalize(m_xMtrFldDrawY->get_value(FieldUnit::TWIP)); + lcl_GetMinMax(*m_xMtrFldDrawY, nMin, nMax); + SetFieldUnit(*m_xMtrFldDrawY, eFUnit, true); + lcl_SetMinMax(*m_xMtrFldDrawY, nMin, nMax); + m_xMtrFldDrawY->set_value(m_xMtrFldDrawY->normalize(nVal), FieldUnit::TWIP); } DeactivateRC SvxGridTabPage::DeactivatePage( SfxItemSet* _pSet ) diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index f7eae17dbca1..e30fbccb7359 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -290,32 +290,32 @@ void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rO rRenderContext.SetFont(aFont); } - if (bTable) + if (!bTable) + return; + + // Paint Table, if necessary center it + rRenderContext.SetLineColor(COL_LIGHTGRAY); + + long nW = aRect.GetWidth(); + long nH = aRect.GetHeight(); + long const nTW = CELL_WIDTH * 3; + long const nTH = CELL_HEIGHT * 3; + long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left(); + long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top(); + tools::Rectangle aCellRect(Point(_nLeft, _nTop),Size(CELL_WIDTH, CELL_HEIGHT)); + + for (sal_uInt16 i = 0; i < 3; ++i) { - // Paint Table, if necessary center it - rRenderContext.SetLineColor(COL_LIGHTGRAY); - - long nW = aRect.GetWidth(); - long nH = aRect.GetHeight(); - long const nTW = CELL_WIDTH * 3; - long const nTH = CELL_HEIGHT * 3; - long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left(); - long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top(); - tools::Rectangle aCellRect(Point(_nLeft, _nTop),Size(CELL_WIDTH, CELL_HEIGHT)); - - for (sal_uInt16 i = 0; i < 3; ++i) - { - aCellRect.SetLeft( _nLeft ); - aCellRect.SetRight( _nLeft + CELL_WIDTH ); - if(i > 0) - aCellRect.Move(0,CELL_HEIGHT); + aCellRect.SetLeft( _nLeft ); + aCellRect.SetRight( _nLeft + CELL_WIDTH ); + if(i > 0) + aCellRect.Move(0,CELL_HEIGHT); - for (sal_uInt16 j = 0; j < 3; ++j) - { - if (j > 0) - aCellRect.Move(CELL_WIDTH,0); - rRenderContext.DrawRect(aCellRect); - } + for (sal_uInt16 j = 0; j < 3; ++j) + { + if (j > 0) + aCellRect.Move(CELL_WIDTH,0); + rRenderContext.DrawRect(aCellRect); } } } @@ -327,45 +327,45 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext, { const basegfx::B2DRange aPaintRange = vcl::unotools::b2DRectangleFromRectangle(rPaintRange); - if(!aPaintRange.isEmpty() && + if(!(!aPaintRange.isEmpty() && !basegfx::fTools::equalZero(aPaintRange.getWidth()) && - !basegfx::fTools::equalZero(aPaintRange.getHeight())) - { - const basegfx::B2DRange aDefineRange = vcl::unotools::b2DRectangleFromRectangle(rDefineRange); + !basegfx::fTools::equalZero(aPaintRange.getHeight()))) + return; - // prepare primitive sequence - drawinglayer::primitive2d::Primitive2DContainer aSequence; + const basegfx::B2DRange aDefineRange = vcl::unotools::b2DRectangleFromRectangle(rDefineRange); - // create fill geometry if there is something to fill - if (rFillAttributes && rFillAttributes->isUsed()) - { - aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange); - } + // prepare primitive sequence + drawinglayer::primitive2d::Primitive2DContainer aSequence; - // create line geometry if a LineColor is set at the target device - if (rRenderContext.IsLineColor()) - { - const drawinglayer::primitive2d::Primitive2DReference xOutline( - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( - basegfx::utils::createPolygonFromRect(aPaintRange), rRenderContext.GetLineColor().getBColor())); + // create fill geometry if there is something to fill + if (rFillAttributes && rFillAttributes->isUsed()) + { + aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange); + } - aSequence.push_back(xOutline); - } + // create line geometry if a LineColor is set at the target device + if (rRenderContext.IsLineColor()) + { + const drawinglayer::primitive2d::Primitive2DReference xOutline( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + basegfx::utils::createPolygonFromRect(aPaintRange), rRenderContext.GetLineColor().getBColor())); - // draw that if we have something to draw - if (!aSequence.empty()) - { - const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(), aPaintRange, nullptr, - 0.0, css::uno::Sequence<css::beans::PropertyValue >()); + aSequence.push_back(xOutline); + } - std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor( - drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D)); - if (pProcessor) - { - pProcessor->process(aSequence); - } - } + // draw that if we have something to draw + if (aSequence.empty()) + return; + + const drawinglayer::geometry::ViewInformation2D aViewInformation2D( + basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(), aPaintRange, nullptr, + 0.0, css::uno::Sequence<css::beans::PropertyValue >()); + + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor( + drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D)); + if (pProcessor) + { + pProcessor->process(aSequence); } } diff --git a/svx/source/dialog/relfld.cxx b/svx/source/dialog/relfld.cxx index 80340a168031..3929e4fcf7df 100644 --- a/svx/source/dialog/relfld.cxx +++ b/svx/source/dialog/relfld.cxx @@ -34,35 +34,35 @@ SvxRelativeField::SvxRelativeField(std::unique_ptr<weld::MetricSpinButton> pCont IMPL_LINK_NOARG(SvxRelativeField, ModifyHdl, weld::Entry&, void) { - if (bRelativeMode) + if (!bRelativeMode) + return; + + OUString aStr = m_xSpinButton->get_text(); + bool bNewMode = bRelative; + + if ( bRelative ) { - OUString aStr = m_xSpinButton->get_text(); - bool bNewMode = bRelative; + const sal_Unicode* pStr = aStr.getStr(); - if ( bRelative ) + while ( *pStr ) { - const sal_Unicode* pStr = aStr.getStr(); - - while ( *pStr ) + if( ( ( *pStr < '0' ) || ( *pStr > '9' ) ) && + ( *pStr != '%' ) ) { - if( ( ( *pStr < '0' ) || ( *pStr > '9' ) ) && - ( *pStr != '%' ) ) - { - bNewMode = false; - break; - } - pStr++; + bNewMode = false; + break; } + pStr++; } - else - { - if ( aStr.indexOf( "%" ) != -1 ) - bNewMode = true; - } - - if ( bNewMode != bRelative ) - SetRelative( bNewMode ); } + else + { + if ( aStr.indexOf( "%" ) != -1 ) + bNewMode = true; + } + + if ( bNewMode != bRelative ) + SetRelative( bNewMode ); } void SvxRelativeField::EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax) diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 550e58e26527..65ef3c14927c 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -139,23 +139,23 @@ SvxRubyData_Impl::~SvxRubyData_Impl() void SvxRubyData_Impl::SetController(const Reference<XController>& xCtrl) { - if (xCtrl.get() != xController.get()) + if (xCtrl.get() == xController.get()) + return; + + try + { + Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY); + if (xSelSupp.is()) + xSelSupp->removeSelectionChangeListener(this); + + bHasSelectionChanged = true; + xController = xCtrl; + xSelSupp.set(xController, UNO_QUERY); + if (xSelSupp.is()) + xSelSupp->addSelectionChangeListener(this); + } + catch (const Exception&) { - try - { - Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY); - if (xSelSupp.is()) - xSelSupp->removeSelectionChangeListener(this); - - bHasSelectionChanged = true; - xController = xCtrl; - xSelSupp.set(xController, UNO_QUERY); - if (xSelSupp.is()) - xSelSupp->addSelectionChangeListener(this); - } - catch (const Exception&) - { - } } } @@ -290,73 +290,72 @@ void SvxRubyDialog::Activate() SfxViewFrame* pCurFrm = SfxViewFrame::Current(); Reference< XController > xCtrl = pCurFrm->GetFrame().GetController(); m_pImpl->SetController(xCtrl); - if (m_pImpl->HasSelectionChanged()) - { + if (!m_pImpl->HasSelectionChanged()) + return; - Reference< XRubySelection > xRubySel = m_pImpl->GetRubySelection(); - m_pImpl->UpdateRubyValues(); - EnableControls(xRubySel.is()); - if (xRubySel.is()) + Reference< XRubySelection > xRubySel = m_pImpl->GetRubySelection(); + m_pImpl->UpdateRubyValues(); + EnableControls(xRubySel.is()); + if (xRubySel.is()) + { + Reference< XModel > xModel = m_pImpl->GetModel(); + const OUString sCharStyleSelect = m_xCharStyleLB->get_active_text(); + ClearCharStyleList(); + Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY); + if (xSupplier.is()) { - Reference< XModel > xModel = m_pImpl->GetModel(); - const OUString sCharStyleSelect = m_xCharStyleLB->get_active_text(); - ClearCharStyleList(); - Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY); - if (xSupplier.is()) + try { - try + Reference<XNameAccess> xFam = xSupplier->getStyleFamilies(); + Any aChar = xFam->getByName("CharacterStyles"); + Reference<XNameContainer> xChar; + aChar >>= xChar; + Reference<XIndexAccess> xCharIdx(xChar, UNO_QUERY); + if (xCharIdx.is()) { - Reference<XNameAccess> xFam = xSupplier->getStyleFamilies(); - Any aChar = xFam->getByName("CharacterStyles"); - Reference<XNameContainer> xChar; - aChar >>= xChar; - Reference<XIndexAccess> xCharIdx(xChar, UNO_QUERY); - if (xCharIdx.is()) + OUString sUIName("DisplayName"); + for (sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++) { - OUString sUIName("DisplayName"); - for (sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++) + Any aStyle = xCharIdx->getByIndex(nStyle); + Reference<XStyle> xStyle; + aStyle >>= xStyle; + Reference<XPropertySet> xPrSet(xStyle, UNO_QUERY); + OUString sName, sCoreName; + if (xPrSet.is()) { - Any aStyle = xCharIdx->getByIndex(nStyle); - Reference<XStyle> xStyle; - aStyle >>= xStyle; - Reference<XPropertySet> xPrSet(xStyle, UNO_QUERY); - OUString sName, sCoreName; - if (xPrSet.is()) - { - Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo(); - if (xInfo->hasPropertyByName(sUIName)) - { - Any aName = xPrSet->getPropertyValue(sUIName); - aName >>= sName; - } - } - if (xStyle.is()) + Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo(); + if (xInfo->hasPropertyByName(sUIName)) { - sCoreName = xStyle->getName(); - if (sName.isEmpty()) - sName = sCoreName; + Any aName = xPrSet->getPropertyValue(sUIName); + aName >>= sName; } - if (!sName.isEmpty()) - { - m_xCharStyleLB->append(sCoreName, sName); + } + if (xStyle.is()) + { + sCoreName = xStyle->getName(); + if (sName.isEmpty()) + sName = sCoreName; + } + if (!sName.isEmpty()) + { + m_xCharStyleLB->append(sCoreName, sName); - } } } } - catch (const Exception&) - { - OSL_FAIL("exception in style access"); - } - if (!sCharStyleSelect.isEmpty()) - m_xCharStyleLB->set_active_text(sCharStyleSelect); } - m_xCharStyleLB->set_sensitive(xSupplier.is()); - m_xCharStyleFT->set_sensitive(xSupplier.is()); + catch (const Exception&) + { + OSL_FAIL("exception in style access"); + } + if (!sCharStyleSelect.isEmpty()) + m_xCharStyleLB->set_active_text(sCharStyleSelect); } - Update(); - m_xPreviewWin->Invalidate(); + m_xCharStyleLB->set_sensitive(xSupplier.is()); + m_xCharStyleFT->set_sensitive(xSupplier.is()); } + Update(); + m_xPreviewWin->Invalidate(); } void SvxRubyDialog::SetRubyText(sal_Int32 nPos, weld::Entry& rLeft, weld::Entry& rRight) diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index b47067a19e42..6a989cb2f2a5 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -153,18 +153,18 @@ static void ListToStrArr_Impl(sal_uInt16 nId, std::vector<OUString>& rStrLst, we const SfxStringListItem* pSrchItem = static_cast<const SfxStringListItem*>(SfxGetpApp()->GetItem( nId )); - if (pSrchItem) - { - std::vector<OUString> aLst = pSrchItem->GetList(); + if (!pSrchItem) + return; - if (aLst.size() > nRememberSize) - aLst.resize(nRememberSize); + std::vector<OUString> aLst = pSrchItem->GetList(); - for (const OUString & s : aLst) - { - rStrLst.push_back(s); - rCBox.append_text(s); - } + if (aLst.size() > nRememberSize) + aLst.resize(nRememberSize); + + for (const OUString & s : aLst) + { + rStrLst.push_back(s); + rCBox.append_text(s); } } @@ -466,46 +466,46 @@ void SvxSearchDialog::Construct_Impl() bSearchComponent2 = true; } - if( bSearchComponent1 || bSearchComponent2 ) + if( !(bSearchComponent1 || bSearchComponent2) ) + return; + + try { - try - { - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = - configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); - uno::Sequence< uno::Any > aArgs { - Any(OUString( "/org.openoffice.Office.Common/SearchOptions/")) }; - - uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationUpdateAccess", - aArgs); - uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY); - if(xDirectAccess.is()) - { - OUString sTemp; - uno::Any aRet = xDirectAccess->getByName("ComponentSearchGroupLabel"); - aRet >>= sTemp; - m_xComponentFrame->set_label(sTemp); - aRet = xDirectAccess->getByName("ComponentSearchCommandLabel1"); - aRet >>= sTemp; - m_xSearchComponent1PB->set_label( sTemp ); - aRet = xDirectAccess->getByName("ComponentSearchCommandLabel2"); - aRet >>= sTemp; - m_xSearchComponent2PB->set_label( sTemp ); - } - } - catch(uno::Exception&){} + uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = + configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); + uno::Sequence< uno::Any > aArgs { + Any(OUString( "/org.openoffice.Office.Common/SearchOptions/")) }; - if(!m_xSearchComponent1PB->get_label().isEmpty() && bSearchComponent1 ) - { - m_xComponentFrame->show(); - m_xSearchComponent1PB->show(); - } - if( !m_xSearchComponent2PB->get_label().isEmpty() ) + uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + aArgs); + uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY); + if(xDirectAccess.is()) { - m_xComponentFrame->show(); - m_xSearchComponent2PB->show(); + OUString sTemp; + uno::Any aRet = xDirectAccess->getByName("ComponentSearchGroupLabel"); + aRet >>= sTemp; + m_xComponentFrame->set_label(sTemp); + aRet = xDirectAccess->getByName("ComponentSearchCommandLabel1"); + aRet >>= sTemp; + m_xSearchComponent1PB->set_label( sTemp ); + aRet = xDirectAccess->getByName("ComponentSearchCommandLabel2"); + aRet >>= sTemp; + m_xSearchComponent2PB->set_label( sTemp ); } } + catch(uno::Exception&){} + + if(!m_xSearchComponent1PB->get_label().isEmpty() && bSearchComponent1 ) + { + m_xComponentFrame->show(); + m_xSearchComponent1PB->show(); + } + if( !m_xSearchComponent2PB->get_label().isEmpty() ) + { + m_xComponentFrame->show(); + m_xSearchComponent2PB->show(); + } } void SvxSearchDialog::Close() @@ -1447,35 +1447,35 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, weld::ComboBox&, rEd, void ) // Calc allows searching for empty cells. bool bAllowEmptySearch = (pSearchItem->GetAppFlag() == SvxSearchApp::CALC); - if (&rEd == m_xSearchLB.get() || &rEd == m_xReplaceLB.get()) - { - sal_Int32 nSrchTxtLen = m_xSearchLB->get_active_text().getLength(); - sal_Int32 nReplTxtLen = 0; - if (bAllowEmptySearch) - nReplTxtLen = m_xReplaceLB->get_active_text().getLength(); - sal_Int32 nAttrTxtLen = m_xSearchAttrText->get_label().getLength(); + if (&rEd != m_xSearchLB.get() && &rEd != m_xReplaceLB.get()) + return; - if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen) - { - EnableControl_Impl(*m_xSearchBtn); - EnableControl_Impl(*m_xBackSearchBtn); - EnableControl_Impl(*m_xReplaceBtn); - if (!bWriter || !m_xNotesBtn->get_active()) - { - EnableControl_Impl(*m_xSearchAllBtn); - EnableControl_Impl(*m_xReplaceAllBtn); - } - } - else + sal_Int32 nSrchTxtLen = m_xSearchLB->get_active_text().getLength(); + sal_Int32 nReplTxtLen = 0; + if (bAllowEmptySearch) + nReplTxtLen = m_xReplaceLB->get_active_text().getLength(); + sal_Int32 nAttrTxtLen = m_xSearchAttrText->get_label().getLength(); + + if (nSrchTxtLen || nReplTxtLen || nAttrTxtLen) + { + EnableControl_Impl(*m_xSearchBtn); + EnableControl_Impl(*m_xBackSearchBtn); + EnableControl_Impl(*m_xReplaceBtn); + if (!bWriter || !m_xNotesBtn->get_active()) { - m_xComponentFrame->set_sensitive(false); - m_xSearchBtn->set_sensitive(false); - m_xBackSearchBtn->set_sensitive(false); - m_xSearchAllBtn->set_sensitive(false); - m_xReplaceBtn->set_sensitive(false); - m_xReplaceAllBtn->set_sensitive(false); + EnableControl_Impl(*m_xSearchAllBtn); + EnableControl_Impl(*m_xReplaceAllBtn); } } + else + { + m_xComponentFrame->set_sensitive(false); + m_xSearchBtn->set_sensitive(false); + m_xBackSearchBtn->set_sensitive(false); + m_xSearchAllBtn->set_sensitive(false); + m_xReplaceBtn->set_sensitive(false); + m_xReplaceAllBtn->set_sensitive(false); + } } IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, weld::Button&, void) @@ -1981,32 +1981,32 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, weld::Button&, void) ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateTabItemDialog(m_xDialog.get(), aSet)); pDlg->SetText( aTxt ); - if ( executeSubDialog(pDlg.get()) == RET_OK ) - { - DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); - SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); + if ( executeSubDialog(pDlg.get()) != RET_OK ) + return; + + DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" ); + SfxItemSet aOutSet( *pDlg->GetOutputItemSet() ); - SearchAttrItemList* pList = bSearch ? pSearchList.get() : pReplaceList.get(); + SearchAttrItemList* pList = bSearch ? pSearchList.get() : pReplaceList.get(); - const SfxPoolItem* pItem; - for( sal_uInt16 n = 0; n < pList->Count(); ++n ) + const SfxPoolItem* pItem; + for( sal_uInt16 n = 0; n < pList->Count(); ++n ) + { + SearchAttrItem* pAItem = &pList->GetObject(n); + if( !IsInvalidItem( pAItem->pItem ) && + SfxItemState::SET == aOutSet.GetItemState( + pAItem->pItem->Which(), false, &pItem ) ) { - SearchAttrItem* pAItem = &pList->GetObject(n); - if( !IsInvalidItem( pAItem->pItem ) && - SfxItemState::SET == aOutSet.GetItemState( - pAItem->pItem->Which(), false, &pItem ) ) - { - delete pAItem->pItem; - pAItem->pItem = pItem->Clone(); - aOutSet.ClearItem( pAItem->pItem->Which() ); - } + delete pAItem->pItem; + pAItem->pItem = pItem->Clone(); + aOutSet.ClearItem( pAItem->pItem->Which() ); } + } - if( aOutSet.Count() ) - pList->Put( aOutSet ); + if( aOutSet.Count() ) + pList->Put( aOutSet ); - PaintAttrText_Impl(); // Set AttributText in GroupBox - } + PaintAttrText_Impl(); // Set AttributText in GroupBox } IMPL_LINK_NOARG(SvxSearchDialog, NoFormatHdl_Impl, weld::Button&, void) diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 10904269d274..3efa537af181 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -700,28 +700,28 @@ void SvxRuler::Update( sal_uInt16 nSID) //Slot Id to identify NULL items { /* Set new value for column view */ - if(bActive) + if(!bActive) + return; + + if(pItem) { - if(pItem) - { - mxColumnItem.reset(new SvxColumnItem(*pItem)); - mxRulerImpl->bIsTableRows = (pItem->Which() == SID_RULER_ROWS || pItem->Which() == SID_RULER_ROWS_VERTICAL); - if(!bHorz && !mxRulerImpl->bIsTableRows) - mxColumnItem->SetWhich(SID_RULER_BORDERS_VERTICAL); - } - else if(mxColumnItem && mxColumnItem->Which() == nSID) - //there are two groups of column items table/frame columns and table rows - //both can occur in vertical or horizontal mode - //the horizontal ruler handles the SID_RULER_BORDERS and SID_RULER_ROWS_VERTICAL - //and the vertical handles SID_RULER_BORDERS_VERTICAL and SID_RULER_ROWS - //if mxColumnItem is already set with one of the ids then a NULL pItem argument - //must not delete it - { - mxColumnItem.reset(); - mxRulerImpl->bIsTableRows = false; - } - StartListening_Impl(); + mxColumnItem.reset(new SvxColumnItem(*pItem)); + mxRulerImpl->bIsTableRows = (pItem->Which() == SID_RULER_ROWS || pItem->Which() == SID_RULER_ROWS_VERTICAL); + if(!bHorz && !mxRulerImpl->bIsTableRows) + mxColumnItem->SetWhich(SID_RULER_BORDERS_VERTICAL); + } + else if(mxColumnItem && mxColumnItem->Which() == nSID) + //there are two groups of column items table/frame columns and table rows + //both can occur in vertical or horizontal mode + //the horizontal ruler handles the SID_RULER_BORDERS and SID_RULER_ROWS_VERTICAL + //and the vertical handles SID_RULER_BORDERS_VERTICAL and SID_RULER_ROWS + //if mxColumnItem is already set with one of the ids then a NULL pItem argument + //must not delete it + { + mxColumnItem.reset(); + mxRulerImpl->bIsTableRows = false; } + StartListening_Impl(); } @@ -1094,20 +1094,20 @@ void SvxRuler::UpdateTabs() void SvxRuler::Update(const SvxTabStopItem *pItem) // new value for tabs { /* Store new value for tabs; delete old ones if possible */ - if(bActive) + if(!bActive) + return; + + if(pItem) { - if(pItem) - { - mxTabStopItem.reset(new SvxTabStopItem(*pItem)); - if(!bHorz) - mxTabStopItem->SetWhich(SID_ATTR_TABSTOP_VERTICAL); - } - else - { - mxTabStopItem.reset(); - } - StartListening_Impl(); + mxTabStopItem.reset(new SvxTabStopItem(*pItem)); + if(!bHorz) + mxTabStopItem->SetWhich(SID_ATTR_TABSTOP_VERTICAL); } + else + { + mxTabStopItem.reset(); + } + StartListening_Impl(); } void SvxRuler::Update(const SvxObjectItem *pItem) // new value for objects @@ -2475,35 +2475,35 @@ void SvxRuler::Click() pBindings->Update( SID_ATTR_PARA_LRSPACE_VERTICAL ); } bool bRTL = mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue(); - if(mxTabStopItem && - (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) - { - bool bContentProtected = mxRulerImpl->aProtectItem->IsContentProtected(); - if( bContentProtected ) return; - const long lPos = GetClickPos(); - if((bRTL && lPos < std::min(GetFirstLineIndent(), GetLeftIndent()) && lPos > GetRightIndent()) || - (!bRTL && lPos > std::min(GetFirstLineIndent(), GetLeftIndent()) && lPos < GetRightIndent())) - { - //convert position in left-to-right text - long nTabPos; - //#i24363# tab stops relative to indent - if(bRTL) - nTabPos = ( mxRulerImpl->bIsTabsRelativeToIndent ? - GetLeftIndent() : - ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset ) ) - - lPos; - else - nTabPos = lPos - - ( mxRulerImpl->bIsTabsRelativeToIndent ? - GetLeftIndent() : - ConvertHPosPixel( GetLeftFrameMargin() + lAppNullOffset )); + if(!(mxTabStopItem && + (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS)) + return; - SvxTabStop aTabStop(ConvertHPosLogic(nTabPos), - ToAttrTab_Impl(nDefTabType)); - mxTabStopItem->Insert(aTabStop); - UpdateTabs(); - } - } + bool bContentProtected = mxRulerImpl->aProtectItem->IsContentProtected(); + if( bContentProtected ) return; + const long lPos = GetClickPos(); + if(!((bRTL && lPos < std::min(GetFirstLineIndent(), GetLeftIndent()) && lPos > GetRightIndent()) || + (!bRTL && lPos > std::min(GetFirstLineIndent(), GetLeftIndent()) && lPos < GetRightIndent()))) + return; + + //convert position in left-to-right text + long nTabPos; +//#i24363# tab stops relative to indent + if(bRTL) + nTabPos = ( mxRulerImpl->bIsTabsRelativeToIndent ? + GetLeftIndent() : + ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset ) ) - + lPos; + else + nTabPos = lPos - + ( mxRulerImpl->bIsTabsRelativeToIndent ? + GetLeftIndent() : + ConvertHPosPixel( GetLeftFrameMargin() + lAppNullOffset )); + + SvxTabStop aTabStop(ConvertHPosLogic(nTabPos), + ToAttrTab_Impl(nDefTabType)); + mxTabStopItem->Insert(aTabStop); + UpdateTabs(); } void SvxRuler::CalcMinMax() |