summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 15:22:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-21 17:14:14 +0100
commit489bce598626390d9c0aa5e5b8514e26070add61 (patch)
tree170ec95dcb393dbe4f7178bc08e6d96b6b76954b
parentf19599c929ac6ae2708b19b9eff62ff70b44ee75 (diff)
loplugin:flatten in filter..framework
Change-Id: I15a577b3c6da03001bbbf2c2b43b29b41c4007c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127234 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--filter/source/msfilter/escherex.cxx102
-rw-r--r--filter/source/msfilter/msdffimp.cxx73
-rw-r--r--filter/source/msfilter/rtfutil.cxx82
-rw-r--r--filter/source/svg/svgexport.cxx60
-rw-r--r--filter/source/svg/svgfilter.cxx45
-rw-r--r--filter/source/svg/svgwriter.cxx422
-rw-r--r--forms/source/component/CheckBox.cxx58
-rw-r--r--forms/source/component/ComboBox.cxx40
-rw-r--r--forms/source/component/DatabaseForm.cxx96
-rw-r--r--forms/source/component/Date.cxx52
-rw-r--r--forms/source/component/Filter.cxx43
-rw-r--r--forms/source/component/FormattedField.cxx48
-rw-r--r--forms/source/component/Pattern.cxx44
-rw-r--r--forms/source/component/Time.cxx58
-rw-r--r--forms/source/misc/limitedformats.cxx106
-rw-r--r--forms/source/runtime/formoperations.cxx37
-rw-r--r--formula/source/core/api/token.cxx164
-rw-r--r--formula/source/ui/dlg/structpg.cxx28
-rw-r--r--fpicker/source/office/PlacesListBox.cxx35
-rw-r--r--fpicker/source/office/iodlg.cxx68
-rw-r--r--framework/source/helper/dockingareadefaultacceptor.cxx48
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx214
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx250
-rw-r--r--framework/source/services/urltransformer.cxx52
-rw-r--r--framework/source/uiconfiguration/globalsettings.cxx40
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx128
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx34
-rw-r--r--framework/source/uielement/menubarmanager.cxx336
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx32
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx32
30 files changed, 1404 insertions, 1423 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c85c51e41c95..b7ffd449cb22 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1997,47 +1997,45 @@ bool EscherPropertyContainer::CreatePolygonProperties(
}
}
- if(0 != nTotalPoints && aSegments.size() >= 6 && aVertices.size() >= 6)
- {
- // Little endian
- aVertices[0] = static_cast<sal_uInt8>(nTotalPoints);
- aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8);
- aVertices[2] = static_cast<sal_uInt8>(nTotalPoints);
- aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8);
-
- aSegments.push_back(static_cast<sal_uInt8>(0));
- aSegments.push_back(static_cast<sal_uInt8>(0x80));
-
- const sal_uInt32 nSegmentBufSize(aSegments.size() - 6);
- aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
- aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
- aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
- aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
-
- AddOpt(
- ESCHER_Prop_geoRight,
- rGeoRect.Width);
- AddOpt(
- ESCHER_Prop_geoBottom,
- rGeoRect.Height);
- AddOpt(
- ESCHER_Prop_shapePath,
- ESCHER_ShapeComplex);
- AddOpt(
- ESCHER_Prop_pVertices,
- true,
- aVertices.size() - 6,
- aVertices);
- AddOpt(
- ESCHER_Prop_pSegmentInfo,
- true,
- aSegments.size(),
- aSegments);
+ if(0 == nTotalPoints || aSegments.size() < 6 || aVertices.size() < 6)
+ return false;
- return true;
- }
+ // Little endian
+ aVertices[0] = static_cast<sal_uInt8>(nTotalPoints);
+ aVertices[1] = static_cast<sal_uInt8>(nTotalPoints >> 8);
+ aVertices[2] = static_cast<sal_uInt8>(nTotalPoints);
+ aVertices[3] = static_cast<sal_uInt8>(nTotalPoints >> 8);
+
+ aSegments.push_back(static_cast<sal_uInt8>(0));
+ aSegments.push_back(static_cast<sal_uInt8>(0x80));
+
+ const sal_uInt32 nSegmentBufSize(aSegments.size() - 6);
+ aSegments[0] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
+ aSegments[1] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
+ aSegments[2] = static_cast<sal_uInt8>(nSegmentBufSize >> 1);
+ aSegments[3] = static_cast<sal_uInt8>(nSegmentBufSize >> 9);
+
+ AddOpt(
+ ESCHER_Prop_geoRight,
+ rGeoRect.Width);
+ AddOpt(
+ ESCHER_Prop_geoBottom,
+ rGeoRect.Height);
+ AddOpt(
+ ESCHER_Prop_shapePath,
+ ESCHER_ShapeComplex);
+ AddOpt(
+ ESCHER_Prop_pVertices,
+ true,
+ aVertices.size() - 6,
+ aVertices);
+ AddOpt(
+ ESCHER_Prop_pSegmentInfo,
+ true,
+ aSegments.size(),
+ aSegments);
- return false;
+ return true;
}
@@ -3751,22 +3749,22 @@ bool EscherPropertyContainer::CreateBlipPropertiesforOLEControl(const uno::Refer
const uno::Reference<drawing::XShape> & rXShape)
{
SdrObject* pShape = SdrObject::getSdrObjectFromXShape(rXShape);
- if ( pShape )
- {
- const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
- const GraphicObject aGraphicObject(aGraphic);
+ if ( !pShape )
+ return false;
- if (!aGraphicObject.GetUniqueID().isEmpty())
+ const Graphic aGraphic(SdrExchangeView::GetObjGraphic(*pShape));
+ const GraphicObject aGraphicObject(aGraphic);
+
+ if (!aGraphicObject.GetUniqueID().isEmpty())
+ {
+ if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
{
- if ( pGraphicProvider && pPicOutStrm && pShapeBoundRect )
+ sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject);
+ if ( nBlibId )
{
- sal_uInt32 nBlibId = pGraphicProvider->GetBlibID(*pPicOutStrm, aGraphicObject);
- if ( nBlibId )
- {
- AddOpt( ESCHER_Prop_pib, nBlibId, true );
- ImplCreateGraphicAttributes( rXPropSet, nBlibId, false );
- return true;
- }
+ AddOpt( ESCHER_Prop_pib, nBlibId, true );
+ ImplCreateGraphicAttributes( rXPropSet, nBlibId, false );
+ return true;
}
}
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 44c9f10402e3..823868ae2dfe 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -422,23 +422,23 @@ SvStream& ReadSvxMSDffSolverContainer( SvStream& rIn, SvxMSDffSolverContainer& r
{
DffRecordHeader aHd;
bool bOk = ReadDffRecordHeader( rIn, aHd );
- if (bOk && aHd.nRecType == DFF_msofbtSolverContainer)
+ if (!bOk || aHd.nRecType != DFF_msofbtSolverContainer)
+ return rIn;
+
+ DffRecordHeader aCRule;
+ auto nEndPos = DffPropSet::SanitizeEndPos(rIn, aHd.GetRecEndFilePos());
+ while ( rIn.good() && ( rIn.Tell() < nEndPos ) )
{
- DffRecordHeader aCRule;
- auto nEndPos = DffPropSet::SanitizeEndPos(rIn, aHd.GetRecEndFilePos());
- while ( rIn.good() && ( rIn.Tell() < nEndPos ) )
+ if (!ReadDffRecordHeader(rIn, aCRule))
+ break;
+ if ( aCRule.nRecType == DFF_msofbtConnectorRule )
{
- if (!ReadDffRecordHeader(rIn, aCRule))
- break;
- if ( aCRule.nRecType == DFF_msofbtConnectorRule )
- {
- std::unique_ptr<SvxMSDffConnectorRule> pRule(new SvxMSDffConnectorRule);
- rIn >> *pRule;
- rContainer.aCList.push_back( std::move(pRule) );
- }
- if (!aCRule.SeekToEndOfRecord(rIn))
- break;
+ std::unique_ptr<SvxMSDffConnectorRule> pRule(new SvxMSDffConnectorRule);
+ rIn >> *pRule;
+ rContainer.aCList.push_back( std::move(pRule) );
}
+ if (!aCRule.SeekToEndOfRecord(rIn))
+ break;
}
return rIn;
}
@@ -6312,31 +6312,30 @@ bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape,
SvxMSDffShapeInfos_ById::const_iterator const it =
m_xShapeInfosById->find(pTmpRec);
- if (it != m_xShapeInfosById->end())
- {
- // Possibly delete old error flag.
- if( rStCtrl.GetError() )
- rStCtrl.ResetError();
- // store FilePos of the stream(s)
- sal_uInt64 nOldPosCtrl = rStCtrl.Tell();
- sal_uInt64 nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
- // jump to the shape in the control stream
- sal_uInt64 const nFilePos((*it)->nFilePos);
- bool bSeeked = (nFilePos == rStCtrl.Seek(nFilePos));
+ if (it == m_xShapeInfosById->end())
+ return false;
- // if it failed, reset error statusF
- if (!bSeeked || rStCtrl.GetError())
- rStCtrl.ResetError();
- else
- rpShape = ImportObj( rStCtrl, rData, rData.aParentRect, rData.aParentRect, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
+ // Possibly delete old error flag.
+ if( rStCtrl.GetError() )
+ rStCtrl.ResetError();
+ // store FilePos of the stream(s)
+ sal_uInt64 nOldPosCtrl = rStCtrl.Tell();
+ sal_uInt64 nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl;
+ // jump to the shape in the control stream
+ sal_uInt64 const nFilePos((*it)->nFilePos);
+ bool bSeeked = (nFilePos == rStCtrl.Seek(nFilePos));
- // restore old FilePos of the stream(s)
- rStCtrl.Seek( nOldPosCtrl );
- if( &rStCtrl != pStData && pStData )
- pStData->Seek( nOldPosData );
- return ( nullptr != rpShape );
- }
- return false;
+ // if it failed, reset error statusF
+ if (!bSeeked || rStCtrl.GetError())
+ rStCtrl.ResetError();
+ else
+ rpShape = ImportObj( rStCtrl, rData, rData.aParentRect, rData.aParentRect, /*nCalledByGroup*/0, /*pShapeId*/nullptr );
+
+ // restore old FilePos of the stream(s)
+ rStCtrl.Seek( nOldPosCtrl );
+ if( &rStCtrl != pStData && pStData )
+ pStData->Seek( nOldPosData );
+ return ( nullptr != rpShape );
}
diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx
index ac2dcdec8a10..e20a146c42d6 100644
--- a/filter/source/msfilter/rtfutil.cxx
+++ b/filter/source/msfilter/rtfutil.cxx
@@ -333,50 +333,50 @@ bool ExtractOLE2FromObjdata(const OString& rObjdata, SvStream& rOle2)
}
// Skip ObjectHeader, see [MS-OLEDS] 2.2.4.
- if (aStream.Tell())
+ if (!aStream.Tell())
+ return true;
+
+ aStream.Seek(0);
+ sal_uInt32 nData;
+ aStream.ReadUInt32(nData); // OLEVersion
+ aStream.ReadUInt32(nData); // FormatID
+ aStream.ReadUInt32(nData); // ClassName
+ OString aClassName;
+ if (nData)
{
- aStream.Seek(0);
- sal_uInt32 nData;
- aStream.ReadUInt32(nData); // OLEVersion
- aStream.ReadUInt32(nData); // FormatID
- aStream.ReadUInt32(nData); // ClassName
- OString aClassName;
- if (nData)
- {
- // -1 because it is null-terminated.
- aClassName = read_uInt8s_ToOString(aStream, nData - 1);
- // Skip null-termination.
- aStream.SeekRel(1);
- }
- aStream.ReadUInt32(nData); // TopicName
- aStream.SeekRel(nData);
- aStream.ReadUInt32(nData); // ItemName
- aStream.SeekRel(nData);
- aStream.ReadUInt32(nData); // NativeDataSize
+ // -1 because it is null-terminated.
+ aClassName = read_uInt8s_ToOString(aStream, nData - 1);
+ // Skip null-termination.
+ aStream.SeekRel(1);
+ }
+ aStream.ReadUInt32(nData); // TopicName
+ aStream.SeekRel(nData);
+ aStream.ReadUInt32(nData); // ItemName
+ aStream.SeekRel(nData);
+ aStream.ReadUInt32(nData); // NativeDataSize
- if (nData)
- {
- sal_uInt64 nPos = aStream.Tell();
- sal_uInt8 aSignature[8];
- aStream.ReadBytes(aSignature, SAL_N_ELEMENTS(aSignature));
- aStream.Seek(nPos);
- const sal_uInt8 aOle2Signature[8] = { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
- // Don't use Storage::IsStorageFile() here, that would seek to the start of the stream,
- // where the magic will always mismatch.
- if (std::memcmp(aSignature, aOle2Signature, SAL_N_ELEMENTS(aSignature)) == 0)
- {
- // NativeData
- rOle2.WriteStream(aStream, nData);
- }
- else
- {
- SvMemoryStream aStorage;
- WrapOle1InOle2(aStream, nData, aStorage, aClassName);
- rOle2.WriteStream(aStorage);
- }
- rOle2.Seek(0);
- }
+ if (!nData)
+ return true;
+
+ sal_uInt64 nPos = aStream.Tell();
+ sal_uInt8 aSignature[8];
+ aStream.ReadBytes(aSignature, SAL_N_ELEMENTS(aSignature));
+ aStream.Seek(nPos);
+ const sal_uInt8 aOle2Signature[8] = { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
+ // Don't use Storage::IsStorageFile() here, that would seek to the start of the stream,
+ // where the magic will always mismatch.
+ if (std::memcmp(aSignature, aOle2Signature, SAL_N_ELEMENTS(aSignature)) == 0)
+ {
+ // NativeData
+ rOle2.WriteStream(aStream, nData);
}
+ else
+ {
+ SvMemoryStream aStorage;
+ WrapOle1InOle2(aStream, nData, aStorage, aClassName);
+ rOle2.WriteStream(aStorage);
+ }
+ rOle2.Seek(0);
return true;
}
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index a9d02b3142ca..e0168d954c05 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -789,42 +789,42 @@ bool SVGFilter::implExportWriterTextGraphic( const Reference< view::XSelectionSu
Any selection = xSelectionSupplier->getSelection();
uno::Reference<lang::XServiceInfo> xSelection;
selection >>= xSelection;
- if (xSelection.is() && xSelection->supportsService("com.sun.star.text.TextGraphicObject"))
- {
- uno::Reference<beans::XPropertySet> xPropertySet(xSelection, uno::UNO_QUERY);
-
- uno::Reference<graphic::XGraphic> xOriginalGraphic;
- xPropertySet->getPropertyValue("Graphic") >>= xOriginalGraphic;
- const Graphic aOriginalGraphic(xOriginalGraphic);
+ if (!xSelection || !xSelection->supportsService("com.sun.star.text.TextGraphicObject"))
+ return true;
- uno::Reference<graphic::XGraphic> xTransformedGraphic;
- xPropertySet->getPropertyValue("TransformedGraphic") >>= xTransformedGraphic;
+ uno::Reference<beans::XPropertySet> xPropertySet(xSelection, uno::UNO_QUERY);
- if (!xTransformedGraphic.is())
- return false;
- const Graphic aTransformedGraphic(xTransformedGraphic);
- bool bSameGraphic = aTransformedGraphic == aOriginalGraphic ||
- aOriginalGraphic.GetChecksum() == aTransformedGraphic.GetChecksum();
- const Graphic aGraphic = bSameGraphic ? aOriginalGraphic : aTransformedGraphic;
- uno::Reference<graphic::XGraphic> xGraphic = bSameGraphic ? xOriginalGraphic : xTransformedGraphic;
+ uno::Reference<graphic::XGraphic> xOriginalGraphic;
+ xPropertySet->getPropertyValue("Graphic") >>= xOriginalGraphic;
+ const Graphic aOriginalGraphic(xOriginalGraphic);
- // Calculate size from Graphic
- Point aPos( OutputDevice::LogicToLogic(aGraphic.GetPrefMapMode().GetOrigin(), aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)) );
- Size aSize( OutputDevice::LogicToLogic(aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)) );
+ uno::Reference<graphic::XGraphic> xTransformedGraphic;
+ xPropertySet->getPropertyValue("TransformedGraphic") >>= xTransformedGraphic;
- assert(mSelectedPages.size() == 1);
- SvxDrawPage* pSvxDrawPage(comphelper::getFromUnoTunnel<SvxDrawPage>(mSelectedPages[0]));
- if(pSvxDrawPage == nullptr || pSvxDrawPage->GetSdrPage() == nullptr)
- return false;
+ if (!xTransformedGraphic.is())
+ return false;
+ const Graphic aTransformedGraphic(xTransformedGraphic);
+ bool bSameGraphic = aTransformedGraphic == aOriginalGraphic ||
+ aOriginalGraphic.GetChecksum() == aTransformedGraphic.GetChecksum();
+ const Graphic aGraphic = bSameGraphic ? aOriginalGraphic : aTransformedGraphic;
+ uno::Reference<graphic::XGraphic> xGraphic = bSameGraphic ? xOriginalGraphic : xTransformedGraphic;
+
+ // Calculate size from Graphic
+ Point aPos( OutputDevice::LogicToLogic(aGraphic.GetPrefMapMode().GetOrigin(), aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)) );
+ Size aSize( OutputDevice::LogicToLogic(aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM)) );
+
+ assert(mSelectedPages.size() == 1);
+ SvxDrawPage* pSvxDrawPage(comphelper::getFromUnoTunnel<SvxDrawPage>(mSelectedPages[0]));
+ if(pSvxDrawPage == nullptr || pSvxDrawPage->GetSdrPage() == nullptr)
+ return false;
- SdrGrafObj* pGraphicObj = new SdrGrafObj(pSvxDrawPage->GetSdrPage()->getSdrModelFromSdrPage(), aGraphic, tools::Rectangle( aPos, aSize ));
- uno::Reference< drawing::XShape > xShape = GetXShapeForSdrObject(pGraphicObj);
- uno::Reference< XPropertySet > xShapePropSet(xShape, uno::UNO_QUERY);
- xShapePropSet->setPropertyValue("Graphic", uno::Any(xGraphic));
+ SdrGrafObj* pGraphicObj = new SdrGrafObj(pSvxDrawPage->GetSdrPage()->getSdrModelFromSdrPage(), aGraphic, tools::Rectangle( aPos, aSize ));
+ uno::Reference< drawing::XShape > xShape = GetXShapeForSdrObject(pGraphicObj);
+ uno::Reference< XPropertySet > xShapePropSet(xShape, uno::UNO_QUERY);
+ xShapePropSet->setPropertyValue("Graphic", uno::Any(xGraphic));
- maShapeSelection = drawing::ShapeCollection::create(comphelper::getProcessComponentContext());
- maShapeSelection->add(xShape);
- }
+ maShapeSelection = drawing::ShapeCollection::create(comphelper::getProcessComponentContext());
+ maShapeSelection->add(xShape);
return true;
}
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 359bd34e3dd8..174c3bbb35b0 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -102,35 +102,34 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
if(mxDstDoc.is()) // Import works for Impress / draw only
return filterImpressOrDraw(rDescriptor);
- if(mxSrcDoc.is())
+ if(!mxSrcDoc)
+ return false;
+
+ for (const PropertyValue& rProp : rDescriptor)
{
- for (const PropertyValue& rProp : rDescriptor)
+ if (rProp.Name == "FilterName")
{
- if (rProp.Name == "FilterName")
+ OUString sFilterName;
+ rProp.Value >>= sFilterName;
+ if(sFilterName == "impress_svg_Export")
{
- OUString sFilterName;
- rProp.Value >>= sFilterName;
- if(sFilterName == "impress_svg_Export")
- {
- mbImpressFilter = true;
- return filterImpressOrDraw(rDescriptor);
- }
- else if(sFilterName == "writer_svg_Export")
- {
- mbWriterFilter = true;
- return filterWriterOrCalc(rDescriptor);
- }
- else if(sFilterName == "calc_svg_Export")
- {
- mbCalcFilter = true;
- return filterWriterOrCalc(rDescriptor);
- }
- break;
+ mbImpressFilter = true;
+ return filterImpressOrDraw(rDescriptor);
+ }
+ else if(sFilterName == "writer_svg_Export")
+ {
+ mbWriterFilter = true;
+ return filterWriterOrCalc(rDescriptor);
}
+ else if(sFilterName == "calc_svg_Export")
+ {
+ mbCalcFilter = true;
+ return filterWriterOrCalc(rDescriptor);
+ }
+ break;
}
- return filterImpressOrDraw(rDescriptor);
}
- return false;
+ return filterImpressOrDraw(rDescriptor);
}
bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescriptor )
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 07afb5f440a1..014de0a808b0 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -961,149 +961,147 @@ bool SVGTextWriter::nextParagraph()
mbIsNewListItem = false;
mbIsListLevelStyleImage = false;
- if( mrParagraphEnumeration.is() && mrParagraphEnumeration->hasMoreElements() )
+ if( !mrParagraphEnumeration || !mrParagraphEnumeration->hasMoreElements() )
+ return false;
+
+ Reference < XTextContent > xTextContent( mrParagraphEnumeration->nextElement(), UNO_QUERY_THROW );
+ if( xTextContent.is() )
{
- Reference < XTextContent > xTextContent( mrParagraphEnumeration->nextElement(), UNO_QUERY_THROW );
- if( xTextContent.is() )
- {
- Reference< XServiceInfo > xServiceInfo( xTextContent, UNO_QUERY_THROW );
+ Reference< XServiceInfo > xServiceInfo( xTextContent, UNO_QUERY_THROW );
#if OSL_DEBUG_LEVEL > 0
- OUString sInfo;
+ OUString sInfo;
#endif
- if( xServiceInfo->supportsService( "com.sun.star.text.Paragraph" ) )
+ if( xServiceInfo->supportsService( "com.sun.star.text.Paragraph" ) )
+ {
+ mrCurrentTextParagraph.set( xTextContent );
+ Reference< XPropertySet > xPropSet( xTextContent, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( "NumberingLevel" ) )
{
- mrCurrentTextParagraph.set( xTextContent );
- Reference< XPropertySet > xPropSet( xTextContent, UNO_QUERY_THROW );
- Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
- if( xPropSetInfo->hasPropertyByName( "NumberingLevel" ) )
+ sal_Int16 nListLevel = 0;
+ if( xPropSet->getPropertyValue( "NumberingLevel" ) >>= nListLevel )
{
- sal_Int16 nListLevel = 0;
- if( xPropSet->getPropertyValue( "NumberingLevel" ) >>= nListLevel )
- {
- mbIsNewListItem = true;
+ mbIsNewListItem = true;
#if OSL_DEBUG_LEVEL > 0
- sInfo = "NumberingLevel: " + OUString::number( nListLevel );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "style", sInfo );
+ sInfo = "NumberingLevel: " + OUString::number( nListLevel );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "style", sInfo );
#endif
- Reference< XIndexReplace > xNumRules;
- if( xPropSetInfo->hasPropertyByName( "NumberingRules" ) )
- {
- xPropSet->getPropertyValue( "NumberingRules" ) >>= xNumRules;
- }
- if( xNumRules.is() && ( nListLevel < xNumRules->getCount() ) )
+ Reference< XIndexReplace > xNumRules;
+ if( xPropSetInfo->hasPropertyByName( "NumberingRules" ) )
+ {
+ xPropSet->getPropertyValue( "NumberingRules" ) >>= xNumRules;
+ }
+ if( xNumRules.is() && ( nListLevel < xNumRules->getCount() ) )
+ {
+ bool bIsNumbered = true;
+ OUString sNumberingIsNumber("NumberingIsNumber");
+ if( xPropSetInfo->hasPropertyByName( sNumberingIsNumber ) )
{
- bool bIsNumbered = true;
- OUString sNumberingIsNumber("NumberingIsNumber");
- if( xPropSetInfo->hasPropertyByName( sNumberingIsNumber ) )
+ if( !(xPropSet->getPropertyValue( sNumberingIsNumber ) >>= bIsNumbered ) )
{
- if( !(xPropSet->getPropertyValue( sNumberingIsNumber ) >>= bIsNumbered ) )
- {
- OSL_FAIL( "numbered paragraph without number info" );
- bIsNumbered = false;
- }
+ OSL_FAIL( "numbered paragraph without number info" );
+ bIsNumbered = false;
+ }
#if OSL_DEBUG_LEVEL > 0
- if( bIsNumbered )
- {
- sInfo = "true";
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "is-numbered", sInfo );
- }
-#endif
+ if( bIsNumbered )
+ {
+ sInfo = "true";
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "is-numbered", sInfo );
}
- mbIsNewListItem = bIsNumbered;
+#endif
+ }
+ mbIsNewListItem = bIsNumbered;
- if( bIsNumbered )
+ if( bIsNumbered )
+ {
+ Sequence<PropertyValue> aProps;
+ if( xNumRules->getByIndex( nListLevel ) >>= aProps )
{
- Sequence<PropertyValue> aProps;
- if( xNumRules->getByIndex( nListLevel ) >>= aProps )
+ sal_Int16 eType = NumberingType::CHAR_SPECIAL;
+ sal_Unicode cBullet = 0xf095;
+ const sal_Int32 nCount = aProps.getLength();
+ const PropertyValue* pPropArray = aProps.getConstArray();
+ for( sal_Int32 i = 0; i < nCount; ++i )
{
- sal_Int16 eType = NumberingType::CHAR_SPECIAL;
- sal_Unicode cBullet = 0xf095;
- const sal_Int32 nCount = aProps.getLength();
- const PropertyValue* pPropArray = aProps.getConstArray();
- for( sal_Int32 i = 0; i < nCount; ++i )
+ const PropertyValue& rProp = pPropArray[i];
+ if( rProp.Name == "NumberingType" )
{
- const PropertyValue& rProp = pPropArray[i];
- if( rProp.Name == "NumberingType" )
- {
- rProp.Value >>= eType;
- }
- else if( rProp.Name == "BulletChar" )
+ rProp.Value >>= eType;
+ }
+ else if( rProp.Name == "BulletChar" )
+ {
+ OUString sValue;
+ rProp.Value >>= sValue;
+ if( !sValue.isEmpty() )
{
- OUString sValue;
- rProp.Value >>= sValue;
- if( !sValue.isEmpty() )
- {
- cBullet = sValue[0];
- }
+ cBullet = sValue[0];
}
}
- meNumberingType = eType;
- mbIsListLevelStyleImage = ( NumberingType::BITMAP == meNumberingType );
- if( NumberingType::CHAR_SPECIAL == meNumberingType )
+ }
+ meNumberingType = eType;
+ mbIsListLevelStyleImage = ( NumberingType::BITMAP == meNumberingType );
+ if( NumberingType::CHAR_SPECIAL == meNumberingType )
+ {
+ if( cBullet )
{
- if( cBullet )
+ if( cBullet < ' ' )
{
- if( cBullet < ' ' )
- {
- cBullet = 0xF000 + 149;
- }
- mcBulletChar = cBullet;
+ cBullet = 0xF000 + 149;
+ }
+ mcBulletChar = cBullet;
#if OSL_DEBUG_LEVEL > 0
- sInfo = OUString::number( static_cast<sal_Int32>(cBullet) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "bullet-char", sInfo );
+ sInfo = OUString::number( static_cast<sal_Int32>(cBullet) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "bullet-char", sInfo );
#endif
- }
-
}
+
}
}
}
-
}
- }
- Reference< XEnumerationAccess > xEnumerationAccess( xTextContent, UNO_QUERY_THROW );
- Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_SET_THROW );
- if( xEnumeration.is() && xEnumeration->hasMoreElements() )
- {
- mrTextPortionEnumeration.set( xEnumeration );
}
-#if OSL_DEBUG_LEVEL > 0
- sInfo = "Paragraph";
-#endif
}
- else if( xServiceInfo->supportsService( "com.sun.star.text.Table" ) )
+
+ Reference< XEnumerationAccess > xEnumerationAccess( xTextContent, UNO_QUERY_THROW );
+ Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_SET_THROW );
+ if( xEnumeration.is() && xEnumeration->hasMoreElements() )
{
- OSL_FAIL( "SVGTextWriter::nextParagraph: text tables are not handled." );
+ mrTextPortionEnumeration.set( xEnumeration );
+ }
#if OSL_DEBUG_LEVEL > 0
- sInfo = "Table";
+ sInfo = "Paragraph";
#endif
- }
- else
- {
- OSL_FAIL( "SVGTextWriter::nextParagraph: Unknown text content." );
- return false;
- }
+ }
+ else if( xServiceInfo->supportsService( "com.sun.star.text.Table" ) )
+ {
+ OSL_FAIL( "SVGTextWriter::nextParagraph: text tables are not handled." );
#if OSL_DEBUG_LEVEL > 0
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", sInfo );
- SvXMLElementExport aParaElem( mrExport, XML_NAMESPACE_NONE, "desc", mbIWS, mbIWS );
+ sInfo = "Table";
#endif
}
else
{
- OSL_FAIL( "SVGTextWriter::nextParagraph: no XServiceInfo interface available for text content." );
+ OSL_FAIL( "SVGTextWriter::nextParagraph: Unknown text content." );
return false;
}
-
- const OUString& rParagraphId = implGetValidIDFromInterface( Reference<XInterface>(xTextContent, UNO_QUERY) );
- if( !rParagraphId.isEmpty() )
- {
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId );
- }
- return true;
+#if OSL_DEBUG_LEVEL > 0
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", sInfo );
+ SvXMLElementExport aParaElem( mrExport, XML_NAMESPACE_NONE, "desc", mbIWS, mbIWS );
+#endif
+ }
+ else
+ {
+ OSL_FAIL( "SVGTextWriter::nextParagraph: no XServiceInfo interface available for text content." );
+ return false;
}
- return false;
+ const OUString& rParagraphId = implGetValidIDFromInterface( Reference<XInterface>(xTextContent, UNO_QUERY) );
+ if( !rParagraphId.isEmpty() )
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId );
+ }
+ return true;
}
@@ -1111,134 +1109,134 @@ bool SVGTextWriter::nextTextPortion()
{
mrCurrentTextPortion.clear();
mbIsURLField = false;
- if( mrTextPortionEnumeration.is() && mrTextPortionEnumeration->hasMoreElements() )
- {
- mbIsPlaceholderShape = false;
- Reference< XPropertySet > xPortionPropSet( mrTextPortionEnumeration->nextElement(), UNO_QUERY );
- Reference< XPropertySetInfo > xPortionPropInfo( xPortionPropSet->getPropertySetInfo() );
- Reference < XTextRange > xPortionTextRange( xPortionPropSet, UNO_QUERY);
- if( xPortionPropSet.is() && xPortionPropInfo.is()
- && xPortionPropInfo->hasPropertyByName( "TextPortionType" ) )
- {
+ if( !mrTextPortionEnumeration || !mrTextPortionEnumeration->hasMoreElements() )
+ return false;
+
+ mbIsPlaceholderShape = false;
+ Reference< XPropertySet > xPortionPropSet( mrTextPortionEnumeration->nextElement(), UNO_QUERY );
+ Reference< XPropertySetInfo > xPortionPropInfo( xPortionPropSet->getPropertySetInfo() );
+ Reference < XTextRange > xPortionTextRange( xPortionPropSet, UNO_QUERY);
+ if( !xPortionPropSet || !xPortionPropInfo
+ || !xPortionPropInfo->hasPropertyByName( "TextPortionType" ) )
+ return true;
+
#if OSL_DEBUG_LEVEL > 0
- OUString sInfo;
- OUString sPortionType;
- if( xPortionPropSet->getPropertyValue( "TextPortionType" ) >>= sPortionType )
- {
- sInfo = "type: " + sPortionType + "; ";
- }
+ OUString sInfo;
+ OUString sPortionType;
+ if( xPortionPropSet->getPropertyValue( "TextPortionType" ) >>= sPortionType )
+ {
+ sInfo = "type: " + sPortionType + "; ";
+ }
#endif
- msPageCount = "";
- msDateTimeType = "";
- msTextFieldType = "";
- if( xPortionTextRange.is() )
- {
+ msPageCount = "";
+ msDateTimeType = "";
+ msTextFieldType = "";
+ if( xPortionTextRange.is() )
+ {
#if OSL_DEBUG_LEVEL > 0
- sInfo += "content: " + xPortionTextRange->getString() + "; ";
+ sInfo += "content: " + xPortionTextRange->getString() + "; ";
#endif
- mrCurrentTextPortion.set( xPortionTextRange );
+ mrCurrentTextPortion.set( xPortionTextRange );
- Reference < XPropertySet > xRangePropSet( xPortionTextRange, UNO_QUERY );
- if( xRangePropSet.is() && xRangePropSet->getPropertySetInfo()->hasPropertyByName( "TextField" ) )
- {
- Reference < XTextField > xTextField( xRangePropSet->getPropertyValue( "TextField" ), UNO_QUERY );
- if( xTextField.is() )
- {
- static const OUStringLiteral sServicePrefix(u"com.sun.star.text.textfield.");
- static const OUStringLiteral sPresentationServicePrefix(u"com.sun.star.presentation.TextField.");
+ Reference < XPropertySet > xRangePropSet( xPortionTextRange, UNO_QUERY );
+ if( xRangePropSet.is() && xRangePropSet->getPropertySetInfo()->hasPropertyByName( "TextField" ) )
+ {
+ Reference < XTextField > xTextField( xRangePropSet->getPropertyValue( "TextField" ), UNO_QUERY );
+ if( xTextField.is() )
+ {
+ static const OUStringLiteral sServicePrefix(u"com.sun.star.text.textfield.");
+ static const OUStringLiteral sPresentationServicePrefix(u"com.sun.star.presentation.TextField.");
- Reference< XServiceInfo > xService( xTextField, UNO_QUERY );
- const Sequence< OUString > aServices = xService->getSupportedServiceNames();
+ Reference< XServiceInfo > xService( xTextField, UNO_QUERY );
+ const Sequence< OUString > aServices = xService->getSupportedServiceNames();
- const OUString* pNames = aServices.getConstArray();
- sal_Int32 nCount = aServices.getLength();
+ const OUString* pNames = aServices.getConstArray();
+ sal_Int32 nCount = aServices.getLength();
- OUString sFieldName; // service name postfix of current field
+ OUString sFieldName; // service name postfix of current field
- // search for TextField service name
- while( nCount-- )
- {
- if ( pNames->matchIgnoreAsciiCase( sServicePrefix ) )
- {
- // TextField found => postfix is field type!
- sFieldName = pNames->copy( sServicePrefix.getLength() );
- break;
- }
- else if( pNames->startsWith( sPresentationServicePrefix ) )
- {
- // TextField found => postfix is field type!
- sFieldName = pNames->copy( sPresentationServicePrefix.getLength() );
- break;
- }
+ // search for TextField service name
+ while( nCount-- )
+ {
+ if ( pNames->matchIgnoreAsciiCase( sServicePrefix ) )
+ {
+ // TextField found => postfix is field type!
+ sFieldName = pNames->copy( sServicePrefix.getLength() );
+ break;
+ }
+ else if( pNames->startsWith( sPresentationServicePrefix ) )
+ {
+ // TextField found => postfix is field type!
+ sFieldName = pNames->copy( sPresentationServicePrefix.getLength() );
+ break;
+ }
- ++pNames;
- }
+ ++pNames;
+ }
- msTextFieldType = sFieldName;
+ msTextFieldType = sFieldName;
#if OSL_DEBUG_LEVEL > 0
- sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
+ sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
#endif
- // This case handle Date or Time text field inserted by the user
- // on both page/master page. It doesn't handle the standard Date/Time field.
- if( sFieldName == "DateTime" )
+ // This case handle Date or Time text field inserted by the user
+ // on both page/master page. It doesn't handle the standard Date/Time field.
+ if( sFieldName == "DateTime" )
+ {
+ Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
+ if( xTextFieldPropSet.is() )
+ {
+ Reference<XPropertySetInfo> xPropSetInfo = xTextFieldPropSet->getPropertySetInfo();
+ if( xPropSetInfo.is() )
{
- Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
- if( xTextFieldPropSet.is() )
+ // The standard Date/Time field has no property.
+ // Trying to get a property value on such field would cause a runtime exception.
+ // So the hasPropertyByName check is needed.
+ bool bIsFixed = true;
+ if( xPropSetInfo->hasPropertyByName("IsFixed") && ( ( xTextFieldPropSet->getPropertyValue( "IsFixed" ) ) >>= bIsFixed ) && !bIsFixed )
{
- Reference<XPropertySetInfo> xPropSetInfo = xTextFieldPropSet->getPropertySetInfo();
- if( xPropSetInfo.is() )
+ bool bIsDate = true;
+ if( xPropSetInfo->hasPropertyByName("IsDate") && ( ( xTextFieldPropSet->getPropertyValue( "IsDate" ) ) >>= bIsDate ) )
{
- // The standard Date/Time field has no property.
- // Trying to get a property value on such field would cause a runtime exception.
- // So the hasPropertyByName check is needed.
- bool bIsFixed = true;
- if( xPropSetInfo->hasPropertyByName("IsFixed") && ( ( xTextFieldPropSet->getPropertyValue( "IsFixed" ) ) >>= bIsFixed ) && !bIsFixed )
- {
- bool bIsDate = true;
- if( xPropSetInfo->hasPropertyByName("IsDate") && ( ( xTextFieldPropSet->getPropertyValue( "IsDate" ) ) >>= bIsDate ) )
- {
- msDateTimeType = OUString::createFromAscii( bIsDate ? "<date>" : "<time>" );
- }
- }
+ msDateTimeType = OUString::createFromAscii( bIsDate ? "<date>" : "<time>" );
}
}
}
- if( sFieldName == "DateTime" || sFieldName == "Header"
- || sFieldName == "Footer" || sFieldName == "PageNumber"
- || sFieldName == "PageName" )
- {
- mbIsPlaceholderShape = true;
- }
- else if (sFieldName == "PageCount")
- {
- msPageCount = xTextField->getPresentation( /* show command: */ false );
- }
- else
- {
- mbIsURLField = sFieldName == "URL";
+ }
+ }
+ if( sFieldName == "DateTime" || sFieldName == "Header"
+ || sFieldName == "Footer" || sFieldName == "PageNumber"
+ || sFieldName == "PageName" )
+ {
+ mbIsPlaceholderShape = true;
+ }
+ else if (sFieldName == "PageCount")
+ {
+ msPageCount = xTextField->getPresentation( /* show command: */ false );
+ }
+ else
+ {
+ mbIsURLField = sFieldName == "URL";
- if( mbIsURLField )
+ if( mbIsURLField )
+ {
+ Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
+ if( xTextFieldPropSet.is() )
+ {
+ OUString sURL;
+ if( ( xTextFieldPropSet->getPropertyValue( sFieldName ) ) >>= sURL )
{
- Reference<XPropertySet> xTextFieldPropSet(xTextField, UNO_QUERY);
- if( xTextFieldPropSet.is() )
- {
- OUString sURL;
- if( ( xTextFieldPropSet->getPropertyValue( sFieldName ) ) >>= sURL )
- {
#if OSL_DEBUG_LEVEL > 0
- sInfo += "url: " + mrExport.GetRelativeReference( sURL );
+ sInfo += "url: " + mrExport.GetRelativeReference( sURL );
#endif
- msUrl = mrExport.GetRelativeReference( sURL );
- if( !msUrl.isEmpty() )
- {
- implRegisterInterface( xPortionTextRange );
+ msUrl = mrExport.GetRelativeReference( sURL );
+ if( !msUrl.isEmpty() )
+ {
+ implRegisterInterface( xPortionTextRange );
- const OUString& rTextPortionId = implGetValidIDFromInterface( Reference<XInterface>(xPortionTextRange, UNO_QUERY) );
- if( !rTextPortionId.isEmpty() )
- {
- msHyperlinkIdList += rTextPortionId + " ";
- }
- }
+ const OUString& rTextPortionId = implGetValidIDFromInterface( Reference<XInterface>(xPortionTextRange, UNO_QUERY) );
+ if( !rTextPortionId.isEmpty() )
+ {
+ msHyperlinkIdList += rTextPortionId + " ";
}
}
}
@@ -1246,16 +1244,14 @@ bool SVGTextWriter::nextTextPortion()
}
}
}
-#if OSL_DEBUG_LEVEL > 0
- mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextPortion" );
- SvXMLElementExport aPortionElem( mrExport, XML_NAMESPACE_NONE, "desc", mbIWS, mbIWS );
- mrExport.GetDocHandler()->characters( sInfo );
-#endif
- return true;
}
}
-
- return false;
+#if OSL_DEBUG_LEVEL > 0
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextPortion" );
+ SvXMLElementExport aPortionElem( mrExport, XML_NAMESPACE_NONE, "desc", mbIWS, mbIWS );
+ mrExport.GetDocHandler()->characters( sInfo );
+#endif
+ return true;
}
diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx
index 7718b7d74504..f82a49f7042c 100644
--- a/forms/source/component/CheckBox.cxx
+++ b/forms/source/component/CheckBox.cxx
@@ -236,39 +236,39 @@ Any OCheckBoxModel::translateDbColumnToControlValue()
bool OCheckBoxModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
OSL_PRECOND( m_xColumnUpdate.is(), "OCheckBoxModel::commitControlValueToDbColumn: not bound!" );
- if ( m_xColumnUpdate.is() )
+ if ( !m_xColumnUpdate )
+ return true;
+
+ Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) );
+ try
{
- Any aControlValue( m_xAggregateSet->getPropertyValue( PROPERTY_STATE ) );
- try
- {
- sal_Int16 nValue = TRISTATE_INDET;
- aControlValue >>= nValue;
- switch (nValue)
- {
- case TRISTATE_INDET:
- m_xColumnUpdate->updateNull();
- break;
- case TRISTATE_TRUE:
- if (DbUseBool())
- m_xColumnUpdate->updateBoolean( true );
- else
- m_xColumnUpdate->updateString( getReferenceValue() );
- break;
- case TRISTATE_FALSE:
- if (DbUseBool())
- m_xColumnUpdate->updateBoolean( false );
- else
- m_xColumnUpdate->updateString( getNoCheckReferenceValue() );
- break;
- default:
- OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: invalid value !");
- }
- }
- catch(const Exception&)
+ sal_Int16 nValue = TRISTATE_INDET;
+ aControlValue >>= nValue;
+ switch (nValue)
{
- OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: could not commit !");
+ case TRISTATE_INDET:
+ m_xColumnUpdate->updateNull();
+ break;
+ case TRISTATE_TRUE:
+ if (DbUseBool())
+ m_xColumnUpdate->updateBoolean( true );
+ else
+ m_xColumnUpdate->updateString( getReferenceValue() );
+ break;
+ case TRISTATE_FALSE:
+ if (DbUseBool())
+ m_xColumnUpdate->updateBoolean( false );
+ else
+ m_xColumnUpdate->updateString( getNoCheckReferenceValue() );
+ break;
+ default:
+ OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: invalid value !");
}
}
+ catch(const Exception&)
+ {
+ OSL_FAIL("OCheckBoxModel::commitControlValueToDbColumn: could not commit !");
+ }
return true;
}
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index d43903bfea35..c26b90f04778 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -755,29 +755,29 @@ bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
bool bAddToList = bModified && !_bPostReset;
// (only if this is not the "commit" triggered by a "reset")
- if ( bAddToList )
+ if ( !bAddToList )
+ return true;
+
+ css::uno::Sequence<OUString> aStringItemList;
+ if ( !(getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aStringItemList) )
+ return true;
+
+ bool bFound = false;
+ for (const OUString& rStringItem : std::as_const(aStringItemList))
{
- css::uno::Sequence<OUString> aStringItemList;
- if ( getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aStringItemList )
- {
- bool bFound = false;
- for (const OUString& rStringItem : std::as_const(aStringItemList))
- {
- if ( (bFound = rStringItem == sNewValue) )
- break;
- }
+ if ( (bFound = rStringItem == sNewValue) )
+ break;
+ }
- // not found -> add
- if (!bFound)
- {
- sal_Int32 nOldLen = aStringItemList.getLength();
- aStringItemList.realloc( nOldLen + 1 );
- aStringItemList.getArray()[ nOldLen ] = sNewValue;
+ // not found -> add
+ if (!bFound)
+ {
+ sal_Int32 nOldLen = aStringItemList.getLength();
+ aStringItemList.realloc( nOldLen + 1 );
+ aStringItemList.getArray()[ nOldLen ] = sNewValue;
- setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) );
- setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) );
- }
- }
+ setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) );
+ setFastPropertyValue( PROPERTY_ID_TYPEDITEMLIST, makeAny( css::uno::Sequence<css::uno::Any>() ) );
}
return true;
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 45ffd5e595f1..74fbaf77e6be 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -1033,32 +1033,31 @@ void ODatabaseForm::updateParameterInfo()
bool ODatabaseForm::hasValidParent() const
{
// do we have to fill the parameters again?
- if (m_bSubForm)
+ if (!m_bSubForm)
+ return true;
+ Reference<XResultSet> xResultSet(m_xParent, UNO_QUERY);
+ if (!xResultSet.is())
{
- Reference<XResultSet> xResultSet(m_xParent, UNO_QUERY);
- if (!xResultSet.is())
- {
- OSL_FAIL("ODatabaseForm::hasValidParent() : no parent resultset !");
- return false;
- }
- try
- {
- Reference< XPropertySet > xSet( m_xParent, UNO_QUERY );
- Reference< XLoadable > xLoad( m_xParent, UNO_QUERY );
- if ( xLoad->isLoaded()
- && ( xResultSet->isBeforeFirst()
- || xResultSet->isAfterLast()
- || getBOOL( xSet->getPropertyValue( PROPERTY_ISNEW ) )
- )
+ OSL_FAIL("ODatabaseForm::hasValidParent() : no parent resultset !");
+ return false;
+ }
+ try
+ {
+ Reference< XPropertySet > xSet( m_xParent, UNO_QUERY );
+ Reference< XLoadable > xLoad( m_xParent, UNO_QUERY );
+ if ( xLoad->isLoaded()
+ && ( xResultSet->isBeforeFirst()
+ || xResultSet->isAfterLast()
+ || getBOOL( xSet->getPropertyValue( PROPERTY_ISNEW ) )
)
- // the parent form is loaded and on a "virtual" row -> not valid
- return false;
- }
- catch(const Exception&)
- {
- // parent could be forwardonly?
+ )
+ // the parent form is loaded and on a "virtual" row -> not valid
return false;
- }
+ }
+ catch(const Exception&)
+ {
+ // parent could be forwardonly?
+ return false;
}
return true;
}
@@ -3110,35 +3109,34 @@ sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event)
sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event)
{
// is our aggregate calling?
- if (event.Source == css::uno::Reference<css::uno::XInterface>(static_cast<XWeak*>(this)))
+ if (event.Source != css::uno::Reference<css::uno::XInterface>(static_cast<XWeak*>(this)))
+ return true;
+
+ // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface
+ // for XRowSetApproveBroadcaster-interface.
+ // So we have to multiplex this approve request.
+ ::comphelper::OInterfaceIteratorHelper3 aIter( m_aRowSetApproveListeners );
+ while ( aIter.hasMoreElements() )
{
- // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface
- // for XRowSetApproveBroadcaster-interface.
- // So we have to multiplex this approve request.
- ::comphelper::OInterfaceIteratorHelper3 aIter( m_aRowSetApproveListeners );
- while ( aIter.hasMoreElements() )
+ Reference< XRowSetApproveListener > xListener( aIter.next() );
+ try
{
- Reference< XRowSetApproveListener > xListener( aIter.next() );
- try
- {
- if ( !xListener->approveRowChange( event ) )
- return false;
- }
- catch (const DisposedException& e)
- {
- if ( e.Context == xListener )
- aIter.remove();
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("forms.component");
- }
+ if ( !xListener->approveRowChange( event ) )
+ return false;
+ }
+ catch (const DisposedException& e)
+ {
+ if ( e.Context == xListener )
+ aIter.remove();
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("forms.component");
}
- return true;
}
return true;
}
diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx
index cf3de99e1b24..35b2f3f7424b 100644
--- a/forms/source/component/Date.cxx
+++ b/forms/source/component/Date.cxx
@@ -219,40 +219,40 @@ void ODateModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
bool ODateModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aControlValue != m_aSaveValue )
+ if ( aControlValue == m_aSaveValue )
+ return true;
+
+ if ( !aControlValue.hasValue() )
+ m_xColumnUpdate->updateNull();
+ else
{
- if ( !aControlValue.hasValue() )
- m_xColumnUpdate->updateNull();
- else
+ try
{
- try
+ util::Date aDate;
+ if ( !( aControlValue >>= aDate ) )
{
- util::Date aDate;
- if ( !( aControlValue >>= aDate ) )
- {
- sal_Int32 nAsInt(0);
- aControlValue >>= nAsInt;
- aDate = DBTypeConversion::toDate(nAsInt);
- }
-
- if ( !m_bDateTimeField )
- m_xColumnUpdate->updateDate( aDate );
- else
- {
- util::DateTime aDateTime = m_xColumn->getTimestamp();
- aDateTime.Day = aDate.Day;
- aDateTime.Month = aDate.Month;
- aDateTime.Year = aDate.Year;
- m_xColumnUpdate->updateTimestamp( aDateTime );
- }
+ sal_Int32 nAsInt(0);
+ aControlValue >>= nAsInt;
+ aDate = DBTypeConversion::toDate(nAsInt);
}
- catch(const Exception&)
+
+ if ( !m_bDateTimeField )
+ m_xColumnUpdate->updateDate( aDate );
+ else
{
- return false;
+ util::DateTime aDateTime = m_xColumn->getTimestamp();
+ aDateTime.Day = aDate.Day;
+ aDateTime.Month = aDate.Month;
+ aDateTime.Year = aDate.Year;
+ m_xColumnUpdate->updateTimestamp( aDateTime );
}
}
- m_aSaveValue = aControlValue;
+ catch(const Exception&)
+ {
+ return false;
+ }
}
+ m_aSaveValue = aControlValue;
return true;
}
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index 38ed0b7ada01..9c6459a0dd04 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -510,32 +510,31 @@ namespace frm
default:
return true;
}
- if ( m_aText != aText )
+ if ( m_aText == aText )
+ return true;
+ // check the text with the SQL-Parser
+ OUString aNewText = aText.trim();
+ if ( !aNewText.isEmpty() )
{
- // check the text with the SQL-Parser
- OUString aNewText = aText.trim();
- if ( !aNewText.isEmpty() )
+ ::dbtools::OPredicateInputController aPredicateInput( m_xContext, m_xConnection, getParseContext() );
+ OUString sErrorMessage;
+ if ( !aPredicateInput.normalizePredicateString( aNewText, m_xField, &sErrorMessage ) )
{
- ::dbtools::OPredicateInputController aPredicateInput( m_xContext, m_xConnection, getParseContext() );
- OUString sErrorMessage;
- if ( !aPredicateInput.normalizePredicateString( aNewText, m_xField, &sErrorMessage ) )
- {
- // display the error and outta here
- SQLContext aError;
- aError.Message = ResourceManager::loadString(RID_STR_SYNTAXERROR);
- aError.Details = sErrorMessage;
- displayException( aError );
- return false;
- }
+ // display the error and outta here
+ SQLContext aError;
+ aError.Message = ResourceManager::loadString(RID_STR_SYNTAXERROR);
+ aError.Details = sErrorMessage;
+ displayException( aError );
+ return false;
}
-
- setText(aNewText);
- TextEvent aEvt;
- aEvt.Source = *this;
- ::comphelper::OInterfaceIteratorHelper3 aIt(m_aTextListeners);
- while( aIt.hasMoreElements() )
- aIt.next()->textChanged(aEvt);
}
+
+ setText(aNewText);
+ TextEvent aEvt;
+ aEvt.Source = *this;
+ ::comphelper::OInterfaceIteratorHelper3 aIt(m_aTextListeners);
+ while( aIt.hasMoreElements() )
+ aIt.next()->textChanged(aEvt);
#endif
return true;
}
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 340ee79a8a0f..432456802c4c 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -809,38 +809,38 @@ sal_uInt16 OFormattedModel::getPersistenceFlags() const
bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aControlValue != m_aSaveValue )
- {
- // empty string + EmptyIsNull = void
- if ( !aControlValue.hasValue()
- || ( ( aControlValue.getValueType().getTypeClass() == TypeClass_STRING )
- && getString( aControlValue ).isEmpty()
- && m_bEmptyIsNull
- )
+ if ( aControlValue == m_aSaveValue )
+ return true;
+
+ // empty string + EmptyIsNull = void
+ if ( !aControlValue.hasValue()
+ || ( ( aControlValue.getValueType().getTypeClass() == TypeClass_STRING )
+ && getString( aControlValue ).isEmpty()
+ && m_bEmptyIsNull
)
- m_xColumnUpdate->updateNull();
- else
+ )
+ m_xColumnUpdate->updateNull();
+ else
+ {
+ try
{
- try
+ double f = 0.0;
+ if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
{
- double f = 0.0;
- if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
- {
- DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
- }
- else
- {
- DBG_ASSERT( aControlValue.getValueType().getTypeClass() == TypeClass_STRING, "OFormattedModel::commitControlValueToDbColumn: invalid value type!" );
- m_xColumnUpdate->updateString( getString( aControlValue ) );
- }
+ DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
}
- catch(const Exception&)
+ else
{
- return false;
+ DBG_ASSERT( aControlValue.getValueType().getTypeClass() == TypeClass_STRING, "OFormattedModel::commitControlValueToDbColumn: invalid value type!" );
+ m_xColumnUpdate->updateString( getString( aControlValue ) );
}
}
- m_aSaveValue = aControlValue;
+ catch(const Exception&)
+ {
+ return false;
+ }
}
+ m_aSaveValue = aControlValue;
return true;
}
diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx
index 434bf27f7cfc..24e9ac10585d 100644
--- a/forms/source/component/Pattern.cxx
+++ b/forms/source/component/Pattern.cxx
@@ -126,33 +126,33 @@ bool OPatternModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aNewValue != m_aLastKnownValue )
- {
- OUString sNewValue;
- aNewValue >>= sNewValue;
+ if ( aNewValue == m_aLastKnownValue )
+ return true;
- if ( !aNewValue.hasValue()
- || ( sNewValue.isEmpty() // an empty string
- && m_bEmptyIsNull // which should be interpreted as NULL
- )
- )
- {
- m_xColumnUpdate->updateNull();
- }
- else
- {
- OSL_ENSURE(m_pFormattedValue,
- "OPatternModel::commitControlValueToDbColumn: no value helper!");
- if (!m_pFormattedValue)
- return false;
+ OUString sNewValue;
+ aNewValue >>= sNewValue;
- if ( !m_pFormattedValue->setFormattedValue( sNewValue ) )
- return false;
- }
+ if ( !aNewValue.hasValue()
+ || ( sNewValue.isEmpty() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
+ )
+ )
+ {
+ m_xColumnUpdate->updateNull();
+ }
+ else
+ {
+ OSL_ENSURE(m_pFormattedValue,
+ "OPatternModel::commitControlValueToDbColumn: no value helper!");
+ if (!m_pFormattedValue)
+ return false;
- m_aLastKnownValue = aNewValue;
+ if ( !m_pFormattedValue->setFormattedValue( sNewValue ) )
+ return false;
}
+ m_aLastKnownValue = aNewValue;
+
return true;
}
diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index 24d4a0369a90..fffcbd5466ed 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -224,43 +224,43 @@ void OTimeModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aControlValue != m_aSaveValue )
+ if ( aControlValue == m_aSaveValue )
+ return true;
+
+ if ( !aControlValue.hasValue() )
+ m_xColumnUpdate->updateNull();
+ else
{
- if ( !aControlValue.hasValue() )
- m_xColumnUpdate->updateNull();
- else
+ try
{
- try
+ util::Time aTime;
+ if ( !( aControlValue >>= aTime ) )
{
- util::Time aTime;
- if ( !( aControlValue >>= aTime ) )
- {
- sal_Int64 nAsInt(0);
- aControlValue >>= nAsInt;
- aTime = DBTypeConversion::toTime(nAsInt);
- }
-
- if (!m_bDateTimeField)
- m_xColumnUpdate->updateTime(aTime);
- else
- {
- util::DateTime aDateTime = m_xColumn->getTimestamp();
- if (aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0)
- aDateTime = ::com::sun::star::util::DateTime(0,0,0,0,30,12,1899, false);
- aDateTime.NanoSeconds = aTime.NanoSeconds;
- aDateTime.Seconds = aTime.Seconds;
- aDateTime.Minutes = aTime.Minutes;
- aDateTime.Hours = aTime.Hours;
- m_xColumnUpdate->updateTimestamp(aDateTime);
- }
+ sal_Int64 nAsInt(0);
+ aControlValue >>= nAsInt;
+ aTime = DBTypeConversion::toTime(nAsInt);
}
- catch(const Exception&)
+
+ if (!m_bDateTimeField)
+ m_xColumnUpdate->updateTime(aTime);
+ else
{
- return false;
+ util::DateTime aDateTime = m_xColumn->getTimestamp();
+ if (aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0)
+ aDateTime = ::com::sun::star::util::DateTime(0,0,0,0,30,12,1899, false);
+ aDateTime.NanoSeconds = aTime.NanoSeconds;
+ aDateTime.Seconds = aTime.Seconds;
+ aDateTime.Minutes = aTime.Minutes;
+ aDateTime.Hours = aTime.Hours;
+ m_xColumnUpdate->updateTimestamp(aDateTime);
}
}
- m_aSaveValue = aControlValue;
+ catch(const Exception&)
+ {
+ return false;
+ }
}
+ m_aSaveValue = aControlValue;
return true;
}
diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx
index f49b8617ff2c..b7a0d5abcbd6 100644
--- a/forms/source/misc/limitedformats.cxx
+++ b/forms/source/misc/limitedformats.cxx
@@ -271,70 +271,68 @@ namespace frm
{
OSL_ENSURE(m_xAggregate.is() && (-1 != m_nFormatEnumPropertyHandle), "OLimitedFormats::convertFormatKeyPropertyValue: not initialized!");
- if (m_xAggregate.is())
+ if (!m_xAggregate)
+ return false;
+
+ // the new format key to set
+ sal_Int32 nNewFormat = 0;
+ if (!(_rNewValue >>= nNewFormat))
+ throw IllegalArgumentException();
+
+ // get the old (enum) value from the aggregate
+ Any aEnumPropertyValue = m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle);
+ sal_Int32 nOldEnumValue = -1;
+ ::cppu::enum2int(nOldEnumValue, aEnumPropertyValue);
+
+ // get the translation table
+ const FormatEntry* pFormats = lcl_getFormatTable(m_nTableId);
+
+ _rOldValue.clear();
+ _rConvertedValue.clear();
+
+ // look for the entry with the given format key
+ sal_Int32 nTablePosition = 0;
+ for ( ;
+ (nullptr != pFormats->pDescription) && (nNewFormat != pFormats->nKey);
+ ++pFormats, ++nTablePosition
+ )
{
- // the new format key to set
- sal_Int32 nNewFormat = 0;
- if (!(_rNewValue >>= nNewFormat))
- throw IllegalArgumentException();
-
- // get the old (enum) value from the aggregate
- Any aEnumPropertyValue = m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle);
- sal_Int32 nOldEnumValue = -1;
- ::cppu::enum2int(nOldEnumValue, aEnumPropertyValue);
-
- // get the translation table
- const FormatEntry* pFormats = lcl_getFormatTable(m_nTableId);
-
- _rOldValue.clear();
- _rConvertedValue.clear();
-
- // look for the entry with the given format key
- sal_Int32 nTablePosition = 0;
- for ( ;
- (nullptr != pFormats->pDescription) && (nNewFormat != pFormats->nKey);
- ++pFormats, ++nTablePosition
- )
- {
- if (nTablePosition == nOldEnumValue)
- _rOldValue <<= pFormats->nKey;
- }
+ if (nTablePosition == nOldEnumValue)
+ _rOldValue <<= pFormats->nKey;
+ }
- bool bFoundIt = (nullptr != pFormats->pDescription);
- bool bModified = false;
- if (bFoundIt)
- {
- _rConvertedValue <<= static_cast<sal_Int16>(nTablePosition);
- bModified = nTablePosition != nOldEnumValue;
- }
+ bool bFoundIt = (nullptr != pFormats->pDescription);
+ bool bModified = false;
+ if (bFoundIt)
+ {
+ _rConvertedValue <<= static_cast<sal_Int16>(nTablePosition);
+ bModified = nTablePosition != nOldEnumValue;
+ }
- if (!_rOldValue.hasValue())
- { // did not reach the end of the table (means we found nNewFormat)
- // -> go to the end to ensure that _rOldValue is set
- while (pFormats->pDescription)
+ if (!_rOldValue.hasValue())
+ { // did not reach the end of the table (means we found nNewFormat)
+ // -> go to the end to ensure that _rOldValue is set
+ while (pFormats->pDescription)
+ {
+ if (nTablePosition == nOldEnumValue)
{
- if (nTablePosition == nOldEnumValue)
- {
- _rOldValue <<= pFormats->nKey;
- break;
- }
-
- ++pFormats;
- ++nTablePosition;
+ _rOldValue <<= pFormats->nKey;
+ break;
}
- }
- OSL_ENSURE(_rOldValue.hasValue(), "OLimitedFormats::convertFormatKeyPropertyValue: did not find the old enum value in the table!");
-
- if (!bFoundIt)
- { // somebody gave us a format which we can't translate
- throw IllegalArgumentException("This control supports only a very limited number of formats.", nullptr, 2);
+ ++pFormats;
+ ++nTablePosition;
}
+ }
+
+ OSL_ENSURE(_rOldValue.hasValue(), "OLimitedFormats::convertFormatKeyPropertyValue: did not find the old enum value in the table!");
- return bModified;
+ if (!bFoundIt)
+ { // somebody gave us a format which we can't translate
+ throw IllegalArgumentException("This control supports only a very limited number of formats.", nullptr, 2);
}
- return false;
+ return bModified;
}
diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx
index e7c7d135f61a..ae40c527b4d6 100644
--- a/forms/source/runtime/formoperations.cxx
+++ b/forms/source/runtime/formoperations.cxx
@@ -430,26 +430,25 @@ namespace frm
// returns false if parent should *abort* (user pressed cancel)
bool checkConfirmation(bool &needConfirmation, bool &shouldCommit)
{
- if(needConfirmation)
+ if(!needConfirmation)
+ return true;
+ // TODO: shouldn't this be done with an interaction handler?
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ResourceManager::loadString(RID_STR_QUERY_SAVE_MODIFIED_ROW)));
+ xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+ xQueryBox->set_default_response(RET_YES);
+
+ switch (xQueryBox->run())
{
- // TODO: shouldn't this be done with an interaction handler?
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr,
- VclMessageType::Question, VclButtonsType::YesNo,
- ResourceManager::loadString(RID_STR_QUERY_SAVE_MODIFIED_ROW)));
- xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
- xQueryBox->set_default_response(RET_YES);
-
- switch (xQueryBox->run())
- {
- case RET_NO:
- shouldCommit = false;
- [[fallthrough]]; // don't ask again!
- case RET_YES:
- needConfirmation = false;
- return true;
- case RET_CANCEL:
- return false;
- }
+ case RET_NO:
+ shouldCommit = false;
+ [[fallthrough]]; // don't ask again!
+ case RET_YES:
+ needConfirmation = false;
+ return true;
+ case RET_CANCEL:
+ return false;
}
return true;
}
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 89ae03162778..abda98f2f86d 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -942,68 +942,68 @@ void FormulaTokenArray::AddRecalcMode( ScRecalcMode nBits )
bool FormulaTokenArray::HasMatrixDoubleRefOps() const
{
- if ( pRPN && nRPN )
+ if ( !pRPN || !nRPN )
+ return false;
+
+ // RPN-Interpreter simulation.
+ // Simply assumes a double as return value of each function.
+ std::unique_ptr<FormulaToken*[]> pStack(new FormulaToken* [nRPN]);
+ FormulaToken* pResult = new FormulaDoubleToken( 0.0 );
+ short sp = 0;
+ for ( auto t: RPNTokens() )
{
- // RPN-Interpreter simulation.
- // Simply assumes a double as return value of each function.
- std::unique_ptr<FormulaToken*[]> pStack(new FormulaToken* [nRPN]);
- FormulaToken* pResult = new FormulaDoubleToken( 0.0 );
- short sp = 0;
- for ( auto t: RPNTokens() )
+ OpCode eOp = t->GetOpCode();
+ sal_uInt8 nParams = t->GetParamCount();
+ switch ( eOp )
{
- OpCode eOp = t->GetOpCode();
- sal_uInt8 nParams = t->GetParamCount();
- switch ( eOp )
+ case ocAdd :
+ case ocSub :
+ case ocMul :
+ case ocDiv :
+ case ocPow :
+ case ocPower :
+ case ocAmpersand :
+ case ocEqual :
+ case ocNotEqual :
+ case ocLess :
+ case ocGreater :
+ case ocLessEqual :
+ case ocGreaterEqual :
{
- case ocAdd :
- case ocSub :
- case ocMul :
- case ocDiv :
- case ocPow :
- case ocPower :
- case ocAmpersand :
- case ocEqual :
- case ocNotEqual :
- case ocLess :
- case ocGreater :
- case ocLessEqual :
- case ocGreaterEqual :
+ for ( sal_uInt8 k = nParams; k; k-- )
{
- for ( sal_uInt8 k = nParams; k; k-- )
+ if ( sp >= k && pStack[sp-k]->GetType() == svDoubleRef )
{
- if ( sp >= k && pStack[sp-k]->GetType() == svDoubleRef )
- {
- pResult->Delete();
- return true;
- }
+ pResult->Delete();
+ return true;
}
}
- break;
- default:
- {
- // added to avoid warnings
- }
}
- if ( eOp == ocPush || lcl_IsReference( eOp, t->GetType() ) )
- pStack[sp++] = t;
- else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
- { // ignore Jumps, pop previous Result (Condition)
- if ( sp )
- --sp;
+ break;
+ default:
+ {
+ // added to avoid warnings
}
- else
- { // pop parameters, push result
- sp = sal::static_int_cast<short>( sp - nParams );
- if ( sp < 0 )
- {
- SAL_WARN("formula.core", "FormulaTokenArray::HasMatrixDoubleRefOps: sp < 0" );
- sp = 0;
- }
- pStack[sp++] = pResult;
+ }
+ if ( eOp == ocPush || lcl_IsReference( eOp, t->GetType() ) )
+ pStack[sp++] = t;
+ else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
+ { // ignore Jumps, pop previous Result (Condition)
+ if ( sp )
+ --sp;
+ }
+ else
+ { // pop parameters, push result
+ sp = sal::static_int_cast<short>( sp - nParams );
+ if ( sp < 0 )
+ {
+ SAL_WARN("formula.core", "FormulaTokenArray::HasMatrixDoubleRefOps: sp < 0" );
+ sp = 0;
}
+ pStack[sp++] = pResult;
}
- pResult->Delete();
}
+ pResult->Delete();
return false;
}
@@ -1530,23 +1530,23 @@ inline bool isWhitespace( OpCode eOp ) { return eOp == ocSpaces || eOp == ocWhit
bool FormulaTokenArray::MayReferenceFollow()
{
- if ( pCode && nLen > 0 )
+ if ( !pCode || nLen <= 0 )
+ return false;
+
+ // ignore trailing spaces
+ sal_uInt16 i = nLen - 1;
+ while (i > 0 && isWhitespace( pCode[i]->GetOpCode()))
{
- // ignore trailing spaces
- sal_uInt16 i = nLen - 1;
- while (i > 0 && isWhitespace( pCode[i]->GetOpCode()))
- {
- --i;
- }
- if (i > 0 || !isWhitespace( pCode[i]->GetOpCode()))
+ --i;
+ }
+ if (i > 0 || !isWhitespace( pCode[i]->GetOpCode()))
+ {
+ OpCode eOp = pCode[i]->GetOpCode();
+ if ( (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP ) ||
+ (SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP ) ||
+ eOp == SC_OPCODE_OPEN || eOp == SC_OPCODE_SEP )
{
- OpCode eOp = pCode[i]->GetOpCode();
- if ( (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP ) ||
- (SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP ) ||
- eOp == SC_OPCODE_OPEN || eOp == SC_OPCODE_SEP )
- {
- return true;
- }
+ return true;
}
}
return false;
@@ -1776,26 +1776,26 @@ FormulaToken* FormulaTokenArrayPlainIterator::GetNextReferenceRPN()
FormulaToken* FormulaTokenArrayPlainIterator::GetNextReferenceOrName()
{
- if( mpFTA->GetArray() )
+ if( !mpFTA->GetArray() )
+ return nullptr;
+
+ while ( mnIndex < mpFTA->GetLen() )
{
- while ( mnIndex < mpFTA->GetLen() )
+ FormulaToken* t = mpFTA->GetArray()[ mnIndex++ ];
+ switch( t->GetType() )
{
- FormulaToken* t = mpFTA->GetArray()[ mnIndex++ ];
- switch( t->GetType() )
+ case svSingleRef:
+ case svDoubleRef:
+ case svIndex:
+ case svExternalSingleRef:
+ case svExternalDoubleRef:
+ case svExternalName:
+ return t;
+ default:
{
- case svSingleRef:
- case svDoubleRef:
- case svIndex:
- case svExternalSingleRef:
- case svExternalDoubleRef:
- case svExternalName:
- return t;
- default:
- {
- // added to avoid warnings
- }
- }
- }
+ // added to avoid warnings
+ }
+ }
}
return nullptr;
}
diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx
index 0eed0ff0dfaa..69a912206384 100644
--- a/formula/source/ui/dlg/structpg.cxx
+++ b/formula/source/ui/dlg/structpg.cxx
@@ -104,22 +104,22 @@ OUString StructPage::GetEntryText(const weld::TreeIter* pEntry) const
const FormulaToken* StructPage::GetFunctionEntry(const weld::TreeIter* pEntry)
{
- if (pEntry)
+ if (!pEntry)
+ return nullptr;
+
+ const FormulaToken * pToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*pEntry).toInt64());
+ if (pToken)
{
- const FormulaToken * pToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*pEntry).toInt64());
- if (pToken)
+ if ( !(pToken->IsFunction() || pToken->GetParamCount() > 1 ) )
{
- if ( !(pToken->IsFunction() || pToken->GetParamCount() > 1 ) )
- {
- std::unique_ptr<weld::TreeIter> xParent(m_xTlbStruct->make_iterator(pEntry));
- if (!m_xTlbStruct->iter_parent(*xParent))
- return nullptr;
- return GetFunctionEntry(xParent.get());
- }
- else
- {
- return pToken;
- }
+ std::unique_ptr<weld::TreeIter> xParent(m_xTlbStruct->make_iterator(pEntry));
+ if (!m_xTlbStruct->iter_parent(*xParent))
+ return nullptr;
+ return GetFunctionEntry(xParent.get());
+ }
+ else
+ {
+ return pToken;
}
}
return nullptr;
diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx
index a7a90281bb11..050cee39c113 100644
--- a/fpicker/source/office/PlacesListBox.cxx
+++ b/fpicker/source/office/PlacesListBox.cxx
@@ -112,27 +112,26 @@ IMPL_LINK_NOARG( PlacesListBox, DoubleClick, weld::TreeView&, bool )
{
sal_uInt16 nSelected = mxImpl->get_cursor_index();
PlacePtr pPlace = maPlaces[nSelected];
- if ( pPlace->IsEditable() && !pPlace->IsLocal( ) )
+ if ( !pPlace->IsEditable() || pPlace->IsLocal( ) )
+ return true;
+ PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
+ short aRetCode = aDlg.run();
+ switch (aRetCode)
{
- PlaceEditDialog aDlg(mpDlg->getDialog(), pPlace);
- short aRetCode = aDlg.run();
- switch (aRetCode)
+ case RET_OK :
+ {
+ pPlace->SetName ( aDlg.GetServerName() );
+ pPlace->SetUrl( aDlg.GetServerUrl() );
+ mbUpdated = true;
+ break;
+ }
+ case RET_NO :
{
- case RET_OK :
- {
- pPlace->SetName ( aDlg.GetServerName() );
- pPlace->SetUrl( aDlg.GetServerUrl() );
- mbUpdated = true;
- break;
- }
- case RET_NO :
- {
- RemovePlace(nSelected);
- break;
- }
- default:
- break;
+ RemovePlace(nSelected);
+ break;
}
+ default:
+ break;
}
return true;
}
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 9f6a11da9ab1..33f42647e308 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1831,51 +1831,51 @@ bool SvtFileDialog::IsolateFilterFromPath_Impl( OUString& rPath, OUString& rFilt
rFilter.clear();
- if ( nWildCardPos != -1 )
- {
- sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' );
+ if ( nWildCardPos == -1 )
+ return true;
- if ( nPathTokenPos == -1 )
- {
- OUString aDelim(
+ sal_Int32 nPathTokenPos = aReversePath.indexOf( '/' );
+
+ if ( nPathTokenPos == -1 )
+ {
+ OUString aDelim(
#if defined(_WIN32)
- '\\'
+ '\\'
#else
- '/'
+ '/'
#endif
- );
+ );
- nPathTokenPos = aReversePath.indexOf( aDelim );
+ nPathTokenPos = aReversePath.indexOf( aDelim );
#if !defined( UNX )
- if ( nPathTokenPos == -1 )
- {
- nPathTokenPos = aReversePath.indexOf( ':' );
- }
-#endif
+ if ( nPathTokenPos == -1 )
+ {
+ nPathTokenPos = aReversePath.indexOf( ':' );
}
+#endif
+ }
- // check syntax
- if ( nPathTokenPos != -1 )
+ // check syntax
+ if ( nPathTokenPos != -1 )
+ {
+ if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) )
{
- if ( nPathTokenPos < (rPath.getLength() - nWildCardPos - 1) )
- {
- ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX );
- return false;
- }
+ ErrorHandler::HandleError( ERRCODE_SFX_INVALIDSYNTAX );
+ return false;
+ }
- // cut off filter
- rFilter = aReversePath.copy( 0, nPathTokenPos );
- rFilter = comphelper::string::reverseString(rFilter);
+ // cut off filter
+ rFilter = aReversePath.copy( 0, nPathTokenPos );
+ rFilter = comphelper::string::reverseString(rFilter);
- // determine folder
- rPath = aReversePath.copy( nPathTokenPos );
- rPath = comphelper::string::reverseString(rPath);
- }
- else
- {
- rFilter = rPath;
- rPath.clear();
- }
+ // determine folder
+ rPath = aReversePath.copy( nPathTokenPos );
+ rPath = comphelper::string::reverseString(rPath);
+ }
+ else
+ {
+ rFilter = rPath;
+ rPath.clear();
}
return true;
diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx
index d167bc11157f..59a43a1e321a 100644
--- a/framework/source/helper/dockingareadefaultacceptor.cxx
+++ b/framework/source/helper/dockingareadefaultacceptor.cxx
@@ -64,32 +64,30 @@ sal_Bool SAL_CALL DockingAreaDefaultAcceptor::requestDockingAreaSpace( const css
// Try to "lock" the frame for access to taskscontainer.
css::uno::Reference< XFrame > xFrame( m_xOwner );
- if ( xFrame.is() )
- {
- css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
- css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
-
- if ( xContainerWindow.is() && xComponentWindow.is() )
- {
- css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
- // Convert relative size to output size.
- css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
- css::awt::DeviceInfo aInfo = xDevice->getInfo();
- css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
- aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
-
- css::awt::Size aMinSize( 0, 0 ); // = xLayoutConstraints->getMinimumSize();
-
- // Check if request border space would decrease component window size below minimum size
- if ((( aSize.Width - RequestedSpace.X - RequestedSpace.Width ) < aMinSize.Width ) ||
- (( aSize.Height - RequestedSpace.Y - RequestedSpace.Height ) < aMinSize.Height ) )
- return false;
-
- return true;
- }
- }
+ if ( !xFrame.is() )
+ return false;
+
+ css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
+ css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
+
+ if ( !xContainerWindow.is() || !xComponentWindow.is() )
+ return false;
+
+ css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
+ // Convert relative size to output size.
+ css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
+ css::awt::DeviceInfo aInfo = xDevice->getInfo();
+ css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
+ aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+
+ css::awt::Size aMinSize( 0, 0 ); // = xLayoutConstraints->getMinimumSize();
+
+ // Check if request border space would decrease component window size below minimum size
+ if ((( aSize.Width - RequestedSpace.X - RequestedSpace.Width ) < aMinSize.Width ) ||
+ (( aSize.Height - RequestedSpace.Y - RequestedSpace.Height ) < aMinSize.Height ) )
+ return false;
- return false;
+ return true;
}
void SAL_CALL DockingAreaDefaultAcceptor::setDockingAreaSpace( const css::awt::Rectangle& BorderSpace )
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index e02f57e4345e..0d1cc619da89 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -513,130 +513,130 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem
std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings,
const Reference< XComponentContext > &rComponentContext )
{
- if ( rPersistentWindowState.is() )
- {
- bool bGetSettingsState( false );
+ if ( !rPersistentWindowState.is() )
+ return false;
- SolarMutexClearableGuard aWriteLock;
- bool bGlobalSettings( bInGlobalSettings );
- if ( rGlobalSettings == nullptr )
- {
- rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
- bGetSettingsState = true;
- }
- GlobalSettings* pGlobalSettings = rGlobalSettings.get();
- aWriteLock.clear();
+ bool bGetSettingsState( false );
- try
+ SolarMutexClearableGuard aWriteLock;
+ bool bGlobalSettings( bInGlobalSettings );
+ if ( rGlobalSettings == nullptr )
+ {
+ rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
+ bGetSettingsState = true;
+ }
+ GlobalSettings* pGlobalSettings = rGlobalSettings.get();
+ aWriteLock.clear();
+
+ try
+ {
+ Sequence< PropertyValue > aWindowState;
+ if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
{
- Sequence< PropertyValue > aWindowState;
- if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
+ bool bValue( false );
+ for ( PropertyValue const & rProp : std::as_const(aWindowState) )
{
- bool bValue( false );
- for ( PropertyValue const & rProp : std::as_const(aWindowState) )
+ if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
{
- if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bFloating = !bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bVisible = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
- {
- ui::DockingArea eDockingArea;
- if ( rProp.Value >>= eDockingArea )
- rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
- {
- awt::Point aPoint;
- if (rProp.Value >>= aPoint)
- {
- //tdf#90256 repair these broken Docking positions
- if (aPoint.X < 0)
- aPoint.X = SAL_MAX_INT32;
- if (aPoint.Y < 0)
- aPoint.Y = SAL_MAX_INT32;
- rElementData.m_aDockedData.m_aPos = aPoint;
- }
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
- {
- awt::Point aPoint;
- if ( rProp.Value >>= aPoint )
- rElementData.m_aFloatingData.m_aPos = aPoint;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
- {
- awt::Size aSize;
- if ( rProp.Value >>= aSize )
- rElementData.m_aFloatingData.m_aSize = aSize;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
- rProp.Value >>= rElementData.m_aUIName;
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
- {
- sal_Int32 nStyle = 0;
- if ( rProp.Value >>= nStyle )
- rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_aDockedData.m_bLocked = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bContextSensitive = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bFloating = !bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bVisible = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
+ {
+ ui::DockingArea eDockingArea;
+ if ( rProp.Value >>= eDockingArea )
+ rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
+ {
+ awt::Point aPoint;
+ if (rProp.Value >>= aPoint)
{
- if ( rProp.Value >>= bValue )
- rElementData.m_bNoClose = bValue;
+ //tdf#90256 repair these broken Docking positions
+ if (aPoint.X < 0)
+ aPoint.X = SAL_MAX_INT32;
+ if (aPoint.Y < 0)
+ aPoint.Y = SAL_MAX_INT32;
+ rElementData.m_aDockedData.m_aPos = aPoint;
}
}
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
+ {
+ awt::Point aPoint;
+ if ( rProp.Value >>= aPoint )
+ rElementData.m_aFloatingData.m_aPos = aPoint;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
+ {
+ awt::Size aSize;
+ if ( rProp.Value >>= aSize )
+ rElementData.m_aFloatingData.m_aSize = aSize;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
+ rProp.Value >>= rElementData.m_aUIName;
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
+ {
+ sal_Int32 nStyle = 0;
+ if ( rProp.Value >>= nStyle )
+ rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_aDockedData.m_bLocked = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bContextSensitive = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bNoClose = bValue;
+ }
}
+ }
- // oversteer values with global settings
- if (bGetSettingsState || bGlobalSettings)
+ // oversteer values with global settings
+ if (bGetSettingsState || bGlobalSettings)
+ {
+ if ( pGlobalSettings->HasToolbarStatesInfo())
{
- if ( pGlobalSettings->HasToolbarStatesInfo())
{
- {
- SolarMutexGuard aWriteLock2;
- bInGlobalSettings = true;
- }
+ SolarMutexGuard aWriteLock2;
+ bInGlobalSettings = true;
+ }
- uno::Any aValue;
- if ( pGlobalSettings->GetToolbarStateInfo(
- GlobalSettings::STATEINFO_LOCKED,
- aValue ))
- aValue >>= rElementData.m_aDockedData.m_bLocked;
- if ( pGlobalSettings->GetToolbarStateInfo(
- GlobalSettings::STATEINFO_DOCKED,
- aValue ))
- {
- bool bValue;
- if ( aValue >>= bValue )
- rElementData.m_bFloating = !bValue;
- }
+ uno::Any aValue;
+ if ( pGlobalSettings->GetToolbarStateInfo(
+ GlobalSettings::STATEINFO_LOCKED,
+ aValue ))
+ aValue >>= rElementData.m_aDockedData.m_bLocked;
+ if ( pGlobalSettings->GetToolbarStateInfo(
+ GlobalSettings::STATEINFO_DOCKED,
+ aValue ))
+ {
+ bool bValue;
+ if ( aValue >>= bValue )
+ rElementData.m_bFloating = !bValue;
}
}
+ }
- const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
- if (bDockingSupportCrippled)
- rElementData.m_bFloating = false;
+ const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
+ if (bDockingSupportCrippled)
+ rElementData.m_bFloating = false;
- return true;
- }
- catch (const NoSuchElementException&)
- {
- }
+ return true;
+ }
+ catch (const NoSuchElementException&)
+ {
}
return false;
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index c190b1a40f23..4191f7434f6e 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -795,81 +795,81 @@ bool ToolbarLayoutManager::dockToolbar( std::u16string_view rResourceURL, ui::Do
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
+ if ( xDockWindow.is() )
{
- uno::Reference< awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
- if ( xDockWindow.is() )
- {
- if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT )
- aUIElement.m_aDockedData.m_nDockedArea = eDockingArea;
+ if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT )
+ aUIElement.m_aDockedData.m_nDockedArea = eDockingArea;
- if ( !isDefaultPos( aPos ))
- aUIElement.m_aDockedData.m_aPos = aPos;
+ if ( !isDefaultPos( aPos ))
+ aUIElement.m_aDockedData.m_aPos = aPos;
- if ( !xDockWindow->isFloating() )
- {
- vcl::Window* pWindow( nullptr );
- ToolBox* pToolBox( nullptr );
+ if ( !xDockWindow->isFloating() )
+ {
+ vcl::Window* pWindow( nullptr );
+ ToolBox* pToolBox( nullptr );
+ {
+ SolarMutexGuard aGuard;
+ pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
{
- SolarMutexGuard aGuard;
- pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
- {
- pToolBox = static_cast<ToolBox *>(pWindow);
+ pToolBox = static_cast<ToolBox *>(pWindow);
- // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
- // horizontal to a vertical docking area!
- pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
- }
+ // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
+ // horizontal to a vertical docking area!
+ pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
}
+ }
- if ( hasDefaultPosValue( aUIElement.m_aDockedData.m_aPos ))
- {
- // Docking on its default position without a preset position -
- // we have to find a good place for it.
- ::Size aSize;
-
- SolarMutexGuard aGuard;
- {
- if (pToolBox)
- aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
- else if (pWindow)
- aSize = pWindow->GetSizePixel();
- }
+ if ( hasDefaultPosValue( aUIElement.m_aDockedData.m_aPos ))
+ {
+ // Docking on its default position without a preset position -
+ // we have to find a good place for it.
+ ::Size aSize;
- ::Point aPixelPos;
- awt::Point aDockPos;
- implts_findNextDockingPos(aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
- aUIElement.m_aDockedData.m_aPos = aDockPos;
+ SolarMutexGuard aGuard;
+ {
+ if (pToolBox)
+ aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
+ else if (pWindow)
+ aSize = pWindow->GetSizePixel();
}
+
+ ::Point aPixelPos;
+ awt::Point aDockPos;
+ implts_findNextDockingPos(aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
+ aUIElement.m_aDockedData.m_aPos = aDockPos;
}
+ }
- implts_setToolbar( aUIElement );
+ implts_setToolbar( aUIElement );
- if ( xDockWindow->isFloating() )
- {
- // ATTENTION: This will call toggleFloatingMode() via notifications which
- // sets the floating member of the UIElement correctly!
- xDockWindow->setFloatingMode( false );
- }
- else
- {
- implts_writeWindowStateData( aUIElement );
- implts_sortUIElements();
+ if ( xDockWindow->isFloating() )
+ {
+ // ATTENTION: This will call toggleFloatingMode() via notifications which
+ // sets the floating member of the UIElement correctly!
+ xDockWindow->setFloatingMode( false );
+ }
+ else
+ {
+ implts_writeWindowStateData( aUIElement );
+ implts_sortUIElements();
- if ( aUIElement.m_bVisible )
- implts_setLayoutDirty();
- }
- return true;
+ if ( aUIElement.m_bVisible )
+ implts_setLayoutDirty();
}
+ return true;
}
- catch (const lang::DisposedException&)
- {
- }
+ }
+ catch (const lang::DisposedException&)
+ {
}
return false;
@@ -3549,33 +3549,33 @@ sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::E
bool bWinFound( !aUIDockingElement.m_aName.isEmpty() );
uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY );
- if ( bWinFound && xWindow.is() )
+ if ( !bWinFound || !xWindow.is() )
+ return true;
+
+ if ( bDockingInProgress )
+ return true;
+
+ uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
+ if ( !xDockWindow->isFloating() )
+ return true;
+
{
- if ( !bDockingInProgress )
+ SolarMutexGuard aGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
- if ( xDockWindow->isFloating() )
- {
- {
- SolarMutexGuard aGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
- {
- ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() );
- aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel());
- aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel());
- aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
- aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox );
- }
- }
-
- UIElement aUIElement = implts_findToolbar( aUIDockingElement.m_aName );
- if ( aUIElement.m_aName == aUIDockingElement.m_aName )
- implts_setToolbar( aUIDockingElement );
- }
+ ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() );
+ aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel());
+ aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel());
+ aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines();
+ aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox );
}
}
+ UIElement aUIElement = implts_findToolbar( aUIDockingElement.m_aName );
+ if ( aUIElement.m_aName == aUIDockingElement.m_aName )
+ implts_setToolbar( aUIDockingElement );
+
return true;
}
@@ -3934,26 +3934,26 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb
bool ToolbarLayoutManager::floatToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() )
- {
- aUIElement.m_bFloating = true;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->setFloatingMode( true );
+ aUIElement.m_bFloating = true;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->setFloatingMode( true );
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}
@@ -3961,26 +3961,26 @@ bool ToolbarLayoutManager::floatToolbar( std::u16string_view rResourceURL )
bool ToolbarLayoutManager::lockToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
- {
- aUIElement.m_aDockedData.m_bLocked = true;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->lock();
+ aUIElement.m_aDockedData.m_bLocked = true;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->lock();
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}
@@ -3988,26 +3988,26 @@ bool ToolbarLayoutManager::lockToolbar( std::u16string_view rResourceURL )
bool ToolbarLayoutManager::unlockToolbar( std::u16string_view rResourceURL )
{
UIElement aUIElement = implts_findToolbar( rResourceURL );
- if ( aUIElement.m_xUIElement.is() )
+ if ( !aUIElement.m_xUIElement.is() )
+ return false;
+
+ try
{
- try
+ uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
{
- uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
- {
- aUIElement.m_aDockedData.m_bLocked = false;
- implts_writeWindowStateData( aUIElement );
- xDockWindow->unlock();
+ aUIElement.m_aDockedData.m_bLocked = false;
+ implts_writeWindowStateData( aUIElement );
+ xDockWindow->unlock();
- implts_setLayoutDirty();
- implts_setToolbar( aUIElement );
- return true;
- }
- }
- catch (const lang::DisposedException&)
- {
+ implts_setLayoutDirty();
+ implts_setToolbar( aUIElement );
+ return true;
}
}
+ catch (const lang::DisposedException&)
+ {
+ }
return false;
}
diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx
index a7655ef9b029..ef9a5d55f152 100644
--- a/framework/source/services/urltransformer.cxx
+++ b/framework/source/services/urltransformer.cxx
@@ -117,41 +117,41 @@ sal_Bool SAL_CALL URLTransformer::parseStrict( css::util::URL& aURL )
}
// Try to extract the protocol
sal_Int32 nURLIndex = aURL.Complete.indexOf( ':' );
- if ( nURLIndex > 1 )
+ if ( nURLIndex <= 1 )
+ return false;
+
+ OUString aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
+
+ // If INetURLObject knows this protocol let it parse
+ if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
{
- OUString aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
+ // Initialize parser with given URL.
+ INetURLObject aParser( aURL.Complete );
- // If INetURLObject knows this protocol let it parse
- if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
+ // Get all information about this URL.
+ INetProtocol eINetProt = aParser.GetProtocol();
+ if ( eINetProt == INetProtocol::NotValid )
{
- // Initialize parser with given URL.
- INetURLObject aParser( aURL.Complete );
-
- // Get all information about this URL.
- INetProtocol eINetProt = aParser.GetProtocol();
- if ( eINetProt == INetProtocol::NotValid )
- {
- return false;
- }
- else if ( !aParser.HasError() )
- {
- lcl_ParserHelper(aParser,aURL,false);
- // Return "URL is parsed".
- return true;
- }
+ return false;
}
- else
+ else if ( !aParser.HasError() )
{
- // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented
- // in framework!
- aURL.Protocol = aProtocol;
- aURL.Main = aURL.Complete;
- aURL.Path = aURL.Complete.copy( nURLIndex+1 );
-
+ lcl_ParserHelper(aParser,aURL,false);
// Return "URL is parsed".
return true;
}
}
+ else
+ {
+ // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented
+ // in framework!
+ aURL.Protocol = aProtocol;
+ aURL.Main = aURL.Complete;
+ aURL.Path = aURL.Complete.copy( nURLIndex+1 );
+
+ // Return "URL is parsed".
+ return true;
+ }
return false;
}
diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx
index 2c517205e2db..b0b6f859c02c 100644
--- a/framework/source/uiconfiguration/globalsettings.cxx
+++ b/framework/source/uiconfiguration/globalsettings.cxx
@@ -160,30 +160,30 @@ bool GlobalSettings_Access::GetToolbarStateInfo( GlobalSettings::StateInfo eStat
impl_initConfigAccess();
}
- if ( m_xConfigAccess.is() )
+ if ( !m_xConfigAccess.is() )
+ return false;
+
+ try
{
- try
- {
- css::uno::Any a = m_xConfigAccess->getByName( m_aNodeRefStates );
- css::uno::Reference< css::container::XNameAccess > xNameAccess;
- if ( a >>= xNameAccess )
- {
- if ( eStateInfo == GlobalSettings::STATEINFO_LOCKED )
- a = xNameAccess->getByName( m_aPropLocked );
- else if ( eStateInfo == GlobalSettings::STATEINFO_DOCKED )
- a = xNameAccess->getByName( m_aPropDocked );
-
- aValue = a;
- return true;
- }
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
- catch ( const css::uno::Exception& )
+ css::uno::Any a = m_xConfigAccess->getByName( m_aNodeRefStates );
+ css::uno::Reference< css::container::XNameAccess > xNameAccess;
+ if ( a >>= xNameAccess )
{
+ if ( eStateInfo == GlobalSettings::STATEINFO_LOCKED )
+ a = xNameAccess->getByName( m_aPropLocked );
+ else if ( eStateInfo == GlobalSettings::STATEINFO_DOCKED )
+ a = xNameAccess->getByName( m_aPropDocked );
+
+ aValue = a;
+ return true;
}
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+ catch ( const css::uno::Exception& )
+ {
+ }
return false;
}
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index a847ee35ff68..1dd41fd38bdf 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -367,89 +367,89 @@ bool ImageManagerImpl::implts_storeUserImages(
{
SolarMutexGuard g;
- if ( m_bModified )
+ if ( !m_bModified )
+ return false;
+
+ ImageList* pImageList = implts_getUserImageList( nImageType );
+ if ( pImageList->GetImageCount() > 0 )
{
- ImageList* pImageList = implts_getUserImageList( nImageType );
- if ( pImageList->GetImageCount() > 0 )
- {
- ImageItemDescriptorList aUserImageListInfo;
+ ImageItemDescriptorList aUserImageListInfo;
- for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
- {
- ImageItemDescriptor aItem;
- aItem.aCommandURL = pImageList->GetImageName( i );
- aUserImageListInfo.push_back( aItem );
- }
+ for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
+ {
+ ImageItemDescriptor aItem;
+ aItem.aCommandURL = pImageList->GetImageName( i );
+ aUserImageListInfo.push_back( aItem );
+ }
- uno::Reference< XTransactedObject > xTransaction;
- uno::Reference< XOutputStream > xOutputStream;
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xStream.is() )
+ uno::Reference< XTransactedObject > xTransaction;
+ uno::Reference< XOutputStream > xOutputStream;
+ uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xStream.is() )
+ {
+ uno::Reference< XStream > xBitmapStream =
+ xUserBitmapsStorage->openStreamElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xBitmapStream.is() )
{
- uno::Reference< XStream > xBitmapStream =
- xUserBitmapsStorage->openStreamElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xBitmapStream.is() )
{
- {
- std::unique_ptr<SvStream> pSvStream(utl::UcbStreamHelper::CreateStream( xBitmapStream ));
- vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- }
-
- // Commit user bitmaps storage
- xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
+ std::unique_ptr<SvStream> pSvStream(utl::UcbStreamHelper::CreateStream( xBitmapStream ));
+ vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
+ aPngWriter.Write( *pSvStream );
}
- xOutputStream = xStream->getOutputStream();
- if ( xOutputStream.is() )
- ImagesConfiguration::StoreImages( m_xContext, xOutputStream, aUserImageListInfo );
-
- // Commit user image storage
- xTransaction.set( xUserImageStorage, UNO_QUERY );
+ // Commit user bitmaps storage
+ xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
if ( xTransaction.is() )
xTransaction->commit();
}
- return true;
- }
- else
- {
- // Remove the streams from the storage, if we have no data. We have to catch
- // the NoSuchElementException as it can be possible that there is no stream at all!
- try
- {
- xUserImageStorage->removeElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
-
- try
- {
- xUserBitmapsStorage->removeElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
-
- uno::Reference< XTransactedObject > xTransaction;
+ xOutputStream = xStream->getOutputStream();
+ if ( xOutputStream.is() )
+ ImagesConfiguration::StoreImages( m_xContext, xOutputStream, aUserImageListInfo );
// Commit user image storage
xTransaction.set( xUserImageStorage, UNO_QUERY );
if ( xTransaction.is() )
xTransaction->commit();
+ }
- // Commit user bitmaps storage
- xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
+ return true;
+ }
+ else
+ {
+ // Remove the streams from the storage, if we have no data. We have to catch
+ // the NoSuchElementException as it can be possible that there is no stream at all!
+ try
+ {
+ xUserImageStorage->removeElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
+ }
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
- return true;
+ try
+ {
+ xUserBitmapsStorage->removeElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+
+ uno::Reference< XTransactedObject > xTransaction;
+
+ // Commit user image storage
+ xTransaction.set( xUserImageStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ // Commit user bitmaps storage
+ xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ return true;
}
return false;
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index e03a3cbc156a..350b2190dc84 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -117,27 +117,27 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont
bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage )
{
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aImageURL, StreamMode::STD_READ ));
- if ( pStream && ( pStream->GetErrorCode() == ERRCODE_NONE ))
- {
- // Use graphic class to also support more graphic formats (bmp,png,...)
- Graphic aGraphic;
+ if ( !pStream || ( pStream->GetErrorCode() != ERRCODE_NONE ))
+ return false;
- GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- rGF.ImportGraphic( aGraphic, OUString(), *pStream );
+ // Use graphic class to also support more graphic formats (bmp,png,...)
+ Graphic aGraphic;
- BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+ GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
+ rGF.ImportGraphic( aGraphic, OUString(), *pStream );
- const ::Size aSize = bBigImage ? aImageSizeBig : aImageSizeSmall; // Sizes used for toolbar images
+ BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
- ::Size aBmpSize = aBitmapEx.GetSizePixel();
- if ( !aBmpSize.IsEmpty() )
- {
- ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() );
- if ( aBmpSize != aNoScaleSize )
- aBitmapEx.Scale( aNoScaleSize, BmpScaleFlag::BestQuality );
- aImage = Image( aBitmapEx );
- return true;
- }
+ const ::Size aSize = bBigImage ? aImageSizeBig : aImageSizeSmall; // Sizes used for toolbar images
+
+ ::Size aBmpSize = aBitmapEx.GetSizePixel();
+ if ( !aBmpSize.IsEmpty() )
+ {
+ ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() );
+ if ( aBmpSize != aNoScaleSize )
+ aBitmapEx.Scale( aNoScaleSize, BmpScaleFlag::BestQuality );
+ aImage = Image( aBitmapEx );
+ return true;
}
return false;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index e17268d8d997..08998a4b8fe8 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -561,179 +561,179 @@ private:
IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
{
- if ( pMenu == m_pVCLMenu )
- {
- css::uno::ContextLayer layer(
- new QuietInteractionContext(
- css::uno::getCurrentContext()));
+ if ( pMenu != m_pVCLMenu )
+ return true;
- // set/unset hiding disabled menu entries
- bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get();
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- bool bShowMenuImages = rSettings.GetUseImagesInMenus();
- bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts();
- bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
+ css::uno::ContextLayer layer(
+ new QuietInteractionContext(
+ css::uno::getCurrentContext()));
- SolarMutexGuard g;
+ // set/unset hiding disabled menu entries
+ bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get();
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ bool bShowMenuImages = rSettings.GetUseImagesInMenus();
+ bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts();
+ bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
- MenuFlags nFlag = pMenu->GetMenuFlags();
- if ( bDontHide )
- nFlag &= ~MenuFlags::HideDisabledEntries;
- else
- nFlag |= MenuFlags::HideDisabledEntries;
- pMenu->SetMenuFlags( nFlag );
+ SolarMutexGuard g;
- if ( m_bActive )
- return false;
+ MenuFlags nFlag = pMenu->GetMenuFlags();
+ if ( bDontHide )
+ nFlag &= ~MenuFlags::HideDisabledEntries;
+ else
+ nFlag |= MenuFlags::HideDisabledEntries;
+ pMenu->SetMenuFlags( nFlag );
- m_bActive = true;
+ if ( m_bActive )
+ return false;
- // Check if some modes have changed so we have to update our menu images
- OUString sIconTheme = SvtMiscOptions().GetIconTheme();
+ m_bActive = true;
- if ( m_bRetrieveImages ||
- bShowMenuImages != m_bShowMenuImages ||
- sIconTheme != m_sIconTheme )
- {
- m_bShowMenuImages = bShowMenuImages;
- m_bRetrieveImages = false;
- m_sIconTheme = sIconTheme;
- FillMenuImages( m_xFrame, pMenu, bShowMenuImages );
- }
+ // Check if some modes have changed so we have to update our menu images
+ OUString sIconTheme = SvtMiscOptions().GetIconTheme();
- // Try to map commands to labels
- for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ if ( m_bRetrieveImages ||
+ bShowMenuImages != m_bShowMenuImages ||
+ sIconTheme != m_sIconTheme )
+ {
+ m_bShowMenuImages = bShowMenuImages;
+ m_bRetrieveImages = false;
+ m_sIconTheme = sIconTheme;
+ FillMenuImages( m_xFrame, pMenu, bShowMenuImages );
+ }
+
+ // Try to map commands to labels
+ for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ {
+ sal_uInt16 nItemId = pMenu->GetItemId( nPos );
+ if (( pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR ) &&
+ ( pMenu->GetItemText( nItemId ).isEmpty() ))
{
- sal_uInt16 nItemId = pMenu->GetItemId( nPos );
- if (( pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR ) &&
- ( pMenu->GetItemText( nItemId ).isEmpty() ))
- {
- OUString aCommand = pMenu->GetItemCommand( nItemId );
- if ( !aCommand.isEmpty() ) {
- pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand ));
- }
+ OUString aCommand = pMenu->GetItemCommand( nItemId );
+ if ( !aCommand.isEmpty() ) {
+ pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand ));
}
}
+ }
- // Try to set accelerator keys
- {
- if ( bShowShortcuts )
- RetrieveShortcuts( m_aMenuItemHandlerVector );
+ // Try to set accelerator keys
+ {
+ if ( bShowShortcuts )
+ RetrieveShortcuts( m_aMenuItemHandlerVector );
- for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ {
+ if ( !bShowShortcuts )
{
- if ( !bShowShortcuts )
- {
- pMenu->SetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() );
- }
- else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex )
- {
- // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex
- // Only non-popup menu items can have a short-cut
- vcl::KeyCode aKeyCode( KEY_F1 );
- pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode );
- }
- else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr )
- pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
+ pMenu->SetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() );
}
+ else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex )
+ {
+ // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex
+ // Only non-popup menu items can have a short-cut
+ vcl::KeyCode aKeyCode( KEY_F1 );
+ pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode );
+ }
+ else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr )
+ pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
}
+ }
- URL aTargetURL;
+ URL aTargetURL;
- // Use provided dispatch provider => fallback to frame as dispatch provider
- Reference< XDispatchProvider > xDispatchProvider;
- if ( m_xDispatchProvider.is() )
- xDispatchProvider = m_xDispatchProvider;
- else
- xDispatchProvider.set( m_xFrame, UNO_QUERY );
+ // Use provided dispatch provider => fallback to frame as dispatch provider
+ Reference< XDispatchProvider > xDispatchProvider;
+ if ( m_xDispatchProvider.is() )
+ xDispatchProvider = m_xDispatchProvider;
+ else
+ xDispatchProvider.set( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
+ if ( !xDispatchProvider.is() )
+ return true;
+
+ SvtCommandOptions aCmdOptions;
+ for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ {
+ if (menuItemHandler)
{
- SvtCommandOptions aCmdOptions;
- for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ if ( !menuItemHandler->xMenuItemDispatch.is() &&
+ !menuItemHandler->xSubMenuManager.is() )
{
- if (menuItemHandler)
- {
- if ( !menuItemHandler->xMenuItemDispatch.is() &&
- !menuItemHandler->xSubMenuManager.is() )
- {
- Reference< XDispatch > xMenuItemDispatch;
+ Reference< XDispatch > xMenuItemDispatch;
- aTargetURL.Complete = menuItemHandler->aMenuItemURL;
+ aTargetURL.Complete = menuItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
- if ( bHasDisabledEntries )
- {
- if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
- pMenu->HideItem( menuItemHandler->nItemId );
- }
+ if ( bHasDisabledEntries )
+ {
+ if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
+ pMenu->HideItem( menuItemHandler->nItemId );
+ }
- if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
- xMenuItemDispatch = new StyleDispatcher( m_xFrame, m_xURLTransformer, aTargetURL );
- else
- xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
+ if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
+ xMenuItemDispatch = new StyleDispatcher( m_xFrame, m_xURLTransformer, aTargetURL );
+ else
+ xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
- bool bPopupMenu( false );
- if ( !menuItemHandler->xPopupMenuController.is() &&
- m_xPopupMenuControllerFactory->hasController( menuItemHandler->aMenuItemURL, m_aModuleIdentifier ) )
- {
- if( xMenuItemDispatch.is() || menuItemHandler->aMenuItemURL != ".uno:RecentFileList" )
- bPopupMenu = CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, m_aModuleIdentifier);
- }
- else if ( menuItemHandler->xPopupMenuController.is() )
- {
- // Force update of popup menu
- menuItemHandler->xPopupMenuController->updatePopupMenu();
- bPopupMenu = true;
- if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( menuItemHandler->nItemId ))
- pMenu->EnableItem( menuItemHandler->nItemId, pThisPopup->GetItemCount() != 0 );
- }
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ bool bPopupMenu( false );
+ if ( !menuItemHandler->xPopupMenuController.is() &&
+ m_xPopupMenuControllerFactory->hasController( menuItemHandler->aMenuItemURL, m_aModuleIdentifier ) )
+ {
+ if( xMenuItemDispatch.is() || menuItemHandler->aMenuItemURL != ".uno:RecentFileList" )
+ bPopupMenu = CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, m_aModuleIdentifier);
+ }
+ else if ( menuItemHandler->xPopupMenuController.is() )
+ {
+ // Force update of popup menu
+ menuItemHandler->xPopupMenuController->updatePopupMenu();
+ bPopupMenu = true;
+ if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( menuItemHandler->nItemId ))
+ pMenu->EnableItem( menuItemHandler->nItemId, pThisPopup->GetItemCount() != 0 );
+ }
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
- if ( xMenuItemDispatch.is() )
- {
- menuItemHandler->xMenuItemDispatch = xMenuItemDispatch;
- menuItemHandler->aParsedItemURL = aTargetURL.Complete;
-
- if ( !bPopupMenu )
- {
- xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
- // For the menubar, we have to keep status listening to support Ubuntu's HUD.
- if ( !m_bHasMenuBar )
- xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
- }
- }
- else if ( !bPopupMenu )
- pMenu->EnableItem( menuItemHandler->nItemId, false );
- }
- else if ( menuItemHandler->xPopupMenuController.is() )
+ if ( xMenuItemDispatch.is() )
+ {
+ menuItemHandler->xMenuItemDispatch = xMenuItemDispatch;
+ menuItemHandler->aParsedItemURL = aTargetURL.Complete;
+
+ if ( !bPopupMenu )
{
- // Force update of popup menu
- menuItemHandler->xPopupMenuController->updatePopupMenu();
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
+ // For the menubar, we have to keep status listening to support Ubuntu's HUD.
+ if ( !m_bHasMenuBar )
+ xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
}
- else if ( menuItemHandler->xMenuItemDispatch.is() )
- {
- // We need an update to reflect the current state
- try
- {
- aTargetURL.Complete = menuItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ }
+ else if ( !bPopupMenu )
+ pMenu->EnableItem( menuItemHandler->nItemId, false );
+ }
+ else if ( menuItemHandler->xPopupMenuController.is() )
+ {
+ // Force update of popup menu
+ menuItemHandler->xPopupMenuController->updatePopupMenu();
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ }
+ else if ( menuItemHandler->xMenuItemDispatch.is() )
+ {
+ // We need an update to reflect the current state
+ try
+ {
+ aTargetURL.Complete = menuItemHandler->aMenuItemURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
- menuItemHandler->xMenuItemDispatch->addStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- menuItemHandler->xMenuItemDispatch->removeStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- }
- catch ( const Exception& )
- {
- }
- }
- else if ( menuItemHandler->xSubMenuManager.is() )
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ menuItemHandler->xMenuItemDispatch->addStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ menuItemHandler->xMenuItemDispatch->removeStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ }
+ catch ( const Exception& )
+ {
}
}
+ else if ( menuItemHandler->xSubMenuManager.is() )
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
}
}
@@ -822,45 +822,43 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu, bool )
bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< XURLTransformer >& rTransformer )
{
- if ( pPopupMenu )
- {
- URL aTargetURL;
- SvtCommandOptions aCmdOptions;
+ if ( !pPopupMenu )
+ return true;
+
+ URL aTargetURL;
+ SvtCommandOptions aCmdOptions;
- sal_uInt16 nCount = pPopupMenu->GetItemCount();
- sal_uInt16 nHideCount( 0 );
+ sal_uInt16 nCount = pPopupMenu->GetItemCount();
+ sal_uInt16 nHideCount( 0 );
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ sal_uInt16 nId = pPopupMenu->GetItemId( i );
+ if ( nId > 0 )
{
- sal_uInt16 nId = pPopupMenu->GetItemId( i );
- if ( nId > 0 )
+ PopupMenu* pSubPopupMenu = pPopupMenu->GetPopupMenu( nId );
+ if ( pSubPopupMenu )
{
- PopupMenu* pSubPopupMenu = pPopupMenu->GetPopupMenu( nId );
- if ( pSubPopupMenu )
- {
- if ( MustBeHidden( pSubPopupMenu, rTransformer ))
- {
- pPopupMenu->HideItem( nId );
- ++nHideCount;
- }
- }
- else
+ if ( MustBeHidden( pSubPopupMenu, rTransformer ))
{
- aTargetURL.Complete = pPopupMenu->GetItemCommand( nId );
- rTransformer->parseStrict( aTargetURL );
-
- if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
- ++nHideCount;
+ pPopupMenu->HideItem( nId );
+ ++nHideCount;
}
}
else
- ++nHideCount;
- }
+ {
+ aTargetURL.Complete = pPopupMenu->GetItemCommand( nId );
+ rTransformer->parseStrict( aTargetURL );
- return ( nCount == nHideCount );
+ if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
+ ++nHideCount;
+ }
+ }
+ else
+ ++nHideCount;
}
- return true;
+ return ( nCount == nHideCount );
}
OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index d27cdb145dbd..a5fe31a7557b 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -262,23 +262,23 @@ bool ConfigurationAccess_ControllerFactory::impl_getElementProps( const Any& aEl
Reference< XPropertySet > xPropertySet;
aElement >>= xPropertySet;
- if ( xPropertySet.is() )
+ if ( !xPropertySet.is() )
+ return true;
+
+ try
{
- try
- {
- xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
- xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
- }
- catch ( const css::beans::UnknownPropertyException& )
- {
- return false;
- }
- catch ( const css::lang::WrappedTargetException& )
- {
- return false;
- }
+ xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
+ xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
+ xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
+ }
+ catch ( const css::beans::UnknownPropertyException& )
+ {
+ return false;
+ }
+ catch ( const css::lang::WrappedTargetException& )
+ {
+ return false;
}
return true;
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index a8c40552609f..918fef603451 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -315,23 +315,23 @@ bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aEleme
Reference< XPropertySet > xPropertySet;
aElement >>= xPropertySet;
- if ( xPropertySet.is() )
+ if ( !xPropertySet.is() )
+ return true;
+
+ try
{
- try
- {
- xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
- xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
- xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
- }
- catch ( const css::beans::UnknownPropertyException& )
- {
- return false;
- }
- catch ( const css::lang::WrappedTargetException& )
- {
- return false;
- }
+ xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
+ xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
+ xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
+ }
+ catch ( const css::beans::UnknownPropertyException& )
+ {
+ return false;
+ }
+ catch ( const css::lang::WrappedTargetException& )
+ {
+ return false;
}
return true;