summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-04-26 22:07:21 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-04-27 07:19:30 +0200
commitb512ce255f46d90e682634e4dd17e146af7f9080 (patch)
treeda2ce68b775e0e45294920074a1ae8306dbac818 /svx/source
parent83cf08b1cb2d493a4c12f88eb6bf0daf25fe5beb (diff)
Make upcasting css::uno::Reference ctor require complete types
The main reason for the "home-grown" UpCast introduced with 904b3d1fceee5827076758ed2a81f80cb73493ca "Up-cast conversion constructor for css::uno::Reference" in 2013 was probably that we could not yet rely on C++11 std::is_base_of back then. A (welcome) side effect was that the derived class could be incomplete. However, specializations of UpCast relying on whether or not T2 is incomplete are obviously an ODR violation if the type is incomplete in some TUs and complete (and derived from T1) in others. And even if UpCast had internal linkage, it would still be brittle that its behavior depends on the completeness of T2 at the point of the template's instantiation, and not necessarily at the point of use. That means we should better base that ctor on std::is_base_of (which we can do now since 39a1edd6fec902ef378acce8af42c4d7fba280d0 "Make css::uno::Reference upcast ctor LIBO_INTERNAL_ONLY"), which causes a compilation error at least on Clang and GCC if the completeness requirements are not met. This change fixes all the cases where types need to be complete now, plus any resulting loplugin:referencecasting warnings ("the source reference is already a subtype of the destination reference"). Change-Id: Ieb9e3552e90adbf2c5a5af933dcb872e20661a2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92950 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/accessibility/AccessibleGraphicShape.cxx3
-rw-r--r--svx/source/accessibility/AccessibleOLEShape.cxx3
-rw-r--r--svx/source/accessibility/DescriptionGenerator.cxx1
-rw-r--r--svx/source/core/graphichelper.cxx1
-rw-r--r--svx/source/dialog/langbox.cxx3
-rw-r--r--svx/source/fmcomp/gridctrl.cxx1
-rw-r--r--svx/source/form/fmmodel.cxx5
-rw-r--r--svx/source/form/fmtools.cxx5
-rw-r--r--svx/source/form/formcontrolfactory.cxx1
-rw-r--r--svx/source/gallery2/galbrws2.cxx1
-rw-r--r--svx/source/gallery2/galobj.cxx2
-rw-r--r--svx/source/svdraw/svdmrkv.cxx1
-rw-r--r--svx/source/table/accessibletableshape.cxx1
13 files changed, 21 insertions, 7 deletions
diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx
index 324af67e5ffb..10f42222d8b2 100644
--- a/svx/source/accessibility/AccessibleGraphicShape.cxx
+++ b/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -23,6 +23,7 @@
#include <svx/SvxShapeTypes.hxx>
#include <svx/svdobj.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapeDescriptor.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/queryinterface.hxx>
@@ -140,7 +141,7 @@ OUString
default:
sName = "UnknownAccessibleGraphicShape";
- uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
if (xDescriptor.is())
sName += ": " + xDescriptor->getShapeType();
}
diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx
index 5f4b03995665..daf3fb29c42b 100644
--- a/svx/source/accessibility/AccessibleOLEShape.cxx
+++ b/svx/source/accessibility/AccessibleOLEShape.cxx
@@ -27,6 +27,7 @@
#include <cppuhelper/queryinterface.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapeDescriptor.hpp>
using namespace ::accessibility;
@@ -168,7 +169,7 @@ OUString
default:
sName = "UnknownAccessibleOLEShape";
- uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+ uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape);
if (xDescriptor.is())
sName += ": " + xDescriptor->getShapeType();
}
diff --git a/svx/source/accessibility/DescriptionGenerator.cxx b/svx/source/accessibility/DescriptionGenerator.cxx
index 95e24dfcc40b..1716f999f1d6 100644
--- a/svx/source/accessibility/DescriptionGenerator.cxx
+++ b/svx/source/accessibility/DescriptionGenerator.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <vcl/svapp.hxx>
// Includes for string resources.
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index e1278da3b5ab..c014ae7b1f89 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/drawing/GraphicExportFilter.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/io/XInputStream.hpp>
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 40639ba80301..5b7526d94084 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -18,6 +18,7 @@
*/
#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp>
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#include <linguistic/misc.hxx>
#include <rtl/ustring.hxx>
@@ -214,7 +215,7 @@ void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags nLangList, bool bHasLa
std::vector< LanguageType > aHyphAvailLang;
std::vector< LanguageType > aThesAvailLang;
Sequence< sal_Int16 > aSpellUsedLang;
- Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
+ Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr() );
if (xAvail.is())
{
Sequence< css::lang::Locale > aTmp;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index f9f692062368..c8e90ea1dd79 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/sdb/XRowsChangeBroadcaster.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/util/NumberFormatter.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx
index d616287ec80f..690ffb77814b 100644
--- a/svx/source/form/fmmodel.cxx
+++ b/svx/source/form/fmmodel.cxx
@@ -22,6 +22,7 @@
#include <fmdocumentclassification.hxx>
#include <fmcontrollayout.hxx>
+#include <com/sun/star/form/XForms.hpp>
#include <svx/fmmodel.hxx>
#include <svx/fmpage.hxx>
@@ -91,7 +92,7 @@ SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum)
if ( pToBeRemovedPage )
{
- Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ), css::uno::UNO_QUERY );
+ Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ) );
if ( xForms.is() )
m_pImpl->mxUndoEnv->RemoveForms( xForms );
}
@@ -116,7 +117,7 @@ SdrPage* FmFormModel::RemoveMasterPage(sal_uInt16 nPgNum)
if ( pPage )
{
- Reference< XNameContainer > xForms( pPage->GetForms( false ), css::uno::UNO_QUERY );
+ Reference< XNameContainer > xForms( pPage->GetForms( false ) );
if ( xForms.is() )
m_pImpl->mxUndoEnv->RemoveForms( xForms );
}
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index ec7304918b19..21df3d4b4411 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/sdb/SQLErrorEvent.hpp>
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
#include <com/sun/star/util/Language.hpp>
@@ -183,7 +184,7 @@ OUString getLabelName(const Reference< css::beans::XPropertySet>& xControlModel)
CursorWrapper::CursorWrapper(const Reference< css::sdbc::XRowSet>& _rxCursor, bool bUseCloned)
{
- ImplConstruct(Reference< css::sdbc::XResultSet>(_rxCursor, UNO_QUERY), bUseCloned);
+ ImplConstruct(Reference< css::sdbc::XResultSet>(_rxCursor), bUseCloned);
}
@@ -225,7 +226,7 @@ void CursorWrapper::ImplConstruct(const Reference< css::sdbc::XResultSet>& _rxCu
CursorWrapper& CursorWrapper::operator=(const Reference< css::sdbc::XRowSet>& _rxCursor)
{
- m_xMoveOperations.set(_rxCursor, UNO_QUERY);
+ m_xMoveOperations.set(_rxCursor);
m_xBookmarkOperations.set(_rxCursor, UNO_QUERY);
m_xColumnsSupplier.set(_rxCursor, UNO_QUERY);
if (!m_xMoveOperations.is() || !m_xBookmarkOperations.is() || !m_xColumnsSupplier.is())
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index 3fd43e0c3b3b..5e4f17a8fb6b 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/awt/LineEndFormat.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 7cb1f32d37a9..7232929e6663 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -41,6 +41,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/gallery/GalleryItemType.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XComponent.hpp>
diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx
index f1ef6bc17bd5..5d97eb9f2a40 100644
--- a/svx/source/gallery2/galobj.cxx
+++ b/svx/source/gallery2/galobj.cxx
@@ -17,7 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <sfx2/objsh.hxx>
#include <comphelper/fileformat.h>
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 7e360f4b43cd..1de49a696469 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -56,6 +56,7 @@
#include <array>
+#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <boost/property_tree/json_parser.hpp>
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index c9b2c666aa1d..2b55d0e8c365 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <vcl/svapp.hxx>